• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Armor Damage Reduction

Status
Not open for further replies.
Level 8
Joined
Sep 23, 2007
Messages
357
Ive been trying to figure this out by changing variables in the Gameplay Constants but I cant seem to get it to work.

Im trying to make it so that, for every point of armor that a hero/unit has, the amount of damage reduced is 1%.

I really need this figured out. +rep, of course, to whoever helps.
 
Level 8
Joined
Sep 23, 2007
Messages
357
The system would detect when a unit takes damage, and right before the damage is applied, the unit's max hp is increased and then the life is set to a correct value.

Yeah, I do know JASS.

Right before the damage is applied the unit's max hp is increased? I didn't know you could even do that. Could you send me a link to a tutorial or something on this system?

And, about the JASS thing, you already helped me out in my other thread. Thank you :)
 
Level 17
Joined
Nov 13, 2006
Messages
1,814
Right before the damage is applied the unit's max hp is increased? I didn't know you could even do that. Could you send me a link to a tutorial or something on this system?

And, about the JASS thing, you already helped me out in my other thread. Thank you :)

after u try that gui damage detection system u also could do ur custom defence with indexer in gui dds.

i just give a example

JASS:
function Trig_Give_Defence_to_creeps_Conditions takes nothing returns boolean
    if ( not ( udg_UDexUnits[udg_UDex] != udg_Hero[GetConvertedPlayerId(GetOwningPlayer(udg_UDexUnits[udg_UDex]))] ) ) then
        return false
    endif
    return true
endfunction

function Trig_Give_Defence_to_creeps_Actions takes nothing returns nothing
    local unit u = udg_UDexUnits[udg_UDex]
    local location l = GetUnitLoc(u)
    set udg_Creep_X[udg_UDex] = GetLocationX(l) 
    set udg_Creep_Y[udg_UDex] = GetLocationY(l) 
    if ( IsUnitType(u, UNIT_TYPE_HERO) == true ) then
        set udg_Creep_Pdef[udg_UDex] = ( ( GetHeroLevel(u) * GetHeroLevel(u) ) * 4 )
        set udg_Creep_Mdef[udg_UDex] = ( ( GetHeroLevel(u) * GetHeroLevel(u) ) * 4 )
    else
        set udg_Creep_Pdef[udg_UDex] = ( ( GetUnitLevel(u) * GetUnitLevel(u) ) * (10 + GetRandomInt(1, 3) * 5) / 10 )
        set udg_Creep_Mdef[udg_UDex] = ( ( GetUnitLevel(u) * GetUnitLevel(u) ) * (10 + GetRandomInt(1, 3) * 5) / 10 )
    endif
    set u = null
    set l = null
endfunction

//===========================================================================
function InitTrig_Indexer_event takes nothing returns nothing
    set gg_trg_Indexer_event = CreateTrigger(  )
    call TriggerRegisterVariableEvent( gg_trg_Indexer_event, "udg_UnitIndexEvent", EQUAL, 1.00 )
    call TriggerAddCondition( gg_trg_Indexer_event, Condition( function Trig_Give_Defence_to_creeps_Conditions ) )
    call TriggerAddAction( gg_trg_Indexer_event, function Trig_Give_Defence_to_creeps_Actions )
endfunction

then in set damage trigger
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • DamageEventTarget Equal to Hero[*player number of ur hero*]
    • Then - Actions
      • Set DD_TargetLv = (Hero level of DamageEventTarget)
      • Set DD_Pdef = TotalPDef[*player number of ur hero*]
      • Set DD_Mdef = TotalMDef[*player number of ur hero*]
    • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (DamageEventTarget is A Hero) Equal to True
        • Then - Actions
          • Set DD_TargetLv = (Hero level of DamageEventTarget)
        • Else - Actions
          • Set DD_TargetLv = (Level of DamageEventTarget)
      • Set DD_Pdef = Creep_Pdef[(Custom value of DamageEventTarget)]
      • Set DD_Mdef = Creep_Mdef[(Custom value of DamageEventTarget)]
  • ......................................................
  • use a formule for damage reduction
  • ......................................................
  • Set DD_PhysicalRessistPercentage = ((Real(DD_Pdef)) / ((40.00 x (Real(DD_AttackerLv))) + ((Real(DD_Pdef)) + 25.00)))
  • Set DD_MagicRessistPercentage = ((Real(DD_Mdef)) / ((40.00 x (Real(DD_AttackerLv))) + ((Real(DD_Mdef)) + 25.00)))
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • DamageEventTarget Equal to Hero[TempNr]
    • Then - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DamageEventType Greater than 1
        • Then - Actions
          • Set TempReal = (DamageEventAmount x (1.00 - DD_MagicRessistPercentage))
        • Else - Actions
          • Set TempReal = (DamageEventAmount x (1.00 - DD_PhysicalRessistPercentage))
    • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DamageEventType Greater than 1
        • Then - Actions
          • Set TempReal = (DamageEventAmount x (1.00 - DD_MagicRessistPercentage))
        • Else - Actions
          • Set TempReal = (DamageEventAmount x (1.00 - DD_PhysicalRessistPercentage))
  • Set DamageEventAmount = TempReal
 
Status
Not open for further replies.
Top