• 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.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

Making a spell that does random amount of damage depending on the level

Level 6
Joined
Mar 17, 2015
Messages
59
Hi, I am working on a hero map, and I want to include a gambler hero who has a bunch of weird spells
One of them being a spell I call Bolt of Randomness
This spell is a spell based on storm bolt but with no stun, it will do 1 - 200 damage in the first level, the amount of damage is random
at the second level it needs to be 100 to 400 damage and in the 3rd level it will be 200 to 600 damage
How do I do this with triggers?
 
Hello, so starting from patch 1.31 (pre-Reforged) we've been able to modify Object Editor ability fields from within the Trigger Editor. That means we can modify the effects of an Ability at runtime and use all sorts of custom Trigger logic to expand on what's normally possible.

Here's an example on how to modify the damage of Storm Bolt using your random values:
  • SB Cast
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Storm Bolt (Mountain King)
    • Actions
      • -------- Define the Damage per Level: --------
      • -------- Level 1: --------
      • Set VariableSet SB_Damage_Min[1] = 1.00
      • Set VariableSet SB_Damage_Max[1] = 200.00
      • -------- --------
      • -------- Level 2: --------
      • Set VariableSet SB_Damage_Min[2] = 100.00
      • Set VariableSet SB_Damage_Max[2] = 400.00
      • -------- --------
      • -------- Level 3: --------
      • Set VariableSet SB_Damage_Min[3] = 200.00
      • Set VariableSet SB_Damage_Max[3] = 600.00
      • -------- --------
      • -------- Calculate a random Damage value between the Min and Max range: --------
      • Set VariableSet SB_Level = (Level of (Ability being cast) for (Triggering unit))
      • Set VariableSet SB_Damage_Dealt = (Random real number between SB_Damage_Min[SB_Level] and SB_Damage_Max[SB_Level])
      • -------- --------
      • -------- Apply this to Storm Bolt: --------
      • Set VariableSet SB_Level = (SB_Level - 1)
      • Ability - Set Ability: (Unit: (Triggering unit)'s Ability with Ability Code: (Ability being cast))'s Real Level Field: Damage ('Htb1') of Level: SB_Level to SB_Damage_Dealt
Notes:
1. I'm using Real (array) variables to track the damage ranges.
The [index] of the Array represents the Ability Level in this case. Often times you would do this in a "Setup" or "Configure" trigger that runs only once.

2. The Action for modifying an Ability uses 0-based indexing for it's Level value. So 0 = 1, 1 = 2, 2 = 3, etc.
That's why I subtract 1 from the SB_Level variable prior to using it in that Action.

3. Afaik, there is no Missile ability that only deals damage and nothing else. I'm using Storm Bolt which will Stun, even if the Duration is set to an extremely small value. Setting the Duration to 0.00 will make the Buff last forever.

4. Maybe Acid Bomb can work by setting it's Area of Effect to 0.00 and applying a single instance of Primary Damage. You would have to adjust the "Set Ability" action to reference Acid Bomb's damage field instead. Look into tutorials on this Action + how to use Rawcodes if you're confused.

5. If you want a Missile with mechanics that you have full control over, you'll have to rely on something completely custom like this:
 

Attachments

Last edited:
Hello, so starting from patch 1.31 (pre-Reforged) we've been able to modify Object Editor ability fields from within the Trigger Editor. That means we can modify the effects of an Ability at runtime and use all sorts of custom Trigger logic to expand on what's normally possible.

Here's an example of how to modify the damage of Storm Bolt to use your random values:
  • SB Cast
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Storm Bolt (Mountain King)
    • Actions
      • -------- Define the Damage per Level: --------
      • -------- Level 1: --------
      • Set VariableSet SB_Damage_Min[1] = 1.00
      • Set VariableSet SB_Damage_Max[1] = 200.00
      • -------- --------
      • -------- Level 2: --------
      • Set VariableSet SB_Damage_Min[2] = 100.00
      • Set VariableSet SB_Damage_Max[2] = 400.00
      • -------- --------
      • -------- Level 3: --------
      • Set VariableSet SB_Damage_Min[3] = 200.00
      • Set VariableSet SB_Damage_Max[3] = 600.00
      • -------- --------
      • -------- Calculate a random Damage value between the Min and Max range: --------
      • Set VariableSet SB_Level = (Level of (Ability being cast) for (Triggering unit))
      • Set VariableSet SB_Damage_Dealt = (Random real number between SB_Damage_Min[SB_Level] and SB_Damage_Max[SB_Level])
      • -------- --------
      • -------- Apply this to Storm Bolt: --------
      • Set VariableSet SB_Level = (SB_Level - 1)
      • Ability - Set Ability: (Unit: (Triggering unit)'s Ability with Ability Code: (Ability being cast))'s Real Level Field: Damage ('Htb1') of Level: SB_Level to SB_Damage_Dealt
Notes:
1. I'm using Real (array) variables to track the damage ranges.
The [index] of the Array represents the Ability Level in this case.

2. The Action for modifying an Ability uses 0-based indexing for it's Level value. So 0 = 1, 1 = 2, 2 = 3, etc.
That's why I subtract 1 from the SB_Level variable prior to using it in that Action.

3. Afaik, there is no Missile ability that only deals damage and nothing else. I'm using Storm Bolt which will Stun, even if the Duration is set to an extremely small value. Setting the Duration to 0.00 will make the Buff last forever.

4. Maybe Acid Bomb can work by setting it's Area of Effect to 0.00 and applying a single instance of Primary Damage. You would have to adjust the "Set Ability" action to reference Acid Bomb's damage field instead. Look into tutorials on this Action + how to use Rawcodes if you're confused.

5. If you want a Missile with mechanics that you have full control over, you'll have to rely on something completely custom like this:
Thank you so much! This works :D
 
Back
Top