• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Custom script, get unit variable

Status
Not open for further replies.
Heya.

I use this custom script when I want to add Locust to a unit.
  • Custom script: call UnitAddAbility( GetSpellTargetUnit(), 'Aloc' )
It works.

I have a case where I need to add Locust to a stored unit.
uChest_Unit_Buffer <- unit variable

I get an error when saving this:
  • Custom script: call UnitAddAbility( GetuChest_Unit_Buffer(), 'Aloc' )

What do type when I want to use the unit variable instead of target of ability?
 
To use GUI generated globals in custom script, simply put "udg_" before the variable name:

uChest_Unit_Buffer ---> udg_uChest_Unit_Buffer

Hm yeah. It's just that I have actually tried that already and I still get the error.
Before you write "are you sure the variable is called that", yes it is ;)

Edit:
The error says "undeclared function".
Does that mean it thinks I didn't set the uChest_Unit_Buffer anywhere?
Because I do that as well.
 
Status
Not open for further replies.
Top