• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

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