RMRK is retiring.
Server is paid up for the rest of 2026, but the forum may go after that. See here for more information. Please archive or save anything you would like to keep before 2027.
Main Menu
  • Welcome to The RPG Maker Resource Kit.

[XP] Found a script, but I don't quite understand it...

Started by Nikoru, October 01, 2013, 06:29:36 AM

0 Members and 1 Guest are viewing this topic.

Nikoru

So recently I got back into RMXP for some random reasons, and I was looking for some scripts- it's been a year or two since I've even looked at the XP program and I was never really nifty with the scripts anyways...

Nevertheless, moving on.

Well, I stumbled upon this unique script that's suppose to animate a panorama on a map, but I'm not sure what all I need to change. Not only, but I can't watch the demo because it's not compatible with my version of XP.

Anyways, here is the link to the site and page I got the code on (The site is mainly in Portuguese):

http://atelier-rgss.com/RGSS/System/XP_SYS02.html

Here is the code (Without Translation):

[spoiler]#_______________________________________________________________________________
# ++++ MOG Animated Panorama XP V2.1 +++           
#_______________________________________________________________________________
# By Moghunter     
# http://www.atelier-rgss.com
#_______________________________________________________________________________
# Animação de panorama por frames.
# É necessário ter as imagens extras dos frames para que a animação ocorra.
# Exemplo.
#
# Nuvem.png        (Frame 1)(Essa é a imagem do Database)     
# Nuvem1.png       (Frame 2)
# Nuvem2.png       (Frame 3)
# Nuvem3.png       (Frame 4)
# Nuvem4.png       (Frame 5)
# Etc...
#_______________________________________________________________________________
module MOG
  # Velocidade da animação 
  PANOREFRESH = 8
  # É possível mudar a velocidade da animação usando este código através do
  # comando chamar script.
  #
  # $game_system.pano_anime_speed = X
  #
  # X = Velocidade da animação.
  #
end

#===============================================================================
# ? Game_System
#===============================================================================
class Game_System
 
attr_accessor :pano_anime_speed

#--------------------------------------------------------------------------
# ? Initialize
#--------------------------------------------------------------------------     
alias mog14_initialize initialize
def initialize
     mog14_initialize
     @pano_anime_speed = MOG::PANOREFRESH
end 
end

#===============================================================================
# ? Spriteset_Map
#===============================================================================
class Spriteset_Map
 
#--------------------------------------------------------------------------
# ? Initialize
#--------------------------------------------------------------------------   
alias mog14_initialize initialize
def initialize
     @panospeed = 0
     @panoframes = 0     
     @panorama_animated = false
     mog14_initialize
end
 
#--------------------------------------------------------------------------
# ? Update
#--------------------------------------------------------------------------   
alias mog14_update update
def update
     can_panorama_animation
     mog14_update
     update_panorama_animation
end

#--------------------------------------------------------------------------
# ? can_panorama_animation
#--------------------------------------------------------------------------     
def can_panorama_animation
     if @panorama_name != $game_map.panorama_name or
        @panorama_hue != $game_map.panorama_hue
        @panospeed = 0
        @panoframes = 0
        @panorama_animated = false
        image = RPG::Cache.panorama($game_map.panorama_name + "1", $game_map.panorama_hue) rescue nil
        if image != nil
           @panorama_animated = true
           image.dispose 
        end           
     end
end

#--------------------------------------------------------------------------
# ? update_panorama_animation
#--------------------------------------------------------------------------     
def update_panorama_animation
     return unless @panorama_animated
     return if @panorama.bitmap == nil
     @panospeed += 1
     if @panospeed > $game_system.pano_anime_speed
        @panospeed = 0
        @panoframes += 1
        @panorama.bitmap = RPG::Cache.panorama(@panorama_name +  @panoframes.to_s, @panorama_hue) rescue nil
        if @panorama.bitmap == nil
           @panoframes = 0
           @panorama.bitmap = RPG::Cache.panorama(@panorama_name, @panorama_hue)       
        end     
        $game_map.panorama_name = @panorama_name
        $game_map.panorama_hue = @panorama_hue           
     end

end
end

$mog_rgss_animemated_panorama = true[/spoiler]

The code (Translated): [spoiler]# _______________________________________________________________________________
# + + + + MOG Animated Overview V2.1 XP + + +
# _______________________________________________________________________________
# By Moghunter
# http://www.atelier-rgss.com
# _______________________________________________________________________________
# Animation panorama frames .
# You need the extra images of the frames for the animation occurs .
# Example .
#
# Nuvem.png ( frame 1 ) ( This is the image of the Database )
# Nuvem1.png (Frame 2 )
# Nuvem2.png (Frame 3 )
# Nuvem3.png (Frame 4 )
# Nuvem4.png (Frame 5 )
# Etc. ..
# _______________________________________________________________________________
MOG module
  # Speed ??of animation
  PANOREFRESH = 8
  # You can change the animation speed by using this code
  # Call script command .
  #
  # $ = X game_system.pano_anime_speed
  #
  # X = speed of the animation.
  #
end

# ================================================= ==============================
# ? Game_System
# ================================================= ==============================
class Game_System
 
attr_accessor : pano_anime_speed

# ------------------------------------------------- -------------------------
? # Initialize
# ------------------------------------------------- -------------------------
alias mog14_initialize initialize
def initialize
     mog14_initialize
     @ pano_anime_speed = MOG :: PANOREFRESH
end
end

# ================================================= ==============================
# ? Spriteset_Map
# ================================================= ==============================
class Spriteset_Map
 
# ------------------------------------------------- -------------------------
? # Initialize
# ------------------------------------------------- -------------------------
alias mog14_initialize initialize
def initialize
     @ panospeed = 0
     @ panoframes = 0
     @ panorama_animated = false
     mog14_initialize
end
 
# ------------------------------------------------- -------------------------
# ? Update
# ------------------------------------------------- -------------------------
alias update mog14_update
def update
     can_panorama_animation
     mog14_update
     update_panorama_animation
end

# ------------------------------------------------- -------------------------
# ? can_panorama_animation
# ------------------------------------------------- -------------------------
def can_panorama_animation
     if @ panorama_name ! = $ game_map.panorama_name or
        panorama_hue @ ! = $ game_map.panorama_hue
        @ panospeed = 0
        @ panoframes = 0
        @ panorama_animated = false
        image = RPG :: Cache.panorama ( $ game_map.panorama_name + " 1 " , $ game_map.panorama_hue ) rescue nil
        if image! = nil
           @ panorama_animated = true
           image.dispose
        end
     end
end

# ------------------------------------------------- -------------------------
# ? update_panorama_animation
# ------------------------------------------------- -------------------------
def update_panorama_animation
     return unless @ panorama_animated
     if@panorama.bitmap == nil return
     panospeed @ + = 1
     if @ panospeed > $ game_system.pano_anime_speed
        @ panospeed = 0
        panoframes @ + = 1
        @ panorama.bitmap = RPG :: Cache.panorama ( @ + @ panorama_name panoframes.to_s , @ panorama_hue ) rescue nil
        if@panorama.bitmap == nil
           @ panoframes = 0
           @ panorama.bitmap = RPG :: Cache.panorama ( panorama_name @ , @ panorama_hue )
        end
        $ game_map.panorama_name = @ panorama_name
        $ game_map.panorama_hue = @ panorama_hue
     end

end
end

$ mog_rgss_animemated_panorama = true
[/spoiler]



And this is what I have done so far that I understand, which is mainly nothing but changing the pictures:

[spoiler] # _______________________________________________________________________________
# + + + + MOG Animated Overview V2.1 XP + + +
# _______________________________________________________________________________
# By Moghunter
# http://www.atelier-rgss.com
# _______________________________________________________________________________
# Animation panorama frames .
# You need the extra images of the frames for the animation occurs .
# Example .
#
# DepthsDarkLava1.png  (Frame 1 ) ( This is the image of the Database )
# DepthsDarkLava2.png (Frame 2 )
# DepthsDarkLava3.png (Frame 3 )
# DepthsDarkLava4.png (Frame 4 )
# DepthsDarkLava5.png (Frame 5 )
# DepthsDarkLava6.png (Frame 6 )
# DepthsDarkLava7.png (Frame 7 )
# DepthsDarkLava8.png (Frame 8 )
# DepthsDarkLava9.png (Frame 9 )
# DepthsDarkLava10.png (Frame 10 )
#______________________________________________________________________________
MOG module
  # Speed ??of animation
  PANOREFRESH = 8
  # You can change the animation speed by using this code
  # Call script command .
  #
  # $ = X game_system.pano_anime_speed
  #
  # X = speed of the animation.
  #
end

# ================================================= ==============================
# ? Game_System
# ================================================= ==============================
class Game_System
 
attr_accessor : pano_anime_speed

# ------------------------------------------------- -------------------------
? # Initialize
# ------------------------------------------------- -------------------------
alias mog14_initialize initialize
def initialize
     mog14_initialize
     @ pano_anime_speed = MOG :: PANOREFRESH
end
end

# ================================================= ==============================
# ? Spriteset_Map
# ================================================= ==============================
class Spriteset_Map
 
# ------------------------------------------------- -------------------------
? # Initialize
# ------------------------------------------------- -------------------------
alias mog14_initialize initialize
def initialize
     @ panospeed = 0
     @ panoframes = 0
     @ panorama_animated = false
     mog14_initialize
end
 
# ------------------------------------------------- -------------------------
# ? Update
# ------------------------------------------------- -------------------------
alias update mog14_update
def update
     can_panorama_animation
     mog14_update
     update_panorama_animation
end

# ------------------------------------------------- -------------------------
# ? can_panorama_animation
# ------------------------------------------------- -------------------------
def can_panorama_animation
     if @ panorama_name ! = $ game_map.panorama_name or
        panorama_hue @ ! = $ game_map.panorama_hue
        @ panospeed = 0
        @ panoframes = 0
        @ panorama_animated = false
        image = RPG :: Cache.panorama ( $ game_map.panorama_name + " 1 " , $ game_map.panorama_hue ) rescue nil
        if image! = nil
           @ panorama_animated = true
           image.dispose
        end
     end
end

# ------------------------------------------------- -------------------------
# ? update_panorama_animation
# ------------------------------------------------- -------------------------
def update_panorama_animation
     return unless @ panorama_animated
     if@panorama.bitmap == nil return
     panospeed @ + = 1
     if @ panospeed > $ game_system.pano_anime_speed
        @ panospeed = 0
        panoframes @ + = 1
        @ panorama.bitmap = RPG :: Cache.panorama ( @ + @ panorama_name panoframes.to_s , @ panorama_hue ) rescue nil
        if@panorama.bitmap == nil
           @ panoframes = 0
           @ panorama.bitmap = RPG :: Cache.panorama ( panorama_name @ , @ panorama_hue )
        end
        $ game_map.panorama_name = @ panorama_name
        $ game_map.panorama_hue = @ panorama_hue
     end

end
end

$ mog_rgss_animemated_panorama = true [/spoiler]




If someone could just tell me where to put it and what else I need to do, maybe even give me some advice on future stuff, that would be amazing and greatly appreciated :D

Acolyte

Put all the pictures in the Panorama folder. Make sure they all have the same name with a number after them (aside from the first frame which doesn't have a number).

For example:

Forest
Forest1
Forest2
etc...

Then just set the first panorama to the map.

Nikoru

Ah, thanks! One more thing, where do I place the script? Do I place it in the main, make a separate script section? Or do I put the script in an event?

Thanks for future help :D