Jump to content
Sign in to follow this  
Gigan

Direct description to setWaypointStatements

Recommended Posts

Hi,

There is one question about setWaypointStatements.

I recognize it as this command being what performs some scripts, when a unit reaches a waypoint. The processing performed with this command seems to be script file specification.

Then, if possible, I will want to describe direct processing instead of file specification.

Although I conducted some experiments, it did not work.

[_group, 1] setWaypointStatements ["true", hint "ok" ];

Failed. A script error message appears.

[_group, 1] setWaypointStatements ["true", {hint "ok"} ];

Failed the same.

[_group, 1] setWaypointStatements ["true", format["%1", {hint "ok"}] ];

Failed the same.

[_group, 1] setWaypointStatements ["true", format["%1", hint "ok"] ];

"OK" appears irrespective of attainment to a waypoint.

Since processing was performed at least, the last processing was tested by the variable next.

_testvar = 0;
[_group, 1] setWaypointStatements ["true", format["%1", _testvar = 1] ];
player sidechat format["%1",_testvar];

Processing is not performed and the error of a result appears.

Can't direct description of the processing performed by this command be performed?

Or if it is possible, I want to know it.

Thanks.

Share this post


Link to post
Share on other sites

Hi,

AFAIK, waypoints or triggers statements are strings, which must be stated between brackets.

So,

[_group, 1] setWaypointStatements ["true", "hint 'OMG it works'" ];

should work.

Share this post


Link to post
Share on other sites

Thanks for reply. It worked well :)

When treating variables, how is it?

This did not work.

[group, 1] setWaypointStatements ["true", "_testvar = 1" ];

---------- Post added at 09:52 PM ---------- Previous post was at 08:29 PM ----------

I have noticed one mistake.

The processing space described to setWaypointStatements differs from the processing space which performs setWaypointStatements. Therefore, a local variable cannot be used.

This succeeded.

[group, 1] setWaypointStatements ["true", "testvar = 1" ];

It solved. Thanks.

Share this post


Link to post
Share on other sites

All these waypoint/marker/trigger etc will use variables in that objects space, they have no direct connection to the script from which they are set/created. Using global variables is the easiest solution.

Share this post


Link to post
Share on other sites

Yes, it should grasp, when those commands are used.

Also, since this command is treated on a script, I thought that this command was more convenient if it has the mechanism in which a value can be passed.

for example,

_testvar = 1;
[_group, 1, [_testvar]] setWaypointStatements ["true", "_value = _this select 0; ..." ];

Of course, such usage cannot be done :rolleyes:

In the case of the spawn command, such usage can do.

[_testvar] spawn { _value = _this select 0; ... };

This is convenient.

Share this post


Link to post
Share on other sites

If this is the case, how does one create a script with waypoint instructions that can be followed? If I am in the editor I can put the waypoint type to load and

helo1 land "land";

in the on Act.: box and the helo will land as indicated.

How do I do this in an SQF?

I have a script that uses

_AShelo1 = createVehicle [airSupROT, _spwn1, [], 0, "FLY"];

to make a helo and then I would expect that I could script my waypoints as

g1wp1=_grp1 addWaypoint [_asloc, 5];
g1wp1 setWaypointBehaviour "COMBAT";
g1wp1 setWaypointType "LAND";
[color="Red"][b]g1wp1 setWaypointStatements ["true","_AShelo1 land "land";"];[/b][/color]

but the code in red is where everything ceases to function. The helo hovers in place.

Share this post


Link to post
Share on other sites

Because the "land" part is already part of a string you need to have double citation-tags around it, making it: g1wp1 setWaypointStatements ["true","_AShelo1 land ""land"";"]; or g1wp1 setWaypointStatements ["true","_AShelo1 land 'land';"]; (a single apostrophe is the same as double quotation-marks).

For each 'nested' string you'll have to add more citation marks for it to read the code properly.

Share this post


Link to post
Share on other sites

removed until I get something straight

Edited by lawndartleo
confusing the matter... neet to work on this more

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  

×