• 🏆 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 can i make a Teleport (move intantly) trigger?

Status
Not open for further replies.
Level 1
Joined
Jun 16, 2009
Messages
3
Hi, im struggeling with something in my hero defence map. I want the hero from all players (1-4) that are in the certan region, to be teleported (moved) to another region. The units cannot leave or enter the region they are teleported from, beacuse this is the map area where the HD takes place, but I want them teleported to another place where I will make a event.

So I thought it wouldnt help to use the trigger "A unit enters/leaves a region". Since they cant leave it. So if anyone knows how I can set up this trigger it would be awesome! im totally stuck atm...
 
Level 2
Joined
Jun 30, 2008
Messages
19
So you want all units within a certain region to be teleported to another? If so, then this should work:

  • Actions
    • Unit Group - Pick every unit in (Units in <REGION1>) and do (Unit - Move (Picked unit) instantly to (Center of <REGION2>)))
Or do you mean that you want an event which will trigger the action?
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
So you want all units within a certain region to be teleported to another? If so, then this should work:

  • Actions
    • Unit Group - Pick every unit in (Units in <REGION1>) and do (Unit - Move (Picked unit) instantly to (Center of <REGION2>)))
Or do you mean that you want an event which will trigger the action?

This leaks: Unit Group and Location.

Basically the trigger isn't hard (if I know what you mean).
So, when the hero duel starts, the heroes that are in a certain region will be teleported to another, right?

  • Melee Initialization
    • Events
      • Time - DuelTimer expires
    • Conditions
    • Actions
      • Set Loc = (Center of (Duel Region))
      • For each (Integer A) from 1 to [Number of Players], do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ([Your Region] contains (Hero[Integer A]) Equal to True
            • Then - Actions
              • Unit - Move (Hero[Integer A]) instantly to Loc
            • Else - Actions
      • Custom script: call RemoveLocation(udg_Loc)
When a player chooses a hero, set the variable "Hero[Player Number]" to the selected hero.
 
Level 4
Joined
Jun 10, 2009
Messages
67
  • Melee Initialization
    • Events
      • Time - DuelTimer expires
    • Conditions
    • Actions
      • Set Loc = (Center of (Duel Region))
      • For each (Integer A) from 1 to [Number of Players], do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ([Your Region] contains (Hero[Integer A]) Equal to True
            • Then - Actions
              • Unit - Move (Hero[Integer A]) instantly to Loc
            • Else - Actions
      • Custom script: call RemoveLocation(udg_Loc)

Also leaks...
Before you Move a unit Instantly, you must pause it. Else, if it is a hero who just have casted a spell, the spell cooldown will not trigger, it will reset the cooldown and the spell can be casted again immediately.

So, before the Unit - Move (Hero...
Add this:

  • Melee Initialization
    • Actions
      • Unit - Pause (Hero[Integer A])
Once the unit is moved, you do this:
  • Melee Initialization
    • Actions
      • Unit - Unpause (Hero[Integer A])
Oh and one more thing, you must also Set the units before... In ap0calypse's trigger, I cant see where you Set Hero[Integer A] anywhere...
 
Level 16
Joined
Oct 12, 2008
Messages
1,570
But take about 2 extra function calls.
PauseUnitBJ just calls PauseUnit
so you actually make 4 calls, with SetUnitX and SetUnitY, you dont need ANY of those 4 calls, neither do you need the SetUnitLoc call, this does those 5 (or even more, dunno what function "Unit - Move Unit instantly to Loc" calls or if it is a native) calls in 2,,
Not a big deal in this part, but it can make a big code faster, thus efficienter ;)
(Well, not immediately efficienter, but mainly when you do so, it is efficienter)
 
Level 1
Joined
Jun 16, 2009
Messages
3
Allright, I solved it, thanks. Now I just need to figure a way of making the event =/ Sugestions would be awesome :D
 
Level 4
Joined
Jun 10, 2009
Messages
67
Why not like this?

  • Your Trigger
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to YOUR SPELL THAT MOVES YOUR UNITS
Or like this:

  • Your Trigger
    • Events
      • Unit - A unit enters YOUR REGION
    • Conditions
      • (Entering Unit) is a Hero Equal to True
 
Status
Not open for further replies.
Top