# Help with: Point with offset

Status
Not open for further replies.

#### Spartipilo

Level 20
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 =/

#### FalseDestiny

Level 2
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.

#### Spartipilo

Level 20
hehehehehe I'm sure there's a way to make it generic using Pint with offset But I don't know how to do ir, nor how to calculate the offset amount

#### Fox536

Level 3
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...

#### Spartipilo

Level 20
I'm going to test that Fox536.. seems interesting 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:

#### Fox536

Level 3
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.

Replies
10
Views
773
Replies
21
Views
1K
Replies
4
Views
3K
Replies
9
Views
977
Replies
5
Views
1K