| 04-07-2008, 08:06 AM | #1 |
Ok so I'm making a tactics battle system, and I use a custom grid made with trackables, and to get trackables to work with multiplayer I have to create one at every grid spot for each player. I'm using GC to store my information because of the 2D array capability. I'm also creating an image at each location for display purposes and storing some info in GC. Now this brings me to my problem and my question. Problem: My grid wont fully complete now it's a 13x13 grid only fills up to like 9,2 now. Question: Am I hitting a max handle count or something? Do GC's add to this number? Anything I can do to fix this if that is the problem? :( |
| 04-07-2008, 08:21 AM | #2 | |
Quote:
Depends on how big your map is. JNPG would probably say if the handle limit is reached (if you have it implemented), I think you made a mistake in the calculations, post the trackable-creation code. Personally, I hate trackables, they don't work for me and nobody knows why and I hate them and I hate them. My suggestion: use RtC for clicking detection, it's far more flexible (can detect both right and left click), you don't have to create a trackable in every grid, and it's more accurate (it can detect exactly where you clicked, while trackable method can only round it up to the closest grid). |
| 04-07-2008, 08:27 AM | #3 | |
I would use RtC but I don't want people to have to run a separate program to play the map. Everything is working fine except that it seems like I'm running out of space for information storage which is absurd with the 8k limit. But here's a snip-it of my Trackable Code. JASS:function NewTrackable takes string path, real x, real y, integer TempX, integer TempY, player owner returns trackable local trackable T local string invisible = "" if GetLocalPlayer() != owner then set path = invisible endif set T = CreateTrackable(path,x,y,0) call StoreInteger(gc, I2S(TempX),I2S(TempY), H2I(T)) call StoreInteger(gc, I2S(H2I(T)),"X", TempX) call StoreInteger(gc, I2S(H2I(T)),"Y", TempY) call StoreReal(gc, I2S(H2I(T)),"RealX", x) call StoreReal(gc, I2S(H2I(T)),"RealY", y) call StoreInteger(gc, I2S(H2I(T)), "Player", GetPlayerId(owner)) call TriggerRegisterTrackableTrackEvent(Hover,T) call TriggerRegisterTrackableHitEvent(Click,T) return T endfunction That's run for players 1-4. I'm also using alot of Structs to hold unit Class data, so I'm not sure if that's part of the problem to?
|
| 04-07-2008, 10:11 AM | #4 |
Mayhaps you're hitting the OP limit. Can you post your code that places all the trackables, please? |
| 04-07-2008, 08:09 PM | #5 | |
Quote:
JASS:set p = 0 loop exitwhen p > 3 set T = NewTrackable("Doodads\\Terrain\\InvisiblePlatform\\InvisiblePlatform.mdl",GetRectCenterX(GridSquare),GetRectCenterY(GridSquare),TempX,TempY,Player(p)) set p=p+1 endloop |
| 04-07-2008, 10:21 PM | #6 |
You need another loop other than that. Where's the loop that calls that function/loop? Since making a grid requires more than one position... How many of these things are you creating? |
| 04-07-2008, 10:48 PM | #7 | |
Quote:
As I said I have a 13x13 grid, so it's calling this at every position. So that's 4 tracakbles at each grid position, 169 grid positions (13*13), 676 trackables. |
| 04-07-2008, 11:13 PM | #8 |
~ may hit the limit BUT run war3 with war3err it will tell you if you have some problems... if not so post the map/code. |
| 04-08-2008, 12:44 AM | #9 |
Hmm it looks like I hit the op limit... Is there anyway around this, what all counts towards the op limit? |
| 04-08-2008, 12:59 AM | #10 | |
Quote:
|
| 04-08-2008, 01:07 AM | #11 |
Damn....what is the limit, cause I get this error right at the start and I'm not even half done with my system. Ive attached the map to the first post, maybe someone can find somewhere I can tidy up some functions or something :( |
| 04-08-2008, 01:09 AM | #12 |
What you should do is outsource the bulk of your system's work to different threads. Try using call ExecuteFunc("...") and get most of the trackables organized in those callbacks. You can pass anything you want to those functions by temp globals. |
| 04-08-2008, 09:14 AM | #13 |
JASS:globals integer TempX_BX=0 integer TempY_BX=0 rect GridSquare_BX=null real startx_BX=0 real starty_BX=0 endglobals function setup_exec takes nothing returns nothing local integer TempX = TempX_BX local integer TempY = TempY_BX local real gridx local real gridy local unit U local trackable T local integer Index local integer p set gridx = startx_BX + (GRID_SIZE * (TempX-1)) set gridy = starty_BX + (GRID_SIZE * (TempY-1)) call MoveRectTo(GridSquare_BX,gridx + (GRID_SIZE / 2) , gridy + (GRID_SIZE / 2) ) if (GetPathable(gridx,gridy) == true ) then set p = 0 loop exitwhen p > 1 set T = NewTrackable("Doodads\\Terrain\\InvisiblePlatform\\InvisiblePlatform.mdl",GetRectCenterX(GridSquare_BX),GetRectCenterY(GridSquare_BX),TempX,TempY,Player(p)) set p=p+1 endloop set Index = GetIndexImage() set Image[Index] = CreateImage("tile.blp", GRID_SIZE, GRID_SIZE, 0, gridx,gridy, 0, 0, 0, 0, 2) call SetImageColor( Image[Index], 0, 0, 100, 95 ) call SetImageRenderAlways(Image[Index], true) call ShowImage(Image[Index], false) //Setup GC Holders=================================================== call StoreInteger(gc, I2S(TempX)+"Image",I2S(TempY)+"Image", Index) call StoreBoolean(gc, "Image",I2S(Index), false) //=================================================================== endif set U = null endfunction struct Grid real X real Y static integer MaxX static integer MaxY //static unit array Pos[255] static method setup takes integer cellwidth, integer cellheight, real startx, real starty returns nothing local rect GridSquare = Rect(startx,starty,startx + GRID_SIZE, starty + GRID_SIZE) local integer TempX = 1 local integer TempY = 1 local real gridx local real gridy local unit U local trackable T local integer Index local integer p set GridArena[1] = Grid.create() set Grid.MaxX = cellwidth set Grid.MaxY = cellheight set startx_BX=startx set starty_BX=starty set GridSquare_BX=GridSquare loop exitwhen TempX > cellwidth loop exitwhen TempY > cellheight set TempX_BX=TempX set TempY_BX=TempY call ExecuteFunc("setup_exec") set TempY = TempY + 1 endloop set TempX = TempX + 1 set TempY = 1 endloop set GridSquare = null endmethod endstruct fixed... at least it doesnt hit the op limit (and it does) |
