Offset Instant Move Trigger

lionheadxO

New Member
Reaction score
3
I am trying to make a trigger where when a unit enters a region, they get teleported 200 range back from where they entered the region. Anyone know how to do this?
 

hunterrravyn

TH.net Regular
Reaction score
19
Trigger:
  • Trigger
    • Events
      • Unit - A unit enters region
    • Conditions
    • Actions
      • Custom Script: local location uloc = GetUnitLoc(GetTriggerUnit())
      • Custom Script: local real uface = GetUnitFacing(GetTriggerUnit())
      • Custom Script: call SetUnitPositionLoc( null, PolarProjectionBJ(uloc, 200.00, ( uface + 180.00 )) )
      • Custom Script: set uloc = null
      • Custom Script: set uface = null

[DEL]If your wondering Move Unit Instantly to Point with Polar Offset[/DEL] Dont need that now

Edit: Killed leaks
 

lionheadxO

New Member
Reaction score
3
is custom script made from JASS?

And are GetUnitLoc, GetTriggerUnit, GetUnitFacing, and PolarProjectionBJ Variables?
 

Happy

Well-Known Member
Reaction score
71
Trigger:
  • # Custom Script: local location uloc = GetUnitLoc(GetTriggerUnit())
    • # Custom Script: local real uface = GetUnitFacing(GetTriggerUnit())


these are the variables...but local not global^^

Trigger:
  • Custom Script: call SetUnitPositionLoc( null, PolarProjectionBJ(uloc, 200.00, ( uface + 180.00 )) )


this "teleports" the unit to the position you want...

Trigger:
  • # Custom Script: set uloc = null
    • # Custom Script: set uface = null


and this is for turning them back to nothing....but you should use

Trigger:
  • # Custom Script: call RemoveLocation(uloc)


instead of

Trigger:
  • # Custom Script: set uloc = null
 

Jedi

New Member
Reaction score
63
Nice answers, just use Unit - Move instantly

Trigger:
  • MoveBack
    • Events
      • Unit - A unit enters SomeRegion <gen>
    • Conditions
      • Add conditions, if you want.
    • Actions
      • Unit - Move (Triggering unit) instantly to ((Position of (Triggering unit)) offset by 200.00 towards ((Facing of (Triggering unit)) + 180.00) degrees)


200 towards = 200 range
((Facing of (Triggering unit)) + 180.00) = back

nevermind leaks.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top