Jump to content
Sign in to follow this  
sttosin

AI buddy script help needed

Recommended Posts

I am trying to script an AI buddy that WILL attack enemy on its own. Don't need to micromanage.

My script below working except he'll rather die than fight. The playmove is to unstuck if too far away after 10s. That needs help too.

private ["_playerpos","_buddy","_degrees","_dist","_team"];

_playerpos = getPosATL player;

_degrees = getDir player;

_team = [_playerpos, WEST,["B_mas_usn_soldier_MG_F"],[],[],[],[],[],_degrees] call BIS_fnc_spawnGroup;

_buddy = leader _team;

player sideChat "Wait up! I got your six.";

while {true} do {

_dist = _buddy distance player;

_count=10;

while {_dist > 3} do {

_myvalue = _myvalue-1;

_wp1 waypointAttachVehicle vehicle player;

_wp1 setwaypointtype "MOVE";

_wp1 setWaypointCombatMode "RED";

_wp1 setWaypointFormation "FILE";

_wp1 setWaypointSpeed "FULL";

_wp1 setWaypointBehaviour "COMBAT";

_wp1 setWaypointCompletionRadius 2;

_wp1 setWaypointStatements ["true", ""];

_buddy setUnitPos "MIDDLE";

sleep 2;

_wp2 = _team addwaypoint [position Player,0];

_wp2 waypointAttachVehicle vehicle player;

_wp2 setwaypointtype "MOVE";

_wp2 setWaypointCombatMode "RED";

_wp2 setWaypointFormation "FILE";

_wp2 setWaypointSpeed "FULL";

_wp2 setWaypointBehaviour "COMBAT";

_wp2 setWaypointCompletionRadius 2;

_wp2 setWaypointStatements ["true", ""];

_buddy setUnitPos "MIDDLE";

Sleep 2;

if (_myvalue < 0)

then {_buddy playMoveNow "AmovPpneMstpSrasWrflDnon_AmovPpneMevaSlowWrflDl"

};

};

};

Share this post


Link to post
Share on other sites

You'd need to disable behaviour execution scripts for this to work, considering seperate scripts get executed from the engine that determine how the AI reacts to contact. Give it a try.

_unit disableAI "FSM"

Share this post


Link to post
Share on other sites
You'd need to disable behaviour execution scripts for this to work, considering seperate scripts get executed from the engine that determine how the AI reacts to contact. Give it a try.

_unit disableAI "FSM"

Thanks @tryteyker. I'll give this a shot and report back.

Share this post


Link to post
Share on other sites

It worked. Thanks @tryteyker! I just have to figure out the part to unstuck AI buddy after a while being away from player.

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  

×