Jump to content
Sign in to follow this  
zonekiller

Zonekiller's AI Vehicle Control System

Recommended Posts

This scrip is a big part of my battlefield missions

what it does is invite AI to use the vehicle the script is attached to

also respawn if you wish and it will delete once it is dead

if it gets left somewhere it will respawn or die in 5 min

if someone gets in it at 4 minutes it will rest the clock back and can be left

for 5 minutes again.

works for empty units and AI units as will as players

AI will pick up AI and players can pickup AI not in there group

AI will not pickup a player but you can still get in

sometimes the AI dont want you and will get pissed off and stop

the engine till you get out

even if a player is driving , a AI may get in as gunner

they are not forced into the vehicles so if they dont want to get

in they wont and will sometimes just change vehicles because that

one looks better

there will always be some cargo seats for left for players

how ever you create the vehicle thats how it will spawn

Flying, with crew , without crew , even full of cargo units

just have a group moveincargo into a truck or plane

and it will respawn with a group inside it every time after that

all you need to do is put a this in the init of the vehicle a

place a marker anywhere on the map,

the marker is used to turn off respawn for CTI missions

you can set i as many vehicles to one marker as you want

when not a CTI mission the marker is used to keep the respawn on

it also creates flares and a missle warning for planes and choppers

AI will pull out a dead person and take his place

the script works in ARMA 2 , OA

will work on servers and in single play

will also work with createvehicle

it should not upset waypoints or scripted move commands

they just get there faster

Yes it is a FSM script it works faster with less effort

the init line

nil = [this,west,1,"marker",0] execFSM "FSM\AI_Driver.fsm";

this -- leave as is,

west -- change to what ever side the vehicle is,

1 -- do respawn , 0 == dont,

"marker" -- name of the marker to use as a respawn switch "it works off of colour

change the colour and it will stop respawning,

0 -- used for planes to set there default airport

/*

ARMA 2 OA:

Takistan:

0 = Airport NorthWest

1 = Airport SouthEast

Planes approach all airports from South West

ARMA 2:

Utes:

0 = There is only one airport

chernarus:

0 = Airport NorthWest close to Grishno

1 = Airport NorthEast close to Kranostav

2 = Airport SouthWest close to Balota

3 = Nearest Airport

Planes approach all airports from South East

*/

it will work on all vehicles and addons

you can open a FSM file in notepad just looks very messy

near the top of the file you will see this

the only 5 things you need to adjust everything else it get the info it needs

from the vehicle

"" \n

"" \n

"" \n

"// ADJUST SETTINGS BELOW HERE " \n

"///////////////////////////////////////////////" \n

"" \n

"" \n

"_Script_Diag = 0;" \n

"" \n

"" \n

"" \n

"_SpareSeats = .35;" \n

"_lookdis = 80;" \n

"_outtime = 300;" \n

"_startdelay = 1;" \n

"" \n

"" \n

"" \n

"// DONT ADJUST SETTINGS PAST THIS POINT " \n

"/////////////////////////////////////////////////////////////" \n

"_timeout = time;" \n

"" \n

"" \n

"" \n

_Script_Diag = 0; change to 1 if you want to see hints as its working

used your testing

_SpareSeats = .35; that means the AI wont use about 1/3 rd of the cargo seats

so players have room to, set it to 0 and they will take all the seats, 1 and they will

not get in as cargo

_lookdis = 80; this is how far the vehicles will look for AI , choppers is *2 this setting

planes stop looking when they leave the ground, 80 is good for most maps as to big and the AI

dont have time to get in

all vehicles stop looking when full or no one in the _lookdis range

_outtime = 300; the time in seconds before a vehicle will start to die when left

away from its starting point without a driver or player gunner

_startdelay = 1; time in seconds before the script kicks in at mission start

1 or 2 is long enough for moveincargo commands to have kicked in if you

want to start a group in a vehicle

you can download the BIS FSM EDITOR if you want a look inside the script

Download the Script here

http://www.ofpec.com/forum/index.php?action=dlattach;topic=35279.0;attach=5496

Or Download the Script here

http://zonekiller.ath.cx/Scripts/ARMA2_OA/AI_Driver.zip

Download the BIS FSM EDITOR here

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

Edited by Zonekiller
add mirror download link

Share this post


Link to post
Share on other sites

ZoneKiller, Great stuff thanks

Update: Zone I am getting a NIL Error "Please fix variable" it appears CBA does not like NIL being used.

Edited by vengeance1

Share this post


Link to post
Share on other sites

i didnt know that ,, just open it in notepad and do a search for nil and change it , there are about 5 of then i will fix and update it ,

Edited by Zonekiller

Share this post


Link to post
Share on other sites

Update: Zone I am getting a NIL Error "Please fix variable" it appears CBA does not like NIL being used.

Never ever assign any value (in this case a script handle) to a global variable nil.

It overrides the engine nil and causes all kinds of troubles.

nil = script handle;

somevar = nil;

if (isNil "somevar") ...

and the condition will never return true as somevar in this case points to the script handle instead of nil.

CBA has a check build in that warns you when a global variable nil exists.

Xeno

Share this post


Link to post
Share on other sites

thanks for that , have changed all my scripts that were using nil to _nil they all seem to work with a local instead of a global word. i do like all my stuff to be compatible.

Share this post


Link to post
Share on other sites
thanks for that , have changed all my scripts that were using nil to _nil they all seem to work with a local instead of a global word. i do like all my stuff to be compatible.

Well, someglobalvar = nil is also used in BIS module scripts.

So you are now completely compatible :)

Xeno

Share this post


Link to post
Share on other sites

Hey Zonekiller,

Just found this, very cool and trying to implement it in my mission, everything works great except their behavior when in contact, I have both sides using the same script. The problem is they just charge right in to any conflict area oblivious to any danger, Seems like they are not aware or something?

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  

×