Page 1 of 3

Wolfenswan's function library

Posted: Mon Mar 18, 2013 3:02 pm
by wolfenswan
Ahead of FA Template: NO
If ws_fnc is ahead of the FA template, it is because there have not been any critical updates to the library.

Updating your FA template is easy:
Download the archive from below and overwrite the ws_fnc folder in your mission directory. You can ignore the install guide below.

Latest master version: See README.
Github: Repository

What is this?
This is a collection of various functions that I've worked on the last weeks for way too long to streamline my mission making. None of them are revolutionary but all of them have been designed with efficiency, modularity and performance in mind. The idea is to reduce the need for repetitive scripting as much as possible while avoiding the need for third-party scripts and the problems that come with that. I've also tried and comment everything as best as possible to make understanding the code easier.

How do I use it?
Unzip the archive into your mission root folder. You should now have a ws_fnc/ folder with various sub-folders (named tools, AI etc.). Open the description.ext that came with the archive and copy & paste the entire part within

Code: Select all

cfgFunctions { }
into cfgFunctions at the bottom of your own description.ext.

If you use F3 it should look sth. like this:

Code: Select all

class CfgFunctions
	class F
		//All F3 relevant functions

	#include "ws_fnc\config.hpp"
If you now open the function viewer inside the editor (CTRL+F) you should be able to see all descriptions for all listed. Make sure to select "missionConfigFile" in the top-left drop down menu.

Is there a readme?
If you did the above you should be able to view all functions inside the game. Every major function is thoroughly document and explained in itself. You can also view all individual documentation on either github or by opening the .sqf files with a text editor.

Example functions
getPos (various functions)
Similar to SHK_Pos, it allows for easy return of randomized positions, positions within a defined marker/trigger area, positions only on roads etc.

Advanced versions of the default createGroup/createVehicle scripting commands.

Orders AI to hold a position, manning statics and entering buildings.

Fills those empty buildings and bunkers with AI the easy way.

Orders AI to lay an ambush on a position. They will move to a hiding spot which provides over watch over the ambush location.

Hate how AI convoys always screw up no matter what you try to do? This little function will make them drive in an orderly column and also react to an engagement in a borderline smart fashion.

Want airborne reinforcements but the transport helos keep bugging out when in contact? This should help.

Placed dozens of markers all labeld mkr_1,mkr_2 etc but too lazy to put them all in an array manually? This function does the trick.

Re: Wolfenswan's function library

Posted: Mon Sep 16, 2013 8:24 pm
by wolfenswan
Updated various functions to work together with A3, changed folder structure and made all functions register nicely in the new A3 library.

Now works with both A3 and A2. Performance slightly increased.

Uses event handler instead of while loop now. better perfomance.

New functions:
Make units crew all static weapons and empty vehicle turrets in a given radius.

Attaches a light source to the given object. Brightness, color etc. can be modified.

ws_fnc_showFPS (A3 only)
Measures player FPS ingame for given time frame and displays afterwards.

ws_fnc_broadcast (A3 only)
Broadcasts a string to all clients, regardless of locality.

Returns true when running A3, false when running A2.

Re: Wolfenswan's function library

Posted: Thu Oct 10, 2013 4:03 pm
by wolfenswan
Update 10.10

Minor tweaks to some functions and restructuring of how getPos works.

New Functions
loads a single group, several groups or an array of units into designated vehicle, prioritizing driver/gunner/commander (in that order) over cargo slots
returns units that were not loaded

Returns nearest position on road

Returns nearest position on dry land

Returns true when called on a headless client

Re: Wolfenswan's function library

Posted: Fri Oct 11, 2013 12:35 pm
by wolfenswan
Update 11.10

Makes a group find a position providing overwatch over the the parsed position. If enemy approaches the trigger or comes to close to the hiding group they start engaging.

Return a random position within a marker or trigger area

Re: Wolfenswan's function library

Posted: Wed Jan 29, 2014 9:03 pm
by wolfenswan
Update 29.01

Misc. improvements.

- caching system based on Black Mamba's work

Re: Wolfenswan's function library

Posted: Fri Jan 31, 2014 6:51 pm
by wolfenswan
Update 31.01.

Several fixes and overhauls, especially for A2 version.

ws_fnc_createGarrison - fills buildings in a town with units of specified side

ws_fnc_collectBuildings - collects Buildings in given area

Re: Wolfenswan's function library

Posted: Sat Feb 01, 2014 1:48 pm
by wolfenswan
Update 01.02.

No new function but renamed all existing ones to clear up the description.ext. Thus if you update you have to manually delete all the old ones (all .sqfs apart from ws_fnc_init)

Re: Wolfenswan's function library

Posted: Fri Feb 21, 2014 1:39 pm
by wolfenswan
Update 21.02.2014

New Functions
Creates colored smoke + chemlight at position

attaches a chem light to unit

attaches IR strobe to unit

New category (folder): misc/
Moved into misc/:
  • broadcast
  • showIntro
  • switchLights
  • attachLight
  • Small bugfixes
  • Re-worked comments to several script (mostly adding examples)

Re: Wolfenswan's function library

Posted: Fri Feb 21, 2014 7:27 pm
by Dogface

Cheers Wolfenswan, I hadn't really looked at these functions before but it turns out they are super neat and I shall surely be using them.

Re: Wolfenswan's function library

Posted: Fri Feb 28, 2014 12:08 am
by wolfenswan
Update 28.02.2014

ws_fnc_taskLand (A3 only):
Prompts a Helicopter to land a certain location. It will ignore enemy fire as best as possible.
If it has units in cargo it'll wait until all are out, if it is empty,
it'll wait for the designated time or until all cargo seats are filled.
Afterwards it'll move to the designated location.

Added private declaration to ws_fnc_getEPos
Fixed title in ws_fnc_taskAmbush