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

[Trigger] Earn gold on crit strike

Status
Not open for further replies.
Level 7
Joined
Aug 5, 2010
Messages
147
Im trying to make it so when a unit critically strikes the owner of the unit gets 20 gold.

Here is the trigger i created

  • Crit Gold
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Critical Strike [Marine Sniper]
    • Actions
      • Player - Add 20 to (Owner of (Casting unit)) Current gold
      • Floating Text - Create floating text that reads +20 Gold at (Position of (Casting unit)) with Z offset 0.00, using font size 8.00, color (100.00%, 100.00%, 0.00%), and 0.00% transparency
      • Floating Text - Change (Last created floating text): Disable permanence
      • Floating Text - Change the lifespan of (Last created floating text) to 2.00 seconds
      • Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds
      • Floating Text - Set the velocity of (Last created floating text) to 100.00 towards 0.00 degrees
The trigger doesn't work, and since i dont know what events or conditions to use in the case of passive ability's i cant correct the trigger.

Ive also used 'Unit - A unit Finishes casting an ability' in the trigger but it didnt work.
 
Level 15
Joined
Oct 29, 2012
Messages
1,474
The best solution so far to think of it , is to trigger the whole critical strike.

First of all , create a passive ability and name it Critical Strike Marine Sniper, add to it a buff named 'Critical Strike Sniper'

Ok , here comes the trigger:

  • Critical Strike
  • Events
    • Unit - A Unit is attacked
  • Conditions
    • ((Attacking Unit) has a buff of Critical Strike Sniper) Equal To True
  • Actions
    • Set Striker = (Attacking Unit)
    • Set Striked = (Attacked Unit)
    • Set Chance_to_cric = 15 (percentage)
    • Set Chance_Generated = (Integer Random from 0 to 100)
    • If/Then/Else multiple actions
      • Conditions
        • 'Chance_Generated' Less or Equal to 'Chance_to_cric'
      • Then - Actions
        • Unit - Damage Unit... (You may use damage detection to cause the same damage type as attacked-used damage too, otherwise the damage will be your choice)
        • ======= Add your Floating Texts Here =======
      • Else - Actions
    • Set Striker = Null
    • Set Striked = Null
This is basically how a critical strike works :D

That's all I think about :) Good luck
 
@jon You don't have to store percentage chance and randomInt(0, 100) into a variable. Just reference them directly, they are only used once anyways. Only store into variables if you do them twice or more.

Don't use a unit is attacked.
this. Though Unit Is Attacked is okay for some sort of custom ability, Critical Strike and On-Hit (notice, on-hit) effects should use a DDS.

(And if you use a DDS already it is even easier to do so over Attack Event)
 
Level 6
Joined
Jan 4, 2014
Messages
227
use Physical Damage Detection for GUI v1.2.0.1 Thats fairly better, it will take you only half an hour to emplement and understand + you will need it for many thing like damage amplification or reduction from spells or physical attacks, this system is the best and very useful, when you implement it in your map tell me to show how to trigger it :)
 
Status
Not open for further replies.
Top