• 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.

[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