Jump to content
kocrachon

Variables not working?

Recommended Posts

Hey All,

 

simple problem I believe. 

 

I currently have a squad, squad1, that is created like this in the squad leaders role.

 

{squad1 = group _x;} foreach units group this; 

 

I then have a waypoint that is supposed to assign all of them as cargo and ordering them to get in, like this

 

{_x assignAsCargo Blackhawk1; [_x] orderGetIn true} forEach units squad1; 

 

For some reason, I don't get the assign or order to get in. Everything that activates after that works fine, but for some reason, my units dont appear to be getting assigned as cargo and ordered in. 

Share this post


Link to post
Share on other sites
// in group leader init field
squad1 = group this;

// in waypoint activation field
{_x assignAsCargo Blackhawk1} forEach (units squad1);
(units squad1) orderGetIn true;

Launch game with -showScriptErrors statrup parameter to easier debug your scripts

Share this post


Link to post
Share on other sites

You can just name group directly in editor, no need to do the foreach loop. Just click on group write squad1 

Share this post


Link to post
Share on other sites

I cannot see why it's not working, but I see some things that could be written a little more straight forward:

 

First, the squad1 assignment is executed too many times. Why is it in a loop? If it is in the init field for the leader, simply write:


squad1 = group this;

 

Likewise, when you order the units in, commands can be separated:


{_x assignAsCargo Blackhawk1;} foreach units squad1;

(units squad1) orderGetIn true;

 

But as I said, the reason that it doesn't work at all is probably something else. Like a misspelling of variable Blackhawk1, or the helicopter has no cargo slots.

Share this post


Link to post
Share on other sites
13 hours ago, serena said:

// in group leader init field
squad1 = group this;

// in waypoint activation field
{_x assignAsCargo Blackhawk1} forEach (units squad1);
(units squad1) orderGetIn true;

Launch game with -showScriptErrors statrup parameter to easier debug your scripts

 

 

Made the changes, used the showscript errors, and nothing. Still not working, and not getting any sort of debug info. 

 

EDIT:

 

Even weirder, I tried doing it individually and its still not working.

Soldier1 assignAsCargo Blackhawk1;
Soldier2 assignAsCargo Blackhawk1;
Soldier3 assignAsCargo Blackhawk1;
[Soldier1, Soldier2, Soldier3] orderGetIn true; 

 

Share this post


Link to post
Share on other sites

I am using a ghosthawk, I just labeled in blackhawk in the names.

 

I renamed everything to GhostHawk1, still not working. Just in case the naming was any sort of issue. 

Share this post


Link to post
Share on other sites

Used a ghost hawk with same names. Mine worked good. But I could be doing something different than you. Sometimes an extra set of eyes can help. Can you upload a sample mission just of what you are trying to do. If I have time I'll try and see whats wrong.

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

×