Jump to content
LoOni3r

formated setWaypointStatements

Recommended Posts

Hello everybody,

 

for my understanding this should work:

_wp setWaypointStatements ["true", format["[%1,%2,%3,%4]call FNC_SERVER_wp_vehicle_radius;",_group,_pos,_radius,_terrain]];

a3 error: missing ]

 

_radius = number

_terrain = string

 

tried a lot, unfortunately the problem was not solved. values are set.

Can someone please explain my mistake?

 

thanks

Share this post


Link to post
Share on other sites

waypoint setWaypointStatements [condition, statement];

You can't use local variables within condition or statement parameters (see link).

But you can setVariable on a group. (here as an array).

_group setVariable ["grpData", [_group,_pos,_radius,_terrain]];

then:

_wp setWaypointStatements ["true", "(group this getVariable ['grpData',[]]) call FNC_SERVER_wp_vehicle_radius"];

(not tested)

 

Share this post


Link to post
Share on other sites

Thank you very much.
I should have thought of that.
I stiffened too much to format

Share this post


Link to post
Share on other sites
1 hour ago, pierremgi said:

You can't use local variables within condition or statement parameters

Of which they are not doing.

 

Groups do not format to a valid type. What is the group? the same group that the waypoint belongs to? If so then the group is already available in the statement as group this.

Strings need to be formatted as strings either wrap %4 in ' ' or pass str _terrain.


FNC_SERVER_wp_vehicle_radius = {
	params[ "_grp", "_pos", "_radius", "_terrain" ];
	
	hint format[ "G: %1\nP: %2\nR: %3\nT: %4", _grp, _pos, _radius, _terrain ];
};

_group = group player;
_pos = player getPos[ 20, getDir player ];
_radius = 10;
_terrain = "STRATIS";

_wp = _group addWaypoint[ _pos, 0 ];
_wp setWaypointStatements[ "true", format[ "[ group this, %1, %2, '%3' ]call FNC_SERVER_wp_vehicle_radius;", _pos, _radius, _terrain ] ];

 

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

×