Jump to content
Rpg²S Forum
  • 0

Un problema con il Panorama Map Script


Zosimos
 Share

Question

Niente, l'RGSS è qualcosa che esula dalle mie possibilità.

Dunque, da qualche tempo mi sono interessato ad uno script (forse vietnamita) che ho trovato su un forum estero. Tale script consentirebbe di adottare due panorami come mappe: la prima come immagine di fondo, l'altra con gli elementi grafici destinati a mostrarsi sopra l'eroe (esempio cime di alberi, tetti, e tutto quello che ha Priority 2-5 nel chipset tradizionale).

Il sistema si compone di due script, uno per ciascun livello:

 

 

#==============================================================================
# ++ 一枚絵を背景化 ver. 1.00 ++
#  Script by パラ犬
#------------------------------------------------------------------------------
# パノラマ画像のスクロールをマップのスクロールと同期させ
# 背景画像として使えるようにします。
#==============================================================================

module PARA_PANORAMA

# パノラマのスクロールをマップと同期させる --- lୠđồng k젣ủa scroll của panorama v࠭ap
#( 0:しない 1:する 2:イベントスイッチで制御 ) --- ( 0 : ko lୠ 1 lୠ 2 d?vent switch để chế ngự)
FIX = 1
# スイッチ制御に使用するスイッチ番号 --- số hiệu switch sử dụng itch chế ngự
FIX_SWITCH = 999

# 画像ファイルの一括指定 --- sự chỉ định c??#7911;a file ảnh
#( PANORAMA[ マップID ] = ファイル名 ) --- ( PANORAMA[ map ID ] = tꮠfile)
PANORAMA=[]#←この行は削除しないでください --- kh?xn๼br /> PANORAMA[1] = "001-Sky01"
PANORAMA[2] = "002-Sky02"

end

# ↑ 設定項目ここまで --- thiết định hạng mục đến đ⹠
#------------------------------------------------------------------------------

#==============================================================================
# ■ Spriteset_Map
#==============================================================================

class Spriteset_Map

#--------------------------------------------------------------------------
# ● オブジェクト初期化 --- objet shokika
#--------------------------------------------------------------------------
alias initialize_parapano initialize
def initialize
initialize_parapano
#パノラマ画像を設定 --- panorama
if PARA_PANORAMA::PANORAMA[$game_map.map_id] != nil
$game_map.panorama_name = PARA_PANORAMA::PANORAMA[$game_map.map_id]
@panorama_name = $game_map.panorama_name
@panorama_hue = $game_map.panorama_hue
@panorama.bitmap = RPG::Cache.panorama(@panorama_name, @panorama_hue)
end
# フレーム更新 --- frame henshin
update
end
#--------------------------------------------------------------------------
# ● フレーム更新 --- frame henshin
#--------------------------------------------------------------------------
alias update_parapano update
def update
update_parapano
if PARA_PANORAMA::FIX == 1 or (PARA_PANORAMA::FIX==2 and $game_switches[PARA_PANORAMA::FIX_SWITCH])
# パノラマプレーンを更新 --- panorama plain 
@panorama.ox = $game_map.display_x / 4
@panorama.oy = $game_map.display_y / 4
end
end
end

 

e due

 

 

#==============================================================================
# ■ Game_Map
#------------------------------------------------------------------------------
#  处理地图的类。包含卷动以及可以通行的判断功能。
# 本类的实例请参考 $game_map 。
#==============================================================================
class Game_Map
attr_accessor :map
attr_accessor :map_id
end
#==============================================================================
# ■ Spriteset_Map
#------------------------------------------------------------------------------
#  处理地图画面活动块和元件的类。本类在
# Scene_Map 类的内部使用。
#==============================================================================

class Spriteset_Map
#--------------------------------------------------------------------------
# ● 初始化对像
#--------------------------------------------------------------------------
def initialize
# 生成显示端口
@viewport1 = Viewport.new(0, 0, 640, 480)
@viewport2 = Viewport.new(0, 0, 640, 480)
@viewport3 = Viewport.new(0, 0, 640, 480)
@viewport2.z = 200
@viewport3.z = 5000
# 生成元件地图
@tilemap = Tilemap.new(@viewport1)
@tilemap.tileset = RPG::Cache.tileset($game_map.tileset_name)
for i in 0..6
autotile_name = $game_map.autotile_names
@tilemap.autotiles[i] = RPG::Cache.autotile(autotile_name)
end
@tilemap.map_data = $game_map.data
@tilemap.priorities = $game_map.priorities
# 生成远景平面
@panorama = Plane.new(@viewport1)
@panorama.z = -1000
@panorama2 = Plane.new(@viewport1)
@panorama2.z = 3000 
# 生成雾平面
@fog = Plane.new(@viewport1)
@fog.z = 3000
# 生成角色活动块
@character_sprites = []
for i in $game_map.events.keys.sort
sprite = Sprite_Character.new(@viewport1, $game_map.events[i])
@character_sprites.push(sprite)
end
@character_sprites.push(Sprite_Character.new(@viewport1, $game_player))
# 生成天气
@weather = RPG::Weather.new(@viewport1)
# 生成图片
@picture_sprites = []
for i in 1..50
@picture_sprites.push(Sprite_Picture.new(@viewport2,
$game_screen.pictures[i]))
end
# 生成计时器块
@timer_sprite = Sprite_Timer.new
# 刷新画面
update
end
#--------------------------------------------------------------------------
# ● 释放
#--------------------------------------------------------------------------
def dispose
# 释放元件地图
@tilemap.tileset.dispose
for i in 0..6
@tilemap.autotiles[i].dispose
end
@tilemap.dispose
# 释放远景平面
@panorama.dispose

# 释放雾平面
@fog.dispose
# 释放角色活动块
for sprite in @character_sprites
sprite.dispose
end
# 释放天候
@weather.dispose
# 释放图片
for sprite in @picture_sprites
sprite.dispose
end
# 释放计时器块
@timer_sprite.dispose
# 释放显示端口
@viewport1.dispose
@viewport2.dispose
@viewport3.dispose
end
#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
def update
# 远景与现在的情况有差异发情况下
if @panorama_name != $game_map.panorama_name or
@panorama_hue != $game_map.panorama_hue
@panorama_name = $game_map.panorama_name
@panorama_hue = $game_map.panorama_hue
if @panorama.bitmap != nil
@panorama.bitmap.dispose
@panarama2.bitmap.dispose
@panorama2.bitmap = nil
@panarama.bitmap = nil
end
if @panorama_name != ""
@panorama.bitmap = RPG::Cache.panorama(@panorama_name, @panorama_hue)
@panorama2.bitmap = RPG::Cache.panorama(@panorama_name+"_2", @panorama_hue)
end
Graphics.frame_reset
end
# 雾与现在的情况有差异的情况下
if @fog_name != $game_map.fog_name or @fog_hue != $game_map.fog_hue
@fog_name = $game_map.fog_name
@fog_hue = $game_map.fog_hue
if @fog.bitmap != nil
@fog.bitmap.dispose
@fog.bitmap = nil
end
if @fog_name != ""
@fog.bitmap = RPG::Cache.fog(@fog_name, @fog_hue)
end
Graphics.frame_reset
end
# 刷新元件地图
@tilemap.ox = $game_map.display_x / 4
@tilemap.oy = $game_map.display_y / 4
@tilemap.update
# 刷新远景平面
@panorama.ox = $game_map.display_x / 4
@panorama.oy = $game_map.display_y / 4
@panorama2.ox = @panorama.ox
@panorama2.oy = @panorama.oy
# 刷新雾平面
@fog.zoom_x = $game_map.fog_zoom / 100.0
@fog.zoom_y = $game_map.fog_zoom / 100.0
@fog.opacity = $game_map.fog_opacity
@fog.blend_type = $game_map.fog_blend_type
@fog.ox = $game_map.display_x / 4 + $game_map.fog_ox
@fog.oy = $game_map.display_y / 4 + $game_map.fog_oy
@fog.tone = $game_map.fog_tone
# 刷新角色活动块
for sprite in @character_sprites
sprite.update
end
# 刷新天候图形
@weather.type = $game_screen.weather_type
@weather.max = $game_screen.weather_max
@weather.ox = $game_map.display_x / 4
@weather.oy = $game_map.display_y / 4
@weather.update
# 刷新图片
for sprite in @picture_sprites
sprite.update
end
# 刷新计时器块
@timer_sprite.update
# 设置画面的色调与震动位置
@viewport1.tone = $game_screen.tone
@viewport1.ox = $game_screen.shake
# 设置画面的闪烁色
@viewport3.color = $game_screen.flash_color
# 刷新显示端口
@viewport1.update
@viewport3.update
end
end

 

 

Ho provato ad inserire questi due script... ma mi dà errore alla riga 34 del secondo. Mi dice TypeError: Cannot convert Array into String.

Beh... non ho la più pallida idea di cosa significhi!

Qualcuno sa come posso risolvere il problema?

Edited by Zosimos

Gioco in Sviluppo:

http://www.studibizantini.it/docs/Logo.png

 

Blog: Ode to my Forthcoming Winter

Riferimento

 

Contest:

http://rpg2s.net/gif/SCContest2Oct.gifx2 http://rpg2s.net/gif/SCContest1Oct.gifx1

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Alla riga 34 il secondo script cerca di caricare le autotiles dichiarate per quella mappa, ma non è lì che sta l'errore, bensì la riga precedente che ad ogni passaggio del ciclo for carica l'intera lista delle autotile, che è appunto un array di nomi e non un singolo nome . . .

Tra l'altro le autotile sono 8 mentra lo script ne usa solo 7: la cosa genererebbe errore solo se più avanti lo script cercasse di usarle appunto tutte e 8.

 

Prova a sostituire la riga 33, mi pare, che presenta questa istruzione

autotile_name = $game_map.autotile_names

con la seguente

autotile_name = $game_map.autotile_names[i]

 

In pratica dovresti aggiungere una parentesi quadra aperta, una i minuscola, ed una parentesi quadra chiusa in fondo alla riga 33 . . .

 


SCRIPT RGSS (RPG Maker XP) VINTAGE LIBRARY [2018+]


Breaking (in ogni senso) News: "Treno deraglia per via del seno di Sakurai Aoi . . ." - Info nello spoiler !!

 


http://afantasymachine.altervista.org/_altervista_ht/NOOOOOOOOOilMIOtreninooooo_500.gif


Non riesco a smettere di essere affascinato da immagini come questa . . .

http://anime.vl-vostok.ru/art/photos2011/17/78049800/wall_VladAnime_WWA_1885-1680x1050.jpg


Alcuni wallpapers che faccio ruotare sul mio vecchio PC . . .


http://afantasymachine.altervista.org/_altervista_ht/gits_window.jpg

http://afantasymachine.altervista.org/_altervista_ht/madoka_group01.jpg
http://afantasymachine.altervista.org/_altervista_ht/arisu_picipici_01.jpg
http://afantasymachine.altervista.org/_altervista_ht/phantom_wp01_einzwei.jpg


La parte più spassosa della mia vita è quando gli altri cercano di spiegarmi i miei pensieri . . .


BBCode Testing


Typeface & Size



Link to comment
Share on other sites

  • 0

Ti ringrazio innanzitutto.

Dunque, ho provato la tua modifica. L'errore in quegli script sembra essersi corretto.

Ora sembrano esserci dei problemi di compatibilità con lo script delle ombre, ovvero il seguente:

 

#=============================================================
=================
# ** Sprite Shadow (Sprite_Ombre )
#------------------------------------------------------------------------------
#    Based on Genzai Kawakami's shadows
#    dynamisme & features by Rataime
#    extra features Boushy
#    New Edits by DerVVulfman
#    February 24, 2008
#
#------------------------------------------------------------------------------
# 
# Introduction:
#
#  This system allows you and all 'prepared' events to generate shadows while
#  on the field map.   The player can move around  a 'light source' event and
#  display a shadow.   Likewise,  events with a special comment  within their
#  event list can also generate shadows.
#
#------------------------------------------------------------------------------
#
# Instructions:
#
#  -- The Light Source
#     To create a light source, you need to create a map event that is to be
#     used 'as' the light source.   Most of the time,  these could be events
#     that sport 'torch' or 'lantern' charactersets.  Just examples :)
#
#     To make one of these events a light source,  you need  to insert a few
#     things into that event's  "List of Event Commands".   These things are
#     nothing more than comments.  
#
#     The first comment to add is "begin Shadow Source" (without quotes). It
#     informs the system  that this event is a light source.   The remaining
#     three values are optional and have default values in the configuration
#     section  (only just added  into the script).   They too  are added  as
#     comments.
#
#     anglemin 'number'     --- Starting position of a lightsource's arc.
#     anglemax 'number'     --- Ending position of a lightsource's arc.
#     distancemax 'number'  --- How far away from the 'source' you can go
#     self_opacity 'number' --- How dark the shadow will grow.
#
#     After that, your characters can now move about and generate shadows.
#
#  -- Other Events
#     Events do not know that they can generate shadows.   To let them gene-
#     rate a shadow,  all you need to do is add a special comment into their
#     "List of Event Commands".   This comment needed  is merely  the phrase
#     'begin Shadow' (again, without quotes).
#
#
#  -- Blocking Shadows
#     To prevent shadows  from passing through  solid objects such as doors, 
#     walls, cabinets or other forms of furniture,  you will want to apply a
#     priority flag of '1' or higher on these items.  Normally, walls in the
#     default database do not have a priority flag as they merely block  the
#     player from passing through.
#     
#
#------------------------------------------------------------------------------
#
# Revisions to note:
#
#  1) Added formatted headers and comments throughout the script.
#  2) Encapsulated a comment/parameter code in an XPML module.
#  3) Set the shadow array into an instance value to lower resource costs.
#  4) Compatability with Near Fantastica's Squad Movement systems.
#  5) Compatability with Ccoa's Caterpillar system.
#  6) Compatability with Trickster's Caterpillar system.
#  7) Added default shadow settings into the configuration section.
#
#==============================================================================



  #========================================================================
  #  **  C  O  N  F  I  G  U  R  A  T  I  O  N      S  Y  S  T  E  M  **  #
  #========================================================================
   # Caterpillar Systems
   CATERPILLAR_COMPATIBLE      = true    # Toggle for Fukuyama's original  
   SQUAD_MOVE_COMPATIBLE       = false   # Toggle for Near Fantastica's SBABS 
   CCOA_CATER_COMPATIBLE       = false   # Toggle for Ccoa's Caterpillar
   TRICKSTER_CATER_COMPATIBLE  = false   # Toggle for Trickster's Caterpillar
   
   # Shadow Specific Systems
   SHADOW_WARN                 = true    # Checks for older shadow system
   SHADOW_MIN                  = 0       # Start setting of shadow arc *
   SHADOW_MAX                  = 0       # Ending setting of shadow arc *
   SHADOW_OPACITY              = 150     # Darkness level of shadow
   SHADOW_DISTANCE             = 350     # Maximum range in pixels

   # * SHADOW ARC:  Set in degrees,  this controls whether a light source
   #                can 'force' shadows in certain directions.  Useful if
   #                a light source is hanging on a wall so it cannot make
   #                a shadow THROUGH a wall.
   #
   #                It may take some practice  to set  the desired angles
   #                as it recognizes 90°  being the  top most part  of an
   #                arc,  180° being the leftmost side and so on...  pro-
   #                ceeding in a counter-clockwise motion.
   
  #========================================================================
  #  ****   E N D   O F   C O N F I G U R A T I O N   S Y S T E M   ****  #
  #========================================================================
  
  

#==============================================================================
# ** Game_Temp
#------------------------------------------------------------------------------
#  This class handles temporary data that is not included with save data.
#  Refer to "$game_temp" for the instance of this class.
#==============================================================================

class Game_Temp
 #--------------------------------------------------------------------------
 # * Public Instance Variables
 #--------------------------------------------------------------------------
 attr_accessor :shadow_spriteset         # holds shadow spritesets
end



#==============================================================================
# ** Game_Party
#------------------------------------------------------------------------------
#  This class handles the party. It includes information on amount of gold 
#  and items. Refer to "$game_party" for the instance of this class.
#==============================================================================

class Game_Party
 #--------------------------------------------------------------------------
 # * Public Instance Variables
 #--------------------------------------------------------------------------
 attr_reader :characters
end



#==============================================================================
# ** Sprite_Shadow
#------------------------------------------------------------------------------
#  This sprite is used to display the character's shadow.  It observes the
#  Game_Character class and automatically changes sprite conditions.
#==============================================================================
class Sprite_Shadow < RPG::Sprite
 #--------------------------------------------------------------------------
 # * Public Instance Variables
 #--------------------------------------------------------------------------
 attr_accessor :character
 #--------------------------------------------------------------------------
 # * Object Initialization
 #     viewport  : viewport
 #     character : character (Game_Character)
 #     id        : id
 #--------------------------------------------------------------------------
 def initialize(viewport, character = nil, id = 0)
   super(viewport)
   params  = $game_temp.shadow_spriteset.shadows[id]
   @source = params[0]
   # Default settings
   @anglemin     = SHADOW_MIN
   @anglemax     = SHADOW_MAX
   @self_opacity = SHADOW_OPACITY
   @distancemax  = SHADOW_DISTANCE
   # Settings changed by parameters
   @anglemin     = params[1]   if params.size > 1
   @anglemax     = params[2]   if params.size > 2
   @distancemax  = params[3]   if params.size > 3
   @self_opacity = params[4]   if params.size > 4
   @character = character
   update
 end
 #--------------------------------------------------------------------------
 # * Frame Update
 #-------------------------------------------------------------------------- 
 def update
   # If shadow not in range of light source
   if !in_range?(@character, @source, @distancemax)
     self.opacity = 0
     return
   end
   super
   # If tile ID, file name, or hue are different from current ones
   if @tile_id != @character.tile_id or
      @character_name != @character.character_name or
      @character_hue != @character.character_hue
     # Remember tile ID, file name, and hue
     @tile_id = @character.tile_id
     @character_name = @character.character_name
     @character_hue = @character.character_hue
     # If tile ID value is valid
     if @tile_id >= 384
       self.bitmap = RPG::Cache.tile($game_map.tileset_name,
         @tile_id, @character.character_hue)
       self.src_rect.set(0, 0, 32, 32)
       self.ox = 16
       self.oy = 32
     # If tile ID value is invalid        
     else
       self.bitmap = RPG::Cache.character(@character.character_name,
         @character.character_hue)
       @cw = bitmap.width / 4
       @ch = bitmap.height / 4
       self.ox = @cw / 2
       self.oy = @ch
     end
   end
   # Set visible situation
   self.visible = (not @character.transparent)
   # If graphic is character
   if @tile_id == 0
     # Set rectangular transfer
     sx = @character.pattern * @cw
     sy = (@character.direction - 2) / 2 * @ch
     if self.angle > 90 or angle < -90
       sy = ( 4 - 2) / 2 * @ch   if @character.direction == 6
       sy = ( 6 - 2) / 2 * @ch   if @character.direction == 4
       sy = ( 8 - 2) / 2 * @ch   if @character.direction == 2
       sy = ( 2 - 2) / 2 * @ch   if @character.direction == 8
     end
     self.src_rect.set(sx, sy, @cw, @ch)
   end
   # Set sprite coordinates    
   self.x = @character.screen_x
   self.y = @character.screen_y-5
   self.z = @character.screen_z(@ch)-1
   # Set blend method and bush depth
   self.blend_type = @character.blend_type
   self.bush_depth = @character.bush_depth
   # Animation
   if @character.animation_id != 0
     animation = $data_animations[@character.animation_id]
     animation(animation, true)
     @character.animation_id = 0
   end
   @deltax       = @source.screen_x - self.x
   @deltay       = @source.screen_y - self.y
   self.color    = Color.new(0, 0, 0)
   @distance     = ((@deltax ** 2) + (@deltay ** 2))
   # Set opacity level based on light source distance
   self.opacity  = @self_opacity * 13000 / 
                     ((@distance * 370 / @distancemax) + 6000)
   self.angle    = 57.3 * Math.atan2(@deltax, @deltay )
   @angle_trigo  = self.angle+90
   if @angle_trigo < 0
       @angle_trigo = 360 + @angle_trigo
    end
   if @anglemin != 0 or @anglemax != 0
      if (@angle_trigo < @anglemin or @angle_trigo > @anglemax) and
         @anglemin < @anglemax
        self.opacity = 0
        return
      end
      if (@angle_trigo < @anglemin and @angle_trigo > @anglemax) and
         @anglemin > @anglemax
        self.opacity=0
        return
      end     
    end
 end
 #--------------------------------------------------------------------------
 # * In Range?  (From Near's Anti Lag Script, edited)
 #     element     : element
 #     object      : object
 #     range       : range in tiles
 #--------------------------------------------------------------------------   
 def in_range?(element, object, range)
   x = (element.screen_x - object.screen_x) * (element.screen_x - object.screen_x)
   y = (element.screen_y - object.screen_y) * (element.screen_y - object.screen_y)
   r = x + y
   if r <= (range * range)
      return true
   else
     return false
   end
 end
end



#==============================================================================
# ** Sprite_Character
#------------------------------------------------------------------------------
#  This sprite is used to display the character.It observes the Game_Character
#  class and automatically changes sprite conditions.
#==============================================================================

class Sprite_Character < RPG::Sprite
 #--------------------------------------------------------------------------
 # * Alias Listings
 #--------------------------------------------------------------------------
 alias shadow_initialize initialize
 alias shadow_update update  
 #--------------------------------------------------------------------------
 # * Object Initialization
 #     viewport  : viewport
 #     character : character (Game_Character)
 #--------------------------------------------------------------------------
 def initialize(viewport, character = nil)
   @character = character
   super(viewport)
   @ombrelist = []
   if character.is_a?(Game_Event) and $game_temp.shadow_spriteset.shadows != []
     params = XPML.XPML_read("Shadow", @character.id, 5)
     if params != nil
       for i in 0...$game_temp.shadow_spriteset.shadows.size
         @ombrelist.push(Sprite_Shadow.new(viewport, @character,i))
       end
     end
   end
   if character.is_a?(Game_Player) and $game_temp.shadow_spriteset.shadows != []
     for i in 0...$game_temp.shadow_spriteset.shadows.size
       @ombrelist.push(Sprite_Shadow.new(viewport, $game_player,i))
     end
     #===================================================
     # * Compatibility with Caterpillar Functions
     #===================================================
     if CATERPILLAR_COMPATIBLE and $game_party.characters != nil
       for member in $game_party.characters
         for i in 0...$game_temp.shadow_spriteset.shadows.size
           @ombrelist.push(Sprite_Shadow.new(viewport, member, i))
         end
       end
     end
     if SQUAD_MOVE_COMPATIBLE and $game_allies.values != nil
       for member in $game_allies.values
         for i in 0...$game_temp.shadow_spriteset.shadows.size
           @ombrelist.push(Sprite_Shadow.new(viewport, member, i))
         end
       end
     end
     if CCOA_CATER_COMPATIBLE and $game_train.actors != nil
       for member in $game_train.actors
         for i in 0...$game_temp.shadow_spriteset.shadows.size
           @ombrelist.push(Sprite_Shadow.new(viewport, member, i))
         end
       end
     end
     if TRICKSTER_CATER_COMPATIBLE and $game_party.followers != nil
       for member in $game_party.followers
         for i in 0...$game_temp.shadow_spriteset.shadows.size
           @ombrelist.push(Sprite_Shadow.new(viewport, member, i))
         end
       end
     end
     #===================================================
     # ** End of the compatibility
     #===================================================       
   end
   # Perform the original call
   shadow_initialize(viewport, @character)
 end
 #--------------------------------------------------------------------------
 # * Frame Update
 #--------------------------------------------------------------------------
 def update
   shadow_update
   if @ombrelist != []
     for i in 0...@ombrelist.size
       @ombrelist[i].update
     end
   end
 end  
end



#==============================================================================
# ** Game_Event
#------------------------------------------------------------------------------
#  This class deals with events. It handles functions including event page 
#  switching via condition determinants, and running parallel process events.
#  It's used within the Game_Map class.
#==============================================================================

class Game_Event < Game_Character
 #--------------------------------------------------------------------------
 # * Public Instance Variables
 #--------------------------------------------------------------------------
 attr_accessor :id
end



#==============================================================================
# ** Spriteset_Map
#------------------------------------------------------------------------------
#  This class brings together map screen sprites, tilemaps, etc.
#  It's used within the Scene_Map class.
#==============================================================================

class Spriteset_Map
 #--------------------------------------------------------------------------
 # * Public Instance Variables
 #--------------------------------------------------------------------------  
 attr_accessor :shadows
 #--------------------------------------------------------------------------
 # * Alias Listings
 #--------------------------------------------------------------------------  
 alias shadow_initialize initialize
 #--------------------------------------------------------------------------
 # * Object Initialization
 #--------------------------------------------------------------------------  
 def initialize
   $game_temp.shadow_spriteset = self
   @shadows = []
   warn = false
   for k in $game_map.events.keys.sort
     if ($game_map.events[k].list != nil and 
           $game_map.events[k].list[0].code == 108 and 
           ($game_map.events[k].list[0].parameters == ["s"] or 
           $game_map.events[k].list[0].parameters == ["o"]))
       warn = true         
     end
     params = XPML.XPML_read("Shadow Source", k, 5)
     if params != nil
       $game_temp.shadow_spriteset.shadows.push([$game_map.events[k]] + params) 
     end
   end
   if warn == true and SHADOW_WARN
     p "Warning : At least one event on this map uses an obsolete way to add shadows" 
   end
   # Perform the original call
   shadow_initialize
 end  
end



#==============================================================================
# ** module XPML
#------------------------------------------------------------------------------
#  This module handles the reading and passing of 'comment' parameters
#
#  The main XPML method is used to check and read event comments.
#  * It returns 'nil' if the markup 'check' text isn't even present.
#  * It returns [] if no parameters are passed
#  * It returns a parameter list with "int" converted as int.
#       eg :
#       begin first
#       begin second
#       param1 1
#       param2 two
#       begin third
#       anything 3
#
#   p XPML_read("first", event_id) -> []
#   p XPML_read("second", event_id) -> [1,"two"]
#   p XPML_read("third", event_id) -> [3]
#   p XPML_read("forth", event_id) -> nil
#===================================================

module XPML
 module_function
 #--------------------------------------------------------------------------
 # * XPML_read
 #     markup           : text in event comment to check
 #     event_id         : event ID
 #     max_param_number : maximum number of parameter/comments to load
 #--------------------------------------------------------------------------  
 def XPML_read(markup, event_id, max_param_number = 0)
   parameter_list = nil
   event = $game_map.events[event_id]
   return if event.list == nil
     for i in 0...event.list.size
       if event.list[i].code == 108 and 
         event.list[i].parameters[0].downcase == "begin " + markup.downcase
         parameter_list = [] if parameter_list == nil
         for j in i + 1...event.list.size
           if event.list[j].code == 108
             parts = event.list[j].parameters[0].split
             if parts.size != 1 and parts[0].downcase != "begin"
               if parts[1].to_i != 0 or parts[1] == "0"
                 parameter_list.push(parts[1].to_i)
               else
                 parameter_list.push(parts[1])
               end
             else
               return parameter_list
             end
           else
             return parameter_list
           end
           if max_param_number != 0 and j == i + max_param_number
             return parameter_list
           end
         end
       end
     end
   return parameter_list
 end
end

 

 

Appena apro l'anteprima, mi dice: Riga 304, NoMethodError occurred, undefined method 'shadows' for nil:NilClass

La riga 304 sarebbe:

 

if character.is_a?(Game_Event) and $game_temp.shadow_spriteset.shadows != []

 

E' una cosa che ti sembra risolvibile?

Grazie!

Gioco in Sviluppo:

http://www.studibizantini.it/docs/Logo.png

 

Blog: Ode to my Forthcoming Winter

Riferimento

 

Contest:

http://rpg2s.net/gif/SCContest2Oct.gifx2 http://rpg2s.net/gif/SCContest1Oct.gifx1

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...