[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?
 
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.
Back
Top