Jump to content
Sign in to follow this  
SaOk

Scripts for Mission Creating by SaOk

Recommended Posts

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.

EDIT (4th May 2013): New download link with all SP Stuff. I have lost the MP Versions:

https://www.dropbox.com/s/n8jc7ayyf7p65p3/ScriptsSaOK.7z

Resources for scripting/editing

FSM editor:

http://community.bistudio.com/wiki/FSM_Editor

Scripting Commands

http://community.bistudio.com/wiki/Category:Scripting_Commands_ArmA2

Classnames:

http://forums.bistudio.com/showthread.php?t=73241&page=2

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/20415583/ambientcivilians.fsm

For MP:

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";

Download:

http://www.gamefront.com/files/20415767/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/20416258/AmbientPatrol.7z

For MP:

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";

Download:

http://www.gamefront.com/files/20416288/AmbientPatrolMP.7z

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/20416275/AmbientCriminals.7z

For MP:

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";

Download:

http://www.gamefront.com/files/20416289/AmbientCriminalsMP.7z

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/20415786/ambientanimals2.7z

For MP:

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";

Download:

http://www.gamefront.com/files/20415775/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/20415639/ambientempcars_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/20416910/ChopperTransport.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/20737093/MinefieldTruckTemplate.Desert_E.7z

More coming very soon!

Edited by SaOk

Share this post


Link to post
Share on other sites

Really nice script, thanks!

All of this script is for sp. Any chance your ambient script become Mp friendly.

Share this post


Link to post
Share on other sites

I have the ambient scripts working for MP in my coop mission. I will add them next.

Edited by SaOk

Share this post


Link to post
Share on other sites

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)

Share this post


Link to post
Share on other sites

Nope :), I will add many times more scripts. But I need to tweak them first since many are really mission connected.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Damn, I forgot that. I update that right away.

The FSM scripting is very easy really. Very similar than SQF. With FSM you basically create tiggers in the script.

Edit: Okay, its fixed now. Sorry :)

Edited by SaOk

Share this post


Link to post
Share on other sites

In your opinion, FSM gives better results than SQF or not ?

Nice thank you :)

Edited by panda123

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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)

Share this post


Link to post
Share on other sites

Thank Sir! Love the patrol spawn, and the Transport chopper... Hell I love all of them :) The criminals... I noticed the other day, in one of the ammo crates...you can get a rock and load it into a grenade/magazine slot. Not sure if that was only Ace 2 mod, but that had me laughing :) Thank you again!

Share this post


Link to post
Share on other sites

I added a template mission of the custom minefield creating with AI. See the first post.

Share this post


Link to post
Share on other sites

Hi, sorry for being so ignorant- but ive tried searching and googling to no avail.

What do you mean by

"Requirements:

Functions module and one enemy unit on map"

Ive been trying to get wrap my head around editing for the last few weeks, so far i havent found anything that properly explains the functions module in language i understand.

Now ive made a trigger with fields filled out, placed an enemy unit, and placed a blank functions module.

When i place a function, what do i need to do next? do i need to write a anything inside the function module? do i need to sync it with the enemy unit (im trying to use ambient patrol)

(edit),,v v Thanks kylania.

F7 for Modules then pick Functions and put it on the map. As long as it's on the map somewhere the BIS functions will work

This info is more helpful than you can imagine. I somehow felt i was doing something wrong by just placing a function module without any scripting.

Edited by Gameqb11

Share this post


Link to post
Share on other sites

Nope, just need to F7 for Modules then pick Functions and put it on the map. As long as it's on the map somewhere the BIS functions will work. Don't need anything in it's init field.

The one enemy unit on the map just means you have a unit of the sides you want to have available somewhere. You can even just put one down anywhere and set it to 'Probability of Presence' 0% and that would be enough.

Share this post


Link to post
Share on other sites

Hey SaOK,

If I'm not mistaken, with your map click copy cords script, I can stay in the game the whole time and copy multiple cords, provided I paste them in between script calls?

If that is the case, it will be saving me lots of time in the near future. Regardless, thanks for the work on your scripts, they all look great.

Skelt aka Bones

Share this post


Link to post
Share on other sites

Thanks :) and yes, you can stay in game, but you need to alt-tab to desktop after each position copy if you want to paste it for your use.

With small changes in script, it would also be possible to gather much positions in array before transfering that to clipboard, but I havent yet made that script.

Share this post


Link to post
Share on other sites

SaOk, your script saved me tons of time this morning!!

thanks again man... so simple, yet so great haha.

Share this post


Link to post
Share on other sites

I also spent much time with named invisible helipads before learning that CopyToClipboard-command. ;)

With those copypos-scripts its easy now to gather even much positions in short time, that could be used e.g. for detailed AI movement scripts.

Share this post


Link to post
Share on other sites

Dude your awesome, thanks so much for everything you do here in the community!

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×