• Check out the results of the Techtree Contest #19!
  • 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.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

Problem with regions

Status
Not open for further replies.
Level 7
Joined
Oct 14, 2008
Messages
340
Okay this is driving me absolutely crazy.

I'm trying to work with regions here, and I have a code setting up 3 regions, but only one region is actually effectively created (the first).. Completely stumped as to why this is happening.

The code:

JASS:
library RegionCreation initializer init
    globals
        region DWT_REGION = null
        region GE_PREBOSS_REGION = null
        region GE_REGION = null
    endglobals
    
    private function RegionSetup takes nothing returns nothing
            set DWT_REGION = CreateRegion()
            call RegionAddRect(DWT_REGION, gg_rct_DWT1)
            call RegionAddRect(DWT_REGION, gg_rct_DWT2)
            call RegionAddRect(DWT_REGION, gg_rct_DWT3)
            call RegionAddRect(DWT_REGION, gg_rct_DWT4)
            set GE_PREBOSS_REGION = CreateRegion()
            call RegionAddRect(GE_PREBOSS_REGION, gg_rct_GE1)
            call RegionAddRect(GE_PREBOSS_REGION, gg_rct_GE2)
            call RegionAddRect(GE_PREBOSS_REGION, gg_rct_GE3)
            set GE_REGION = CreateRegion()
            call RegionAddRect(GE_PREBOSS_REGION, gg_rct_GE1)
            call RegionAddRect(GE_PREBOSS_REGION, gg_rct_GE2)
            call RegionAddRect(GE_PREBOSS_REGION, gg_rct_GE3)
            call RegionAddRect(GE_PREBOSS_REGION, gg_rct_GE4)
    endfunction

    private function init takes nothing returns nothing
        local trigger regs = CreateTrigger(  )
        call TriggerRegisterTimerEventSingle(regs, 0.5)
        call TriggerAddAction(regs, function RegionSetup)
    endfunction
endlibrary

Anyone know what exactly the issue is here? I'm pullin my hair out.
 
Err look at you're lines after setting you're third region... you're still using GE_PREBOSS_REGION in RegionAddRect instead of GE_REGION, also gg_rct_GE1 - gg_rct_GE3 were already used in your GE_PREBOSS_REGION one.
 
JASS:
            set GE_PREBOSS_REGION = CreateRegion()
            call RegionAddRect(GE_PREBOSS_REGION, gg_rct_GE1)
            call RegionAddRect(GE_PREBOSS_REGION, gg_rct_GE2)
            call RegionAddRect(GE_PREBOSS_REGION, gg_rct_GE3)
            
            set GE_REGION = CreateRegion()
            call RegionAddRect(GE_PREBOSS_REGION, gg_rct_GE1)
            call RegionAddRect(GE_PREBOSS_REGION, gg_rct_GE2)
            call RegionAddRect(GE_PREBOSS_REGION, gg_rct_GE3)
            call RegionAddRect(GE_PREBOSS_REGION, gg_rct_GE4)

Why do you create GE_REGION and then not use it? Also, why are you adding gg_rct_GE1/2/3 to region GE_PREBOSS_REGION twice?
 
Good lord, how stupid can I be? :/ I was staring at this bit of code for more than an hour and didn't realize I hadn't been adding rects to GE_REGION.

I do know that GE_PREBOSS_REGION is only one rect short of being identical to GE_REGION, but that's intentional.
 
Good lord, how stupid can I be? :/ I was staring at this bit of code for more than an hour and didn't realize I hadn't been adding rects to GE_REGION.

I do know that GE_PREBOSS_REGION is only one rect short of being identical to GE_REGION, but that's intentional.

You could've made all the regions exactly the same, but hey sometimes people just ignore the obvious and rely too much on the syntax checker when it just comes down to reading through script.
 
Status
Not open for further replies.
Back
Top