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

How do I move all player-owned units to next region?

Level 3
Joined
May 27, 2023
Messages
10
Its simple, a player pulls a lever and it transports the player to the next section of the map. How exactly can I grab all player-owned units wherever they are in the map and make them move instantly to the next region. The last part is easy, but I can't figure out the event and conditions. The units can be ANYWHERE on the map, but once the lever is pulled, how do I grab them all and do the proper action script. How best to approach?
 
Level 25
Joined
Sep 26, 2009
Messages
2,381
Something like this should work

  • Actions
    • Set VariableSet TargetLoc = (Center of <your_region>)
    • Custom script: set bj_wantDestroyGroup = true
    • Unit Group - Pick every unit in (Units owned by <your_player> matching ((((Matching unit) is A structure) Equal to False) and (((Matching unit) is alive) Equal to True)).) and do (Actions)
      • Loop - Actions
        • Unit - Move (Picked unit) instantly to TargetLoc
    • Custom script: call RemoveLocation(udg_TargetLoc)
Those custom scripts are to prevent memory leaks.
TargetLoc is a 'point' variable
 
Level 12
Joined
Feb 5, 2018
Messages
521
So how the Levers work in warcraft 3 is that the lever position changes when the destructible dies.

Here is an example on how to do it. There should also be a mouse button event that runs when a player clicks the Lever, but I cant remember at the moment how to do it. :)

  • Lever pulled
    • Events
      • Unit - A unit Is issued an order targeting an object
      • Unit - A unit Is issued an order with no target
    • Conditions
      • (Destructible-type of (Target destructible of issued order)) Equal to Lever
    • Actions
      • Destructible - Kill (Target destructible of issued order)
  • Lever dies
    • Events
      • Destructible - Lever 0000 <gen> dies
    • Conditions
    • Actions
      • -------- Actions here --------
      • Game - Display to (All players) for 5.00 seconds the text: Lever Pulled!
 
Top