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

[General] unit moves indefinitely

Status
Not open for further replies.
Level 4
Joined
Dec 24, 2014
Messages
37
i have this unit, that i can't control and is following my hero (is an ally).
I can just order this unit only move to the point of an ability, when the unit reaches the point, it immediately falls back to follow my hero.
But it keeps moving indefinitely across the map.
I dunno what to do.
 
Level 4
Joined
Dec 24, 2014
Messages
37
Whats the question?
sorry i wrote that wrong.

It Would be like this:

i have this unit, that i can't control and is following my hero (is an ally).
I can just order this unit only to move to the target point of an ability, when the unit reaches the point it keeps moving to nowhere and dont go back to follow my hero.
I want the unit stop in the target point for a few seconds, then returns to follow my hero.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,564
sorry i wrote that wrong.

It Would be like this:

i have this unit, that i can't control and is following my hero (is an ally).
I can just order this unit only to move to the target point of an ability, when the unit reaches the point it keeps moving to nowhere and dont go back to follow my hero.
I want the unit stop in the target point for a few seconds, then returns to follow my hero.
Order the allied unit to cast a spell at the target point instead of issuing a move order there. You can then detect when it reaches the target point because it will run a spell event. Here's an example:
  • Move To Point Setup
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set VariableSet MTP_Hero = Paladin 0000 <gen>
      • Set VariableSet MTP_Ally = Footman 0001 <gen>
      • Player - Make Player 1 (Red) treat Player 2 (Blue) as an Ally with shared vision
      • Player - Make Player 2 (Blue) treat Player 1 (Red) as an Ally with shared vision
      • Unit - Order MTP_Ally to Follow MTP_Hero
  • Move To Point Hero
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Move To Point (Hero)
    • Actions
      • Set VariableSet MTP_Point = (Target point of ability being cast)
      • Unit - Order MTP_Ally to Human Archmage - Blizzard MTP_Point
      • Custom script: call RemoveLocation(udg_MTP_Point)
      • Trigger - Turn off Move To Point Loop <gen>
  • Move To Point Ally
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Move To Point (Ally)
    • Actions
      • Unit - Order MTP_Ally to Hold Position.
      • Set VariableSet MTP_Duration = 2.00
      • Trigger - Turn on Move To Point Loop <gen>
  • Move To Point Loop
    • Events
      • Time - Every 0.01 seconds of game time
    • Conditions
    • Actions
      • Set VariableSet MTP_Duration = (MTP_Duration - 0.01)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • MTP_Duration Less than or equal to 0.00
        • Then - Actions
          • Set VariableSet MTP_Duration = 0.00
          • Unit - Order MTP_Ally to Follow MTP_Hero
          • Trigger - Turn off (This trigger)
        • Else - Actions
Both of the Move To Point abilities are based on the Channel ability. Move To Point (Ally) has the Base Order Id of Blizzard which is important for this to work since the Order in the trigger is to cast Blizzard. It also has 1 Cast Range so that the unit needs to get very close to the destination in order to begin casting the ability. But instead of actually casting the ability the unit will instead get issued to Hold Position for 2.00 seconds.

The only issue here is that our allied unit may never reach the destination so it won't ever cast the ability. To fix this you should create a trigger similar to Move To Point Loop which tracks the allied unit and checks to see what it's currently up to. If it's not trying to cast Move To Point (Ally) or maybe it's too far away from the Hero then you should order it to Follow the Hero again.
 

Attachments

  • Move To Point 1.w3m
    18.8 KB · Views: 2
Level 4
Joined
Dec 24, 2014
Messages
37
Order the allied unit to cast a spell at the target point instead of issuing a move order there. You can then detect when it reaches the target point because it will run a spell event. Here's an example:
  • Move To Point Setup
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set VariableSet MTP_Hero = Paladin 0000 <gen>
      • Set VariableSet MTP_Ally = Footman 0001 <gen>
      • Player - Make Player 1 (Red) treat Player 2 (Blue) as an Ally with shared vision
      • Player - Make Player 2 (Blue) treat Player 1 (Red) as an Ally with shared vision
      • Unit - Order MTP_Ally to Follow MTP_Hero
  • Move To Point Hero
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Move To Point (Hero)
    • Actions
      • Set VariableSet MTP_Point = (Target point of ability being cast)
      • Unit - Order MTP_Ally to Human Archmage - Blizzard MTP_Point
      • Custom script: call RemoveLocation(udg_MTP_Point)
      • Trigger - Turn off Move To Point Loop <gen>
  • Move To Point Ally
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Move To Point (Ally)
    • Actions
      • Unit - Order MTP_Ally to Hold Position.
      • Set VariableSet MTP_Duration = 2.00
      • Trigger - Turn on Move To Point Loop <gen>
  • Move To Point Loop
    • Events
      • Time - Every 0.01 seconds of game time
    • Conditions
    • Actions
      • Set VariableSet MTP_Duration = (MTP_Duration - 0.01)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • MTP_Duration Less than or equal to 0.00
        • Then - Actions
          • Set VariableSet MTP_Duration = 0.00
          • Unit - Order MTP_Ally to Follow MTP_Hero
          • Trigger - Turn off (This trigger)
        • Else - Actions
Both of the Move To Point abilities are based on the Channel ability. Move To Point (Ally) has the Base Order Id of Blizzard which is important for this to work since the Order in the trigger is to cast Blizzard. It also has 1 Cast Range so that the unit needs to get very close to the destination in order to begin casting the ability. But instead of actually casting the ability the unit will instead get issued to Hold Position for 2.00 seconds.

The only issue here is that our allied unit may never reach the destination so it won't ever cast the ability. To fix this you should create a trigger similar to Move To Point Loop which tracks the allied unit and checks to see what it's currently up to. If it's not trying to cast Move To Point (Ally) or maybe it's too far away from the Hero then you should order it to Follow the Hero again.
what´s that CHANNEL ABILITY??????
is the ability with the weird guy?????


And i was trying to do that without variables.
Because i don't understand variables well.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,564
Can you not open the map? Anyway, Channel is a Hero ability. It's basically a template for making custom spells.
 
Level 4
Joined
Dec 24, 2014
Messages
37
  • Aggression
    • Events
      • Time - Every 35.00 seconds of game time
    • Conditions
    • Actions
      • Unit - Create 5 Furbolg for Player 6 (Orange) at (Random point in Aggressive Bears <gen>) facing (Position of Town Hall 0003 <gen>)
      • Unit - Create 2 Furbolg Shaman for Player 6 (Orange) at (Random point in Aggressive Bears <gen>) facing (Position of Town Hall 0003 <gen>)
      • Wait 5.00 seconds
      • Unit Group - Pick every unit in (Units owned by Player 6 (Orange)) and do (Actions)
        • Loop - Actions
          • Unit - Order (Picked unit) to Attack-Move To (Position of Town Hall 0003 <gen>)
      • Wait 218.00 seconds



LIKE THAT??????????????
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,564
  • Aggression
    • Events
      • Time - Every 35.00 seconds of game time
    • Conditions
    • Actions
      • Unit - Create 5 Furbolg for Player 6 (Orange) at (Random point in Aggressive Bears <gen>) facing (Position of Town Hall 0003 <gen>)
      • Unit - Create 2 Furbolg Shaman for Player 6 (Orange) at (Random point in Aggressive Bears <gen>) facing (Position of Town Hall 0003 <gen>)
      • Wait 5.00 seconds
      • Unit Group - Pick every unit in (Units owned by Player 6 (Orange)) and do (Actions)
        • Loop - Actions
          • Unit - Order (Picked unit) to Attack-Move To (Position of Town Hall 0003 <gen>)
      • Wait 218.00 seconds



LIKE THAT??????????????
Are you asking if that's how you post a trigger? Because I think the answer is pretty clear.

If not, what exactly are you asking?

Also, that trigger will work fine, although I don't understand what the Wait 218.00 seconds is for. What are you trying to do?

Here's a tutorial on variables:
 
Last edited:
Level 4
Joined
Dec 24, 2014
Messages
37
Are you asking if that's how you post a trigger? Because I think the answer is pretty clear.

If not, what exactly are you asking?

Also, that trigger will work fine, although I don't understand what the Wait 218.00 seconds is for. What are you trying to do?
Good, i know how to post triggers now............ yay.
mmmmm about my trigger............
I was trying to do waves of enemies, 3 waves of the same, then 3 waves of enemies more powerful y finish with 3 waves of ultimates enemies.
Every wave contains the same number and type of monsters.
But i dunno how to do that.
So i was just counting the time for stop the first trigger and start the other.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,564
There's lots of different ways to handle waves of enemies. The best methods will use variables (and variable arrays) that keep track of everything like:
  • Wave Number
  • Wave Spawn Unit-Type
  • Wave Spawn Count
  • Wave Spawn Interval
  • Wave Spawn Delay
  • Wave Timer
With these variables you can store all of the data about your waves in one trigger. Then you can create another trigger that periodically spawns these waves of units by getting the data associated with the current wave. Here's an example: Custom Tower TD

An "easier" but more limited method would be to use multiple triggers like so:

This main trigger turns on/off a bunch of other triggers which are setup to periodically spawn (create) waves of units:
  • Spawn Waves
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Trigger - Turn on Spawn Easy Bears <gen>
      • Wait 218.00 game-time seconds
      • Trigger - Turn off Spawn Easy Bears <gen>
      • Trigger - Turn on Spawn Medium Bears <gen>
      • Wait 218.00 game-time seconds
      • Trigger - Turn off Spawn Medium Bears <gen>
      • Trigger - Turn on Spawn Hard Bears <gen>
      • Wait 218.00 game-time seconds
      • Trigger - Turn off Spawn Hard Bears <gen>
First we turn on the Spawn Easy Bears trigger which looks like this:
  • Spawn Easy Bears
    • Events
      • Time - Every 35.00 seconds of game time
    • Conditions
    • Actions
      • Unit - Create 5 Furbolg for Player 6 (Orange) at (Random point in SpawnRegion <gen>) facing (Center of AttackRegion <gen>)
      • Unit - Create 2 Furbolg Shaman for Player 6 (Orange) at (Random point in SpawnRegion <gen>) facing (Center of AttackRegion <gen>)
      • Unit Group - Pick every unit in (Units owned by Player 6 (Orange).) and do (Actions)
        • Loop - Actions
          • Unit - Order (Picked unit) to Attack-Move To (Center of AttackRegion <gen>)
Then after 218 seconds has passed, which is enough time for 6 waves to spawn, we turn off Spawn Easy Bears and turn on Spawn Medium Bears:
  • Spawn Medium Bears
    • Events
      • Time - Every 35.00 seconds of game time
    • Conditions
    • Actions
      • Unit - Create 5 Medium Furbolg for Player 6 (Orange) at (Random point in SpawnRegion <gen>) facing (Center of AttackRegion <gen>)
      • Unit - Create 2 Medium Furbolg Shaman for Player 6 (Orange) at (Random point in SpawnRegion <gen>) facing (Center of AttackRegion <gen>)
      • Unit Group - Pick every unit in (Units owned by Player 6 (Orange).) and do (Actions)
        • Loop - Actions
          • Unit - Order (Picked unit) to Attack-Move To (Center of AttackRegion <gen>)
Again, after 218 seconds has passed we turn off Spawn Medium Bears and turn on Spawn Hard Bears:
  • Spawn Medium Bears
    • Events
      • Time - Every 35.00 seconds of game time
    • Conditions
    • Actions
      • Unit - Create 5 Hard Furbolg for Player 6 (Orange) at (Random point in SpawnRegion <gen>) facing (Center of AttackRegion <gen>)
      • Unit - Create 2 Hard Furbolg Shaman for Player 6 (Orange) at (Random point in SpawnRegion <gen>) facing (Center of AttackRegion <gen>)
      • Unit Group - Pick every unit in (Units owned by Player 6 (Orange).) and do (Actions)
        • Loop - Actions
          • Unit - Order (Picked unit) to Attack-Move To (Center of AttackRegion <gen>)
We can keep doing this pattern until we want to stop spawning units.

Just remember to click the Initially On checkbox on the Spawn Easy/Medium/Hard triggers so that they're turned off by default. We only want to turn them on when necessary!
 

Attachments

  • Spawn Basic Example 1.w3m
    17 KB · Views: 2
Last edited:
Level 4
Joined
Dec 24, 2014
Messages
37
There's lots of different ways to handle waves of enemies. The best methods will use variables (and variable arrays) that keep track of everything like:
  • Wave Number
  • Wave Spawn Unit-Type
  • Wave Spawn Count
  • Wave Spawn Interval
  • Wave Spawn Delay
  • Wave Timer
With these variables you can store all of the data about your waves in one trigger. Then you can create another trigger that periodically spawns these waves of units by getting the data associated with the current wave. Here's an example: Custom Tower TD

An "easier" but more limited method would be to use multiple triggers like so:

This main trigger turns on/off a bunch of other triggers which are setup to periodically spawn (create) waves of units:
  • Spawn Waves
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Trigger - Turn on Spawn Easy Bears <gen>
      • Wait 218.00 game-time seconds
      • Trigger - Turn off Spawn Easy Bears <gen>
      • Trigger - Turn on Spawn Medium Bears <gen>
      • Wait 218.00 game-time seconds
      • Trigger - Turn off Spawn Medium Bears <gen>
      • Trigger - Turn on Spawn Hard Bears <gen>
      • Wait 218.00 game-time seconds
      • Trigger - Turn off Spawn Hard Bears <gen>
First we turn on the Spawn Easy Bears trigger which looks like this:
  • Spawn Easy Bears
    • Events
      • Time - Every 35.00 seconds of game time
    • Conditions
    • Actions
      • Unit - Create 5 Furbolg for Player 6 (Orange) at (Random point in SpawnRegion <gen>) facing (Center of AttackRegion <gen>)
      • Unit - Create 2 Furbolg Shaman for Player 6 (Orange) at (Random point in SpawnRegion <gen>) facing (Center of AttackRegion <gen>)
      • Unit Group - Pick every unit in (Units owned by Player 6 (Orange).) and do (Actions)
        • Loop - Actions
          • Unit - Order (Picked unit) to Attack-Move To (Center of AttackRegion <gen>)
Then after 218 seconds has passed, which is enough time for 6 waves to spawn, we turn off Spawn Easy Bears and turn on Spawn Medium Bears:
  • Spawn Medium Bears
    • Events
      • Time - Every 35.00 seconds of game time
    • Conditions
    • Actions
      • Unit - Create 5 Medium Furbolg for Player 6 (Orange) at (Random point in SpawnRegion <gen>) facing (Center of AttackRegion <gen>)
      • Unit - Create 2 Medium Furbolg Shaman for Player 6 (Orange) at (Random point in SpawnRegion <gen>) facing (Center of AttackRegion <gen>)
      • Unit Group - Pick every unit in (Units owned by Player 6 (Orange).) and do (Actions)
        • Loop - Actions
          • Unit - Order (Picked unit) to Attack-Move To (Center of AttackRegion <gen>)
Again, after 218 seconds has passed we turn off Spawn Medium Bears and turn on Spawn Hard Bears:
  • Spawn Medium Bears
    • Events
      • Time - Every 35.00 seconds of game time
    • Conditions
    • Actions
      • Unit - Create 5 Hard Furbolg for Player 6 (Orange) at (Random point in SpawnRegion <gen>) facing (Center of AttackRegion <gen>)
      • Unit - Create 2 Hard Furbolg Shaman for Player 6 (Orange) at (Random point in SpawnRegion <gen>) facing (Center of AttackRegion <gen>)
      • Unit Group - Pick every unit in (Units owned by Player 6 (Orange).) and do (Actions)
        • Loop - Actions
          • Unit - Order (Picked unit) to Attack-Move To (Center of AttackRegion <gen>)
We can keep doing this pattern until we want to stop spawning units.

Just remember to click the Initially On checkbox on the Spawn Easy/Medium/Hard triggers so that they're turned off by default. We only want to turn them on when necessary!
Thanks man.
But i couldn´t open the file.
Not matter, i´ll do it manually.
 

Attachments

  • Captura.JPG
    Captura.JPG
    104.6 KB · Views: 5
Level 29
Joined
May 14, 2021
Messages
1,118
Yeah.
I have the 1.27 patch.
mmmmmmm if i created a map i that old version, it will run in the latest versions????
There are numerous elements that were introduced in Reforged that will not work on the legacy versions, but you can try this method if you want to make the specific Reforged maps openable with legacy one:
 
Status
Not open for further replies.
Top