Bonjour/soir à tous ! Je viens vous partager un script que j'ai trouvé et qui est fort intéressant.
L’intérêt réside dans le fait qu'il est possible avec ce script de posséder une infinité de tag, nous ne sommes donc plus limiter à 8 Tag Terrains (0 à 7).
Code: |
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:= # Unlimited Terrain Tags Script by Nathmatt # Version: 1.00 # Type: Add On #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:= # # This work is protected by the following license: # #---------------------------------------------------------------------------- # # # # Creative Commons - Attribution-NonCommercial-ShareAlike 3.0 Unported # # ( http://creativecommons.org/licenses/by-nc-sa/3.0/ ) # # # # You are free: # # # # to Share - to copy, distribute and transmit the work # # to Remix - to adapt the work # # # # Under the following conditions: # # # # Attribution. You must attribute the work in the manner specified by the # # author or licensor (but not in any way that suggests that they endorse you # # or your use of the work). # # # # Noncommercial. You may not use this work for commercial purposes. # # # # Share alike. If you alter, transform, or build upon this work, you may # # distribute the resulting work only under the same or similar license to # # this one. # # # # - For any reuse or distribution, you must make clear to others the license # # terms of this work. The best way to do this is with a link to this web # # page. # # # # - Any of the above conditions can be waived if you get permission from the # # copyright holder. # # # # - Nothing in this license impairs or restricts the author's moral rights. # # # #---------------------------------------------------------------------------- # #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:= # Instrutions: # Scroll down to the config and add terrain_tags by adding these to the config # module (Unlimited_Terrain_Tags.add_terrains(tileset_id,x,y,terrain_tag)) # # tileset_id - is the tilsets id # x,y - is the location on the tile set # terrain_tag - is the terrain_tag for that tile # # To get the x and y think of the tilset as the map and the x and y are each block # dont count the auto tiles. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:= module Unlimited_Terrain_Tags # dont touch any of this $terrains = [] class Terrains attr_reader :tileset_id,:tile_id,:terrain_tag def initialize(tileset_id,tile_id,terrain_tag) @tileset_id,@tile_id,@terrain_tag = tileset_id,tile_id,terrain_tag end end def self.get_tile_id(x,y) return((y*8)+x)+384 end def self.add_terrains(tileset_id,x,y,terrain_tag) $terrains.push(Terrains.new(tileset_id,self.get_tile_id(x,y),terrain_tag)) end #============================================================================ # MCES::Config #---------------------------------------------------------------------------- # The configuration for Unlimited Terrain Tags #============================================================================ module Config # add terrain tags here #Unlimited_Terrain_Tags.add_terrains(tileset_id,x,y,terrain_tag) end def self.get_terrain_tag(tileset_id,tile_id) $terrains.each {|terrain| if [tileset_id,tile_id] == [terrain.tileset_id,terrain.tile_id] return terrain.terrain_tag end} return 0 end end class Game_Map def terrain_tag(x, y) if @map_id != 0 [2, 1, 0].each{|i| tile_id = data[x, y, i] if tile_id == nil return 0 else t = Unlimited_Terrain_Tags.get_terrain_tag(@map.tileset_id,tile_id) return t if t > 0 return @terrain_tags[tile_id] if @terrain_tags[tile_id] > 0 end} end return 0 end end |
Mais comment marche ce script ?Il suffit juste d'aller à la ligne 83. Pour ajouter de nouveaux tags, il faut écrire ceci : Unlimited_Terrain_Tags.add_terrains(tileset_id,x,y,terrain_tag).
Vous pouvez en ajouter autant que vous le voulez.
Tileset_id correspond au numéro de votre tileset dans votre BDD, x et y correspondent aux carreaux verticaux et horizontaux, et terrain_tag par le tag terrain que vous voulez attribuer à ce tile.
ATTENTION : la ligne des autotiles ne comptent pas ! Il faut donc commencer à compter à partir de la 1ère ligne de votre tileset.
De plus, la première ligne et la première colonne compte pour 0.
Voilà un petit schéma explicatif, au cas ou :
De plus, ce script ne marche pas avec les autotiles.
Voilà, j'espère que vous avez compris, si toutefois vous n'y arrivez toujours pas, postez un message ici.