Jump to content
Sign in to follow this  
SilentSpike

Any success with waypointAttachVehicle/Object?

Recommended Posts

I'm trying to create "destroy" waypoints for some spawned jets in a mission. The problem I seem to be encountering is that the waypointAttachVehicle command seems to have no effect (yes, I am using it on editor placed units - though I'm skeptical of that note's relevance to ARMA 3). Anyone with more experience scripting waypoints got any advice?

(If the command/waypoint is broken it could also explain the behavior I was experiencing from AI in another mission whereby the attackers didn't hang around their target until it was destroyed as detailed on the wiki.)

Edit: I should mention that I'm checking whether it is attached using zeus to destroy the unit and observe whether the waypoint is then completed (it isn't, instead they move to the location of the destroy waypoint and then it becomes completed - this also happens even if the unit isn't destroyed). The waypointAttachedVehicle command suggests the waypoint is correctly attached though.

Edited by SilentSpike

Share this post


Link to post
Share on other sites

private ["_attacker","_west","_type","_sideCoord","_side","_waypointPos","_spawnPos","_defender1","_defender2","_grp","_wyp"];
_attacker = _this select 0;


// Retrieve info
_west = ((side _attacker) == west);
if _west then {
   _type = "O_Plane_CAS_02_F";
   _sideCoord = 30720;
   _side = east;
   _waypointPos = [0,0,0];
} else {
   _type = "B_Plane_CAS_01_F";
   _sideCoord = 0;
   _side = west;
   _waypointPos = [30720,30720,0];
};
_spawnPos = [(getPosASL _attacker) select 0,_sideCoord,0];


// Spawn defenders
_defender1 = createVehicle [_type, _spawnPos, [], 100, "FLY"];
_defender2 = createVehicle [_type, _spawnPos, [], 100, "FLY"];
createVehicleCrew _defender1;
createVehicleCrew _defender2;


_grp = group (driver _defender1);
(crew _defender2) join _grp;


_defender1 engineOn true;
if _west then { _defender1 setDir 180; _defender1 setVelocity [0,-62,0]; };
_defender1 setCombatMode "RED";


_defender2 engineOn true;
if _west then { _defender2 setDir 180; _defender2 setVelocity [0,-62,0]; };
_defender2 setCombatMode "RED";


// Setup waypoint
_wyp = _grp addWaypoint [_waypointPos,0];
_wyp setWaypointBehaviour "COMBAT";
_wyp waypointAttachVehicle (vehicle _attacker);
_wyp setWaypointType "DESTROY";
_wyp setWaypointStatements ["","systemChat 'Waypoint complete'"];


Zeus1 addCuratorEditableObjects [[_defender1,_defender2],true];

Edit: Neater code

Edit 2: I probably shouldn't assume it's obvious what I'm doing. Basically _attacker is the unit passed to the script which I want the spawned jets to attack (they're named defenders because in my scenario they're defending an area). The defenders come in from either the north or south (depending on side of attacker) and - theoretically - attack the unit. However, instead they just seem to fly to where the waypoint was created and then it gets completed.

Edit3: Oh and the script was written with Altis in mind :P

Edited by SilentSpike

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  

×