Chance when attacked trigger.

Nappe

New Member
Reaction score
5
I was wondering how to trigger a passive ability that would have a % chance to stun the enemies attacking hero. Need some help with this.
 

dragonhord

Knowledge is true opinion. - Plato
Reaction score
82
Code:
Skill
    Events
        Unit - A unit Is attacked
    Conditions
        (Level of Skill  for (Triggering unit)) Greater than 0
        (Random integer number between 1 and 100) Less than or equal to 10
    Actions
        Set Point = (Position of (Triggering unit))
        Unit - Create 1 Dummy Unit for (Owner of (Triggering unit)) at Point facing Default building facing (270.0) degrees
        Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
        Unit - Add Storm Bolt Dummy  to (Last created unit)
        Unit - Set level of Storm Bolt Dummy for (Last created unit) to (Level of Skill  for (Triggering unit))
        Unit - Order (Last created unit) to Human Mountain King - Storm Bolt (Attacking unit)
        Custom script: call RemoveLocation (udg_Point)
Make sure that the storm bolt doesnt have any mana cost... and you have to make a dummy unit that has no model file... Which would be a Zone Indicator XD... If you dont understand I will elaborate further :p The less than or equal to 10 gives it a 10% chance on attack... If you want it less or more adjust the 10 accordingly.
 

Nappe

New Member
Reaction score
5
Code:
Skill
    Events
        Unit - A unit Is attacked
    Conditions
        (Level of Skill  for (Triggering unit)) Greater than 0
        (Random integer number between 1 and 100) Less than or equal to 10
    Actions
        Set Point = (Position of (Triggering unit))
        Unit - Create 1 Dummy Unit for (Owner of (Triggering unit)) at Point facing Default building facing (270.0) degrees
        Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
        Unit - Add Storm Bolt Dummy  to (Last created unit)
        Unit - Set level of Storm Bolt Dummy for (Last created unit) to (Level of Skill  for (Triggering unit))
        Unit - Order (Last created unit) to Human Mountain King - Storm Bolt (Attacking unit)
        Custom script: call RemoveLocation (udg_Point)
Make sure that the storm bolt doesnt have any mana cost... and you have to make a dummy unit that has no model file... Which would be a Zone Indicator XD... If you dont understand I will elaborate further :p The less than or equal to 10 gives it a 10% chance on attack... If you want it less or more adjust the 10 accordingly.

Okies, I quess that will pretty well, thanks alot :) But I'm still a noob when it comes to triggering, and I'm not exactly sure how to make the chance to trigger go up as it is leveled?
 

Alphabet

New Member
Reaction score
12
You could create some simple algorithm and change the last number in the second condition to the algorithm. Eg. if you'd like the chances to be 10 % at level 1, 15 % at level 2, and 20 % at level 3, you'd make the line like this:
Code:
(Random integer number between 1 and 100) Less than or equal to (Level of Skill for (((Triggering Unit)) * 5) + 5)
If can't come up with an algorithm, you could use ifs (one for each level).
 

Nappe

New Member
Reaction score
5
I'm sorry for bothering you again, but I can't manage to get it work. Could anyone create the trigger in a map and attach it here, so I could try to copy it from there. I'm pretty lost at this moment. Thanks in advance.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top