During creating missions for few years, I have made quite many scripts that maybe could be usefull for someone. For start, these scripts are mostly for single-player missions only. I will add time to time, more and more scripts to this thread (I hope they all fit in this first post). Use and modify these freely.
First, usefull tools to copy positions Scriptname: Copypos.sqs Description: Copies player 3d position to clipboard for use in scripts How to use: Add this code to player init and use action ingame
this addaction ["copypos","copypos.sqs"]; Notes: You can copy only one 3d position at time. The position is array from and looks like this [32133.342,1123.22,0] Download: http://www.gamefront.com/files/20415721/copypos.sqs
Scriptname: Copyposmap.sqs Description: Copies clicked map position to clipboard for use in scripts How to use: Add this code to player init, use the action once ingame and click map to copy position:
this addaction ["copyposmap","copyposmap.sqs"]; Notes: Quicker to use than the copypos.sqs. You can of course alt-tab between game and desktop to paste position for script before copy new position again from map. Download: http://www.gamefront.com/files/20415722/copyposmap.sqs
The Scripts
EDIT (30.6):- I found out that you can get position of the trigger with (position thisTrigger) that makes it much faster to use the ambient scripts while you can just copy&paste the same trigger and life spawns to those locations. (Thanks for Xenogf and Celery)
Ambient Civilians:
Spawns civilians around wanted position when player is near and later delete them, when player is away Notes:
-Spawns only Takiban civilians (Unless you edit the FSM file)
-Made for good performance so spawning happens quite near and its possible that player sees spawning from far Requirements:
Functions module and one civilian unit on map To use, create a repeatedly activated trigger with:
Condition: ((position thisTrigger) distance player < 400)
On Activation: _nul = [(position thisTrigger), 200, 7, 70] execFSM "AmbientCivilians.FSM"; Description:
The example spawns 7 civilians that are all inside 200m radius from the trigger position. Never a civilian is spawned under 70m away from player. Distance in condition must be 400. The spawn radius needs to be lower than it. And the min distance lower that spawn radius. Download: http://www.gamefront.com/files/20415...tcivilians.fsm
For MP: Spoiler:
Extra requirement:
-Logic named server on map
-Currently only for missions were all players are in same group
-For dedicated servers you need to create a trigger with (and add "gpp = group this" for the player group leader init):
Cond: (isNull player) && (local server)
On Act: player = leader gpp; To use, create a repeatedly activated trigger with (currently fits only good in urban enviroment. Tweak FSM for open areas 150->400):
Condition: ({_x distance (position thisTrigger) < 150;} count (units group player)) > 0
On Activation: _nul = [(position thisTrigger), 150, 7, 70] execFSM "AmbientCiviliansMP.FSM";
Ambient Patrol:
Spawns enemy patrol group (every (40 + (random 40) seconds) around wanted position when player is near and later delete them, when player is away. Notes:
-Spawns only Takibans (Unless you edit the FSM file) with EAST as side
-Made for good performance so spawning happens quite near and its possible that player sees spawning from far Requirements:
Functions module and one enemy unit on map To use, create a repeatedly activated trigger with:
Condition: player distance (position thisTrigger) < 400
On Activation: _nul = [(position thisTrigger),400,[2,3]] execFSM "ambientpatrol.fsm"; Description:
The example spawns 2-3 men enemy groups. Download (Includes two required scripts): http://www.gamefront.com/files/20416...bientPatrol.7z
For MP: Spoiler:
Extra requirement:
-Logic named server on map
-Currently only for missions were all players are in same group
-For dedicated servers you need to create a trigger with (and add "gpp = group this" for the player group leader init):
Cond: (isNull player) && (local server)
On Act: player = leader gpp; To use, create a repeatedly activated trigger with:
Condition: ({_x distance (position thisTrigger) < 400;} count (units group player)) > 0
On Activation: _nul = [(position thisTrigger),400,[2,3]] execFSM "ambientpatrol.fsm";
Ambient Criminals:
Spawns small armed enemy criminal group (every (40 + (random 40) seconds) (5 groups max total) around wanted position when player is near and later delete them, when player is away. Notes:
-Spawns only Takibans (Unless you edit the FSM file) with EAST as side
-Made for good performance so spawning happens quite near and its possible that player sees spawning from far Requirements:
Functions module and one enemy unit on map To use, create a repeatedly activated trigger with:
Condition: player distance (position thisTrigger) < 400
On Activation: _nul = [(position thisTrigger),200,[1,2]] execFSM "ambientcriminal.fsm"; Description:
The example spawns 1-2 men criminal groups. Download (Includes three required scripts): http://www.gamefront.com/files/20416...ntCriminals.7z
For MP: Spoiler:
Extra requirement:
-Logic named server on map
-Currently only for missions were all players are in same group
-For dedicated servers you need to create a trigger with (and add "gpp = group this" for the player group leader init):
Cond: (isNull player) && (local server)
On Act: player = leader gpp; To use, create a repeatedly activated trigger with:
Condition: ({_x distance (position thisTrigger) < 400;} count (units group player)) > 0
On Activation: _nul = [(position thisTrigger),400,[1,2]] execFSM "ambientcriminal.fsm";
Ambient Animals:
Spawns animals around wanted position when player is near and later delete them, when player is away Notes:
-Made for good performance so spawning happens quite near and its possible that player sees spawning from far To use, create a repeatedly activated trigger with:
Condition: ((position thisTrigger) distance player < 400)
_nul = [(position thisTrigger),100,14,["Cow01_EP1","Sheep01_EP1"],50] execFSM "ambientanimals2.fsm";
_nul = [(position thisTrigger),15,9,["Hen","Hen","Hen","Hen","Cock"],5] execFSM "ambientanimals2.fsm"; Description:
The first example spawns 14 animals (randomly Cow or Sheep) that are all inside 100m radius from the trigger. Never a civilian is spawned under 50m away from player. Distance in condition must be 400. The spawn radius needs to be lower than it. And the min distance lower that spawn radius. The animal types that you want to spawn are listed in the array. Download (You need to unpack it - for some reason gamefront didnt like the raw FSM): http://www.gamefront.com/files/20415...entanimals2.7z
For MP: Spoiler:
Extra requirement:
-Logic named server on map
-Currently only for missions were all players are in same group
-For dedicated servers you need to create a trigger with (and add "gpp = group this" for the player group leader init):
Cond: (isNull player) && (local server)
On Act: player = leader gpp; To use, create a repeatedly activated trigger with:
Condition: ({_x distance (position thisTrigger) < 200;} count (units group player)) > 0
On Activation: _nul = [(position thisTrigger),40,3,["Hen"],50] execFSM "ambientanimals2MP.fsm";
Ambient Empty Cars:
Spawns empty cilians cars over wanted invisible helipads using the direction of the object for the cars. Cars are then deleted when player is far, unless they are used. Notes:
-Spawns only Takiban Vehicles (Unless you edit the FSM file)
-Made for good performance so spawning happens quite near and its possible that player sees spawning from far To use, create a repeatedly activated trigger with:
Condition: ((position thisTrigger) distance player < 400)
On Activation: _nul = [(position thisTrigger),0,[o1,o2,o3],0] execFSM "ambientempcars.fsm"; Description:
(o1, o2...) are names of the invisible helipad objects. You can as many of them you like. Random vehicle is spawned over every of them. The two zeros have no effect. Leave them as zeros or some other number. Download: http://www.gamefront.com/files/20415...entempcars_fsm
Chopper Transport:
Bring spawned soldiers to the battlefield with a chopper transport. Requirements:
At least one unit of the spawned side needs to be on map To use, launch the script like this:
_nul = [[getpos start select 0, getpos start select 1, 50], position LZ1, position WayP1, EAST, 290, "Mi17_TK_EP1", 50,["TK_Soldier_SL_EP1","TK_Soldier_MG_EP1"],[0.6,0.7],1] execFSM "ChopperTransport.fsm"; Description:
At position start, the chopper and cargo is spawned. At position LZ1, soldiers eject (chopper return back to start for deleting), soldiers head to "position WayP1" where they guard. Next the side is set (could be EAST, WEST, RESISTANCE) which needs to match with the spawned classes. 290 is spawning direction which is important if you use planes. Then the chopper/plane class, then flying height (good to be somewhere 50 to 100). Then array of the spawned soldiers and their random skill range. If the last parameter is 1, more soldiers is brought until the chopper is destroyed. With 0 only one group is brought and chopper is deleted and starting pos. Download (Includes 2 required scripts): http://www.gamefront.com/files/20416...erTransport.7z
Minefield Creating System:
Allows player to select wanted team members and send them to build minefield with wanted specs. After job is done, the builder(s) return back to player's group. Only for SP Template Mission:http://www.gamefront.com/files/20737...te.Desert_E.7z
Nice scripts Buddy!
I especially Like the chopper script.. Its a nice way to do a "defend the area for x amount of time" kind of mission. I tweaked it a bit for MP and had C130's dropping crud loads of guys Against our Opfor fire team at intreval (Condition of no Opfor Present resulted in another wave of enemy troops)
Nice thanks for sharing
I've started to learn/understand a little .sqf now I need to learn .fsm (oooh my head, meeediiic, héhé)
Just tested the ChopperTransport.fsm but jumpout.sqf is missing.
For complex structures FSM is much faster to use and tweak. But if you multiply scripts a lot then its better to use SQF, I believe (and heard something like that from experienced scripters). FSM count conditions all the time, with SQF you can use sleep. But for the light use (like have having less than 50 FSM scripts running at the same time) it is really good.
FSM= Good for repeated frequent use (such as creating town defenders when x condition is met)
SQF= Scripts you only want activated ocasionaly. Really you can use either in alot of situations, I personally prefer to stick to SQF for the most part it keeps the script side cleaner and easier to debug imho (since you know exactly why a script would be running)