• 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] Using local variable in other functions as well?

Status
Not open for further replies.
Level 4
Joined
Aug 12, 2004
Messages
76
Is this possible? I am really new to Jass and went through many tutorials, but I am still a beginner, so it's kind of complex to me.

I wanted to make a local variable work in multiple functions because I want to create a spell, that creates a shield that absorbs 300 damage.

I made a local variable "damagelimit"
I made the unit being shielded "target"

but I was able to set the damagelimit and loop it so the damage won't be done to the unit until the damagelimit is turned to 0 or lower. However, I don't seem to be able to work this right. Can someone help me?

EDIT: Is it also possible to take EVENT_UNIT_DAMAGED as TriggerRegisterAnyUnitEventBJ unit?
 
Level 4
Joined
Aug 12, 2004
Messages
76
can handles be threaded and act on multiple instances as well with the same local variable?
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,255
What you asked made no sense.

Well aynway a local lasts until the end of a function, when it is destroied.

locals can not interfear with other functions or even the same function but on a different call.

Handle vars attach a value to a unit. You can attach any value to any object using them as much as you want, however each value much have a unique ID to be retrieved by or it will overwrite an already existant attached ID.
 
Status
Not open for further replies.
Top