HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

What does 'static' do?

12-31-2009, 10:26 PM#1
thehellman
I tried looking through JASSHelper but I still don't quite get what the term static does in a struct.

In normal programming it means like makes the entire program have access to that method/variables. But I'm confused it's purpose in a struct.

If anyone would be so kind as to tell me when it comes in handy?
12-31-2009, 10:36 PM#2
thehellman
I also have 2 other unrelated questions:

1) What's the best way to keep a units health at 1 (such as disabling health regeneration) and without the use of a timer.
2) Do item abilities stack? (Example, if I put on Item Armor Bonus that adds +4 armor, if I add another ability off the same base Item Armor Bonus, but instead it -4 armor, will the net result be 0 armor gained)
12-31-2009, 11:03 PM#3
Here-b-Trollz
It designates a specific character as static; they cannot undergo character development for the course of the novel.
Expand ???:
Expand A better way to explain:

Static makes it essentially a global with the STRUCTNAME.<blah> prefix. It's not instance specific. There's only one.

Wikipedia: Class variable
Yahoo Answers: What's the difference between static and instance members?

---

You can stack item abilities if they are different abilities;
Example:
Ability A (+4 armor)
Ability B (+4 armor)
Ability C (-4 armor)

A + C = 0
A + B = 8
A + A = 4
Ax10 = 4
A + B + A + C = 4
B + B + B + B + C + C = 0

BonusMod (item abilities)

---

Keeping a unit from regenerating HP could be done with a -100% Unholy Aura Regen, but keeping a unit's HP at exactly 1 is an entirely different thing (assuming you don't want it to die when it takes damage) and therefore DOES require a timer, or a Resistant Skin -50000 ability or Elune's Grace -100% ability. Maybe. This last one is speculation on my part because I don't feel like opening the editor.
12-31-2009, 11:34 PM#4
thehellman
Quote:
Originally Posted by Here-b-Trollz
It designates a specific character as static; they cannot undergo character development for the course of the novel.
Expand ???:
Expand A better way to explain:

Static makes it essentially a global with the STRUCTNAME.<blah> prefix. It's not instance specific. There's only one.

Wikipedia: Class variable
Yahoo Answers: What's the difference between static and instance members?

---

You can stack item abilities if they are different abilities;
Example:
Ability A (+4 armor)
Ability B (+4 armor)
Ability C (-4 armor)

A + C = 0
A + B = 8
A + A = 4
Ax10 = 4
A + B + A + C = 4
B + B + B + B + C + C = 0

BonusMod (item abilities)

---

Keeping a unit from regenerating HP could be done with a -100% Unholy Aura Regen, but keeping a unit's HP at exactly 1 is an entirely different thing (assuming you don't want it to die when it takes damage) and therefore DOES require a timer, or a Resistant Skin -50000 ability or Elune's Grace -100% ability. Maybe. This last one is speculation on my part because I don't feel like opening the editor.

Okay thanks. I had the Unholy Aura idea in mind but wanted some confirmation. (And no, the unit will be invulnerable so it can't take damage)
01-01-2010, 02:26 AM#5
thehellman
I just tested it. It's actually killing the unit, and causing an infinite loop. It's set to -1.00 and percent bonus is on true.
01-01-2010, 02:10 PM#6
Themerion
Why wouldn't you want to use timers...?

Anyway, if you can store the unit's current max hp, you can use .: UnitMaxState :. to set its max hp to 1 (then reset it to the stored value at will).
01-03-2010, 09:31 PM#7
thehellman
Yeah I ended up using a timer for this. Thanks for the help

/close
01-04-2010, 06:00 AM#8
Tyrande_ma3x
> 1) What's the best way to keep a units health at 1 (such as disabling health regeneration) and without the use of a timer.
Use Slow Poison on the unit.