- Joined
- Feb 16, 2014
- Messages
- 4
- Reaction score
- 5
- First Language
- English
- Primarily Uses
Trying to compile a useful list of native / semi native functions for scripting. Can't seem to find a good single page resource for this anywhere. Will add more as I progress. I am aware of the 14 page monstrosity floating around with content spread all over the place.
REGION MANIPULATION
setTileRegion(x,y,newID)
description: extends the game map class to be able to set tile regions in real time
typical usage: $game_map.setTileRegion(x,y)
getTileRegion(x,y)
description: extends the game map class to return the tile region at coordinate x,y on the map loaded into game map
typical usage:
@variablename = $game_map.getTileRegion(x,y)
class Game_Map def getTileRegion(reg_x,reg_y) # gets a 14 bit long binary string from the map data array @thirdvalue = "%14b" % self.data[reg_x, reg_y, 3] # binary split of the two elements @bLEFT = @thirdvalue[0,6] # REGION ID IN BINARY @bRIGHT = @thirdvalue[6,8] # SHADOW ID IN BINARY # converts the binary string back to an integer and returns return(@bLEFT.to_i(2)) endend
getShadowID(x,y)
description: extends the game map class to return the shadow tile ID at coordinate x,y on the map loaded into game map
typical usage:
@variablename = $game_map.getShadowID(x,y)
class Game_Map def getTileShadowID(reg_x,reg_y) # gets a 14 bit long binary string from the map data array @thirdvalue = "%14b" % self.data[reg_x, reg_y, 3] # returns binary split of the two elements @bLEFT = @thirdvalue[0,6] # REGION ID IN BINARY @bRIGHT = @thirdvalue[6,8] # SHADOW ID IN BINARY # converts the binary string back to an integer and returns return(@bRIGHT.to_i(2)) endend
MAP MANIPULATION
getTileIDByLayer(x,y,layer)
description:
returns the tile ID stored in the map database. These are the internal ID's that the engine uses to refer to tiles. Autotiles can have anywhere up to 50 variants! More useful for checking if scenery items are ona tile than checking if a ground type is of a certain variety. Layer0 is the ground layer, Layer1 is the mask layer that overlays Layer0's and Layer2 is the object layer for A5-B,C,D,E.
typical usage:
@variablename = $game_map.getTileIDByLayer(x,y,layer)
class Game_Map def getTileIDByLayer(x,y,layer) return(self.data[x,y,layer]) endendsetTileIDByLayer(x,y,layer,tile_ID)
description:
sets the tile ID of a specified tile on the map to temporarily display on screen. This is temporary only because it does not update the saved map data, only the copy in memory that is temporary. Changing map, loading,saving etc will all refresh this value and cause the map to revert to its state in the game editor.
tile_ID is the internal ID's that the engine uses to refer to tiles. Autotiles can have anywhere up to 50 variants! More useful for temporary spell effects, puzzles than permenant world changes.
Layer0 is the ground layer, Layer1 is the mask layer that overlays Layer0's and Layer2 is the object layer for A5-B,C,D,E.
typical usage:
$game_map.setTileIDByLayer(57,32,1,1069)
class Game_Map def setTileIDByLayer(x,y,layer,tile_ID) self.data[x,y,layer] = tile_ID endendSAVABLE MAP MANIPULATION
Strongly recommend the following script:
Title: Tile Swap
Author: Tsukihime, Rycochet
(just google it, better than me posting dead links here, fantastic script I couldnt recommend more highly)
combined with the below additional command:
changeTileByInternalID(map_id,x,y,layer,intID)
description:
sets the tile ID of a specified tile on the map_id number permenantly to another value.
The script linked above does 99% of the heavy lifting here as far as retaining data between games, autotiles etc.
tile_ID is the internal ID's that the engine uses to refer to tiles. Autotiles can have anywhere up to 50 variants!
Layer0 is the ground layer, Layer1 is the mask layer that overlays Layer0's and Layer2 is the object layer for A5-B,C,D,E.
typical usage:
$game_system.changeTileByInternalID($game_map.map_id, x, y, layer, tile_ID)
dependency:
Title: Tile Swap
Author: Tsukihime, Rycochet
REGION MANIPULATION
setTileRegion(x,y,newID)
description: extends the game map class to be able to set tile regions in real time
typical usage: $game_map.setTileRegion(x,y)
class Game_Map def setTileRegion(reg_x,reg_y,reg_id) if reg_id > 63 || reg_id < 0 reg_id = 0 end @thirdvalue = "%14b" % self.data[reg_x, reg_y, 3] # binary split of the two elements @bLEFT = @thirdvalue[0,6] # REGION ID IN BINARY @bRIGHT = @thirdvalue[6,8] # SHADOW ID IN BINARY @bLEFT = "%6b" % reg_id @newvalue = @bLEFT.to_s + @bRIGHT.to_s @newvalue = @newvalue.to_i(2) self.data[reg_x, reg_y, 3] = @newvalue endend
getTileRegion(x,y)
description: extends the game map class to return the tile region at coordinate x,y on the map loaded into game map
typical usage:
@variablename = $game_map.getTileRegion(x,y)
class Game_Map def getTileRegion(reg_x,reg_y) # gets a 14 bit long binary string from the map data array @thirdvalue = "%14b" % self.data[reg_x, reg_y, 3] # binary split of the two elements @bLEFT = @thirdvalue[0,6] # REGION ID IN BINARY @bRIGHT = @thirdvalue[6,8] # SHADOW ID IN BINARY # converts the binary string back to an integer and returns return(@bLEFT.to_i(2)) endend
getShadowID(x,y)
description: extends the game map class to return the shadow tile ID at coordinate x,y on the map loaded into game map
typical usage:
@variablename = $game_map.getShadowID(x,y)
class Game_Map def getTileShadowID(reg_x,reg_y) # gets a 14 bit long binary string from the map data array @thirdvalue = "%14b" % self.data[reg_x, reg_y, 3] # returns binary split of the two elements @bLEFT = @thirdvalue[0,6] # REGION ID IN BINARY @bRIGHT = @thirdvalue[6,8] # SHADOW ID IN BINARY # converts the binary string back to an integer and returns return(@bRIGHT.to_i(2)) endend
MAP MANIPULATION
getTileIDByLayer(x,y,layer)
description:
returns the tile ID stored in the map database. These are the internal ID's that the engine uses to refer to tiles. Autotiles can have anywhere up to 50 variants! More useful for checking if scenery items are ona tile than checking if a ground type is of a certain variety. Layer0 is the ground layer, Layer1 is the mask layer that overlays Layer0's and Layer2 is the object layer for A5-B,C,D,E.
typical usage:
@variablename = $game_map.getTileIDByLayer(x,y,layer)
class Game_Map def getTileIDByLayer(x,y,layer) return(self.data[x,y,layer]) endendsetTileIDByLayer(x,y,layer,tile_ID)
description:
sets the tile ID of a specified tile on the map to temporarily display on screen. This is temporary only because it does not update the saved map data, only the copy in memory that is temporary. Changing map, loading,saving etc will all refresh this value and cause the map to revert to its state in the game editor.
tile_ID is the internal ID's that the engine uses to refer to tiles. Autotiles can have anywhere up to 50 variants! More useful for temporary spell effects, puzzles than permenant world changes.
Layer0 is the ground layer, Layer1 is the mask layer that overlays Layer0's and Layer2 is the object layer for A5-B,C,D,E.
typical usage:
$game_map.setTileIDByLayer(57,32,1,1069)
class Game_Map def setTileIDByLayer(x,y,layer,tile_ID) self.data[x,y,layer] = tile_ID endendSAVABLE MAP MANIPULATION
Strongly recommend the following script:
Title: Tile Swap
Author: Tsukihime, Rycochet
(just google it, better than me posting dead links here, fantastic script I couldnt recommend more highly)
combined with the below additional command:
changeTileByInternalID(map_id,x,y,layer,intID)
description:
sets the tile ID of a specified tile on the map_id number permenantly to another value.
The script linked above does 99% of the heavy lifting here as far as retaining data between games, autotiles etc.
tile_ID is the internal ID's that the engine uses to refer to tiles. Autotiles can have anywhere up to 50 variants!
Layer0 is the ground layer, Layer1 is the mask layer that overlays Layer0's and Layer2 is the object layer for A5-B,C,D,E.
typical usage:
$game_system.changeTileByInternalID($game_map.map_id, x, y, layer, tile_ID)
dependency:
Title: Tile Swap
Author: Tsukihime, Rycochet
Code:
class Game_System def changeTileByInternalID(map_id,x,y,layer,intID) initialize_pos_list(map_id, layer) tid = intID @swapped_pos_tiles[map_id][layer][y] = [] if @swapped_pos_tiles[map_id][layer][y].nil? @swapped_pos_tiles[map_id][layer][y][x] = tid $game_map.load_new_map_data endend
Last edited by a moderator: