Age : 30 Inscrit le : 22/11/2008 Messages : 3382
| Sujet: Incompatibilité de 2 scripts Mer 23 Juin 2010 - 12:03 | |
| B'jour, J'viens poster ici parce qu'une incompatibilité entre deux scripts est intervenue dans mon projet. En effet, j'utilise un script (partagé en trois parties) permettant de créer des ombres aux évènements. Une de ces trois parties permet de disposer les ombres sur uniquement certains tiles. (Si j'ai bien compris). Voici le script en question : - Spoiler:
- Code:
-
#============================================================================== # ** Spriteset_Map #------------------------------------------------------------------------------ # This class edits problems cause by Sprite_Shadow and Sprite_Sun #============================================================================== class Spriteset_Map
#-------------------------------------------------------------------------- # * Alias Listings #-------------------------------------------------------------------------- alias create_parallax_original create_parallax alias dispose_parallax_original dispose_parallax alias create_viewports_original create_viewports alias update_viewports_original update_viewports alias dispose_viewports_original dispose_viewports alias update_tilemap_original update_tilemap alias dispose_tilemap_original dispose_tilemap #-------------------------------------------------------------------------- # * Create Parallax #-------------------------------------------------------------------------- def create_parallax @parallax = Plane.new(@viewport0) @parallax.z = -100 end #-------------------------------------------------------------------------- # * Create Viewport #-------------------------------------------------------------------------- def create_viewports create_viewports_original @viewport0 = Viewport.new(0,0,544,416) @viewport0.z = 1 @viewport1.z = 25 end #-------------------------------------------------------------------------- # * Create Tilemap #-------------------------------------------------------------------------- def create_tilemap @tilemap0 = Tilemap.new(@viewport0) @tilemap0.bitmaps[0] = Cache.system("TileA1", "2tileA1") @tilemap0.bitmaps[1] = Cache.system("TileA2", "2tileA2") @tilemap0.bitmaps[4] = Cache.system("TileA5", "2tileA5") @tilemap0.map_data = $game_map.data @tilemap0.passages = $game_map.passages @tilemap = Tilemap.new(@viewport1) @tilemap.bitmaps[2] = Cache.system("TileA3", "2tileA3") @tilemap.bitmaps[3] = Cache.system("TileA4", "2tileA4") @tilemap.bitmaps[5] = Cache.system("TileB") @tilemap.bitmaps[6] = Cache.system("TileC") @tilemap.bitmaps[7] = Cache.system("TileD") @tilemap.bitmaps[8] = Cache.system("TileE") @tilemap.map_data = $game_map.data @tilemap.passages = $game_map.passages end #-------------------------------------------------------------------------- # * Update Tilemap #-------------------------------------------------------------------------- def update_tilemap @tilemap0.ox = $game_map.display_x / 8 @tilemap0.oy = $game_map.display_y / 8 @tilemap0.update update_tilemap_original end #-------------------------------------------------------------------------- # * Dispose Parallax #-------------------------------------------------------------------------- def dispose_parallax @tilemap0.dispose dispose_parallax_original end #-------------------------------------------------------------------------- # * Dispose Viewports #-------------------------------------------------------------------------- def dispose_viewports @viewport0.dispose dispose_viewports_original end #-------------------------------------------------------------------------- # * Dispose Tilemap #-------------------------------------------------------------------------- def dispose_tilemap @tilemap0.dispose dispose_tilemap_original end end
Le deuxième script est un équivalent du Tileset Editor mais en plus pratique. Le Swap_Tiles, que voici: - Spoiler:
- Code:
-
=begin Swap Tileset with new passage setting
Version: 0.4 Author: BulletXt (bulletxt@gmail.com) Date: 13/06/2009
This scripts makes you:
a) Swap a tileset at any time b) you can swap all tilesets or n tilesets c) you can load a new passage setting any time you want
How it works: Create a folder named "extra_tiles" inside Graphics/System. Place your new tilesets there. They can be named as you like. Before doing a map transfer, do a simple callscript inside the event like this: $tileA1 = "fileName"
Replace "fileName" with the tileset you want to change. In that example, it will swap tile set A1. You can swap all tilesets or just some of them. For example you can swap TileA1, TileA4 and TileE doing as said above: $tileA1 = "fileName" $tileA4 = "fileName" $tileE = "fileName"
Immediately after the script call/s inside event, turn the SWAP_TILE switch ON (this can be set below). To reset default tileset, before a map transfer simply turn the switch to OFF.
This said, you can also load a new passage setting. Simply open a new project, set the passagesettings as you want, save and close. Get into Data folder and copy System.rvdata to your real project. Paste it always inside "extra_tiles" and rename it to anything you want. Be sure file extension ends with ".rvdata" . Example: System.rvdata is renamed to: pub.rvdata
Passage setting gets loaded exactly like tilesets, this means that first you do the script call inside event and then you turn the LOAD_PASSAGE_SETTING switch ON(this can be set below). You can load a new passage setting without swapping any tiles. The 2 things are totally indipendent. The script call to load a passage setting is like this: $swap_passages = "filePassage" Replace filePassage with the passage setting file you want to load.
By simply turning both switches to OFF, you automatically reset passage setting to default one and reset all tilesets to default. If instead you want to do a map transfer and keep your swapped tilesets but want to reset only TileA3,simply do a script call of this type: $tileA3 = nil Same behaviour is for passage setting, simply set: $swap_passages = nil and that will reset passage setting to default.
Tricks:
- you can create a special effect as seen in the demo. For example, you can make a tile swap without doing a map transfer. You can for instance make a wall change real time its tile! To do this, do the normal call for swapping (callscript + switch ON), then immediatley after do this callscript: $game_map.tileset This callscript will reload the map (screen freezes for 30 milliseconds) so the final effect is that the wall has magically a new tile! Same thing is for passagesetting, you can load a new passage setting in real time by simply doing (callscript + switch ON) and then $game_map.tileset.
=end
############################# CONFIGURATION ####################################
# This is a switch ID, if ON it calls the swapping system. This is # used for swapping/resetting tile sets. THIS DOES NOT CHANGE PASSAGE SETTINGS. # Be sure to turn the switch ON only after doing the callscript (as said above). SWAP_TILE = 13
# This is a switch ID, if ON it calls the passage setting system. This is # used for loading/resetting new passage settings. # THIS DOES NOT SWAP TILE SETS. # Be sure to turn the switch ON only after doing the callscript (as said above). LOAD_PASSAGE_SETTING = 14
########################## END CONFIGURATION ###################################
#============================================================================== # ** Cache
module Cache_Swap_Tiles #-------------------------------------------------------------------------- # * Get Character Graphic # filename : Filename #-------------------------------------------------------------------------- def self.swap(filename) load_bitmap("Graphics/System/extra_tiles/", filename) end #-------------------------------------------------------------------------- # * Clear Cache #-------------------------------------------------------------------------- def self.clear @cache = {} if @cache == nil @cache.clear GC.start end #-------------------------------------------------------------------------- # * Load Bitmap #-------------------------------------------------------------------------- def self.load_bitmap(folder_name, filename, hue = 0) @cache = {} if @cache == nil path = folder_name + filename if not @cache.include?(path) or @cache[path].disposed? if filename.empty? @cache[path] = Bitmap.new(32, 32) else @cache[path] = Bitmap.new(path) end end if hue == 0 return @cache[path] else key = [path, hue] if not @cache.include?(key) or @cache[key].disposed? @cache[key] = @cache[path].clone @cache[key].hue_change(hue) end return @cache[key] end end end
#initialize global variables $tileA1 = nil $tileA2 = nil $tileA3 = nil $tileA4 = nil $tileA5 = nil $tileB = nil $tileC = nil $tileD = nil $tileE = nil $swap_passages = nil ################################################################################ class Game_Map include Cache_Swap_Tiles alias bulletxt_goodbye_vx_limit_tile_setup setup def setup(map_id) #if false, normal vx behavior and exit if $game_switches[LOAD_PASSAGE_SETTING] == false bulletxt_goodbye_vx_limit_tile_setup(map_id) $swap_passages = nil return end path = "Graphics/System/extra_tiles/" + $swap_passages.to_s() + ".rvdata" rescue nil
if $swap_passages != nil
@map_id = map_id @map = load_data(sprintf("Data/Map%03d.rvdata", @map_id)) @display_x = 0 @display_y = 0 # load system settings from that file new_system_rvdata = load_data(path) # Use passage settings from that file @passages = new_system_rvdata.passages #default vx code referesh_vehicles setup_events setup_scroll setup_parallax @need_refresh = false else bulletxt_goodbye_vx_limit_tile_setup(map_id) end end #if here, player has done a $game_map.tileset call. It must reload #map with new passage setting (if it exists) and upate map. def tileset #if false, we must update and load default passage if $game_switches[LOAD_PASSAGE_SETTING] == false @passages = $data_system.passages else #if nil, must reset passage setting to default if $swap_passages == nil @passages = $data_system.passages $scene = Scene_Map.new return end path = "Graphics/System/extra_tiles/" + $swap_passages + ".rvdata" rescue nil # load system settings from that file new_system_rvdata = load_data(path) # Use passage settings from that file @passages = new_system_rvdata.passages end #this updates the map tiles. it does not modify events or anything else. $scene = Scene_Map.new end end
class Spriteset_Map include Cache_Swap_Tiles alias bulletxt_lodestone_create_tilemap create_tilemap def create_tilemap if $game_switches[SWAP_TILE] == false bulletxt_lodestone_create_tilemap $tileA1 = nil $tileA2 = nil $tileA3 = nil $tileA4 = nil $tileA5 = nil $tileB = nil $tileC = nil $tileD = nil $tileE = nil else bulletxt_lodestone_create_tilemap path_to_graphic = "extra_tiles/"
#tileA1 tile1 = Cache_Swap_Tiles.swap($tileA1 + ".png") rescue nil @tilemap.bitmaps[0] = tile1 if $tileA1 != nil#if FileTest.exist?(path_to_graphic + $tileA1.to_s() + ".png") #tileA2 tile2 = Cache_Swap_Tiles.swap($tileA2 + ".png") rescue nil @tilemap.bitmaps[1] = tile2 if $tileA2 != nil#if FileTest.exist?(path_to_graphic + $tileA2.to_s() + ".png") #tileA3 tile3 = Cache_Swap_Tiles.swap($tileA3 + ".png") rescue nil @tilemap.bitmaps[2] = tile3 if $tileA3 != nil#if FileTest.exist?(path_to_graphic + $tileA3.to_s() + ".png") #tileA4 tile4 = Cache_Swap_Tiles.swap($tileA4 + ".png") rescue nil @tilemap.bitmaps[3] = tile4 if $tileA4 != nil#if FileTest.exist?(path_to_graphic + $tileA4.to_s() + ".png") #tileA5 tile5 = Cache_Swap_Tiles.swap($tileA5 + ".png") rescue nil @tilemap.bitmaps[4] = tile5 if $tileA5 != nil#if FileTest.exist?(path_to_graphic + $tileA5.to_s() + ".png") #tileB tile6 = Cache_Swap_Tiles.swap($tileB + ".png") rescue nil @tilemap.bitmaps[5] = tile6 if $tileB != nil#if FileTest.exist?(path_to_graphic + $tileB.to_s() + ".png") #tileC tile7 = Cache_Swap_Tiles.swap($tileC + ".png") rescue nil @tilemap.bitmaps[6] = tile7 if $tileC != nil#if FileTest.exist?(path_to_graphic + $tileC.to_s() + ".png") #tileD tile8 = Cache_Swap_Tiles.swap($tileD + ".png") rescue nil @tilemap.bitmaps[7] = tile8 if $tileD != nil#if FileTest.exist?(path_to_graphic + $tileD.to_s() + ".png") #tileE tile9 = Cache_Swap_Tiles.swap($tileE + ".png") rescue nil @tilemap.bitmaps[8] = tile9 if $tileE != nil#if FileTest.exist?(path_to_graphic + $tileE.to_s() + ".png")
end
end
end
class Scene_File < Scene_Base alias bulletxt_swap_tiles_write_save_data write_save_data def write_save_data(file) bulletxt_swap_tiles_write_save_data(file) Marshal.dump($tileA1, file) Marshal.dump($tileA2, file) Marshal.dump($tileA3, file) Marshal.dump($tileA4, file) Marshal.dump($tileA5, file) Marshal.dump($tileB, file) Marshal.dump($tileC, file) Marshal.dump($tileD, file) Marshal.dump($tileE, file) Marshal.dump($swap_passages.to_s(), file) end alias bulletxt_swap_tiles_read_save_data read_save_data def read_save_data(file) bulletxt_swap_tiles_read_save_data(file) $tileA1 = Marshal.load(file) $tileA2 = Marshal.load(file) $tileA3 = Marshal.load(file) $tileA4 = Marshal.load(file) $tileA5 = Marshal.load(file) $tileB = Marshal.load(file) $tileC = Marshal.load(file) $tileD = Marshal.load(file) $tileE = Marshal.load(file) $swap_passages = Marshal.load(file) end end
Voila, je voudrais savoir si l'incompatibilité pourrait être réglée ou non .. Ce script pour les ombres est assez important, car il permet de ne pas les disposer partout (Donc pas sur les toits et toussa). Le Swap_Tile marche grâce à un dossier nommé "extra_tile" créé dans le dossier System, où l'on dispose les nouveaux tiles, puis grâce à quelques évents faisant des appels de script, on peut arriver à changer de tiles. On change aussi la praticabilité en appel de script, après avoir enregistré un fichier contenant la praticabilité voulue dans le même dossier. Voila voila .. EDIT : J'ai oublié de préciser que.. Y a aucun message d'erreur. Simplement, si ces deux scripts sont ensemble dans le projet, le Swap_Tiles ne marchera pas. |
|
Admindictatrice
Age : 34 Inscrit le : 27/02/2009 Messages : 2855
| Sujet: Re: Incompatibilité de 2 scripts Mar 27 Juil 2010 - 13:29 | |
| Un scripteur pour répondre à mamour (si son problème est toujours d'actualité ?) |
|
Age : 30 Inscrit le : 22/11/2008 Messages : 3382
| Sujet: Re: Incompatibilité de 2 scripts Lun 2 Aoû 2010 - 18:26 | |
| Bin j'ai laissé de côté le script des ombres, mais ça peut toujours être intéressant de savoir si cette incompatibilité peut être contournée ^^ |
|
Maître des Duels
Age : 32 Inscrit le : 29/07/2009 Messages : 7841
| Sujet: Re: Incompatibilité de 2 scripts Lun 2 Aoû 2010 - 18:42 | |
| Elle peut surement mais il te faudra l'aide d'un scripteur de haut niveau avec du temps pour la contourner.
Le problème étant que ces deux scripts ne sont pas fait pour marcher ensemble. Peut être en mettant le script des ombre au dessus du script swap_tiles ? Mais bon je garantis pas le résultat du tout.
Si tu utilises un script de multi-tile, ne t'attend pas a pouvoir utilise un script qui modifie quelques chose a propos des tiles et des maps.
Après tu peux aussi abandonner le multi-tile et passer à un autre style de mapping... ( normal, panorama, event, ou autre ) |
|
| Sujet: Re: Incompatibilité de 2 scripts | |
| |
|