• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] Problem in autocasting

Status
Not open for further replies.
Hi, I have made a trigger which make the ability "Chain Lightning" auto cast on a tower.
The spell has a 30% chance on every attack to cast the Chain Lightning.
I am using a dummy unit.
The problem is that players can make it a bug, using the hotkey "h" or "s" and then attack.
The trigger will work every time that the player uses the hotkey "h".
I wanted to fix this problem.
I am using this event:
  • Events
  • Unit - A unit is attacked
Sorry for bad English.
 
Level 25
Joined
Sep 26, 2009
Messages
2,377
I am using dummy unit, the dummy unit casts the chain lightning.
cooldown wont work... becuase this is based on a chance.
with every 30% chance it will make another dummy unit.
I meant that when this effect procs, you switch off that trigger and switch it back on after 1 seconds. Since the trigger is off for the second, it will not check the chance, nor if a unit is attacked, thus creating an internal cooldown.
 
Level 20
Joined
Aug 13, 2013
Messages
1,696
I meant that when this effect procs, you switch off that trigger and switch it back on after 1 seconds. Since the trigger is off for the second, it will not check the chance, nor if a unit is attacked, thus creating an internal cooldown.

In that way is inefficient.


The question he saids that it must be not abusable because he is using the event - Unit is attacked and it has a chance to release the effect of the cast. The best way to be not abusable when attacked is this like my triggers and this will not be abusable because it only executing when the - UNIT TAKES DAMAGE:

  • GryphonTakeDamageInit
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Set GryphonGroup = (Units in (Playable map area))
      • Unit Group - Pick every unit in GryphonGroup and do (Actions)
        • Loop - Actions
          • Unit Group - Add (Picked unit) to GryphonDamGroup
          • Trigger - Add to GryphonTakeDamage <gen> the event (Unit - (Picked unit) Takes damage)
      • Custom script: call DestroyGroup( udg_FrozenGroup )
  • GryphonTakeDamageDetector
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
      • ((Triggering unit) is in GryphonDamGroup) Equal to False
    • Actions
      • Unit Group - Add (Triggering unit) to GryphonDamGroup
      • Trigger - Add to GryphonTakeDamage <gen> the event (Unit - (Triggering unit) Takes damage)
  • GryphonTakeDamage
    • Events
    • Conditions
    • Actions
      • Trigger - Turn off (This trigger)
      • -------- ---------------------- --------
      • Set GryphonUnit = (Triggering unit)
      • Set GryphonUnit2 = (Damage source)
      • -------- Impetus --------
      • Set GryphonInt = (Level of |cff0080ffGryphon Lightning|r for GryphonUnit2)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • GryphonInt Greater than 0
          • (Random real number between 0.00 and 1.00) Less than or equal to 0.35
        • Then - Actions
          • Set GryphonLoc = (Position of GryphonUnit2)
          • Unit - Create 1 Gryphon Lightning Dummy for (Owner of GryphonUnit2) at GryphonLoc facing Default building facing degrees
          • Set GryphonLightningCaster = (Last created unit)
          • Custom script: call DestroyEffect( AddSpecialEffectTarget("Abilities\\Weapons\\Bolt\\BoltImpact.mdl",udg_GryphonUnit2,"weapon"))
          • Unit - Order GryphonLightningCaster to Orc Far Seer - Chain Lightning GryphonUnit
          • Unit - Add a 1.00 second Generic expiration timer to GryphonLightningCaster
        • Else - Actions
      • -------- ---------------------- --------
      • Trigger - Turn on (This trigger)
I hope it helps in you.
 
Sorry guys i wasn't here!
Thanks for your comments!
Actually "Orb of lightning" is a good idea but you have to order a unit to attack,
I solved the problem in another way xD. I set the unit classification to ward :))
It's a tower and it doesn't need to move!
Jakezinc I will try your offer... and thanks to you for it!

I have done 10% of your triggers but I guess it is a nice trick! Generally you cant add "takes damage" event but in that way you can :D
nice work, I haven't found this trick anywhere!

jakeZinc it didn't work :(
Look at my trigger:
  • Chain Lightning Cast
  • Events
  • Unit - a unit is attacked
  • Conditions
  • Actions
  • Trigger - Add to (This Trigger) the event (Unit - (Attacked Unit) takes damage)
  • If (All Conditions are True) then do (Then Actions) Else do (Else Actions)
    • If - Conditions
      • (Unit-Type of (Attacking Unit)) Equal to Lightning Tower
      • (Random real number between 0.00 and 1.00) less than or equal to 0.60
      • Then - Actions
      • Set - Point_Dummy = (Position of(Attacking Unit))
      • Unit - Create 1 Lightning_Dummy for...
      • Unit - Add a 3 second generic time...
      • Custom Script: Call remove location...
      • Unit - Order (last created unit) to Orc - Farsear - Chain lightning
      • else - Actions
But the second Event does not work... can someone fix it?! thanks!
 
Last edited by a moderator:
Thanks to jakeZinc!
Great Work!
with only 2 triggers I made this system! I am making a TD so I applied the system on units which enter spawn region!

  • For each (Integer A) from 1 to 8, do (Actions)
    • Loop - Actions
      • Unit - Create 1 Unit_Type[Wave] for Player 9 (Gray) at (Center of Spawn <gen>) facing Default building facing degrees
      • Trigger - Add to Chain Lightning Cast <gen> the event (Unit - (Last created unit) Takes damage)
      • Unit - Turn collision for (Last created unit) Off
  • Chain Lightning Cast
    • Events
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Damage source)) Equal to Lightning Tower
          • (Random real number between 0.00 and 1.00) Less than or equal to 0.60
        • Then - Actions
          • Set Point_Dummy = (Position of (Damage source))
          • Unit - Create 1 Chain Lightning Dummy for (Owner of (Damage source)) at Point_Dummy facing Default building facing degrees
          • Unit - Add a 3.00 second Generic expiration timer to (Last created unit)
          • Custom script: call RemoveLocation(udg_Point_Dummy)
          • Unit - Order (Last created unit) to Orc Far Seer - Chain Lightning (Triggering unit)
        • Else - Actions
 
Status
Not open for further replies.
Top