Jump to content

TheNicestGuy

Member
  • Posts

    9
  • Joined

  • Last visited

TheNicestGuy's Achievements

  1. RoboMat, that did not fix the error, but it does raise questions that will probably get me there. But first, I discovered something fascinating. Having the Coordinate Viewer mod enabled makes the numbers involved very, very different. With Coordinate Viewer wX = 11640 wY = 6611 Without Coordinate Viewer, same code, player beginning in the exact same spot wX = 370 wY = 18 Could I possibly be running into some name collision between the mods, or does this mean Coordinate Viewer changes the behaviour of ISCoordConversion.ToWorld()? Anyway, even though the modulo-by-300 of those numbers is quite different, the result is the same: gridSquare is still nil. So your answer implies that an IsoCell is a section of the map which is 300 x 300 IsoGridSquares. If so, then calling getWorld():getCell() during OnGameStart does what, gets the cell that the player is currently in? This wouldn't explain why getGridSquare() still wouldn't work with coordinates that are less than 300, but it does mean I'm probably going about this the wrong way. A later milestone is to randomly choose, from a list of say five or six fixed locations, two or three at the beginning of a game. A boat will appear at each of those. Rather than directly planting boats in OnGameStart, should I be doing the choosing and the math in some one-time event (OnInitWorld, maybe?), storing the results, then testing each time the player enters a new cell (OnPostMapLoad, maybe?) whether that cell contains a boat and plant it at the correct cell-relative coordinates?
  2. I'm working on my first mod, as an experienced programmer but Lua newbie. My first milestone is to have a boat appear in the boathouse. This is my mockup with an awful-looking placeholder boat: So I've got PNGs of the boat chopped up into ten iso squares, each 64x128. Using both the SprayPaint mod by Thuztor and Peanuts and turbotutone's World Object tutorial as a guide, I threw together the following code to try to get one piece of the boat to appear. The coords 11303 x 6587 are what RoboMat's Coordinate Viewer shows as the mouse coordinates when I click the square inside the boathouse I want to use. When this runs, I get this output: So it seems clear that the problem is that cell:getGridSquare() is returning nil unexpectedly, but I'm little at sea as to why. My main question is obviously if anyone can spot what I'm doing wrong or offer further troubleshooting leads. But since I'm sure this is some rookie mistake because I really don't know what I'm doing yet, here are some other questions whose answers would edify me greatly: What are the various coordinate systems, in which contexts are they used, and how do they differ?What exactly is the IsoCell that getWorld():getCell() returns? It doesn't seem to be any particular piece of the map, so what's its point?Also one other interesting, relevant point: The World Object tutorial itself does not work. I assume this is just because it got outmoded by a new release, but in any case its error is not quite the same as mine. It seems to be caused by a failure to populate a sprite into an object.
×
×
  • Create New...