| 01-24-2010, 07:44 PM | #2 |
Why would you store a static trigger (OfShieldEffect <gen>) into the hashtable for every unit? The "Attacked unit" is meant to be used in triggers with an attack event and as far as I know does not do anything in triggers that run on the damage event. In the timer callback, you never update the shield life stored in the hashtable. Also, you increase the unit's life by the amount of shield life remaining rather than the amount of damage blocked. There must be at least half a dozen cases in which this code makes an error or just downright fails. Why not use a system that actually works instead, like DamageModifiers? |
| 01-24-2010, 09:56 PM | #3 |
I stored the trigger in hopes that it'll not conflict and I don't have to create a trigger for ever unit that casts, but that sort of was a dumb idea, forgot to take it back out. The Attacked unit works though, oddly. I updated the hashtable after I called the timer, and I called the timer to heal the shield life remaining because that timer only runs whenever damage > shield, I subtracted shield from damage and shieldlife would be negative, that's the leftover damage not blocked so I added the unit by that. This code actually doesn't make an error at all except the case of two units getting damaged in one instance =/ but I do admit it's a fail |
| 01-24-2010, 10:04 PM | #4 | |
Quote:
(Damage Greater than ShieldLife) or ((Damage Greater than or equal to (Life of Unit)) or ((Percentage life of Unit) Equal to 100.00)) What happens for example if a unit with 10/100 hp and a shield with 100 hp takes 20 damage? |
| 01-25-2010, 12:06 AM | #5 |
Well when damage > life of the unit, the trigger gives lifebonus, adds the damage as life, remove the lifebonus, set shieldlife = (shieldlife-damage), and unit stays alive with 80 shield life. When damage > shield life, it does the same thing as when damage > life, but also adds the lifeshield at the end, which should be a negative number as it was set to (shieldlife - damage). e: oh wow I'm confused myself now, I don't get how come the trigger works perfectly during a lot of my tests anymore, there seems to be conflicts =/ |
