How to add unit to unit group

Shadow

TH.net Regular
Reaction score
23
I inlined the gui to get GroupAddUnit but how do I add last created units to a unit group?

GroupAddUnit(MyUnitGroup, ? )
 

emjlr3

Change can be a good thing
Reaction score
395
you could always still use bj_lastCreatedUnit in the same fashion
 

Sevion

The DIY Ninja
Reaction score
413
No, you'd have to use the BJ to use bj_lastCreatedUnit. The native would not set bj_lastCreatedUnit.

Using it with the native would be the same as using the local unit variable by replacing all instance of u with bj_lastCreatedUnit and not declaring it as a local.
 

emjlr3

Change can be a good thing
Reaction score
395
aren't we talking about JASS here? he is calling a native function, so I imagine he can declare and/or use globals as required
 

Sevion

The DIY Ninja
Reaction score
413
He can't use bj_lastCreatedUnit with the native is what I'm saying. Natives don't automatically set bj_lastCreatedUnit.
 

emjlr3

Change can be a good thing
Reaction score
395
it doesn't use a global or local, and so long as he is using jASS natives, he will need to use a local or global unit to store the last created unit so he can then add it to a group

in which case bj_lastCreatedUnit fits the bill, just the same as a local unit would, minus the deceleration
 

Sevion

The DIY Ninja
Reaction score
413
I think you misunderstood what I was saying...

All I'm saying is that he can't use bj_lastCreatedUnit if he uses the native unless he sets it to the returned unit because the Native does not automatically set the global to that value.
 

emjlr3

Change can be a good thing
Reaction score
395
well then to answer his initial question - yes, it is perfectly safe to use
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top