- Joined
- May 28, 2009
- Messages
- 5
Hi btw (first ever post)
I'm trying to make a spell that works like Power Word: Shield from World of Warcraft using GUI. The spell creates a barrier on the target, protecting it from X amount of damage, and then disperses once X damage has been dealt to the target. I couldn't find a spell that works the way I want (Anti-Magic Shell is exactly what I want but only effects spell damage T_T) so I started messing around with triggers and came up with these two triggers:
Once the spell Light Shield is cast on a target, this trigger checks for an open slot on an array called LightShield. It checks to see if LightShield [X] is in use (has a value higher than 0) and then if it is not, the target of the spell is recorded in the corresponding LightShieldTarget [X] array. Also, LightShield [X] is set to an amount based on the caster's Intellect and the level of the spell at the time it is being used. It also adds the Event "If LightShieldTarget [X] takes damage" to my second trigger. LightShield [X] measures the amount of damage LightShieldTarget [X] can take before losing the shield.
This trigger activates when any unit that has ever had Light Shield cast upon it takes damage and still has the buff "Light Shield". It searches through all 100 slots in the LightShieldTarget array, searching for the slot that the unit is in. Then, it subtracts the damage taken from the LightShield [X] that corresponds to that unit. It is also supposed to nullify the damage taken by adding it back to the unit's HP. This is where I run into problems.
For whatever reason, strange things keep happening to the target when he takes damage. Sometimes he'll lose 3 hit points. Sometimes he'll heal 10 hit points, but rarely is damage ever negated like I want. Also, I've seen a unit that does 12ish damage take out a shield in two hits. It's really buggy and I don't know why. The problem seems to stem from "damage taken". Any suggestions.
(P.S. I discovered what Arrays and Integer A Loops do as I was making this spell, so it's possible that I screwed up on the Array trigger somehow.)
I'm trying to make a spell that works like Power Word: Shield from World of Warcraft using GUI. The spell creates a barrier on the target, protecting it from X amount of damage, and then disperses once X damage has been dealt to the target. I couldn't find a spell that works the way I want (Anti-Magic Shell is exactly what I want but only effects spell damage T_T) so I started messing around with triggers and came up with these two triggers:
Once the spell Light Shield is cast on a target, this trigger checks for an open slot on an array called LightShield. It checks to see if LightShield [X] is in use (has a value higher than 0) and then if it is not, the target of the spell is recorded in the corresponding LightShieldTarget [X] array. Also, LightShield [X] is set to an amount based on the caster's Intellect and the level of the spell at the time it is being used. It also adds the Event "If LightShieldTarget [X] takes damage" to my second trigger. LightShield [X] measures the amount of damage LightShieldTarget [X] can take before losing the shield.
This trigger activates when any unit that has ever had Light Shield cast upon it takes damage and still has the buff "Light Shield". It searches through all 100 slots in the LightShieldTarget array, searching for the slot that the unit is in. Then, it subtracts the damage taken from the LightShield [X] that corresponds to that unit. It is also supposed to nullify the damage taken by adding it back to the unit's HP. This is where I run into problems.
For whatever reason, strange things keep happening to the target when he takes damage. Sometimes he'll lose 3 hit points. Sometimes he'll heal 10 hit points, but rarely is damage ever negated like I want. Also, I've seen a unit that does 12ish damage take out a shield in two hits. It's really buggy and I don't know why. The problem seems to stem from "damage taken". Any suggestions.
(P.S. I discovered what Arrays and Integer A Loops do as I was making this spell, so it's possible that I screwed up on the Array trigger somehow.)