Ogłoszenie 

Uwaga! To forum jest w trybie offline.
Wszelką pomoc uzyskasz pod adresem
forum.ultimateam.pl


Administracja Forum


Poprzedni temat «» Następny temat
Zamknięty przez: Ayene
Nie 22 Lip, 2012 16:12
Problem ze skryptem i przedmiotami
Autor Wiadomość
tracersgta 




Preferowany:
RPG Maker VX

Pomógł: 45 razy
Dołączył: 10 Sty 2011
Posty: 612
Skąd: mam wiedzieć?
Wysłany: Pią 20 Lip, 2012 15:00
Problem ze skryptem i przedmiotami
Witam! Podczas gdy dodaję drużynie przedmiot (jaki kolwiek i w jakiej kolwiek ilości) gra crashuje z komunikatem:
Kod:
Script 'Sliding Graphics' line 114: NoMethodError occured.
undefined method 'each' for nil:Nil:Class


Sliding Graphics's linijka 114:
Kod:
for slider in @ma_sliding_objects


Cały skrypt Sliding Graphic's 1.0:
Spoiler:

Kod:
#==============================================================================
#    Sliding Graphics
#    Version: 1.0
#    Author: modern algebra (rmrk.net)
#    Date: Canada Day, 2011 (July 1)
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Description:
#
#    This is a scripter's tool that allows you to slide any graphics in the
#   scene of your choice. It is a very simple function which any scripter could
#   do on their own, of course, but this should make it slightly easier.
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Instructions:
#
#    This script adds the following method to Scene_Base:
#
#      start_slide (dest_x, dest_y, object, frames, start_se, finish_se)
#        dest_x    : the x coordinate you want the object to end up at
#        dest_y    : the y coordinate you want the object to end up at
#        object    : the graphic (window or sprite) you want to move
#        frames    : the number of frames it takes to get there. If left empty,
#                   defaults to 30 frames (half a second)
#        start_se  : a string holding the name of the SE to play when starting
#                   the slide. You can also make it an array and add volume and
#                   pitch. If the SE file does not exist, it won't cause an
#                   error - it just won't play it.
#        finish_se : a string holding the name of the SE to play when ending
#                   the slide. You can also make it an array and add volume and
#                   pitch. If the SE file does not exist, it won't cause an
#                   error - it just won't play it.
#
#      If you are calling it from somewhere else (not in the scene), you just
#     use:
#       $scene.start_slide (dest_x, dest_y, object, frames, start_se, finish_se)
#
#    EXAMPLE:
#      Say you are in the default menu scene and you want to slide the gold
#     window up to right below the command window in 1/3 of a second, you would
#     do the following:
#
#        start_slide (0, @command_window.height, @gold_window, 20)
#
#      If you wanted also to play the "Open1" SE when starting the slide and
#     the "Close1" SE (at 100 volume but 80 pitch) when finishing, it would be:
#
#        start_slide (0, @command_window.height, @gold_window, 20, "Open1", ["Close1", 100, 80])
#
#    Also, at line 62, you will see the MASG_INACTIVE_WHEN_SLIDING option. If
#   you turn this to true, you can make it so that the player can't use the
#   selectable windows. Otherwise, it won't affect that operation at all.
#
#    Finally, if you want to check whether a particular object is sliding at
#   any given time, there is another method in Scene_Base for that:
#
#      sliding? (object)
#        object : the graphic (window or sprite) you want to check is sliding.
#          If you exclude this argument, then the method will just check if
#          anything is sliding.
#==============================================================================
#\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
#  EDITABLE REGION
#||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
#  Turn this option to false if you want to be able to operate selectable
# windows even if they are sliding.
MASG_INACTIVE_WHEN_SLIDING = true
#||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
#  END EDITABLE REGION
#//////////////////////////////////////////////////////////////////////////////

$imported = {} unless $imported
$imported["MASlidingGraphics"] = true

#==============================================================================
# ** Window_Selectable
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    aliased method - active
#==============================================================================

class Window_Selectable
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Active
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias mlgb_slidwin_actv_3ts8 active unless self.method_defined? (:mlgb_slidwin_actv_3ts8)
  def active (*args, &block)
    return false if MASG_INACTIVE_WHEN_SLIDING && $scene && $scene.class.method_defined? (:sliding?) && $scene.sliding? (self)
    return mlgb_slidwin_actv_3ts8 (*args, &block) # Run Original Method
  end
end

#==============================================================================
# ** Scene_Base
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    aliased methods - initialize; update
#    new_method - start_slide; sliding?
#==============================================================================

class Scene_Base
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Object Initialization
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias ma_objslide_strt_5rf1 start
  def start (*args, &block)
    @ma_sliding_objects = []
    ma_objslide_strt_5rf1 (*args, &block) # Run Original Method
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Frame Update
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias mlg_slidinobjt_updt_4ev5 update
  def update (*args, &block)
    # Slide the objects
   for slider in @ma_sliding_objects
      slider[1] += slider[2]       # Add to X
      slider[3] += slider[4]       # Add to Y
      slider[5] -= 1               # Subtract from frames
      slider[0].x = slider[1].to_i # Set X to match float
      slider[0].y = slider[3].to_i # Set Y to match float
      if slider[5] <= 0 # Remove when done
        masg_play_se (slider[6])
        @ma_sliding_objects.delete (slider)
      end
    end
    mlg_slidinobjt_updt_4ev5 (*args, &block) # Run Original Method
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Start Slide
  #    object         : the Window or Sprite to move
  #    dest_x; dest_y : the x and y position the object should end at
  #    frames         : number of frames it takes to get to its destination
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def start_slide (dest_x, dest_y, object, frames = 30, start_se = [], fin_se = [])
    return if !(object.class.method_defined? (:x) && object.class.method_defined? (:y))
    # If the object is already sliding, replace it
    @ma_sliding_objects.reject! { |sliding_object| sliding_object[0] == object }
    speed_x = (dest_x - object.x).to_f / frames
    speed_y = (dest_y - object.y).to_f / frames
    masg_play_se (start_se)
    @ma_sliding_objects.push ([object, object.x.to_f, speed_x, object.y.to_f, speed_y, frames, fin_se])
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Sliding?
  #    object : the object to see if it is sliding
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def sliding? (object = nil)
    return @ma_sliding_objects && (object.nil? ? !@ma_sliding_objects.empty? : @ma_sliding_objects.assoc (object) != nil)
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * MASG Play SE
  #    se : se to play
  #``````````````````````````````````````````````````````````````````````````
  #  This method checks if the SE exists and converts it, then plays it)
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def masg_play_se (se = [])
    return if se.empty?
    se = [se] if se.is_a? (String)
    begin
      (RPG::SE.new (*se)).play
    rescue
    end
  end
end



Proszę o jak najszybszą odpowiedź :-(
________________________
I'm a tiger! I roar. I hunt, I climb, I eat, I wash, I sleep!

Gość, jeżeli pomogłem daj "Pomógł" ;-)
 
 
 
Ayene 




Ranga RM:
4 gry

Pomogła: 232 razy
Dołączyła: 18 Wrz 2007
Posty: 2424
Wysłany: Sob 21 Lip, 2012 09:23
Rany, to już takie niepotrzebne skrypty robią? :co:
Nie wiem, co może powodować błąd. Pewnie skrypt ten kłóci się z innymi. Najlepiej by było, żebyś zrobił demo z tym błędem i wysłał mi je na PW.
________________________


 
 
 
tracersgta 




Preferowany:
RPG Maker VX

Pomógł: 45 razy
Dołączył: 10 Sty 2011
Posty: 612
Skąd: mam wiedzieć?
Wysłany: Sob 21 Lip, 2012 10:34
Ten skrypt jest wymagany do moje CMS'a :ehe:

Demo już uploaduję i wysyłam.
________________________
I'm a tiger! I roar. I hunt, I climb, I eat, I wash, I sleep!

Gość, jeżeli pomogłem daj "Pomógł" ;-)
 
 
 
Ayene 




Ranga RM:
4 gry

Pomogła: 232 razy
Dołączyła: 18 Wrz 2007
Posty: 2424
Wysłany: Nie 22 Lip, 2012 09:05
Zobacz, czy to pomoże. Wejdź w skrypt 'Sliding Graphics', znajdź linijkę (114):
Kod:
for slider in @ma_sliding_objects

przed nią dodaj:
Kod:
unless @ma_sliding_objects == nil

następnie znajdź (127):
Kod:
mlg_slidinobjt_updt_4ev5 (*args, &block) # Run Original Method

po niej dodaj:
Kod:
end
________________________


 
 
 
tracersgta 




Preferowany:
RPG Maker VX

Pomógł: 45 razy
Dołączył: 10 Sty 2011
Posty: 612
Skąd: mam wiedzieć?
Wysłany: Nie 22 Lip, 2012 10:48
Super, wszystko działa. Ty to jesteś jednak niezawodna... :mrgreen:
________________________
I'm a tiger! I roar. I hunt, I climb, I eat, I wash, I sleep!

Gość, jeżeli pomogłem daj "Pomógł" ;-)
 
 
 
Wyświetl posty z ostatnich:   
Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi
Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Nie możesz załączać plików na tym forum
Możesz ściągać załączniki na tym forum
Dodaj temat do Ulubionych
Wersja do druku

Skocz do:  

Powered by phpBB modified by Przemo © 2003 phpBB Group | Template Klam by Ayene