Main Menu
  • Welcome to The RPG Maker Resource Kit.

Module System to make your script structure looks neat.

Started by Sthrattoff, February 15, 2009, 05:28:14 AM

0 Members and 1 Guest are viewing this topic.

Sthrattoff

This is just a simple script that enables you beginner scripter to add something. Currently I have two modules to publish. They are Game_System module and Victory Handler module. Here's the script:

[spoiler]#==============================================================================
# Game_System Add-On Module
#------------------------------------------------------------------------------
# © 2009 by Sthrattoff
#==============================================================================

# Description:
# This module modify Game_System so you can save your custom variables within
# save files.

class Game_System
 
  #Add attr_accessor of your variables here.
  attr_accessor :victory_points
 
  alias old_initialize initialize
  def initialize
    old_initialize
    # Set your initial variables values here.
    @victory_points = 0
  end
 
end

[/spoiler]

[spoiler]#==============================================================================
# Battle Victory Add-On Module
#------------------------------------------------------------------------------
# © 2009 by Sthrattoff
#==============================================================================

# Description:
# This module modify phase_5 of Scene_Battle which handle victory conditions.

class Scene_Battle
 
  alias old_start_phase5 start_phase5
  def start_phase5
    old_start_phase5
    #You can add anything you like to happen after victory here.
    $game_system.victory_points += 1
  end
 
end
[/spoiler]
Symphony of Alderra : Memoirs of Life

Storyline : 200% (Overimaginatives)
Scripting : 100% (At last...)
Eventing  : 100%
Mapping   : 0.125%