• 💀 Happy Halloween! 💀 It's time to vote for the best terrain! Check out the entries to Hive's HD Terrain Contest #2 - Vampire Folklore.❗️Poll closes on November 14, 2023. 🔗Click here to cast your vote!
  • 🏆 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!
  • 🏆 HD Level Design Contest #1 is OPEN! Contestants must create a maze with at least one entry point, and at least one exit point. The map should be made in HD mode, and should not be openable in SD. Only custom models from Hive's HD model and texture sections are allowed. The only exceptions are DNC models and omnilights. This is mainly a visual and design oriented contest, not technical. The UI and video walkthrough rules are there to give everyone an equal shot at victory by standardizing how viewers see the terrain. 🔗Click here to enter!

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