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

[Solved] Passive Dummy

Status
Not open for further replies.
Level 1
Joined
Jun 9, 2013
Messages
2
Need help. I have unit with passive ability. Critical hit. With no damage. What i want. Ability has 10% chanse to steal money from enemy unit(20gold) with each strike. I dont know how to realise it because its passive. (Not needs to steal money from player, just add 20 gold to player) Thanks.
 
Level 28
Joined
Sep 26, 2009
Messages
2,520
There is an easy way to do this:
  • Gold Steal
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Unit-type of (Attacking unit)) Equal to YOUR_STEALING_UNIT
      • (Level of YOUR_ABILITY for (Attacking unit)) Greater than 0
      • ((Owner of (Attacked unit)) Current gold) Greater than 0
    • Actions
      • -------- This sets random number between 1-100 and then checks what number it is --------
      • -------- --- "Chance" is Integer variable --------
      • Set Chance = (Random integer number between 1 and 100)
      • -------- ------------------------------------------------------------ --------
      • -------- If chance is less or equal to 10, then it will pass as proc (i.e. you get 10% chance) --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Chance Less than or equal to 10
        • Then - Actions
          • -------- This sets the amount your unit steals. It will be at least 20 gold or less if attacked player doesn't have enough gold --------
          • -------- --- "StolenAmount" is Integer variable --------
          • Set StolenAmount = (Min(20, ((Owner of (Attacked unit)) Current gold)))
          • -------- ------------------------------------------------------------ --------
          • -------- Adds gold to owner attacker --------
          • Player - Add StolenAmount to (Owner of (Attacking unit)) Current gold
          • -------- ------------------------------------------------------------ --------
          • -------- Reduces gold of the victim player --------
          • Player - Add (-1 x StolenAmount) to (Owner of (Attacked unit)) Current gold
        • Else - Actions
The bad thing about this is that this spell may fire even when your stealing unit misses an attack. If you want this spell to trigger only when your unit deals damage, you will most likely need damage detection system

If you do it like in my trigger, make sure you set "Attacked unit" and "Attacking unit" correctly
 
Status
Not open for further replies.
Top