Jump to content
Sign in to follow this  
Prv_Jezz

AI Waypoint Movement

Recommended Posts

Hi Guys,

i ma working on a Sniper Mission.

Smal Story Infos: A Gerneral (AI - Name: VIP) is in an Area with a Car (PMC SUV NAME: vipcar) with four Bodyguards (Body1-4) is

for a visit on Utes. The Mission starts at smal Town south left on Utes. The General and his Bodyguards should board the SUV and drive on

the Street to the upper North-West Base (wp1). There they should disembark walk to (wp2) wait there a while (sleep 240;) go back to

the SUV and drive down to the First Town (south left) disembark and walk a bit abround (maybee wp3) as a loop.

Town 1 (South - East) < - > Town 2 North - West | till the vip get killed. I hope i could to describe it allright. :rolleyes:

Maybee the Easy way work with normal Editor Waypoints (Get in -> Move -> Get out -> Move -> Sleep -> Get In -> Move etc.)

But i think its not the smartest way. (Or i am wrong?) and i would do it with a Script to port it later on other Maps.

I think the first thing i should solve it to group the AI (But there placed in the Editor the General is the Group leader and he hast 4 AI Bodyguards)

maybee there allready grouped.

My Scripting knowledge is very basic(!) :o

I start my Script with: nul = [] execvm "viptour.sqf";

waituntil {!isnil "bis_fnc_init"};

if isserver then 
{

hint "Mounting Vehicle";
sleep 1;

body1 MoveInDriver vipcar;
vip MoveInCargo vipcar;
body2 MoveInCargo vipcar;
body3 MoveInCargo vipcar;
body4 MoveInCargo vipcar;

// Maybee the better way is:  {_x moveincargo vipcar} foreach units group -- how to group ai thats working on Multiplayer!?! -- ;

_wp1 = body1 addWaypoint [getmarkerpos "wp1",0];
_wp1 setWaypointSpeed "SAVE";  //should save that they keep on streets i think.
_wp1 setwaypointtype "MOVE";
_wp1 setWaypointStatements ["true", ""];  

_wp2 = body1 addWaypoint [getmarkerpos "wp2",0];
_wp2 setWaypointSpeed "SAVE";  
_wp2 setwaypointtype "GETOUT";
_wp2 setWaypointStatements ["true", ""]; 

sleep 240;

body1 MoveInDriver vipcar;
vip MoveInCargo vipcar;
body2 MoveInCargo vipcar;
body3 MoveInCargo vipcar;
body4 MoveInCargo vipcar;

_wp3 = body1 addWaypoint [getmarkerpos "wp2",0];
_wp3 setWaypointSpeed "SAVE";  
_wp3 setwaypointtype "MOVE";
_wp3 setWaypointStatements ["true", ""]; 

};

But it dont works. And i need some Help! :(

Share this post


Link to post
Share on other sites

Just use the Cycle waypoint after the "get in" in town 1:

(Get in -> Move -> Get out -> Move -> Sleep -> Get In -> Move -> Get out -> Sleep -> Cycle).

thats the whole thing. no need for a script...

Share this post


Link to post
Share on other sites

Thanks for the awnser but i will try it with Scripting. :)

I change my Code and my Idea a bit. Now i got 4 Persons. It works not bad but at the First Car Stop Point the VIP gets out the car and walk to the marker point

then after the sleep command he goes back to the car but he don't get in. Stand ~5 meters of the car and thats it. -.-

I can fix that if i cut out the:

"{_x setbehaviour "CARELESS"; _x domove position _veh; _x setSpeedMode "LIMITED"; _x setFormation "WEDGE";} foreach units group _man;"

Under the "sleep 120;" But then the VIP and the Bodyguard will run and dont walk how they should. I think my code is just to worse. :(

vip = The VIP

vipcar = The Car of the VIP

drv1 = The Driver

vipmk1 = First Car Stop Marker Point

vipwk1 = After reaching vipmk1 leave the Car and walk to that marker vipwk1.

vipmk2 = Second Car Stop Marker Point

vipwk2 = After reaching vipmk2 leave the Car and walk to that marker vipwk2.

vipmk3 = Final Car Stop Marker Point

The VIP has 2 Bodyguards (body1, body2).

I run it by: nul = [vip,vipcar,drv1,"vipmk1","vipwk1","vipmk2","vipwk2","vipmk3"] execvm "viptour.sqf";


if isserver then 
{

private ["_man","_veh","_drv","_mkr","_mkr2","_mkr3","_mkr4","_mkr5"];

_man = _this select 0;
_veh = _this select 1;
_drv = _this select 2;
_mkr = _this select 3;
_mkr2 = _this select 4;
_mkr3 = _this select 5;
_mkr4 = _this select 6;
_mkr5 = _this select 7;

_drv setbehaviour "SAFE";
_drv domove position _veh;
_drv setSpeedMode "LIMITED";
_drv setFormation "WEDGE";
waituntil {unitready _drv};

{_x setbehaviour "SAFE"; _x domove position _veh; _x setSpeedMode "LIMITED"; _x setFormation "WEDGE";} foreach units group _man;


_drv assignAsDriver _veh;
[_drv] orderGetIn true;
waituntil {vehicle _drv != _drv};
sleep 1;

{_x assignAsCargo _veh;} foreach units group _man;
units group _man orderGetIn true;
waituntil {vehicle _man != _man};
sleep 1;

_veh setfuel 1;
_drv domove (getmarkerpos _mkr);
_drv commandmove (getmarkerpos _mkr);  

_wp1 = group _man addWayPoint [getmarkerpos _mkr,10];
_wp1 setwaypointtype "MOVE";
_wp1 setWaypointSpeed "LIMITED";
_wp1 setWaypointBehaviour "SAFE"; 

waituntil {unitready _drv};
_veh setfuel 0;
{unassignVehicle _x} forEach units _man;

{_x setFormation "WEDGE";} foreach units group _man;
_wp2 = group _man addWayPoint [getmarkerpos _mkr2,10];
_wp2 setwaypointtype "MOVE";
_wp2 setWaypointSpeed "LIMITED";
_wp2 setWaypointBehaviour "SAFE"; 


sleep 120;
{_x setbehaviour "CARELESS"; _x domove position _veh; _x setSpeedMode "LIMITED"; _x setFormation "WEDGE";} foreach units group _man;
{_x assignAsCargo _veh;} foreach units group _man;
units group _man orderGetIn true;

waituntil {vehicle _man != _man};
sleep 1;

_veh setfuel 1;
_drv domove (getmarkerpos _mkr3);
_drv commandmove (getmarkerpos _mkr3);  

_wp3 = group _man addWayPoint [getmarkerpos _mkr3,10];
_wp3 setwaypointtype "MOVE";
_wp3 setWaypointSpeed "LIMITED";
_wp3 setWaypointBehaviour "SAFE"; 

waituntil {unitready _drv};
_veh setfuel 0;
{unassignVehicle _x} forEach units _man;

{_x setFormation "WEDGE";} foreach units group _man;
_wp4 = group _man addWayPoint [getmarkerpos _mkr4,10];
_wp4 setwaypointtype "MOVE";
_wp4 setWaypointSpeed "LIMITED";
_wp4 setWaypointBehaviour "SAFE"; 

sleep 120;
{_x setbehaviour "SAFE"; _x domove position _veh; _x setSpeedMode "LIMITED"; _x setFormation "WEDGE";} foreach units group _man;
{_x assignAsCargo _veh;} foreach units group _man;
units group _man orderGetIn true;

waituntil {vehicle _man != _man};
sleep 1;

_veh setfuel 1;
_drv domove (getmarkerpos _mkr5);
_drv commandmove (getmarkerpos _mkr5);  

_wp5 = group _man addWayPoint [getmarkerpos _mkr5,10];
_wp5 setwaypointtype "MOVE";
_wp5 setWaypointSpeed "LIMITED";
_wp5 setWaypointBehaviour "SAFE"; 

waituntil {unitready _drv};
_veh setfuel 0;

};

Any Ideas?

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  

×