Create regions in a checked pattern ? :S

Komaqtion

You can change this now in User CP.
Reaction score
469
Hellu ! ;)

Ok, so I just wanted to know, how can I create a region in every square, in a check pattern ? :S

Ok, so with this code below I've created a checked pattern (Like a Chess board, but it isn't :p), and I was wondering what the easiest way it to create a region in those squares that are creates :S

I've already "started" with something at the bottow, but I stopped as I didn't know what I was doing XD

JASS:
scope TerrainPattern initializer Create_Checked_Pattern

    globals
        constant real CENTER_X = 0
        constant real CENTER_Y = 0

        private constant real SQUARE_WIDTH = 8192.
        private constant real SQUARE_HEIGHT = 8192.

        private constant real COLUMNS = 19.
        private constant real ROWS = 19.

        private constant integer BORDER_RES = 200
        private constant string SFX_PATH = "Abilities\\Spells\\Human\\SpellSteal\\SpellStealMissile.mdl"

    endglobals

    globals
        rect array BoxCol
        rect Board = Rect( CENTER_X - ( SQUARE_WIDTH / 2 ), CENTER_Y - ( SQUARE_HEIGHT / 2 ), CENTER_X + ( SQUARE_WIDTH / 2 ), CENTER_Y + ( SQUARE_WIDTH / 2 ) )
    endglobals

    private function Create_Checked_Pattern takes nothing returns nothing
        local real posx
        local real posy
        local real x
        local real y
        local real width = SQUARE_WIDTH / COLUMNS
        local real height = SQUARE_HEIGHT / ROWS

        local integer ic
        local integer ir
        
        local integer i = 0
        
        loop
            exitwhen i >= 12
            call FogModifierStart( CreateFogModifierRect( Player(i), FOG_OF_WAR_VISIBLE, bj_mapInitialPlayableArea, true, true ) )
            
            set i = i + 1
        endloop

        set i = 1
        set posx = CENTER_X - ( SQUARE_WIDTH / 2 )
        set posy = CENTER_Y + ( SQUARE_HEIGHT / 2 )
        set ic = 0
        
        loop
            exitwhen ( ic == COLUMNS + 1 )
            
            set x = posx + ( ic * ( SQUARE_WIDTH / COLUMNS ) )
            set y = posy
            set ir = 0
            
            loop
                exitwhen ( ir == BORDER_RES + 1 )
                
                set y = ( posy - ( ir * ( SQUARE_HEIGHT / BORDER_RES ) ) )

                call AddSpecialEffect( SFX_PATH, x, y )

                set ir = ir + 1
            endloop

            set ic = ic + 1
        endloop

        set ir = 0
        
        loop
            exitwhen ( ir == ROWS + 1 )
    
            set x = posx
            set y = posy - ( ir * ( SQUARE_HEIGHT / ROWS ) )
            set ic = 0
            
            loop
                exitwhen ( ic == BORDER_RES + 1 )
                
                set x = ( posx + ( ic * ( SQUARE_WIDTH / BORDER_RES ) ) )
                
                call AddSpecialEffect( SFX_PATH, x, y )
                
                set ic = ic + 1
            endloop
    
            set ir = ir + 1
        endloop
        
        loop
            exitwhen i >= ( ( SQUARE_HEIGHT * SQUARE_WIDTH ) / 2 )
            
            set BoxCol<i> = Rect( ( i - 1 ) * width, ( i - 1 ) * height, i * width, i * height )
                
            call SaveInteger( Boxes, 1, GetHandleId( BoxCol<i> ), BoxData.create( BoxCol<i> ) )
            
            set i = i + 1
        endloop
    
    endfunction

endscope</i></i></i>


Any ideas ? :eek:
 
JASS:
globals
    constant integer COLUMN_COUNT   = 5
    constant integer ROW_COUNT      = 5
    constant real    SQUARE_EDGE    = 120.
    constant real    SQUARE_SPACE   = 40.
    constant real    SQUARE_STEP    = SQUARE_EDGE + SQUARE_SPACE
    constant real    FIELD_STARTX   = 0.
    constant real    FIELD_STARTY   = 0.
endglobals

struct IndexedRect
    rect r
endstruct

function Test takes nothing returns nothing
    local integer c = 0
    local integer r = 0
    
    local real x    = 0.
    local real y    = 0.
    
    loop
        exitwhen c == COLUMN_COUNT
        
        set x = FIELD_STARTX + c * SQUARE_STEP
        
        set r = 0
        loop
            exitwhen r == ROW_COUNT
            
            set y = FIELD_STARTY + r * SQUARE_STEP
            
            set IndexedRect.create().r = Rect(x,y,x+SQUARE_EDGE,y+SQUARE_EDGE)
            
            set r = r + 1
        endloop
        set c = c + 1
    endloop
endfunction

//  ................ = STEP
//        ...        = SPACE
//  .......          = EDGE
//  _______  _______
//  |     |  |     |
//  |     |  |     |
//  |_____|  |_____|


shouldn't sth. like this work, or am I misunderstanding you?
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • The Helper The Helper:
    News portal has been retired. Main page of site goes to Headline News forum now
  • The Helper The Helper:
    I am working on getting access to the old news portal under a different URL for those that would rather use that for news before we get a different news view.
  • Ghan Ghan:
    Easily done
    +1
  • The Helper The Helper:
    https://www.thehelper.net/pages/news/ is a link to the old news portal - i will integrate it into the interface somewhere when i figure it out
  • Ghan Ghan:
    Need to try something
  • Ghan Ghan:
    Hopefully this won't cause problems.
  • Ghan Ghan:
    Hmm
  • Ghan Ghan:
    I have converted the Headline News forum to an Article type forum. It will now show the top 20 threads with more detail of each thread.
  • Ghan Ghan:
    See how we like that.
  • The Helper The Helper:
    I do not see a way to go past the 1st page of posts on the forum though
  • The Helper The Helper:
    It is OK though for the main page to open up on the forum in the view it was before. As long as the portal has its own URL so it can be viewed that way I do want to try it as a regular forum view for a while
  • Ghan Ghan:
    Yeah I'm not sure what the deal is with the pagination.
  • Ghan Ghan:
    It SHOULD be there so I think it might just be an artifact of having an older style.
  • Ghan Ghan:
    I switched it to a "Standard" article forum. This will show the thread list like normal, but the threads themselves will have the first post set up above the rest of the "comments"
  • The Helper The Helper:
    I don't really get that article forum but I think it is because I have never really seen it used on a multi post thread
  • Ghan Ghan:
    RpNation makes more use of it right now as an example: https://www.rpnation.com/news/
  • The Helper The Helper:
  • The Helper The Helper:
    What do you think Tom?
  • tom_mai78101 tom_mai78101:
    I will have to get used to this.
  • tom_mai78101 tom_mai78101:
    The latest news feed looks good
  • The Helper The Helper:
    I would like to see it again like Ghan had it the first time with pagination though - without the pagination that view will not work but with pagination it just might...
  • The Helper The Helper:
    This drink recipe I have had more than a few times back in the day! Mind Eraser https://www.thehelper.net/threads/cocktail-mind-eraser.194720/

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top