Jump to content
Sign in to follow this  
Mr Opteron

script unit to spawn after mission start

Recommended Posts

Is it possible to get an ai unit pilot + plane to spawn some time after a mission has started Ive searched the ARMA wiki and on here but I cant find an example of what I am to do.

The aircraft always show up too soon even igf I place them on the map edges. I need to make them spawn there later on or have them forced to stay there till a particular time.

Share this post


Link to post
Share on other sites

OK one way to do this is have some code like this activated by a trigger <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> _vcl_1 = createVehicle ["A10", getMarkerPos "spawn_pos", [], 0, "FLY"];

_vcl_1 setDir (180);

_vcl_1 setpos [getPos _vcl_1 select 0, getPos _vcl_1 select 1, 40]};

_vcl_1 setvelocity [0,-300,5];

_vcl_1 forceSpeed 300;

_grp_1 = createGroup west;

"soldierWpilot" createUnit[getMarkerPos "spawn_pos", _grp_1, "spawn_pilot = this", 1, "PRIVATE"];

spawn_pilot moveInDriver _vcl_1;

_waypoint0 = _grp_1 addWaypoint [getMarkerPos "flyto_pos",0];

waypoint0 setWaypointType "MOVE";

To make it work you'll need a marker on the map called "spawn_pos" where the plane spawns and a second (at least) where you want your aircraft headed towards eg "flyto_pos".  180 is the direction in which you want your aircraft headed in (if you change this you may need to play with the setVelocity settings so it corresponds).  The code <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_vcl_1 setpos [getPos _vcl_1 select 0, getPos _vcl_1 select 1, 40]}; just places the aircraft 40 metres off the ground when it spawns (you may want to increase this).  Hopefully the rest will be pretty self explanatory.

Share this post


Link to post
Share on other sites

Great thanks mate I've tried controling the fighter planes using synchronise so they are held off till a squad has gotten to a waypoint.It works but will give you script a try too so I can add more in later to keep the war going.

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  

×