Author: norrin
Author Website:

Requirements: No addons required

Version: 1.0

Short description:

Date: 2009-07-05 05:47

Comments: (0)


AI respawn move to map position script

AI respawn and move to map position script

1. Copy the AI_respawn folder to your mission directory
2. Create and name the AI units that will respawn in the editor eg. e1
3. in the init line of the AI units put:
nul = [this, 3, 10, "east_spawn","East_WP.sqf"] execVM "AI_respawn\AI_respawn_init.sqf";
3 - is the number of times you want the AI unit to respawn;
10 - is the delay in seconds after the unit dies that you want it to respawn in
"east_spawn" - is the marker postion wher you want the AI units to respawn
"East_WP.sqf" - is the name of the script that will give the AI unit is moveTo commands.

In the test mission I have put the moveTo script in the mission directory it is called "East_WP.sqf".
It commands the units to moveTo a marker on the map then when the unit gets near that marker it is commanded to moveTo the next marker. In the test mission the moveTo markers for AI units are called:"East_WP1" and "East_WP2" and the code looks like this:
_unit = _this select 0;
// add 1st move to postion and wait until near it before adding second moveTo position
_unit doMove (getMarkerPos "East_WP1");
waitUntil {!alive _unit || _unit distance (getMarkerPos "East_WP1") < 10}; 

_unit doMove (getMarkerPos "East_WP2");
waitUntil {!alive _unit || _unit distance (getMarkerPos "East_WP2") < 10}; 

sleep 2;

// etcAdapt this script to your own purposes. For instance you can add additional
moveTo markers or you could have several of these
scripts in the mission so different units moveTo different positions.
An alternative method would be to create waypoints for the units in this script. 

Forum topic:
- forums
- BI forums

Enable javascript to be able to download from Armaholic please!

Tags: No tags