Jump to content
Sign in to follow this  
natethegreat

cant get AI to follow waypoint

Recommended Posts

I have AI spawn in a trigger but the Waypoint I created through code they wont follow. Any help appreciated

_wp = GroupSquad1 addwaypoint [getMarkerPos "s1",0];
_wp setwaypointtype "MOVE";
_wp setWaypointCompletionRadius 10;
_wp setWaypointSpeed "FULL";
_wp setWaypointBehaviour "Careless";
_wp setSpeedMode "FULL";
_wp move getMarkerPos "s1"; 

Share this post


Link to post
Share on other sites

Why are you telling the waypoint (_wp) to use speed mode FULL and move itself to marker pos S1? :)

Other then those last two lines I don't really see anything wrong unless GroupSquad1 isn't declared ahead of time?

Share this post


Link to post
Share on other sites

that move was a mistype and I forgot to take it out when I pasted it in here but here is the beginning of the script.

GroupSquad1 = CreateGroup East;
_leader = GroupSquad1 createUnit ["TK_INS_Soldier_TL_EP1", [(getMarkerPos "Squad1") select 0,(getMarkerPos "Squad1") select 1,0], [], 3, "FORM"];
_unit = GroupSquad1 createUnit ["TK_INS_Soldier_3_EP1", [(getMarkerPos "Squad1") select 0,(getMarkerPos "Squad1") select 1,0], [], 3, "FORM"];
_unit = GroupSquad1 createUnit ["TK_INS_Soldier_4_EP1", [(getMarkerPos "Squad1") select 0,(getMarkerPos "Squad1") select 1,0], [], 3, "FORM"];
_unit = GroupSquad1 createUnit ["TK_INS_Soldier_AAT_EP1", [(getMarkerPos "Squad1") select 0,(getMarkerPos "Squad1") select 1,0], [], 3, "FORM"];
_unit = GroupSquad1 createUnit ["TK_INS_Soldier_MG_EP1", [(getMarkerPos "Squad1") select 0,(getMarkerPos "Squad1") select 1,0], [], 3, "FORM"];
_unit = GroupSquad1 createUnit ["TK_INS_Soldier_AR_EP1", [(getMarkerPos "Squad1") select 0,(getMarkerPos "Squad1") select 1,0], [], 3, "FORM"];
_unit = GroupSquad1 createUnit ["TK_Soldier_Medic_EP1", [(getMarkerPos "Squad1") select 0,(getMarkerPos "Squad1") select 1,0], [], 3, "FORM"];
_unit = GroupSquad1 createUnit ["TK_Soldier_EP1", [(getMarkerPos "Squad1") select 0,(getMarkerPos "Squad1") select 1,0], [], 3, "FORM"];
_unit = GroupSquad1 createUnit ["TK_Soldier_AA_EP1", [(getMarkerPos "Squad1") select 0,(getMarkerPos "Squad1") select 1,0], [], 3, "FORM"];
_unit = GroupSquad1 createUnit ["TK_INS_Soldier_TL_EP1L", [(getMarkerPos "Squad1") select 0,(getMarkerPos "Squad1") select 1,0], [], 3, "FORM"];
_unit = GroupSquad1 createUnit ["TK_INS_Warlord_EP1", [(getMarkerPos "Squad1") select 0,(getMarkerPos "Squad1") select 1,0], [], 3, "FORM"];
_unit = GroupSquad1 createUnit ["TK_INS_Soldier_MG_EP1", [(getMarkerPos "Squad1") select 0,(getMarkerPos "Squad1") select 1,0], [], 3, "FORM"];
_leader = leader GroupSquad1;

GroupSquad1 is declared and for the addwaypoint what should it look like. like this

_wp = GroupSquad1 addwaypoint [getMarkerPos "s1"];

I want the waypoint to be the marker s1 right? But they just don't move/

---------- Post added at 01:21 PM ---------- Previous post was at 01:21 PM ----------

thanks for responding :)

Share this post


Link to post
Share on other sites

This worked for me:

GroupSquad1 = [getMarkerPos "Squad1", east, ["TK_INS_Soldier_TL_EP1","TK_INS_Soldier_3_EP1","TK_INS_Soldier_4_EP1","TK_INS_Soldier_AAT_EP1","TK_INS_Soldier_MG_EP1","TK_INS_Soldier_AR_EP1","TK_Soldier_Medic_EP1","TK_Soldier_EP1","TK_Soldier_AA_EP1","TK_INS_Soldier_TL_EP1","TK_INS_Warlord_EP1","TK_INS_Soldier_MG_EP1"]] call BIS_fnc_spawnGroup;
wp = GroupSquad1 addwaypoint [getMarkerPos "s1",20];  
wp setWaypointType "MOVE";  

Share this post


Link to post
Share on other sites

****Nevermind dude I got it to work the problem was when I went into the trigger zone it was trying to exec the whole script at once so sometimes the waypoint was exec before all the units were spawned, all I did was put a sleep in for 5 secs and walla. Thanks

Share this post


Link to post
Share on other sites

I'm having this same issue but I can't seem to fix it, even by adding the sleep.

_pos = getmarkerPos "enemygroup1";

_skill = [0.1, 0.5];

_side = EAST;

_units = ["TK_Soldier_SL_EP1", "TK_Soldier_EP1", "TK_Soldier_EP1", "TK_Soldier_GL_EP1", "TK_Soldier_AR_EP1", "TK_Soldier_EP1"];

_EmenyGroup1 = [_pos, _side, _units, [], [], _skill] call BIS_fnc_spawnGroup;

sleep 5;

_ewp1 = _EnemyGroup1 addWaypoint [getMarkerpos "enemywp"];

_ewp1 = setWaypointType "MOVE";

hint "Done!";

Activated by trigger. Trigger is activated, the group spawns properly with a leader auto picked and a formation set, but something goes wrong around _ewp1 that stops the script, not adding a waypoint and not allowing the hint.

Share this post


Link to post
Share on other sites

addWaypoint requires a center and a radius, with index being optional. You're missing the radius value after your getMarkerPos.

_ewp1 = _EnemyGroup1 addWaypoint [getMarkerpos "enemywp"[color="Red"], 0[/color]];

Share this post


Link to post
Share on other sites

_pos = getmarkerPos "enemygroup1";

_skill = [0.1, 0.5];

_side = EAST;

_units = ["TK_Soldier_SL_EP1", "TK_Soldier_EP1", "TK_Soldier_EP1", "TK_Soldier_GL_EP1", "TK_Soldier_AR_EP1", "TK_Soldier_EP1"];

_EmenyGroup1 = [_pos, _side, _units, [], [], _skill] call BIS_fnc_spawnGroup;

sleep 5;

_ewp1 = _EnemyGroup1 addWaypoint [getMarkerpos "enemywp", 5];

_ewp1 = setWaypointType "MOVE";

hint "Done!";

Still not working, same issue as before. Does it have something to do with the lack of createGroup East?

Edit:

Found it.... God damn I feel like a 3rd grader. Line 6, misspelled Enemy. Testing now

Edit 2: Works as it should. Thanks for the help!

Edited by Grimes [3rd ID]

Share this post


Link to post
Share on other sites

I'm trying this for the first time. My mission is too laggy with all the enemy in it so I knew eventually that I would have to tackle this stuff. My mission is done, I just need to remove a lot of enemy and then spawn them when needed. When you mentioned "declared ahead of time", that's the part I'm lost on. Other than that, this thread seems to cover the rest pretty well. Actually, what I want to do is take a bunch of 12 man enemy squads, break them down into 6 man squads that when killed will respawn over on the other side of a hill someplace and then head back to the same area that they were originally patrolling around. So yeah, I'm lost right now, help! heh :)

---------- Post added at 07:41 AM ---------- Previous post was at 06:26 AM ----------

yay, i got some to spawn, and they killed me, lol. still needs some more work tho.

---------- Post added at 08:37 AM ---------- Previous post was at 07:41 AM ----------

Yeah, they wont move. I'm getting _wp errors. grr

---------- Post added at 08:50 AM ---------- Previous post was at 08:37 AM ----------

I think I just got dummer. Can somebody please post a full working script? Right now I'm using what nate started with and what grimes finished with, lol. Where's the first part of grimes script? - where he creates the group. He said he got it working.

Share this post


Link to post
Share on other sites

is there an example mission that somebody could hook me up with? i got them to spawn, but i can get them to go to their waypoints. i get an error telling that _wp is an invalid expression or something.

Share this post


Link to post
Share on other sites

I tried Kylanias example, but it didn't work. So then I figured since the script had "call BIS_fnc_spawnGroup", I figured to add the functions module and then everything worked. I tried other ways of scripting it and I was able to spawn enemy without the functions module, but they wouldn't move at all and I got errors. At least I got it working now. Thanks guys.

Share this post


Link to post
Share on other sites

So they're spawning now? good to hear. ;)

Sui, can you teach me now. xD

Share this post


Link to post
Share on other sites

I found that this worked to spawn a manned vehicle and move it to a waypoint using Radio Alpha. Trigger using Functions Module, On Act. As follows;

Tank = [markerPos "Marker1", random 360, "M1A1", WEST] call BIS_fnc_spawnVehicle; wp = Marker1 addwaypoint [getMarkerPos "Marker2",0]; wp setWaypointType "MOVE"; Tank commandMove (getMarkerPos "Marker2")

Edited by Signalman

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  

×