| 07-14-2009, 01:09 PM | #1 |
Hello and thank-you for opening this thread. I was wondering if it were possible to have say 10 or so arrays per index for another array if that makes any sense. E.G. I have 81 different Island on my map each having it's own: - Lumber productivity - Fish productivity (Higher increase income gain.) - X Target for colonizing new island - Y Target for colonizing new island (Well what I'm kinda trying to do is like making a mini database for each island I guess :S.) The way I'm trying this is not working at all. So far I've managed to replicate the setting of Coordinates from each 'Town Hall' but once i've colonized another Island I am unable to get the new Town Hall to select and colonize according to it's displayed Coordinates (Using coordinates from first Town Hall.) (What I'm trying to do is replicate the map Space Command but make it my own, with battleships and such also it will be more exciting as it can actually be won?) I've attached the Space Command map to give you all an idea of what I'm trying to do. Once again, thank-you for whomever replies. :) |
| 07-14-2009, 01:56 PM | #2 |
An array of structs would actually do just this. Make a new struct in an array for each island, and then in each struct just input the data you need. Example...ish JASS:struct IslandData integer LumberProd integer FishProd real ColonizeX real ColonizeY static method create takes integer lumber, integer fish, real x, real y returns IslandData local IslandData dat = IslandData.allocate set dat.LumberProd = lumber set dat.FishProd = fish set dat.ColonizeX = x set dat.ColonizeY = y return dat endmethod endstruct Then when you want to "make" the island, just do this: JASS:function Blah takes nothing returns nothing //Stuff set ArrayOfIslandStructs[1] = IslandData.Create(whatever, whatever, x, y) //Other stuff endfunction You'd need a global array of IslandData's for this to work. To access that data: JASS:function Bloo takes nothing returns nothing local real x local real y local IslandData dat //Stuff to determine which island you're getting data from set dat = ArrayOfIslandStructs[1] set x = dat.ColonizeX set y = dat.ColonizeY //other stuff Hope that helps you! |
| 07-14-2009, 02:36 PM | #3 |
Thank-you Darkwulv for taking the time for helping me. I would also like to thank D3zmodos and Deaod for helping in IRC. +rep for the helpful info Darkwulv (Because you explained it very clearly especially for a novice such as myself.) |
| 07-14-2009, 02:50 PM | #4 |
No problem, glad I could help. |
| 07-14-2009, 05:24 PM | #5 |
Quick note before I forget, because I made a typo: To create an island, use IslandData.create(number, number, x, y). The one I had before had 'create' as 'Create', which would give you a syntax error. Oops. |
| 07-15-2009, 01:16 AM | #6 |
Haha that's ok, I fixed that up anyway and local IslandData dat = IslandData.allocate should have been local IslandData dat = IslandData.allocate() Although thank-you for your concern :) |
