Jump to content
Sign in to follow this  
Sardaukar17

Scripting Waypoints "Cycle" (setwaypointtype "cycle")

Recommended Posts

Well I have been on 2 websites searching tonight and I still cannot figure it out. There must be something I am not understanding here. Let me show you what I have and the variations I have tried. It will do the explaining for me.

_grp = createGroup east

"RU_Soldier_Officer" createUnit [getmarkerpos "Infstarttest", _grp,"", 1.0, "major"];
"MVD_Soldier_GL" createUnit [getmarkerpos "Infstarttest", _grp] 
"MVD_Soldier_GL" createUnit [getmarkerpos "Infstarttest", _grp] 

#wp1
_wptest1 = _grp addWaypoint [wptest1, 1] 
[wptest1, 1] setWaypointType "MOVE"
[wptest1, 1] setwaypointBehaviour "COMBAT"
[wptest1, 1] setwaypointcombatmode "RED" 
[wptest1, 1] setWaypointSpeed "NORMAL" 


#wp2
_wptest2 = _grp addWaypoint [wptest2, 2] 
[wptest2, 2] setWaypointType "MOVE"
[wptest2, 2] setwaypointBehaviour "COMBAT"
[wptest2, 2] setwaypointcombatmode "RED" 
[wptest2, 2] setWaypointSpeed "NORMAL" 


#wp3
_wptest3 = _grp addWaypoint [wptest3, 3] 
[wptest3, 3] setWaypointType "CYCLE"
[wptest3, 3] setwaypointBehaviour "COMBAT"
[wptest3, 3] setwaypointcombatmode "RED" 
[wptest3, 3] setWaypointSpeed "NORMAL" 
exit

The result I constantly get is 3 guys standing at the third waypoint. I have tried several variations which I will also list.

#wp3
_wptest3 = _grp addWaypoint [wptest1, 3] 
[wptest1, 3] setWaypointType "CYCLE"
[wptest1, 3] setwaypointBehaviour "COMBAT"
[wptest1, 3] setwaypointcombatmode "RED" 
[wptest1, 3] setWaypointSpeed "NORMAL" 

This one above goes back to wp1 incase they had to be overlapping. Same result

#wp3
_wptest3 = _grp addWaypoint [wptest3, 3] 
[wptest3, 3] setWaypointType "CYCLE"

I tried this incase the other options where confusing it

I even tried making the cycle waypoint the 2nd waypoint number in addition to the WP2

_wptest3 = _grp addWaypoint [wptest1, 2] 
[wptest1, 2] setWaypointType "CYCLE"
[wptest1, 2] setwaypointBehaviour "COMBAT"
[wptest1, 2] setwaypointcombatmode "RED" 
[wptest1, 2] setWaypointSpeed "NORMAL" 

and same result.

I also tried adding cycle to the array just to see.

_wptest3 = _grp addWaypoint [wptest3, Cycle] 

I figured that wouldn't work.

Does the setwaypointtype "Cycle" command just not work?

Share this post


Link to post
Share on other sites

OR you could use my editor based AI spawn script where you simply place your infantry soldiers in the editor and place all the waypoints as usual: http://www.armaholic.com/page.php?id=7074

I just tested with cycle (I havent tested all waypoint functions lol) and it works just fine, had 2 spawned guys running around in circles.

Much improved version coming out soon.

Share this post


Link to post
Share on other sites

The cycle waypoint does work. Is this an sqs file your using? I only know sqf so I took the liberty of writing a sqf script. I've re named the markers so I could see it easier and I've added a waypoint. Put the 5 markers down were you want them as long as the "wp" and "wp3" markers are fairly close to one another and call the script with

 nul = [East1] execVM "spawn.sqf";

where East1 is the name of the group and the script name is spawn.sqf

if (isServer) then {
_grp = _this select 0;

_grp= Creategroup EAST;

_Unit1= _grp createUnit ["RU_Soldier_Officer",[(getMarkerPos "Itest") select 

0,(getMarkerPos "Itest") select 1,0],[],0,"FORM"];

_Unit2= _grp createUnit ["MVD_Soldier_GL",[(getMarkerPos "Itest") select 

0,(getMarkerPos "Itest") select 1,0],[],0,"FORM"];

_Unit3= _grp createUnit ["MVD_Soldier_GL",[(getMarkerPos "Itest") select 

0,(getMarkerPos "Itest") select 1,0],[],0,"FORM"];

_unit1 setunitrank "MAJOR";
_unit1=leader _grp;

_waypoint0 = _grp addWaypoint [getmarkerpos "wp0",0]; 
_waypoint0 setWaypointType "Move";
_waypoint0 setWaypointBehaviour "COMBAT";
_waypoint0 setwaypointcombatmode "RED"; 
_waypoint0 setWaypointSpeed "NORMAL"; 



_waypoint1 = _grp addWaypoint [getmarkerpos "wp1",0];
_waypoint1 setWaypointType "Move";
_waypoint1 setWaypointBehaviour "UNCHANGED";
_waypoint1 setwaypointcombatmode "NO CHANGE"; 
_waypoint1 setWaypointSpeed "UNCHANGED"; 



_waypoint2 = _grp addWaypoint [getmarkerpos "wp2",0]; 
_waypoint2 setWaypointType "Move";
_waypoint2 setWaypointBehaviour "UNCHANGED";
_waypoint2 setwaypointcombatmode "NO CHANGE"; 
_waypoint2 setWaypointSpeed "UNCHANGED";


_waypoint3 = _grp addWaypoint [getmarkerpos "wp3",0]; 
_waypoint3 setWaypointType "Cycle";
_waypoint3 setWaypointBehaviour "UNCHANGED";
_waypoint3 setwaypointcombatmode "NO CHANGE"; 
_waypoint3 setWaypointSpeed "UNCHANGED";
}; 

Share this post


Link to post
Share on other sites

You showed me what I was doing wrong. Thank you lol. Your the first in 5

days and 2 websites.

I was doing this:

#wp1
_wp1 = _grp addWaypoint [wp1, 1] 
[wp1, 1] setWaypointType "MOVE"
[wp1, 1] setwaypointBehaviour "COMBAT"
[wp1, 1] setwaypointcombatmode "RED" 
[wp1, 1] setWaypointSpeed "NORMAL" 

When I should have been doing this:

#wp1
_wp1 = _veh addWaypoint [wp1, 1] 
_wp1 setWaypointType "SAD"
_wp1 setwaypointBehaviour "Aware"
_wp1 setwaypointcombatmode "RED" 
_wp1 setWaypointSpeed "NORMAL" 
goto "WpNumber"

Incindentally if someone, anyone needs to set a large string of waypoints you

can see at the bottom of that brief script there it goes to #WpNumber. I'll

show you what I use that for and how to make your waypoints chosen

randomly. Since this post will probly get hit allot due to the way I named it..

With ofcourse that intention.

I'll post a section of what I got.. (I apologize for the SQS it's all I know)

?!(local Server): Goto "exit"

_veh=_this select 0

_wpnum=1

#WaypointMaster
_rand = random 5
_num = _rand - (_rand mod 1) 
~1
?(_num==0):goto "Wp1"
?(_num==1):goto "WP2"
?(_num==2):goto "WP3"
?(_num==3):goto "WP4"
?(_num==4):goto "Wp5"

;---------------------------------

#wp1
_wp1 = _veh addWaypoint [wp1, _WPnum] 
_wp1 setWaypointType "SAD"
_wp1 setwaypointBehaviour "Aware"
_wp1 setwaypointcombatmode "RED" 
_wp1 setWaypointSpeed "NORMAL" 
goto "WpNumber"

#wp2
_wp2 = _veh addWaypoint [wp2, _WPnum] 
_wp2 setWaypointType "SAD"
_wp2 setwaypointBehaviour "AWARE"
_wp2 setwaypointcombatmode "RED" 
_wp2 setWaypointSpeed "NORMAL" 
goto "WpNumber"

#wp3
_wp3 = _veh addWaypoint [wp3, _WPnum] 
_wp3 setWaypointType "SAD"
_wp3 setwaypointBehaviour "AWARE"
_wp3 setwaypointcombatmode "RED" 
_wp3 setWaypointSpeed "NORMAL" 
goto "WpNumber"

#wp4
_wp4 = _veh addWaypoint [wp4, _WPnum] 
_wp4 setWaypointType "SAD"
_wp4 setwaypointBehaviour "AWARE"
_wp4 setwaypointcombatmode "RED" 
_wp4 setWaypointSpeed "NORMAL" 
goto "WpNumber"

#wp5
_wp5 = _veh addWaypoint [wp5, _WPnum] 
_wp5 setWaypointType "SAD"
_wp5 setwaypointBehaviour "AWARE"
_wp5 setwaypointcombatmode "RED" 
_wp5 setWaypointSpeed "NORMAL" 
goto "WpNumber"

;---------------------------------------------

#WpNumber
_wpnum=_wpnum+1
~1
?(_wpnum==5):goto "Cycle"
goto "WayPointMaster"

;----------------------------------------------

#Cycle
_wpnum=_wpnum+1
~1
_wp29 = _veh addWaypoint [wp25, _wpnum] 
_wp29 setWaypointType "CYCLE"
_wp29 setwaypointBehaviour "AWARE"
_wp29 setwaypointcombatmode "RED" 
_wp29 setWaypointSpeed "NORMAL" 
goto "exit"

;------------------------------------------------------

#exit
exit

Ok to track this it is pretty simple. You need to execute it like this:

[YourGroupName] exec "waypoint.sqs"

_veh= _this select 0 is just the line that pulls the group name from the

execution array. I make _wpnum equal to 1 it's important for reasons below.

You can see the Random section. it simply creates a random (whole number -thats the mod 1-) number.

It then detects what number it is through the string of ?(_num==1):goto

"wp1" lines. It goes to the line hits the waypoint commands of the selected

waypoints and then goes to #wpNumber This section is simply a counter

that is used to replace the number of the waypoint order in the

addWaypoint array

addWaypoint [Location, #in order]

When _wpNumber hits the number you enter into the

?(_wpnum==5):goto "Cycle"

it will go to the #cycle and add a cycle waypoint and then exit.

It is all in SQS so sorry and there may be a way of shortening this up. But I'm proud for only being at this for a couple months. Just trying to be helpful.:)

Share this post


Link to post
Share on other sites

Yea the syntax is

_wp0 = groupName addWaypoint [center, radius],
the centre being a Position or Object eg. a marker

and I believe the radius sets the completion radius for the waypoint

If you wish to introduce randomness into a patrol why not use the mighty Kronzky Urban Patrol Script? Nothing can compare to it! plus using random in multiplayer missions can result in each player coming up with a different result. The UPS script adds so much more to a mission will intelligent AI behaviour, such as outflanking enemies if detected, a random patrol that has a logic to it, etc.

If as you say others are reading this thread, my advice to them would be:

That if you do not already know SQS learn SQF. SQF supersedes SQS and most scripts for ARMA2 are if SQF. If you already know SQS then it would be to your advantage to switch to SQF.

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  

×