• 🏆 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!

Tower Defense Unit Routing Problem

Level 3
Joined
Dec 29, 2019
Messages
13
Hello, so I am making a Tower Defense and I need help with the routing...

  • Events
    • Unit - A unit enters (Playable map area)
  • Conditions
  • Actions
    • Trigger - Turn off (This trigger)
    • If ((Owner of (Triggering unit)) Equal to Player 1 (Red)) then do (Unit Group - Order (Units in Point Start A <gen>) to Move To (Center of Point 1 <gen>)) else do (Do nothing)
    • If ((Owner of (Triggering unit)) Equal to Player 1 (Red)) then do (Unit Group - Order (Units in Point Start B <gen>) to Move To (Center of Point 2 <gen>)) else do (Do nothing)
    • If ((Owner of (Triggering unit)) Equal to Player 1 (Red)) then do (Unit Group - Order (Units in Point 1 <gen>) to Move To (Center of Point 2 <gen>)) else do (Do nothing)
    • If ((Owner of (Triggering unit)) Equal to Player 1 (Red)) then do (Unit Group - Order (Units in Point 2 <gen>) to Move To (Center of Point 3 <gen>)) else do (Do nothing)
    • If ((Owner of (Triggering unit)) Equal to Player 1 (Red)) then do (Unit Group - Order (Units in Point 3 <gen>) to Move To (Center of Point 4 <gen>)) else do (Do nothing)
    • If ((Owner of (Triggering unit)) Equal to Player 1 (Red)) then do (Unit Group - Order (Units in Point 4 <gen>) to Move To (Center of Point 5 <gen>)) else do (Do nothing)
    • If ((Owner of (Triggering unit)) Equal to Player 1 (Red)) then do (Unit Group - Order (Units in Point 5 <gen>) to Move To (Center of Point 6 <gen>)) else do (Do nothing)
    • If ((Owner of (Triggering unit)) Equal to Player 1 (Red)) then do (Unit Group - Order (Units in Point 6 <gen>) to Move To (Center of Point 7 <gen>)) else do (Do nothing)
    • If ((Owner of (Triggering unit)) Equal to Player 1 (Red)) then do (Unit Group - Order (Units in Point 7 <gen>) to Move To (Center of Point 8 <gen>)) else do (Do nothing)
    • If ((Owner of (Triggering unit)) Equal to Player 1 (Red)) then do (Unit Group - Order (Units in Point 8 <gen>) to Move To (Center of Point 9 <gen>)) else do (Do nothing)
    • If ((Owner of (Triggering unit)) Equal to Player 1 (Red)) then do (Unit Group - Order (Units in Point 9 <gen>) to Move To (Center of Point 10 <gen>)) else do (Do nothing)
    • If ((Owner of (Triggering unit)) Equal to Player 1 (Red)) then do (Unit Group - Order (Units in Point 10 <gen>) to Move To (Center of Point End <gen>)) else do (Do nothing)
    • -------- . --------
    • If ((Owner of (Triggering unit)) Equal to Player 2 (Blue)) then do (Unit Group - Order (Units in Point End <gen>) to Neutral - Kaboom! (Center of Point 10 <gen>)) else do (Do nothing)
    • If ((Owner of (Triggering unit)) Equal to Player 2 (Blue)) then do (Unit Group - Order (Units in Point 10 <gen>) to Neutral - Kaboom! (Center of Point 9 <gen>)) else do (Do nothing)
    • If ((Owner of (Triggering unit)) Equal to Player 2 (Blue)) then do (Unit Group - Order (Units in Point 9 <gen>) to Neutral - Kaboom! (Center of Point 8 <gen>)) else do (Do nothing)
    • If ((Owner of (Triggering unit)) Equal to Player 2 (Blue)) then do (Unit Group - Order (Units in Point 8 <gen>) to Neutral - Kaboom! (Center of Point 7 <gen>)) else do (Do nothing)
    • If ((Owner of (Triggering unit)) Equal to Player 2 (Blue)) then do (Unit Group - Order (Units in Point 7 <gen>) to Neutral - Kaboom! (Center of Point 6 <gen>)) else do (Do nothing)
    • If ((Owner of (Triggering unit)) Equal to Player 2 (Blue)) then do (Unit Group - Order (Units in Point 6 <gen>) to Neutral - Kaboom! (Center of Point 5 <gen>)) else do (Do nothing)
    • If ((Owner of (Triggering unit)) Equal to Player 2 (Blue)) then do (Unit Group - Order (Units in Point 5 <gen>) to Neutral - Kaboom! (Center of Point 4 <gen>)) else do (Do nothing)
    • If ((Owner of (Triggering unit)) Equal to Player 2 (Blue)) then do (Unit Group - Order (Units in Point 4 <gen>) to Neutral - Kaboom! (Center of Point 3 <gen>)) else do (Do nothing)
    • If ((Owner of (Triggering unit)) Equal to Player 2 (Blue)) then do (Unit Group - Order (Units in Point 3 <gen>) to Neutral - Kaboom! (Center of Point 2 <gen>)) else do (Do nothing)
    • If ((Owner of (Triggering unit)) Equal to Player 2 (Blue)) then do (Unit Group - Order (Units in Point 2 <gen>) to Neutral - Kaboom! (Center of Point 1 <gen>)) else do (Do nothing)
    • If ((Owner of (Triggering unit)) Equal to Player 2 (Blue)) then do (Unit Group - Order (Units in Point 1 <gen>) to Neutral - Kaboom! (Center of Point Start A <gen>)) else do (Do nothing)

So, what I'm trying to do here is to have Player 1's all units (which spawns timely) to move from Point Start A to the Points #s, then lastly to Point End. While my spawned units is to Kaboom! enemies along the way from the Point End, Point #s then to Point Start A.

Also, I have tried this trigger before I want to implement the Kaboom!.

  • Events
    • Time - Every 0.08 seconds of game time
  • Conditions
  • Actions
    • Unit Group - Order (Units in Point Start A <gen>) to Move To (Center of Point 1 <gen>)
    • Unit Group - Order (Units in Point 1 <gen>) to Move To (Center of Point 2 <gen>)
    • Unit Group - Order (Units in Point Start B <gen>) to Move To (Center of Point 2 <gen>)
    • Unit Group - Order (Units in Point 2 <gen>) to Move To (Center of Point 3 <gen>)
    • Unit Group - Order (Units in Point 3 <gen>) to Move To (Center of Point 4 <gen>)
    • Unit Group - Order (Units in Point 4 <gen>) to Move To (Center of Point 5 <gen>)
    • Unit Group - Order (Units in Point 5 <gen>) to Move To (Center of Point 6 <gen>)
    • Unit Group - Order (Units in Point 6 <gen>) to Move To (Center of Point 7 <gen>)
    • Unit Group - Order (Units in Point 7 <gen>) to Move To (Center of Point 8 <gen>)
    • Unit Group - Order (Units in Point 8 <gen>) to Move To (Center of Point 9 <gen>)
    • Unit Group - Order (Units in Point 9 <gen>) to Move To (Center of Point 10 <gen>)
    • Unit Group - Order (Units in Point 10 <gen>) to Move To (Center of Point End <gen>)

Which is way smoother, no enemies fleeing when attacked, turns and move from point to point with no break. Which is not the case with the first trigger that I have showed, but this one affects all Player units not just Player 1.

That is why I also made this trigger to compensate with that...

  • Events
    • Time - Every 0.08 seconds of game time
  • Conditions
  • Actions
    • Trigger - Turn on Pathing 2b <gen>

:goblin_cry: I know that I am lacking a lot as you can see, but I am willing to learn. Thank you for helping.
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,542
You can't queue Move orders in the Trigger Editor. As a result, your first trigger is setup to ignore everything but the last order given.

The easy solution is to create a trigger for each Region:
  • Region 1 to 2
    • Events
      • Unit - A unit enters Region1 <gen>
    • Conditions
      • (Owner of (Triggering unit)) Equal to Player 1 (Red)
    • Actions
      • Unit - Order (Triggering unit) to Move To (Center of Region2 <gen>)
  • Region 2 to 3
    • Events
      • Unit - A unit enters Region2 <gen>
    • Conditions
      • (Owner of (Triggering unit)) Equal to Player 1 (Red)
    • Actions
      • Unit - Order (Triggering unit) to Move To (Center of Region3 <gen>)
1 to 2, 2 to 3, 3 to 4, etc...

For the Kaboom thing, you probably want to Order the units to Attack-Move to those Regions instead of casting the ability. Remember, a Unit is going to do exactly what you Order it to do, so if you say "Kaboom at Region3" then it's going to ignore everything else until it reaches Region3 and then go boom. This means it will not try to kaboom into nearby enemies along the way since it has specific orders different from that.

By ordering the unit to Attack-Move to the Regions it SHOULD know to autocast Kaboom on enemies along the way. I can't guarantee that though, so if that doesn't work then give your kaboom Units a melee attack and detect when they attack something and then tell them to kaboom in response:
  • Events
    • Unit - A unit is attacked
  • Conditions
    • (Level of Kaboom for (Attacking unit)) Greater than or equal to 1
  • Actions
    • Unit - Kill (Attacking unit)
This trigger will kill the kaboom unit, which will also cause it to explode.

For the fleeing issue, make sure to disable "Can flee" in the Object Editor.

Some other helpful threads you can use to improve your tower defense:
 
Level 3
Joined
Dec 29, 2019
Messages
13
Wow, thank you for the fast response. That sure clear things up for me, I'm hoping to speed up my progress soon in enough to post an alpha. :thumbs_up:
You can't queue Move orders in the Trigger Editor. As a result, your first trigger is setup to ignore everything but the last order given.

The easy solution is to create a trigger for each Region:
  • Region 1 to 2
    • Events
      • Unit - A unit enters Region1 <gen>
    • Conditions
      • (Owner of (Triggering unit)) Equal to Player 1 (Red)
    • Actions
      • Unit - Order (Triggering unit) to Move To (Center of Region2 <gen>)
  • Region 2 to 3
    • Events
      • Unit - A unit enters Region2 <gen>
    • Conditions
      • (Owner of (Triggering unit)) Equal to Player 1 (Red)
    • Actions
      • Unit - Order (Triggering unit) to Move To (Center of Region3 <gen>)
1 to 2, 2 to 3, 3 to 4, etc...

For the Kaboom thing, you probably want to Order the units to Attack-Move to those Regions instead of casting the ability. Remember, a Unit is going to do exactly what you Order it to do, so if you say "Kaboom at Region3" then it's going to ignore everything else until it reaches Region3 and then go boom. This means it will not try to kaboom into nearby enemies along the way since it has specific orders different from that.

By ordering the unit to Attack-Move to the Regions it SHOULD know to autocast Kaboom on enemies along the way. I can't guarantee that though, so if that doesn't work then give your kaboom Units a melee attack and detect when they attack something and then tell them to kaboom in response:
  • Events
    • Unit - A unit is attacked
  • Conditions
    • (Level of Kaboom for (Attacking unit)) Greater than or equal to 1
  • Actions
    • Unit - Kill (Attacking unit)
This trigger will kill the kaboom unit, which will also cause it to explode.

For the fleeing issue, make sure to disable "Can flee" in the Object Editor.

Some other helpful threads you can use to improve your tower defense:
 
Top