HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Modify Damage Trigger

05-18-2008, 01:32 PM#1
Castlemaster
I recently switched from Shadow 1500's Damage detection to Grim001's detection system. Unfortunately the damage modification trigger I used doesn't work w/Grim001's system.

So is there a damage modification system I can use with his system, or could I receive some help making my own.

I'm aware that Damage modify systems go something like this:
1. Detect damage
2. See if the damage will kill the target unless the damage is blocked
3. If (2) is true, add a +max hp ability to prevent death
4. Set the damaged unit's hit points to the amount appropriate for the modified damage
5. If (3) occurred remove the + max hp ability

Either one would help me out.

Thanks ahead of time.
05-18-2008, 01:56 PM#2
grim001
Did you make it call the damage modify function from inside an onDamaged or onSpellDamaged method? Need a little more info on why it doesn't work.

I am probably going to make a damage modifying function soon so I'll post a link to it in this thread.
05-18-2008, 05:29 PM#3
Castlemaster
Here's what I did, I added the struct to OnDamaged and I have a function that records total damage taken, which works 100%.

In the method I added the line
Collapse JASS:
        call SetWidgetLife(.u,GetWidgetLife(.u)+dmg)
which would theoretically just restore life from damage taken. However it doesn't do anything, the unit takes damage as normal
05-18-2008, 06:06 PM#4
Captain Griffen
Triggers before the unit is damaged.
05-19-2008, 03:59 AM#5
Castlemaster
I assume I put the call ModifyDamage() into the damage detection struct right?
like so?
Collapse JASS:
 
struct TankPointsDDStruct extends DamageDetection
    method onDamage takes unit target, real dmg returns nothing
        call DamageModify(target,0)
    endmethod
        
    method onSpellDamage takes unit target, real damage returns nothing
        call DamageModify(target,0)
    endmethod
endstruct

thanks for the help
+rep
05-19-2008, 05:53 AM#6
grim001
Yes, that example would prevent that unit from dealing any damage, except that you got the function name wrong.

Consider this not the final version because it still has a very big limitation. Any damage inflicted to a unit within the same moment subsequently to the ModifyDamage command being used will be ignored.

I'll probably release the updated DamageDetection tomorrow, along with the final version of DamageMod.
05-19-2008, 08:34 AM#7
d07.RiV
is it all just to make sure the unit doesn't get killed by the damage? why cant u just heal the unit or make the actual attack deal 0 damage (by modifying armor type resistance)?
by the way unless i missed something the system has a major flaw - it will not record who killed the unit. its usually done by checking if the damage is enough for a kill, it will deal like 132423 chaos damage originating from the attacking unit.
05-19-2008, 01:13 PM#8
Castlemaster
There is a perfectly functional Blizz trigger to determine who killed a unit. Just make a trigger separate from the system that uses the Event: A unit dies, and refer to the killing unit as "killing unit" (make a GUI trigger and you can see). Or you can just figure out if dmg or damage is >= the current hp of the unit, it will be a killing blow. Both are plausible and easy to work with.
05-19-2008, 06:40 PM#9
d07.RiV
no lol read his system code. effectively the only "damage source" is the SetWidgetLife function which does NOT have any killing unit. yes, the way you specified would work but he does not do it in his system.
05-20-2008, 09:25 AM#10
d07.RiV
Um - I think the ONLY difference between this and traditional heal+damage trigger is that this one doesn't make the unit die if originally dealt damage was more than its maximum health.
05-20-2008, 02:44 PM#11
Vexorian
Yes, the ONLY difference is that this is a lot more robust, you are right.
05-20-2008, 03:16 PM#12
emjlr3
if something in your map can deal more damage then the max hp of a unit that should be able to negate any damage taken, something is wrong with it, or you care for menial details far too much

I can't say that makes it A LOT MORE ROBUST, just fixes the only problem that doesn't really matter
05-20-2008, 04:22 PM#13
Vexorian
A single map may not have a situation to allow this to happen, that's not a reason to think a map would have to be wrong to allow this to happen, there are always minor units, negative buffs, possitive buffs and workarounds that use large damage bonuses to ensure a unit is credited for a kill. It is not like this addition makes the trigger any more complicated anyway.
05-20-2008, 05:14 PM#14
d07.RiV
Quote:
It is not like this addition makes the trigger any more complicated anyway.
Isn't it the only reason for using health modification buff, the timer etc etc?
And - why would GetKillingUnit work? Unless its using some "bug" which might be changed in future.
05-20-2008, 09:25 PM#15
grim001
The advantages over just healing the unit before it takes damage:

1.) The most noticeable problem without this method is that if a unit is at max HP and gets hit, you can't heal it. So if you a unit is hit for 100 damage and you try to mitigate 50 of it, it will take 100 damage instead.

2.) The unit won't die if 1 hit was strong enough to take all of its health. Most map designs deal with small amounts of damage gradually inflicted over time, but in a more action-oriented map where some attacks are likely to one or two- shot players, this becomes extremely noticeable, if you want defensive buffs/skills to actually function correctly.

So decide for yourself whether those problems make it worthwhile for you to use one method over the other. I made this thing because those problems were potentially too noticeable in my game design.

About GetKillingUnit(): turns out that it only works in the specific situation I was testing it in (reducing a very high dmg attack to a lower damage). It also doesn't work properly if you are altering a low damage attack to a high one.

Fortunately I've found a workaround, the new version (updated in pastebin) includes the function GetKiller() which if used in place of GetKillingUnit() throughout a map will always return the correct killer.