• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

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.
 
Level 9
Joined
Nov 4, 2007
Messages
931
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.
 
Level 18
Joined
Jan 21, 2006
Messages
2,552
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?
 
Level 7
Joined
Oct 14, 2008
Messages
340
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.
 
Level 9
Joined
Nov 4, 2007
Messages
931
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.
Top