• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Need help with a basic Jass problem....

Status
Not open for further replies.
Level 11
Joined
Oct 11, 2012
Messages
711
How to set a unit variable to a specific unit ID?
For example:
if I create a unit "n000" at a certain location and I want to later refer to that unit, I need to set "n000" to "gg_unit_n000_0001",how to do that? I tried the following but failed:
JASS:
call CreateUnitAtLoc(Player(11),'n000',udg_GO[1],bj_UNIT_FACING)      
set gg_unit_n000_0001 = bj_lastCreatedUnit

When I later use "gg_unit_n000_0001", which is a global variable, in a trigger, the trigger does not respond....

I want to use "gg_unit_n000_0001" instead of the unit ID "n000", because some function requires unit and not integer....
 
Last edited:
Level 11
Joined
Oct 11, 2012
Messages
711
make a global variable for the unit.
then do
JASS:
set unitVariable = CreateUnit()

don't use locations in jass.

You can't use gg_unit_n000_0001 because these are preplaced units only.
Thanks for the reply. Do you mean the name of the global variable should be "unitVariable"? Sorry I don't quite understand.

Update: I see what you mean... Thanks a lot! :)
 
Status
Not open for further replies.
Top