undead damage

Kyux

Active Member
Reaction score
3
Hey, i want my dude to do extra damage to undead, but regular damage to anything else. i also dont want it to be a spell, and if so, i dont miind if its from a weapon.

thanks!
 

Naga'sShadow

Ultra Cool Member
Reaction score
49
Reminds me of an item I made a while ago. It was an orb of lightning with the purge spell changed to a holy light spell. So it had a percent chance of casting holy light on the attacked unit. Holy light fails on enemy living units but would hit undead units for extra damage.
 

Cold

New Member
Reaction score
4
Something like

Code:
Trigger 1

Event - A unit is attacked

Condition - 
Attacking unit equal to (Your hero)
Attacked unit is undead equal to true

Actions - 
Set variable - UndeadUnit equal to attacked unit
Add event to (Trigger 2) UndeadUnit takes damage

Code:
Trigger 2

Events -

Conditions -

Events - 

Deal damage to UndeadUnit equal to X
 

Kyux

Active Member
Reaction score
3
thanks

hey, thanks a bunch, but, i want it to be a %. like, 300% to undead, so it works no matter what lvl the hero is.

and Naga'sshadow, how did you do that?, i'll just change the % to 100
 

Happy

Well-Known Member
Reaction score
71
why you dont just make X = (your pencent as real number for example 2.75 instead of 275%) multiplied by the dmg of your hero ?

that should work....
 

Summoned

New Member
Reaction score
51
Elaborating on Cold's idea, since it's pretty much exactly what you want, you just don't know it yet. :p You'll need to make 2 triggers.

Name the first trigger UndeadDamageInit (the name must be exact, with no spaces), convert to custom text (in the Edit option at the toolbar), check the Run On Map Initialization near the top of the window, and delete the code. Then copy/paste everything here inside:
JASS:
function Undead_Check takes nothing returns boolean
    if IsUnitType(GetTriggerUnit(), UNIT_TYPE_UNDEAD) then
        call TriggerRegisterUnitEvent(gg_trg_UndeadDamageBonus, GetTriggerUnit(), EVENT_UNIT_DAMAGED)
    endif
    return false
endfunction


function Undead_Check2 takes nothing returns boolean
    if IsUnitType(GetFilterUnit(), UNIT_TYPE_UNDEAD) then
        call TriggerRegisterUnitEvent(gg_trg_UndeadDamageBonus, GetFilterUnit(), EVENT_UNIT_DAMAGED)
    endif
    return false
endfunction


function Trig_UndeadDamageInit_Actions takes nothing returns nothing
    local group g = CreateGroup()
    local trigger addnewcomers = CreateTrigger()
    local region R = CreateRegion()
    
    call RegionAddRect(R, bj_mapInitialPlayableArea)
    call TriggerRegisterEnterRegion(addnewcomers, R, Condition(function Undead_Check))
    
    call GroupEnumUnitsInRect(g, bj_mapInitialPlayableArea, Condition(function Undead_Check2))
    call DestroyGroup(g)
    set g = null
    set addnewcomers = null
endfunction


function InitTrig_UndeadDamageInit takes nothing returns nothing
    set gg_trg_UndeadDamageInit = CreateTrigger()
    call TriggerAddAction(gg_trg_UndeadDamageInit, function Trig_UndeadDamageInit_Actions)
endfunction

Note: I did that in JASS because it would take 2 triggers in GUI and if done in GUI it uses a null boolean expression filter, which I've heard is bad. :p

The second trigger should be named UndeadDamageBonus (again, exact name), which looks like the following EXCEPT you should change the conditions:
Trigger:
  • UndeadDamageBonus
    • Events
    • Conditions
      • (Unit-type of (Damage source)) Equal to Paladin <--- use this condition for specific unit
      • ((Damage source) has an item of type Crown of Kings +5) Equal to True <--- use this condition for items
      • (Level of Holy Light for (Damage source)) Greater than 0 <--- use this condition for ability-based
    • Actions
      • Trigger - Turn off (This trigger)
      • Unit - Cause (Damage source) to damage (Triggering unit), dealing ((Damage taken) x 2.00) damage of attack type Chaos and damage type Universal
      • --------- ^ Change the 2.00 to whatever number you want ---------
      • --------- 2.00 means 200% extra damage ---------
      • Trigger - Turn on (This trigger)
 

Sunchips

New Member
Reaction score
6
use the last one since you need to detect if it's damaged and not just attacked because otherwise you could hack it by spamattackins and pressing S between =)
 

Kyux

Active Member
Reaction score
3
thanks, but how?

tyvm all for the help. just one thing... you said to delete the code and stuff when you were talking about the Jass. everything in that sentence i dont get.... could you explain it? thanks!
 

Summoned

New Member
Reaction score
51
Edit: Changed the JASS code a little bit. Should do the exact same thing, just a bit shorter.

Make the UndeadDamageInit trigger.
Trigger:
  • UndeadDamageInit
    • Events
    • Conditions
    • Actions

Click Edit, then Convert to Custom Text.
JASS:
function Trig_UndeadDamageInit_Actions takes nothing returns nothing
endfunction

//===========================================================================
function InitTrig_UndeadDamageInit takes nothing returns nothing
    set gg_trg_UndeadDamageInit = CreateTrigger(  )
    call TriggerAddAction( gg_trg_UndeadDamageInit, function Trig_UndeadDamageInit_Actions )
endfunction

Delete everything you see there. Check "Run on Map Initialization" at the top of the trigger window.

Copy/paste the jass code.

attachment.php
 

Summoned

New Member
Reaction score
51
JASS:
function Undead_Check takes nothing returns boolean
    if IsUnitType(GetTriggerUnit(), UNIT_TYPE_UNDEAD) then
        call TriggerRegisterUnitEvent(gg_trg_UndeadDamageBonus, GetTriggerUnit(), EVENT_UNIT_DAMAGED)
    endif
    return false
endfunction


function Undead_Check2 takes nothing returns boolean
    if IsUnitType(GetFilterUnit(), UNIT_TYPE_UNDEAD) then
        call TriggerRegisterUnitEvent(gg_trg_UndeadDamageBonus, GetFilterUnit(), EVENT_UNIT_DAMAGED)
    endif
    return false
endfunction


function Trig_UndeadDamageInit_Actions takes nothing returns nothing
    local group g = CreateGroup()
    local trigger addnewcomers = CreateTrigger()
    local region R = CreateRegion()
    
    call RegionAddRect(R, bj_mapInitialPlayableArea)
    call TriggerRegisterEnterRegion(addnewcomers, R, Condition(function Undead_Check))
    
    call GroupEnumUnitsInRect(g, bj_mapInitialPlayableArea, Condition(function Undead_Check2))
    call DestroyGroup(g)
    set g = null
    set addnewcomers = null
endfunction


function InitTrig_UndeadDamageInit takes nothing returns nothing
    set gg_trg_UndeadDamageInit = CreateTrigger()
    call TriggerAddAction(gg_trg_UndeadDamageInit, function Trig_UndeadDamageInit_Actions)
endfunction

is not the same as
JASS:
function Trig_UndeadDamageInit_Actions takes nothing returns nothing
endfunction

//===========================================================================
function InitTrig_UndeadDamageInit takes nothing returns nothing
    set gg_trg_UndeadDamageInit = CreateTrigger(  )
    call TriggerAddAction( gg_trg_UndeadDamageInit, function Trig_UndeadDamageInit_Actions )
endfunction

I guess that might have been confusing?
 

Kyux

Active Member
Reaction score
3
ok, im going to try it now.... but why wrte the first Jass if your just deleting it?

sorry....
 

Summoned

New Member
Reaction score
51
ok, im going to try it now.... but why wrte the first Jass if your just deleting it?

sorry....
Um...
JASS:
function Trig_UndeadDamageInit_Actions takes nothing returns nothing
endfunction

//===========================================================================
function InitTrig_UndeadDamageInit takes nothing returns nothing
    set gg_trg_UndeadDamageInit = CreateTrigger(  )
    call TriggerAddAction( gg_trg_UndeadDamageInit, function Trig_UndeadDamageInit_Actions )
endfunction

^ is an empty trigger. Which does absolutely nothing.
 

Kyux

Active Member
Reaction score
3
ahhk i see tyvm

ok im trying the trigger now, from your first post, im trying to do the item Compaision, where do i find it?
and the action too.

thanks
 

Summoned

New Member
Reaction score
51
The item condition is: Boolean Comparison -> Hero - Has Item, or something.

Actions are: Trigger - Turn Off, Unit - Damage Target, then Trigger - Turn On
 

Narks

Vastly intelligent whale-like being from the stars
Reaction score
90
Critical Strike, make it only apply to Undead units


maybe you can hax Demolish / Bash / some passives to do the same so you dont get ugly red text, but i know for a fact critical strike works
 

Kyux

Active Member
Reaction score
3
thanks both summoned and Narks, tyvm for your help, i have it sorted now!

ok, summoned, i tried it, got it all, but i got the action, where it says "damage taken" i couldn't get the x2.0, just damage taken (btw, it was Event response - Damage Taken)
 

Summoned

New Member
Reaction score
51
Use the "arithmetic" function whenever you need to do addition/subtraction/multiplication/division.
 

Kyux

Active Member
Reaction score
3
thanks, i'll give it a shot!

right, all i got was when your action said ((Damage taken) is[or w/e it was] 3.0) i got 1.00 x 3.00 nothing else, no damage taken or w/e. that was using arithmetic
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top