This is a hard one for me and can't seem to get it to work:
I am using a respawn script for ai groups and let them move to markers placed inside towns using a waypoint script. I have several towns that need to be captured by the AI, opfor and blufor. I made the markers color red when opfor has seized a town, and blue when blufor seizes.
Now, when the ai respawns after they all have been killed I want them to immedeately move to one of the towns that are not captured yet, random.
So for blufor this must be something like: when markercolor blue, do not move to town. When markercolor red, possible town to move to.
I want them to move to one of (random) the towns that are not captured yet.
Who can help me out here a bit and maybe post a smal example wp script to get me started.
thx
// place all markers over towns in here
_ALL_towns_markers = ["townMarker1","townMarker2","townMarker3","etc"];
_pos = [];
// this will select a random town that is not yet captured.
if ((side _this) == west) then {
_notCapped = [];
{if ((getMarkerColor _x) != "ColorBlue") then {_notCapped = _notCapped + [_x]}} foreach _ALL_towns_markers;
_pos = _notCapped select (floor(random(count _notCapped)));
} else {
_notCapped = [];
{if ((getMarkerColor _x) != "ColorRed") then {_notCapped = _notCapped + [_x]}} foreach _ALL_towns_markers;
_pos = _notCapped select (floor(random(count _notCapped)));
};
waitUntil { !isNil "BIS_fnc_init" };
// here we create a patrol for the group, its randomised 200 around center of marker, change to whatever you like, or create own waypoints.
_null = [_this, _pos, 200] call BIS_fnc_taskPatrol;
Any new mission editor or scripter in Arma2 should have read Mr Murrays Editing Guide Deluxe at least once, it still applies for A2 even though it was made for Armed Assault.
Im using this script quite a bit... can i please request vehicle support for mechanized or motorized groups... or vehicles in general?
Currently using Zonekiller's AI Vehicle Control System it works except i think its a bit hit and miss at times if AI spawn before vehicle and then move off on foot.
Im using this script quite a bit... can i please request vehicle support for mechanized or motorized groups... or vehicles in general?
Currently using Zonekiller's AI Vehicle Control System it works except i think its a bit hit and miss at times if AI spawn before vehicle and then move off on foot.
There was an issue with vehicles, tusk, bradley maybe more when using BIS_fnc_taskPatrol.
It appears that when beheaviour and speed was not set for each created waypoint these groups never moved, maybe due to me removing all waypoints prior to calling the function, so the creation from BIS_fnc_taskPatrol had no reference to work with.
Anywho, included a modified version of BIS_fnc_taskPatrol as a function in the script, all working now. Demo mission OA required
Edit: also includes vehicle respawn for groups.