• 🏆 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] Need help with circular attack

Status
Not open for further replies.
Level 4
Joined
Dec 4, 2007
Messages
76
I need to figure out how to make a unit attack really fast in a circle around itself at a given distance...



Right now i've got a tower and a TempPoint and FacingDegrees variable, I set FacingDegrees to 1 (which is just 1 degree, not the facing of the tower) and TempPoint to position of the tower offset by 350 towards FacingDegrees and then order it to attack to temppoint.

So in essence, the tower should attack 350 units away from itself facing 1 degrees. However, I need to loop this to do it in a full circle. I tried using the "For every integer A from 1 to 360" loop, I ordered the tower to attack to temppoint in the loop, then set FacingDegrees to FacingDegrees+1, then reset temppoint to include the new value of facingdegrees. But my problem with this is that the tower wont attack due to the fact that it cant attack in 0.01 seconds and then reset and attack again (Damned Cooldown...)

I set the attack cooldown of the tower and all the animations and backswing times to 0, but it still doesnt work.

  • Tower1
    • Events
    • Conditions
    • Actions
      • Set FacingDegree = 1.00
      • Set TempPoint = ((Position of Cannon Tower 0082 <gen>) offset by 250.00 towards FacingDegree degrees)
      • For each (Integer A) from 1 to 360, do (Actions)
        • Loop - Actions
          • Unit - Order Cannon Tower 0082 <gen> to Attack Ground TempPoint
          • Wait 0.01 seconds
          • Set FacingDegree = (FacingDegree + 1.00)
          • Set TempPoint = ((Position of Cannon Tower 0082 <gen>) offset by 250.00 towards FacingDegree degrees)
That's the trigger I use (It doesn't have an event because it turns on when someone reaches the checkpoint of the lvl (Im making a maze))

So is there any way to modify this or make a different trigger to make the unit attack in a circle around itself really quick? I Need to know... +Rep to anyone who can help.
 
Level 4
Joined
Dec 4, 2007
Messages
76
Well, in maze designer you can build a mortar team that attacks in a circle..thats the effect I want, I just dont know how to get it.


-Edit

I reworked trigger using ghostwolfs idea..yet it still doesn't work...did I get the trigger right? what is going wrong?

  • Ring1
    • Events
    • Conditions
    • Actions
      • Set TempPoint = ((Center of Region 081 <gen>) offset by 250.00 towards FaceDegrees degrees)
      • Set FaceDegrees = 1.00
      • For each (Integer A) from 1 to 40, do (Actions)
        • Loop - Actions
          • Unit - Create 1 Dummy for Player 11 (Dark Green) at (Position of Scout Tower 0082 <gen>) facing FaceDegrees degrees
          • Set Dummy = (Last created unit)
          • Unit Group - Add Dummy to DummyGroup
          • Unit - Add a 2.00 second Generic expiration timer to Dummy
          • Unit - Order Dummy to Attack Ground TempPoint
          • Set FaceDegrees = (FaceDegrees + 9.00)
          • Set TempPoint = ((Center of Region 081 <gen>) offset by 250.00 towards FaceDegrees degrees)
          • Wait 0.10 seconds
      • Unit Group - Remove all units from DummyGroup
      • My Functions - Remove TempPoint
      • Trigger - Run (This trigger) (checking conditions)
 
Last edited:
Level 4
Joined
Mar 15, 2008
Messages
71
here ya go

lol...let a noob show you...
  • LoL
  • Events
    • Time-Every 0.20 seconds of game time
  • Conditions
    • (Canon Tower 0082 <gen> is alive) Equal to True[optional]
  • Actions
    • Set FacingDegree = FacingDegree + 1.00 // In the variable editor set it to 0 as a starting real number :)//
    • Set TempPoint = ((Position of Cannon Tower 0082 <gen>) offset by 250.00 towards FacingDegree degrees)
    • Unit - Order Cannon Tower 0082 <gen> to Attack Ground TempPoint
and before that I used a trigger to turn on this one that looked like this (but you will probably use another one :) )
  • ...
  • Events
    • Player - Player 1 (Red) Selects a unit
    • Player - Player 2 (*Colour*) Selects a unit
    • Player - Player 3 (*Colour*) Selects a unit
    • Player - Player 4 (*Colour*) Selects a unit
    • Player - Player 5 (*Colour*) Selects a unit
    • Player - Player 6 (*Colour*) Selects a unit
    • Player - Player 7 (*Colour*) Selects a unit
    • Player - Player 8 (*Colour*) Selects a unit
  • Conditions
    • (Triggering unit) equal to Cannon Tower 0082 <gen>
  • Actions
    • Trigger - Turn on LoL <gen>
    • Wait 72.00 seconds // Thats 360 * 0.2 //
    • Trigger - Turn off LoL <gen>
 
Level 4
Joined
Mar 15, 2008
Messages
71
I noticed that the minimal time between two attacks(when using a cannon tower) is 0.12 seconds... so you can use your trigger also-but like this..
  • AKI the NOOB
  • Events
    • Player - Player 1 (Red) Selects a unit
    • Player - Player 2 (*Colour*) Selects a unit
    • Player - Player 3 (*Colour*) Selects a unit
    • Player - Player 4 (*Colour*) Selects a unit
    • Player - Player 5 (*Colour*) Selects a unit
    • Player - Player 6 (*Colour*) Selects a unit
    • Player - Player 7 (*Colour*) Selects a unit
    • Player - Player 8 (*Colour*) Selects a unit
  • Conditions
    • (Triggering unit) equal to Cannon Tower 0082 <gen>
  • Actions
    • Set FacingDegree = 0.00
    • Set TempPoint = ((Position of Cannon Tower 0082 <gen>) offset by 250.00 towards FacingDegree degrees)
    • For each (Integer A) from 1 to 360, do (Actions)
      • Loop - Actions
        • Unit - Order Cannon Tower 0082 <gen> to Attack Ground TempPoint
        • Wait 0.12 seconds
        • Set FacingDegree = (FacingDegree + 1.00)
        • Set TempPoint = ((Position of Cannon Tower 0082 <gen>) offset by 250.00 towards FacingDegree degrees)
 
Level 4
Joined
Dec 4, 2007
Messages
76
Well, using the bottom trigger, the tower rotates and everything, and I can see it tries to fire but for some reason the bullet just doesn't come out...do I need to change the animations to something special? or just leave them at normal?



-Edit: Nvm, I changed it to attack 2 only on the cannon tower and it works now! Thanks for the trigger!! +rep!
 
Last edited:
Level 4
Joined
Mar 15, 2008
Messages
71
...You should use "wait 0.12 seconds" instead of 0.01... because that's as fast as the cannon tower goes.
 
Status
Not open for further replies.
Top