Jump to content
Sign in to follow this  
PeterBitt

scripted waypoints !? (i must be stupid...)

Recommended Posts

hi,

iam frustrated, i searched for hours and tried different variants but i cant get scripted waypoints to work with my editor placed group :mad:

i use the following script, wich strangely works perfect with groups created via "creategroup" but my editor placed group is just not moving:

wp4 = bluegrp1 addWaypoint [getMarkerPos "bg1wp2", 1];
wp4 setWaypointType "MOVE";
wp4 setWaypointSpeed "NORMAL";
wp4 setWaypointBehaviour "AWARE";
wp4 setWaypointFormation "DIAMOND";
wp4 setWaypointStatements ["true", ""];

my problem is that i have no understanding about scripting, i dont know when i have to use "_" or all the brakets and i dont know wether to call the script via "exec" or "execVM" ... and must it be an "sqf" or "sqs"?

till now its an "sqs" wich i called via:

[] exec "scripts\WaypointTest.sqs";

a little hint on what iam missing would be much appreciated.

thx for all the help i allready got from you mates!

Share this post


Link to post
Share on other sites

Use an array:

[_grp, 2] setWaypointType "HOLD"

http://community.bistudio.com/wiki/setWaypointType

[group, index]

http://community.bistudio.com/wiki/Waypoint

I'd recommend using sqf with execVM command instead of sqs with exec command.

It is not recommended to use this command. Instead, the execVM command should be used!

http://community.bistudio.com/wiki/exec

Share this post


Link to post
Share on other sites

thx, i tried to get it to work as a "sqf" and to call it via "execVM" but i cant even get the sqf to start (a little bit of sqs-scripting skills is all i have :confused_o:).

would it be to much to ask wether someone could post the two codes from the first post as a working version :o

trying to figure out the biwiki pages is very hard or even impossible with my low english and scripting skills...

Share this post


Link to post
Share on other sites
hi,

iam frustrated, i searched for hours and tried different variants but i cant get scripted waypoints to work with my editor placed group :mad:

i use the following script, wich strangely works perfect with groups created via "creategroup" but my editor placed group is just not moving:

wp4 = bluegrp1 addWaypoint [getMarkerPos "bg1wp2", 1];
wp4 setWaypointType "MOVE";
wp4 setWaypointSpeed "NORMAL";
wp4 setWaypointBehaviour "AWARE";
wp4 setWaypointFormation "DIAMOND";
wp4 setWaypointStatements ["true", ""];

my problem is that i have no understanding about scripting, i dont know when i have to use "_" or all the brakets and i dont know wether to call the script via "exec" or "execVM" ... and must it be an "sqf" or "sqs"?

till now its an "sqs" wich i called via:

[] exec "scripts\WaypointTest.sqs";

a little hint on what iam missing would be much appreciated.

thx for all the help i allready got from you mates!

First of all it seems ok the code you wrote , here is no need to use the array version. But if you are not going to use never again that variable its recomended to use local variables(with the _ you say) instead of global ones, but it should work both ways. If you use always golbal variables you will probably have conflicts between your scripts for example if you use the same variable names in 2 diferent scripts.

Note also that there is no need to use setWaypointStatements if you aren't really using it, same for the rest.

And as Lonestar said, use sqf and call it with execvm.

So if i am saying that your code is okay why they aren't moving, well here posible problems:

1- You must set the current waypoint, so add this line at the end

bluegrp1 setCurrentWaypoint wp4;

2-If there are any syntax error, the execution of the sqf will stop. So start the game with -showScriptErrors or look at the RPT to be sure that there isn't any script error.

Here you have a working example:

http://www.mediafire.com/?rpcoas68pq2eodp

Trigger alpha adds a waypoint to a existing group.

Triger bravo creates a group and a unit on it and adds some waypoints

As you see i use local variables and both scripts uses the same variablenames without problems.

Edited by columdrum

Share this post


Link to post
Share on other sites

if the setCurrent waypoint dont work, use domove to get group going.

place this after you have created the waypoints:

_leader = (leader bluegrp1);
_leader doMove [(getPos _leader select 0)+2, getPos _leader select 1,0];

this will make the leader (followed by his group) move to a position 2 meters east of him, and then go to his assigned wps.

PS: your script is already written as a sqf. at least the part you have posted, and then you can use execVM instead of exec, remember to save as script.sqf instead of .sqs if you do.

Edited by Demonized

Share this post


Link to post
Share on other sites

@columdrum: thx for the demo mission but there seem to be no triggers to call the scripts in the mission?

now i have this setup in my mission:

WaypointTest.sqf

_wp4 = bluegrp1 addWaypoint [getMarkerPos "bg1wp2", 1];
_wp4 setWaypointType "MOVE";
_wp4 setWaypointSpeed "NORMAL";
_wp4 setWaypointBehaviour "AWARE";
_wp4 setWaypointFormation "DIAMOND";
bluegrp1 setCurrentWaypoint _wp4;

Trigger

[] execvm "WaypointTest.sqf";

i get the massage that "type script, awaits nothing" when i try to add this to the "on activation" field, so i tried:

[] exec "WaypointTest.sqf";

now the script is getting executed but the group is still not moving to waypoint :j:

if you maybe could re-upload your mission with the triggers, i would be happy.

Edited by PeterBitt

Share this post


Link to post
Share on other sites

try this:

_null = [] execVM "WaypointTest.sqf";

Edit: also i use execVM instead of execvm, but i dont think it matters.

Edited by Demonized

Share this post


Link to post
Share on other sites
try this:

_null = [] execVM "WaypointTest.sqf";

Edit: also i use execVM instead of execvm, but i dont think it matters.

with your help i was able to execute the scripts from columdrum´s mission and finaly made it! :yay:

thank you all for your quick help!

Share this post


Link to post
Share on other sites
with your help i was able to execute the scripts from columdrum´s mission and finaly made it! :yay:

thank you all for your quick help!

Fail, i forgot to save in the editor before uploading for sure, thats why the triggers where missing. But i am happy that it was heplfull anyways ^^. There are also 2 missing markers move2 and move3 btw :P

Edited by columdrum

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  

×