Jump to content
Salty Bear

[HELP] AI misbehaving after parachute drop

Recommended Posts

Everyone starts up in the air with parachutes (units are named flead, fmark, far, fmedic, and fuav) :

 

//Waaaaaay up in the sky:
	flead setPosATL (flead modelToWorld[0,0,2500]);
	fmark setPosATL (fmark modelToWorld[0,0,2500]);
	far setPosATL (far modelToWorld[0,0,2500]);
	fmedic setPosATL (fmedic modelToWorld[0,0,2500]);
	fuav setPosATL (fuav modelToWorld[0,0,2500]);

They fall, and open their parachutes at default altitude. The next part of the script creates triggers to check each unit to see if it's a player, then opens the player's chute automatically too (I'm just posting fmark's trigger, but there are four - one for each playable unit (flead is not playable)):

//Auto open parachute at 350 M:
	_fmarkChuteOpenTrig = createTrigger ["EmptyDetector", getMarkerPos "dropZoneMarker"];
	_fmarkChuteOpenTrig setTriggerArea [2000, 2000, 0, false, 350];
	_fmarkChuteOpenTrig setTriggerActivation ["WEST", "PRESENT", false];
	_fmarkChuteOpenTrig setTriggerStatements ["(isPlayer fmark) and (fmark in thisList)", "fmark action ['openParachute']; deleteVehicle thisTrigger", ""];

Since the wind blows the AI all around, I have four more triggers to make sure the NPCs make it to their drop zone (again, only posting one of the triggers for you to see):

//Make sure AI lands in the drop zone:
	_fleadDropZoneTrig = createTrigger ["EmptyDetector", getMarkerPos "dropZoneMarker"];
	_fleadDropZoneTrig setTriggerArea [2000, 2000, 0, false, 80];
	_fleadDropZoneTrig setTriggerActivation ["WEST", "PRESENT", false];
	_fleadDropZoneTrig setTriggerStatements ["(!(isPlayer flead)) and (flead in thisList)", "flead setPosATL [getMarkerPos 'fleadDZMarker' select 0, getMarkerPos 'fleadDZMarker' select 1, getPosATL flead select 2]; deleteVehicle thisTrigger", ""];

Once the player is 100 meters from the ground, the script checks to see if all 5 units are still alive. If everyone survived the jump (even using allowDamage false does not keep the stupid AI from dying on parachute jumps), then as soon as they're all on the ground, they get a waypoint (the group _fgrp) was defined already, I just didn't include it):

	waitUntil {getPosATL player select 2 < 100};

//Go to the next script once everyone's on the ground:
	if ({alive _x} count units group player == 5) then {	
		waitUntil {
			(isTouchingGround flead) and (isTouchingGround fmark) and (isTouchingGround far) and (isTouchingGround fmedic) and (isTouchingGround fuav)
		};
		
//Waypoint to rally point:
	
	_wp = _fgrp addWaypoint [getMarkerPos "rallyPointMarker",0];
	_wp setWaypointType "MOVE"; 
	_wp setWaypointSpeed "LIMITED";
	_wp setWaypointBehaviour "SAFE";
	_wp setWaypointVisible false;

The problem: the AI do not treat this waypoint like a LIMITED, SAFE waypoint. They are running around with their flashlights on, and they act like they're trying to secure the area around the waypoint (they take FOREVER) before they finally reach the waypoint. Additionally, all of the successive waypoints (even though identical Speed and Behaviour) act like this.

The only way I've found to fix this is to start the player on the ground. If the player doesn't join the rest of the group for the parachute jump, it all works just fine. I would greatly appreciate any help. Thank you in advance.

  • Like 1

Share this post


Link to post
Share on other sites
On 7/28/2018 at 6:07 PM, beno_83au said:

You may be missing setCurrentWaypoint at the end.

 

Tried it, no effect. I used the debug console to try to get the group leader (named flead) to stop being in "COMBAT" behaviour, but to no avail:

behaviour flead; //returns "COMBAT"

group flead setCurrentWaypoint [group flead, 1];

[group flead, 1] setWaypointBehaviour "SAFE"; //does not affect behaviour - still "COMBAT"

currentwaypoint group flead setWaypointBehaviour "SAFE"; //does not affect behaviour - still "COMBAT"

flead setBehaviour "SAFE"; //does not affect behaviour - still "COMBAT"

 

Share this post


Link to post
Share on other sites

Okay, so I think I've found a workaround. The key was to use the "CARELESS" behaviour. The CARELESS behaviour does override the COMBAT behaviour, although COMBAT does try to reassert itself, so I used sleep to make sure that CARELESS was the last thing on the AI's mind.

//Waypoint to rally point:
	
	_wp = _fgrp addWaypoint [getMarkerPos "rallyPointMarker",0];
	_wp setWaypointType "MOVE"; 
	_wp setWaypointSpeed "LIMITED";
	_wp setWaypointBehaviour "CARELESS";
	_wp setWaypointVisible false;
	//_fgrp setCurrentWaypoint [_fgrp, 1];

sleep 5;

flead setBehaviour "CARELESS";

So they walk slowly to the waypoint with their weapons lowered.

Share this post


Link to post
Share on other sites

Also, you can add those units to an array and use forEach command, like so:

{
	_x setPosATL (_x modelToWorld [0, 0, 2500]);
} forEach [flead, fmark, far, fmedic, fuav];

 

Share this post


Link to post
Share on other sites
12 hours ago, HazJ said:

Also, you can add those units to an array and use forEach command, like so:


{
	_x setPosATL (_x modelToWorld [0, 0, 2500]);
} forEach [flead, fmark, far, fmedic, fuav];

 


Thanks HazJ. I use the "_x forEach" construction for a lot of things, but it didn't occur to me to use it there. Would it work if I did this?:

_fgrp = units group flead; //includes flead, fmark, far, fmedic, and fuav.

{
_x setPosATL (_x modelToWorld [0, 0, 2500]);
} forEach _fgrp;

 

 

Share this post


Link to post
Share on other sites

Yes, assuming all units are in flead's group.

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

×