OFPEC Forum
Editors Depot - Mission Editing and Scripting => Arma2 - Editing/Scripting General => Topic started by: JamesF1 on 06 Jul 2009, 21:45:44
-
I'm having a peculiar issue with a script. I'm generating a waypoint for a chopper, as in the block of code below (excuse the terrible organisation of it, I'm just fiddling around/testing... will tidy it all up later):
_landWP = (group HMM_SUPPORT_TRANSPORT_GO) addWaypoint [[HMM_SUPPORT_TRANSPORT_X,HMM_SUPPORT_TRANSPORT_Y],100];
_landWP setWaypointType "MOVE";
_landWP setWaypointSpeed "FULL";
_landWP setWaypointBehaviour "AWARE";
_landWP setWaypointCombatMode "GREEN";
_landWP setWaypointStatements ["true", "HMM_SUPPORT_TRANSPORT_GO land ""GETIN""; _markerName setMarkerType ""Empty"";"];
Now, the issue here is that while the waypoint statements do execute, they only execute up to the land command. E.g. if I have the following, I get "Hello" but no action on the land command:
_landWP setWaypointStatements ["true", "hint ""Hello""; HMM_SUPPORT_TRANSPORT_GO land ""GETIN""; _markerName setMarkerType ""Empty"";"];
If, however, I use some other method of invoking the land command, it works... so, using StraDebug2, I can enter this and the chopper lands on the nearby Invisible H:
HMM_SUPPORT_TRANSPORT_GO land "GETIN";
The command is being executed where the chopper is local, so that's not the issue. The statements are being executed in some way, so that's not the issue. I'm a little stumped. Am I just missing something obvious?
Thanks in advance :)
Anyone with any ideas?
-
Sorry to bump, but anyone with any ideas? I've tried to come at it with a fresh point of view, but I figure there must be some subtlety that I'm missing (perhaps an A1 -> A2 change?). The same script seems to work in A1.
-
Warning: this post will be of no help other than to commiserate.
I've noticed that A2 *seems* to be pickier in some things than A1 was. Things like using parentheses to structure math formulas and single v. double quotes. I can't really be specific, only because I'm not absolutely confident that I was doing it right in A1. :D The stuff I'm seeing may have been errors all along that A1 just kinda got through.
For you, one thing I'd try is the single ' quotes inside the double " quotes in the setWaypointStatements. That might make sense since it seems like that is the command that is being troublesome. Might not mean a damn thing, though, too.
Good luck, and post back if you figure out a solution!
-
Hmm, the code works fine here. Placed myself next to a "H" and used getPos player instead of the *_X and *_Y coordinates.
-
Well, the problem is, the chopper does actually fly, but just hovers overhead.
One thing that has sprung to mind is that the chopper is in its own group - as all I need it to really do is land, engine on, and wait until given another waypoint.
-
The chopper landed at the "H" but turned the engine off as soon as it touched the ground. You could try to make it flyInHeight (0-2m) as a workaround...
Edit: If you still have A1 installed you might want to take a look at this example (http://www.ofpec.com/forum/index.php?topic=33102.msg228144#msg228144).
-
Okay... I'd made a really dumb mistake. I was, at a much later point in the script, re-setting the *_X, *_Y and *_GO variables (as 'clean-up', really)... and had presumed A2 used object references rather than variable references, rather stupidly. Removed the clean-up code, as it's not really needed if I'm strictly honest, and all is working (i.e. the chopper is landing).
Sorry for my dire stupidity :D