• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Help with: Point with offset

Status
Not open for further replies.
Level 20
Joined
Jul 14, 2011
Messages
3,213
Hi!

I want to simulate a 'World map' where units standing in the right edge of the map are moved to the same position in the left side of the map. Same with bottom and top. But I don't know to do it =/
 
Level 2
Joined
Oct 5, 2008
Messages
15
A simple (if somewhat inaccurate) way to do it would be to create a punch of regions on each side of the map, and have them move to a region on the other side, something aranged like:

12--12
12--12
12--12

So entering region 1 on the left goes to region 1 on the right, and so forth. Same would apply for the top of the map.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
hehehehehe I'm sure there's a way to make it generic using Pint with offset :p But I don't know how to do ir, nor how to calculate the offset amount
 
Level 3
Joined
Aug 27, 2011
Messages
41
well you could take the x and y of the unit and inverse it in the direction they are going....

Quick Gui Trigger like
  • WorldMap
    • Events
      • Unit - A unit enters NorthRegion
      • Unit - A unit enters WestRegion
      • Unit - A unit enters EastRegion
      • Unit - A unit enters SouthRegion
    • Conditions
  • Actions
    • -------- Unit went through to the North (Upper Bounds) --------
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (NorthRegion contains (Triggering unit)) Equal to True
      • Then - Actions
        • Unit - Move (Triggering unit) instantly to ((Center of (Playable map area)) offset by ((X of (Position of (Triggering unit))), ((Y of ((Position of (Triggering unit))) x -1.00) + 32.0)))
      • Else - Actions
    • -------- Unit went through to the West (Left Bounds) --------
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (WestRegion contains (Triggering unit)) Equal to True
      • Then - Actions
        • Unit - Move (Triggering unit) instantly to ((Center of (Playable map area)) offset by ((((X of (Position of (Triggering unit))) x -1.00) + 32.0), (Y of (Position of (Triggering unit)))))
      • Else - Actions
    • -------- Unit went through to the East (Right Bounds) --------
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (EastRegion contains (Triggering unit)) Equal to True
      • Then - Actions
        • Unit - Move (Triggering unit) instantly to ((Center of (Playable map area)) offset by ((((X of (Position of (Triggering unit))) x -1.00) - 32.0), (Y of (Position of (Triggering unit)))))
      • Else - Actions
    • -------- Unit went through to the South (Bottom Bounds) --------
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (SouthRegion contains (Triggering unit)) Equal to True
      • Then - Actions
        • Unit - Move (Triggering unit) instantly to ((Center of (Playable map area)) offset by ((X of (Position of (Triggering unit))), ((Y of ((Position of (Triggering unit))) x -1.00) - 32.0)))
      • Else - Actions
  • [/HIDDEN]
or Jass

JASS:
// Unit went through to the North (Upper Bounds)
local unit trigUnit = GetTriggerUnit()
call SetUnitY(trigUnit, GetUnitY(trigUnit) * -1  + 32.0)
set trigUnit = null

// Unit went through to the West (Left Bounds)
local unit trigUnit = GetTriggerUnit()
call SetUnitX(trigUnit, GetUnitX(trigUnit) * -1 + 32.0)
set trigUnit = null

// Unit went through to the East (Right Bounds)
local unit trigUnit = GetTriggerUnit()
call SetUnitX(trigUnit, GetUnitX(trigUnit) * -1 - 32.0)
set trigUnit = null

// Unit went through to the South (Bottom Bounds)
local unit trigUnit = GetTriggerUnit()
call SetUnitY(trigUnit, GetUnitY(trigUnit) * -1 - 32.0)
set trigUnit = null
[/HIDDEN]

Just make sure to subtract or add some distance so that you don't cause a endless loop...
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
I'm going to test that Fox536.. seems interesting :p Ok, it works fine. I just have to test over and over untill i find the right spot in the other side of the map :) Thanks!
 
Last edited:
Level 3
Joined
Aug 27, 2011
Messages
41
Ok, I wrote it from scratch but ya you should just be able to invert in in the opposite direction and get where your going. Sorry I didn't know if you needed jass or GUI lol

No problem Glad I could help best of luck :)
 
Last edited:
Status
Not open for further replies.
Top