• 🏆 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!

[Solved] GetRectCenter & GetRectCenterX/Y not working?

Status
Not open for further replies.
Level 12
Joined
Nov 3, 2013
Messages
989
I had a problem with my trigger not working for some some reason, and I just couldn't figure out why.

The coordinates always ended up at the center of the map, which they should not.



I narrowed it down to the preplaced regions (rect) somehow not working, but no matter how I look and test it should work but it doesn't.


Finally tested just making a new region and still the same problem, now I've even just made a new blank map and the only trigger I've got is this:

JASS:
globals
    location middlePoint = GetRectCenter(gg_rct_Region_000)
    real middleX = GetRectCenterX(gg_rct_Region_000)
    real middleY = GetRectCenterY(gg_rct_Region_000)
endglobals

and

JASS:
function Trig_Untitled_Trigger_001_Actions takes nothing returns nothing
    call DisplayTextToForce( GetPlayersAll(), "real X = " + R2S(middleX))
    call DisplayTextToForce( GetPlayersAll(), "real Y = " + R2S(middleY))
    call CreateUnitAtLoc(Player(1), 'hfoo', middlePoint, 90)
endfunction

//===========================================================================
function InitTrig_Untitled_Trigger_001 takes nothing returns nothing
    set gg_trg_Untitled_Trigger_001 = CreateTrigger(  )
    call TriggerAddAction( gg_trg_Untitled_Trigger_001, function Trig_Untitled_Trigger_001_Actions )
endfunction

(I tried with the globals both in the same trigger and in map header, nothing changed)


and still the x & y is 0 and the unit is created in the center of the map as well, so what's actually going on here?
 
Status
Not open for further replies.
Top