Some On-Hit ability help

Status
Not open for further replies.
Level 1
Joined
Apr 25, 2023
Messages
5
So I'm trying to create a few custom abilities to splice up a campaign I'm working on. Theres a few different sorts.

Looking for effects that trigger every X number of attacks like every 4th auto attack will be a critical hit for such and such amount of damage. Or every 5th hit applies a bash effect.

Similarly i want to make an ability that is passive in practice but is activated on hit, such as a bleed effect or a heal ability triggers when the unit attacks but it has a cooldown so it only happens once every 8 seconds or something.

And finally making ability effects that stack has vexed me, trying to say get a stacking DoT going and I'm just not sure where to begin.
 
Level 25
Joined
Aug 29, 2012
Messages
1,100
This is assuming you use the latest version of the editor, which makes it much easier to do in GUI. There are millions of ways possible, that's an example of the every X attacks effect
  • Four Hits Crit
    • Events
      • Unit - A unit Takes damage
    • Conditions
      • (Unit-type of (Damage source)) Equal to Paladin
    • Actions
      • Set VariableSet Integer = (Integer + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Integer Equal to 4
        • Then - Actions
          • Event Response - Set Damage of Unit Damaged Event to ((Damage taken) x 2.00)
          • Set VariableSet Integer = 0
        • Else - Actions
Change the condition to fit what you need, and you can add a floating text and whatnot to simulate a crit effect number.

Here's for a passive heal with a cooldown, in two triggers

  • Heal Proc
    • Events
      • Unit - A unit Takes damage
    • Conditions
      • (Unit-type of (Damage source)) Equal to Paladin
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Boolean_OnCooldown Equal to False
        • Then - Actions
          • Unit - Set life of (Damage source) to ((Life of (Damage source)) + 100.00)
          • Set VariableSet Boolean_OnCooldown = True
          • Countdown Timer - Start Timer_Cooldown as a One-shot timer that will expire in 8.00 seconds
        • Else - Actions
  • Timer Reset
    • Events
      • Time - Timer_Cooldown expires
    • Conditions
    • Actions
      • Set VariableSet Boolean_OnCooldown = False
 
Level 1
Joined
Apr 25, 2023
Messages
5
This is assuming you use the latest version of the editor, which makes it much easier to do in GUI. There are millions of ways possible, that's an example of the every X attacks effect
  • Four Hits Crit
    • Events
      • Unit - A unit Takes damage
    • Conditions
      • (Unit-type of (Damage source)) Equal to Paladin
    • Actions
      • Set VariableSet Integer = (Integer + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Integer Equal to 4
        • Then - Actions
          • Event Response - Set Damage of Unit Damaged Event to ((Damage taken) x 2.00)
          • Set VariableSet Integer = 0
        • Else - Actions
Change the condition to fit what you need, and you can add a floating text and whatnot to simulate a crit effect number.

Here's for a passive heal with a cooldown, in two triggers

  • Heal Proc
    • Events
      • Unit - A unit Takes damage
    • Conditions
      • (Unit-type of (Damage source)) Equal to Paladin
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Boolean_OnCooldown Equal to False
        • Then - Actions
          • Unit - Set life of (Damage source) to ((Life of (Damage source)) + 100.00)
          • Set VariableSet Boolean_OnCooldown = True
          • Countdown Timer - Start Timer_Cooldown as a One-shot timer that will expire in 8.00 seconds
        • Else - Actions
  • Timer Reset
    • Events
      • Time - Timer_Cooldown expires
    • Conditions
    • Actions
      • Set VariableSet Boolean_OnCooldown = False
Thank you very much for your response this is a great help. I'm fairly new at this so apologize if this is a silly question but could these be tied to like physical hero abilities that can be leveled up and what not? Cause if I'm understanding correctly these trigger examples are specific to the unit selected.
 
In some of my "older" "complex" on-hit-effect, I store some data in a Hashtable (hit-count for damage-source).
In this example: every 4 hits, add some damage and do an AoE around the target. I have some custom scripts to do math easier (I kinda hate the GUI-way of doing math, arithmetic) and some other functions do use my "custom stats" that I use in my map (Spell Power).

This requires a created Hashtable setup beforehand and some temp-variables.

This uses Damage Engine 5.9.0.0 because that was the only way of detecting damage in GUI years ago. That's what DamageModifierEvent, DamageEventSource and so on is from.
  • PhoenixAxeOnHit
    • Events
      • Game - DamageModifierEvent becomes Equal to 2.00
    • Conditions
      • (DamageEventSource has an item of type Phoenix Axe) Equal to True
      • IsDamageAttack Equal to True
      • (DamageEventSource is an illusion) Equal to False
    • Actions
      • Custom script: set udg_temp_integer1 = GetHandleId(udg_DamageEventSource)
      • Set Variable Set temp_integer2 = (Load (Key phoenixaxe.) of temp_integer1 from item_hash.)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • temp_integer2 Greater than or equal to 4
        • Then - Actions
          • -------- Reset attack counter --------
          • Hashtable - Save 0 as (Key phoenixaxe.) of temp_integer1 in item_hash .
          • -------- Bonus Damage --------
          • Custom script: set udg_temp_real2 = 50 + 1.00 * GetSpellPower(udg_DamageEventSource)
          • Custom script: set udg_DamageEventAmount = udg_DamageEventAmount + udg_temp_real2
          • -------- FireStrike --------
          • Custom script: set udg_temp_real1 = udg_temp_real2 + 0.5 * udg_DamageEventPrevAmt
          • Set Variable Set temp_move_point1 = (Position of DamageEventTarget)
          • Special Effect - Create a special effect at temp_move_point1 using Items\Abilities\Pillar of Flame Orange.mdx
          • Special Effect - Destroy (Last created special effect)
          • Set Variable Set temp_unit_group = (Units within 200.00 of temp_move_point1.)
          • Custom script: call RemoveLocation(udg_temp_move_point1)
          • Unit Group - Pick every unit in temp_unit_group and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Picked unit) belongs to an enemy of (Owner of DamageEventSource).) Equal to True
                  • ((Picked unit) is selectable) Equal to True
                  • (Picked unit) Not equal to DamageEventTarget
                • Then - Actions
                  • Unit - Cause DamageEventSource to damage (Picked unit) , dealing temp_real1 damage of attack type Spells and damage type Fire
                • Else - Actions
          • Custom script: call DestroyGroup (udg_temp_unit_group)
        • Else - Actions
          • Hashtable - Save (temp_integer2 + 1) as (Key phoenixaxe.) of temp_integer1 in item_hash .
 
Level 25
Joined
Aug 29, 2012
Messages
1,100
Thank you very much for your response this is a great help. I'm fairly new at this so apologize if this is a silly question but could these be tied to like physical hero abilities that can be leveled up and what not? Cause if I'm understanding correctly these trigger examples are specific to the unit selected.
Yes that paladin thing was just an example, you need something to specify that the trigger will not fire every time one unit takes damage otherwise it would be happening everywhere :D You can add a condition that checks whether the damage source has a specific ability for instance. The only limiting factor is that with this "unit takes damage event", it will apply to all sources of damage (auto attacks or offensive spells)
 
Level 1
Joined
Apr 25, 2023
Messages
5
Yes that paladin thing was just an example, you need something to specify that the trigger will not fire every time one unit takes damage otherwise it would be happening everywhere :D You can add a condition that checks whether the damage source has a specific ability for instance. The only limiting factor is that with this "unit takes damage event", it will apply to all sources of damage (auto attacks or offensive spells)
Thank you. Much appreciated.
 
Status
Not open for further replies.
Top