Strange results in unit creation

Rushhour

New Member
Reaction score
46
I got a small script to create the basic layout for the 'maze' but it acts weird in the middle of the map:
Look at the attached image. I added locust to the towers so they aren't automatically moved by creation when the space is too small between them, but still they aren't in the correct position.
JASS:

globals
    constant integer X_LENGTH=14
    constant integer Y_LENGTH=14
    constant real BLOCKER=64.  //half of the towers pathing map size (its the standard guard tower, tested this value by DistanceBetweenUnits )
    
 //   location array center
 //   rect array fields
    
    player mazeowner=Player(4)
    
  //  group DUMMYGROUP=CreateGroup()
endglobals

private function Trig_Field_Actions takes nothing returns nothing
local real factor =400.
local real startX=GetRectMinX(bj_mapInitialPlayableArea)+factor
local real endX=GetRectMaxX(bj_mapInitialPlayableArea)
local real startY=GetRectMaxY(bj_mapInitialPlayableArea)-factor
local real endY=GetRectMinY(bj_mapInitialPlayableArea)

local real x
local real y

local integer modX
local integer modY

set modY=1
set y=startY
loop
set x=startX
set modX=1
    loop
    if y==startY or x==startX or y==startY-Y_LENGTH*2*BLOCKER or x==startX+X_LENGTH*2*BLOCKER or (ModuloInteger(modX,2)==1 and ModuloInteger(modY,2) ==1 )then
        call CreateUnit(mazeowner,'h000',x,y,90.)
//creates a wall on the north west east and south and every two fields in the middle, look at the image
    endif
    set x=x+2*BLOCKER //im constantly adding this, but at the middle it seems to be lower for the game than it really is ?!
    set modX=modX+1
    exitwhen x>startX+X_LENGTH*2*BLOCKER
    endloop
set modY=modY+1
set y=y-2*BLOCKER
exitwhen y<startY-Y_LENGTH*2*BLOCKER
endloop

endfunction
 

Attachments

  • WC3ScrnShot_031810_132906_01.jpg
    WC3ScrnShot_031810_132906_01.jpg
    92.5 KB · Views: 165

dudeim

New Member
Reaction score
22
I think the region in wich you create it is a little bit to small that's why the towers overlap in the middle try making the region a bit larger
 

Troll-Brain

You can change this now in User CP.
Reaction score
85
I've tried your script with the standard tower guard ('htow') and i works fine on a 64*64 map.
But it fails on a 32*32 map like your screen, but remove the locust ability and you will see that dudeim is right.
 

Rushhour

New Member
Reaction score
46
Well the map is small (32x32, yes), but there is still enough room for the towers.. . will have to use a bigger map and set the camera field. Thanks, but that's strange stuff 0o.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      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