• 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.

How to make a global vamp?

Status
Not open for further replies.
Hey guys, id like to ask if anyone knows how to make a Vamp spell/aura/item that heals the person for... i dunno lets say 20% of all damage dealt, by all damage I mean autoattack, Spell, thorns / spiked cars, overtime poison, channel abilities (example bladestorm), crits, bash etc. Simply said, ALL damage dealt.
(in case this requires a damage system like damage engine etc, that's fine)

thanks in advance lads :goblin_good_job:
 
Level 15
Joined
Feb 7, 2020
Messages
398
I would recommend a damage system such as Damage Engine 5.5.0.0 to have complete control.

The trigger would be quite easy to make, too. It would look something like this, with your added effects:

  • Untitled Trigger 001
    • Events
      • Game - DamageEvent becomes Equal to 1.00
    • Conditions
      • (Unit-type of DamageEventSource) Equal to Dreadlord
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • IsDamageSpell Equal to True
        • Then - Actions
          • Unit - Set life of DamageEventSource to ((Life of DamageEventSource) + (DamageEventAmount x 0.50))
        • Else - Actions
          • Unit - Set life of DamageEventSource to ((Life of DamageEventSource) + (DamageEventAmount x 0.25))
Basic GUI variable overview:
DamageEventTarget = damaged unit.
DamageEventSource = unit that dealt damage.
DamageEventAmount = damage that was dealt by DamageEventSource.
DamageEvent = check for this being the real value set to 1.0 to run a trigger on damage.

DamageModifierEvent = allows the manipulation of the damage that will be dealt when checking for it being set to 1.0; same above variables apply, but changing DamageEventAmount after referencing this variable means it changes the damage before it happens.

Read the ReadMe in the map for more info.
 
Last edited:
Level 21
Joined
May 16, 2012
Messages
644
Hey guys, id like to ask if anyone knows how to make a Vamp spell/aura/item that heals the person for... i dunno lets say 20% of all damage dealt, by all damage I mean autoattack, Spell, thorns / spiked cars, overtime poison, channel abilities (example bladestorm), crits, bash etc. Simply said, ALL damage dealt.
(in case this requires a damage system like damage engine etc, that's fine)

thanks in advance lads :goblin_good_job:

Do you have a UnitIndexer in your map?

if you do, then my solution is more generalized and simpler to apply to multiple units and scale and do not require any Damage System.

First, the requirements:
1 - Any UnitIndexer in your map or else this will not work
2 - Create a real array variable called Vamp, exactly like that, must be real, must be an array and must be called Vamp

Simply create a trigger in your map called Vampirism and convert it to custom text (select the newly created trigger then in the Edit menu click Conver to Custom Text), then delete all text in it. After that, paste the following code there:

JASS:
library Vampirism

private struct Vamp
    static method OnDamage takes nothing returns nothing
        local unit    src = GetEventDamageSource()
        //-------------------------------------------------
        local integer idx = GetUnitUserData(src)
        //-------------------------------------------------
        local real    dmg = GetEventDamage()
        //-------------------------------------------------

        if dmg > 0 and udg_Vamp[idx] > 0 then
            set dmg = dmg*udg_Vamp[idx]
            call SetWidgetLife(src, GetWidgetLife(src) + dmg)
        endif

        set src = null
    endmethod

    static method onInit takes nothing returns nothing
        local trigger t = CreateTrigger()

        call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_DAMAGED)
        call TriggerAddCondition(t, Condition(function thistype.OnDamage))
    endmethod
endstruct

endlibrary

Well, how to use it? How to add, subtract or set vamp for any unit? Easy now, simply do:

  • Set VariableSet index = (Custom value of (YourUnit))
  • Set VariableSet Vamp[index] = (Vamp[index] + 0.20)
the line above just added 20% vamp to the unit chosen. The index variable is an Integer and the Custom Value of (YourUnit) represents the value given to a unit by the UnitIndexer. YourUnit could be TriggeringUnit, PickedUnit, etc depending on the usage. Note that the value is decimal, so 1 represents 100%, 2 -> 200%, 0.23 -> 23%...

Since you didn't specified if it should only work against enemy units or if it should allow negative vamp i assumed the most general, so if the unit has vamp greater than 0 and the damage it deal is also greater than 0 than it will heal, that includes damage dealt to allies and even to yourself. You also didn't specified if you wanted to create a special effect on the unit, so i left it with none. Modifying any unit Vamp amount is piece of cake this way.

To Add:

  • Set VariableSet index = (Custom value of (YourUnit))
  • Set VariableSet Vamp[index] = (Vamp[index] + Value)
To Subtract:

  • Set VariableSet index = (Custom value of (YourUnit))
  • Set VariableSet Vamp[index] = (Vamp[index] - Value)
To Set:

  • Set VariableSet index = (Custom value of (YourUnit))
  • Set VariableSet Vamp[index] = Value
 
Last edited:
I would recommend a damage system such as Damage Engine 5.5.0.0 to have complete control.

The trigger would be quite easy to make, too. It would look something like this, with your added effects:

  • Untitled Trigger 001
    • Events
      • Game - DamageEvent becomes Equal to 1.00
    • Conditions
      • (Unit-type of DamageEventSource) Equal to Dreadlord
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • IsDamageSpell Equal to True
        • Then - Actions
          • Unit - Set life of DamageEventSource to ((Life of DamageEventSource) + (DamageEventAmount x 0.50))
        • Else - Actions
          • Unit - Set life of DamageEventSource to ((Life of DamageEventSource) + (DamageEventAmount x 0.25))
Basic GUI variable overview:
DamageEventTarget = damaged unit
DamageEventSource = unit that dealt damage
DamageEventAmount = damage that was dealt by DamageEventSource
DamageEvent = check for this being the real value set to 1.0 to run a trigger on damage

Read the ReadMe in the map for more info.

if I understand that trigger correctly, if the damage is SPELL damage, it spellvamps for 50% and if its not then it spellvamps for 25% right??
so if I want ALL of the things to vamp for... idk 20% then I dont need the IF THEN ELSE just 1 action
Unit - Set life of DamageEventSource to ((Life of DamageEventSource) + (DamageEventAmount x 0.20))

right?
 
Level 15
Joined
Feb 7, 2020
Messages
398
if I understand that trigger correctly, if the damage is SPELL damage, it spellvamps for 50% and if its not then it spellvamps for 25% right??
so if I want ALL of the things to vamp for... idk 20% then I dont need the IF THEN ELSE just 1 action
Unit - Set life of DamageEventSource to ((Life of DamageEventSource) + (DamageEventAmount x 0.20))

right?
Exactly right. My conditions were just to show the different effects you can integrate. They are definitely not necessary.
 
Status
Not open for further replies.
Top