• 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.

[JASS] What is the correct line to assign a variable to this?

Status
Not open for further replies.
(Last created unit) only works with the BJ functions.

In order to assign a variable to it, simply use the "set" keyword, followed by the name of the variable, and then an assignment operator "=".

Like so:
  • Custom script: set udg_BossUnit = CreateUnit(Player(9), udg_boss[udg_Abosslvl], udg_xspawning, udg_yspawning, 0)
  • Unit Group - Add BossUnit to bossgroup
Note that I removed the 'call' part. When you assign a variable, you can omit the 'call' after the equal sign.

In this case, the variable is named "BossUnit" of type "Unit". Since it is a GUI variable, I added udg_ as a prefix to refer to it in custom script (user defined global). If you use a different variable, just change the name accordingly.
 
Status
Not open for further replies.
Top