Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

[Resolved] How do I find a map's tileset ID and store it?

Status
Not open for further replies.
How do I find a map's tileset ID and store it into a variable?

I'm using ccoa's Tileset Swap for the new version of my Dynamic Time System as a method to automatically change the tileset used according to the season generated by the system.

My post from before":1eaf90s5 said:
Hmm, actually, I've just tried to implement this into the DTS, but in order for it to function I need to retrieve the tileset ID of the map before I call your script.

Basically, at the moment, I'm calling your script with
$game_map.change_tileset($game_variables 
 
 
Can't use the first method- this stuff will be happening in a common event, and there is no real way of knowing what map is currently there; unless I force it to also retrieve the current map id.

Second way throws a NoMethodError, undefined method 'tileset_id' in Game_Map. I'm fairly certain I tried this way to no avail before.
 
Just add the following code above main.
Code:
class Game_Map
  #--------------------------------------------------------------------------
  # * Get Tileset_id
  #--------------------------------------------------------------------------
  def tileset_id
    return @map.tileset_id
  end
end
Now you can use
Code:
$game_variables[x] = $game_map.tileset_id
in an event command to store the tileset id.
That should do it.
 
Yeah, a bit of fiddling and that worked. (I was hoping to find a non- scripting solution, but never mind) I've added the definition to Game_map class already in ccoa's script for ease in the DTS. Thankyou Icarus Featherfight, I'll credit you, if you'd like.

Mods can close, if they like.
 
Status
Not open for further replies.

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top