Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #===============================================================================
- #
- # Pacman Advanced Creative (PAC) Engine - Utility Engine v1.6
- # Updated 15/6/2011
- # Type: Utility
- # Installation: Configuration, script calls, tags.
- # Level: Simple, Average
- #
- #===============================================================================
- #
- # Hi! This is the PAC Utility Engine, designed to give the user more control
- # over menial things in their game. You'll find quite a few features in here,
- # but not nearly as many as PAC Battle Addons. The reason the engine is in
- # bulk now is simply for organization's sake, and to give you, the user, all
- # the instructions and configurables of the features in one place. So, with
- # the administrative side out of the way, I'll give you some instructions on
- # what to do with this script.
- #
- #===============================================================================
- #
- # INSTALLATION
- # Paste this script anywhere below materials and above main in the script editor
- # (F11) of your game. Read the instructions below on how to use the Utility
- # Engine.
- #
- #===============================================================================
- #
- # SCRIPT CALLS AND TAGS
- # $game_system.skin = 'File name'
- # Use a script call with this syntax to change the current in-game windowskin.
- # File extensions may be ommited. Example:
- # $game_system.skin = 'Red'
- # Will change the windowskin to the file named 'Red' in the Graphics\System
- # folder.
- #
- #===============================================================================
- #
- # INSTRUCTIONS AND CONFIGURATION
- # Follow the instructions beside each configurable to alter the engine to your
- # liking. Make sure you read through everything to use the engine to the
- # maximum capacity.
- #
- #===============================================================================
- module PAC
- module UTILITY
- #===============================================================================
- # BEGIN EDITING
- #===============================================================================
- RECOVER_HEALTH = true # Recover health on level up?
- RECOVER_MAGIC = true # Recover MP on level up?
- RECOVER_STATES = true # Recover states on level up?
- GOLD_VARIANCE = 24 # Variance (+/-) the gold can change for all enemies.
- BATTLE_HEAL_HP = 10 # Heal x% health after each battle.
- BATTLE_HEAL_MP = 10 # Heal x% MP after each battle.
- BATTLE_HEAL_STATES = false # Heal all states after each battle?
- USE_FIX = true # If you must, set this to false to not use the system.
- # Prefixes used for enemies of which there are more than one of. Syntax:
- # LETTER_TABLE = [' Prefix', ' Prefix2', ' Prefix3']
- LETTER_TABLE = [' 1', ' 2', ' 3', ' 4', ' 5', ' 6', ' 7', ' 8', ' 9', ' 10',
- ' 11', ' 12', ' 13', ' 14', ' 15', ' 16', ' 17', ' 18',
- ' 19', ' 20', ' 21', ' 22', ' 23', ' 24', ' 25', '26']
- BB_TYPE = 2 # Type of battleback feature used. 1 or 2, 0 for none.
- #===============================================================================
- # This section of config is only used if BB_TYPE is set to 1.
- #===============================================================================
- BB_DIRECTORY = "Graphics/Battlebacks/"# Directory of the battlebacks.
- BB_MAPS = { # Hash to change battleback for maps:
- 1 => "Grassland", # BB_MAPS = {
- } # Don't touch this. # MAPID => "Battleback Name",
- BB_TEST = "Grassland" # Battleback used in battle test.
- CREATE_FLOOR = true # Create battle floor?
- #===============================================================================
- # This section of config is only used if BB_TYPE is set to 2.
- #===============================================================================
- WIDTH = 640 # Width of the battleback.
- HEIGHT = 480 # Height of the battleback.
- BLUR_INTENSITY = 1 # Intensity of blur (higher = possible lag)
- FLOOR_X = 0 # X-coordinate of floor.
- FLOOR_Y = 192 # Y-coordinate of floor.
- FLOOR_O = 128 # Opacity of floor.
- CREATE_FLOOR = true # Create battle floor?
- #===============================================================================
- # END EDITING
- #===============================================================================
- end
- end
- #==============================================================================
- # ** Game_Actor
- #------------------------------------------------------------------------------
- # This class handles actors. It's used within the Game_Actors class
- # ($game_actors) and referenced by the Game_Party class ($game_party).
- #==============================================================================
- class Game_Actor < Game_Battler
- #--------------------------------------------------------------------------
- # alias listing
- #--------------------------------------------------------------------------
- alias pac_level_up level_up
- #--------------------------------------------------------------------------
- # * Level Up
- #--------------------------------------------------------------------------
- def level_up
- pac_level_up
- @hp = maxhp if PAC::UTILITY::RECOVER_HEALTH
- @mp = maxmp if PAC::UTILITY::RECOVER_MAGIC
- if PAC::UTILITY::RECOVER_STATES
- @states.clone.each {|i| remove_state(i) }
- end
- end
- #--------------------------------------------------------------------------
- # * After battle heal
- #--------------------------------------------------------------------------
- def battle_heal
- if PAC::UTILITY::BATTLE_HEAL_STATES
- for state in states do remove_state(state.id) end
- end
- return if dead?
- self.hp += maxhp * PAC::UTILITY::BATTLE_HEAL_HP / 100
- self.mp += maxmp * PAC::UTILITY::BATTLE_HEAL_MP / 100
- end
- end
- #==============================================================================
- # ** Game_Enemy
- #------------------------------------------------------------------------------
- # This class handles enemy characters. It's used within the Game_Troop class
- # ($game_troop).
- #==============================================================================
- class Game_Enemy < Game_Battler
- #--------------------------------------------------------------------------
- # alias listing
- #--------------------------------------------------------------------------
- alias initialize_ae initialize unless $@
- #--------------------------------------------------------------------------
- # * Get Gold
- #--------------------------------------------------------------------------
- def gold
- default_gold = enemy.gold
- variation = PAC::UTILITY::GOLD_VARIANCE
- lower = Integer(default_gold * (100 - variation) / 100)
- upper = Integer(default_gold * (100 + variation) / 100)
- value = lower + rand(upper - lower + 1)
- end
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize(index, enemy_id)
- if $data_enemies[enemy_id].swaps != []
- swaps = $data_enemies[enemy_id].swaps
- enemy_id = swaps[rand(swaps.size)]
- end
- initialize_ae(index, enemy_id)
- end
- end
- #==============================================================================
- # ** Scene_Battle
- #------------------------------------------------------------------------------
- # This class performs battle screen processing.
- #==============================================================================
- class Scene_Battle < Scene_Base
- alias pac_hab_battle_end battle_end unless $@
- def battle_end(result)
- pac_hab_battle_end(result)
- if result != 2
- for member in $game_party.members
- member.battle_heal
- end
- end
- end
- end
- #==============================================================================
- # ** Game_Troop
- #------------------------------------------------------------------------------
- # This class handles enemy groups and battle-related data. Also performs
- # battle events. The instance of this class is referenced by $game_troop.
- #==============================================================================
- class Game_Troop < Game_Unit
- #--------------------------------------------------------------------------
- # Letter Table
- #--------------------------------------------------------------------------
- if PAC::UTILITY::USE_FIX == true # If use table system...
- LETTER_TABLE = PAC::UTILITY::LETTER_TABLE
- else # If no system...
- LETTER_TABLE = ['']
- end
- end
- #==============================================================================
- # ** Game_System
- #------------------------------------------------------------------------------
- # This class handles system-related data. Also manages vehicles and BGM, etc.
- # The instance of this class is referenced by $game_system.
- #==============================================================================
- class Game_System
- #-----------------------------------------------------------------------------
- # public instance variables
- #-----------------------------------------------------------------------------
- attr_accessor :battleback if PAC::UTILITY::BB_TYPE == 1
- #-----------------------------------------------------------------------------
- # alias listing
- #-----------------------------------------------------------------------------
- alias pac_initialize initialize
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize
- pac_initialize
- @battle_back = nil if PAC::UTILITY::BB_TYPE == 1
- end
- end
- #===============================================================================
- #
- # PAC BATTLEBACK SYSTEM
- #
- #===============================================================================
- if PAC::UTILITY::BB_TYPE == 1 # Run ABB.
- #==============================================================================
- # ** Cache
- #------------------------------------------------------------------------------
- # This module loads each of graphics, creates a Bitmap object, and retains it.
- # To speed up load times and conserve memory, this module holds the created
- # Bitmap object in the internal hash, allowing the program to return
- # preexisting objects when the same bitmap is requested again.
- #==============================================================================
- module Cache
- #--------------------------------------------------------------------------
- # * Get Battleback Graphic
- # filename : Filename
- #--------------------------------------------------------------------------
- def self.battleback(filename)
- load_bitmap(PAC::UTILITY::BB_DIRECTORY, filename)
- end
- end
- #==============================================================================
- # ** Spriteset_Battle
- #------------------------------------------------------------------------------
- # This class brings together battle screen sprites. It's used within the
- # Scene_Battle class.
- #==============================================================================
- class Spriteset_Battle
- #--------------------------------------------------------------------------
- # alias listing
- #--------------------------------------------------------------------------
- alias pac_abb_create_battleback create_battleback
- alias pac_abb_create_battlefloor create_battlefloor
- #--------------------------------------------------------------------------
- # * Create Battleback Sprite
- #--------------------------------------------------------------------------
- def create_battleback
- if $BTEST # If Battletest
- if PAC::UTILITY::BB_TEST != nil # If BB_TEST is set
- @battleback_sprite = Sprite.new(@viewport1)
- @battleback_sprite.bitmap = Cache.battleback(PAC::UTILITY::BB_TEST)
- return
- else
- pac_abb_create_battleback # The usual.
- end
- end
- if $game_system.battleback != nil # If battleback is set...
- @battleback_sprite = Sprite.new(@viewport1)
- @battleback_sprite.bitmap = Cache.battleback($game_system.battleback)
- elsif PAC::UTILITY::BB_MAPS.key?($game_map.map_id)
- @battleback_sprite = Sprite.new(@viewport1)
- @battleback_sprite.bitmap = Cache.battleback(PAC::UTILITY::BB_MAPS[$game_map.map_id])
- else
- pac_abb_create_battleback # The. Usual. Method.
- end
- end
- #--------------------------------------------------------------------------
- # * Create Battlefloor Sprite
- #--------------------------------------------------------------------------
- unless PAC::UTILITY::CREATE_FLOOR == true # Check if rewrite is needed...
- def create_battlefloor
- if PAC::UTILITY::BB_MAPS.key?($game_map.map_id) or $game_system.battleback != nil
- @battlefloor_sprite = Sprite.new(@viewport1)
- return
- end
- if $BTEST
- if PAC::UTILITY::BB_TEST != nil
- @battlefloor_sprite = Sprite.new(@viewport1)
- return
- end
- end
- pac_abb_create_battlefloor # The usual.
- end
- def update_battlefloor
- end # Do not rewrite battlefloor sprite.
- end
- end
- elsif PAC::UTILITY::BB_TYPE == 2 # Run SBB.
- #==============================================================================
- # ** Spriteset_Battle
- #------------------------------------------------------------------------------
- # This class brings together battle screen sprites. It's used within the
- # Scene_Battle class.
- #==============================================================================
- class Spriteset_Battle
- #-----------------------------------------------------------------------------
- # * Create Battleback Sprite
- #-----------------------------------------------------------------------------
- def create_battleback
- source = $game_temp.background_bitmap
- width = PAC::UTILITY::WIDTH
- height = PAC::UTILITY::HEIGHT
- bitmap = Bitmap.new(width, height)
- bitmap.stretch_blt(bitmap.rect, source, source.rect)
- PAC::UTILITY::BLUR_INTENSITY.times do bitmap.blur end
- @battleback_sprite = Sprite.new(@viewport1)
- @battleback_sprite.bitmap = bitmap
- @battleback_sprite.ox = width/2
- @battleback_sprite.oy = height/2
- @battleback_sprite.x = Graphics.width/2
- @battleback_sprite.y = (Graphics.height-128)/2+64
- end
- #-----------------------------------------------------------------------------
- # * Create Battlefloor Sprite
- #-----------------------------------------------------------------------------
- if PAC::UTILITY::CREATE_FLOOR == true # Rewrite method?
- def create_battlefloor
- @battlefloor_sprite = Sprite.new(@viewport1)
- @battlefloor_sprite.bitmap = Cache.system("BattleFloor")
- @battlefloor_sprite.x = PAC::UTILITY::FLOOR_X
- @battlefloor_sprite.y = PAC::UTILITY::FLOOR_Y
- @battlefloor_sprite.z = 1
- @battlefloor_sprite.opacity = PAC::UTILITY::FLOOR_O
- end
- end
- end
- elsif PAC::UTILITY::BB_TYPE == 0
- else # If you fucked it up...
- p "The PAC says: BB_TYPE not set to 1 or 2. Check your Battle Back script."
- $scene = nil
- end
- #===============================================================================
- #
- # END OF SCRIPT
- #
- #===============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement