• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Chance Spell Triggr Request

Status
Not open for further replies.
Hello guys, i want a GUI leak-free trigger that when a unit attacks he has a certain percentage chance that can create a dummy which will cast a spell on the attacked unit.

I'm noob at triggering but if this helps:
A unit attacks a unit
random number between 0 and 1
if (0<number<0.25) do
Create dummy at position of attacker and make it cast a certain spell on the attacked unit
Remove position leak

This is what i need, if possible, no damage detector no hard stuff, this simple trigger which i can change its variable and values like chance percentage and the spell casted by the dummy.

Please, if you can create this trigger, create it and post it here, this is more like a request ( don't tell me do that or land on the moon :p ).

Thanks.
 
Level 13
Joined
Jan 2, 2016
Messages
975
Yeah, that's indeed a request, and this belongs to the request section.
Anyways.. here's the trigger:
  • asd
    • Events
      • Unit - A unit Is attacked
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random integer number between 1 and 100) Less than or equal to 25
        • Then - Actions
          • Set TempPoint = (Position of (Attacking unit))
          • Unit - Create 1 Dummy for (Owner of (Attacking unit)) at TempPoint facing Default building facing degrees
          • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
          • Unit - Add Chain Lightning to (Last created unit)
          • Unit - Order (Last created unit) to Orc Far Seer - Chain Lightning (Attacked unit)
          • Custom script: call RemoveLocation(udg_TempPoint)
        • Else - Actions
It can be abused by spamming "stop" tho (since you don't want to use a DDS) :p

Set the conditions to the conditions you want.
 
Level 14
Joined
Nov 30, 2013
Messages
926
  • Attacked Unit
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Unit-type of (Attacking unit)) Equal to (What Unit)
    • Actions
      • Set Chance = (Random real number between 0.00 and 1.00)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Chance Less than or equal to 0.25
        • Then - Actions
          • Set TempPoint = (Position of (Attacked unit))
          • Unit - Create 1 (Dummy )for (Owner of (Attacking unit)) at TempPoint facing Default building facing degrees
          • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
          • Unit - Order (Last created unit) to (What Ability) (Attacked unit)
          • Custom script: call RemoveLocation(udg_TempPoint)
        • Else - Actions
Is this what you wanted?

EDITED
WereElf beats me in a blink of an eye. :p
 
Level 11
Joined
Jul 25, 2014
Messages
490
Well, triggering with the event "A unit is attacked" when having something automatically on attack and not really controlable, I can see how that is better.
However, if you want to give that ability to a unit you are controlling, it becomes abusable with "stop" command, so there's a downside to that as well.
The way to solve both problems is to use a DDS of course :p
 
Level 13
Joined
Jan 2, 2016
Messages
975
You could also use my "Attack is Launched" library (2-nd row in my signature). But it doesn't work flawlessly if your unit has its attack speed altered by items/abilities.
It's still kind a good enough if your unit doesn't get more than 20% attack speed boost/slow. :p
 
Status
Not open for further replies.
Top