Can anyone make this script activated by a switch. I just don't want the hud showing up in towns or during cutscenes.
Or any help would be appreciated. Thanks to who ever decides to take on this task.
Code:
#***************************************************
# Wild Arms Alter Code 'F' Migrant Seal
#***************************************************
# Author: El Conductor
# Date: August/10/07
# Version: 3.0
#***************************************************
#----------------------------------------------------------------------------
# What it Does:
# If you've played any of the Wild Arms games after the first one,
# they all featured a version of battle cancelation. This script is
# based on Wild Arms Alter Code 'F's battle cancel system called
# Migrant Seal.
#
# Players are notified before a fight occurs and are given a chance to
# cancel it by pressing B.
#----------------------------------------------------------------------------
#----------------------------------------------------------------------------
# How it Works:
# The system is actually a little more complex. Players have Migrant
# Points and Migrant Levels, and enemies have Migrant Resistance.
# Every time a fight is cancelled, a certian amount of Migrant points
# are lost. The exact amount is determined by the enemy Migrant
# Resistance minus the player's Migrant LV. With a high enough
# Migrant level, canceling a fight will take no points. Migrant Points
# are restored by one after every battle.
#
# New scripts for this system are:
#
# - Troop_Migrant
# - Sprite_Alert
# - Window_Migrant
#
# Original scripts that were altered for the system are:
#
# - RPG::Troop - Variable @mig_resist was added
# - Scene_Map - Processing for canceling battles and Migrant window was added
# - Scene_Title - Migrant_Troop to set enemies resistance was added
# - Scene_Battle 2 - Regain 1 migrant point at battle end was added
# - Window_Base - Draw bars added
# - Game_Party - Migrant Points and Level added
#----------------------------------------------------------------------------
#----------------------------------------------------------------------------
# How to Use This Script:
# Just copy it and paste it above Main.
#
# To add and edit enemy troops migrant resistance levels, see class Troop_Migrant
# for more info.
#
# To increase the party's Migrant Level, use an Event Call Script and type;
# $game_party.mig_level += 1
#----------------------------------------------------------------------------
#----------------------------------------------------------------------------
# Comments:
# I try to make my scripts easily understandable and easy to use
# and modify. Study this script to learn RGSS better and become
# a better scripter yourself.
#----------------------------------------------------------------------------
#==============================================================================
# ** Troop_Migrant
#------------------------------------------------------------------------------
# This class sets enemy troop migrant resistance levels.
#==============================================================================
# To add enemy troops, and another line of $data_troops[X].mig_resist = P to the list
# Where X is put the troop ID. Where P is, put the level of resistance you want them to have.
class Troop_Migrant
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
# Set enemy troop Migrant resistance levels
# This list is an example. You can modify the resistance levels and troop ID's
# depending on your troops. For every enemy troop defined in your game,
# set the resistance level here.
$data_troops[1].mig_resist = 4
$data_troops[2].mig_resist = 4
$data_troops[3].mig_resist = 4
$data_troops[4].mig_resist = 4
$data_troops[5].mig_resist = 4
$data_troops[6].mig_resist = 4
$data_troops[7].mig_resist = 5
$data_troops[8].mig_resist = 5
$data_troops[9].mig_resist = 6
$data_troops[10].mig_resist = 6
$data_troops[11].mig_resist = 7
$data_troops[12].mig_resist = 7
$data_troops[13].mig_resist = 8
$data_troops[14].mig_resist = 8
$data_troops[15].mig_resist = 9
$data_troops[16].mig_resist = 9
$data_troops[17].mig_resist = 10
$data_troops[18].mig_resist = 10
$data_troops[29].mig_resist = 11
$data_troops[20].mig_resist = 11
$data_troops[21].mig_resist = 12
$data_troops[22].mig_resist = 12
$data_troops[23].mig_resist = 13
$data_troops[24].mig_resist = 13
$data_troops[25].mig_resist = 14
$data_troops[26].mig_resist = 14
$data_troops[27].mig_resist = 15
$data_troops[28].mig_resist = 16
$data_troops[29].mig_resist = 17
$data_troops[30].mig_resist = 18
$data_troops[31].mig_resist = 19
$data_troops[32].mig_resist = 20
end
end
#==============================================================================
# ** Sprite_Alert
#------------------------------------------------------------------------------
# This class creates the sprite above the player's head, notifying of a fight to be canceled
#==============================================================================
class Sprite_Alert
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
# Create alert sprite
@image = Sprite.new
# Set sprite bitmap
@image.bitmap = RPG::Cache.icon("049-Skill06")
@image.z = 500
# Make the sprite centered above player's head
@image.x = $game_player.screen_x - 13
@image.y = $game_player.screen_y - 80
end
#--------------------------------------------------------------------------
# Refresh
#--------------------------------------------------------------------------
def refresh
# Keep the sprite above the player
if @image.x != $game_player.screen_x or @image.y != $game_player.screen_y
# Make the sprite centered above player's head
@image.x = $game_player.screen_x - 13
@image.y = $game_player.screen_y - 80
end
end
#--------------------------------------------------------------------------
# Dispose
#--------------------------------------------------------------------------
def dispose
@image.dispose
end
end
#==============================================================================
# ** Window_Migrant
#------------------------------------------------------------------------------
# This window displays they player's Migrant Level and Migrant Points Bar.
#==============================================================================
class Window_Migrant < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0, 200, 80)
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = 0
refresh
end
#--------------------------------------------------------------------------
# Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(0, 0, 100, 32, "Enc Resistance")
self.contents.draw_text(100, 0, 50, 32, $game_party.mig_level.to_s)
draw_migrant_bar($game_party.mig_points, 0, 30, 150)
end
#--------------------------------------------------------------------------
# Show how much of the bar will be lost if fight is canceled
#--------------------------------------------------------------------------
def show_amount(np)
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(0, 0, 100, 32, "Enc Resistance")
self.contents.draw_text(100, 0, 50, 32, $game_party.mig_level.to_s)
draw_migrant_bar($game_party.mig_points, 0, 30, 150)
draw_portion_migrant_bar(np, $game_party.mig_points, 0, 30, 150)
end
end
#==============================================================================
# ** RPG::Troop
#------------------------------------------------------------------------------
# This class defines the enemy troops.
#==============================================================================
module RPG
class Troop
def initialize
@id = 0
@name = ""
@members = []
@pages = [RPG::BattleEventPage.new]
@mig_resist = 0
end
attr_accessor :id
attr_accessor :name
attr_accessor :members
attr_accessor :pages
attr_accessor :mig_resist
end
end
#==============================================================================
# ** Game_Party
#==============================================================================
class Game_Party
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
# Added variables
attr_accessor :mig_points
attr_accessor :mig_level
#--------------------------------------------------------------------------
# * Alias Method
#--------------------------------------------------------------------------
alias mig_game_party_init initialize
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
# Original initialize method
mig_game_party_init
# Party's Migrant points
@mig_points = 12
# Party's Migrant level
@mig_level = 1
end
end
#==============================================================================
# ** Window_Base
#==============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# * Draws a rounded edge Bar
#--------------------------------------------------------------------------
def draw_roundbar(x, y, l, xp, max_xp, color)
# Get width with the simple proportion formula
# l / width == Max_xp / xp, where xp stands for migrant points
# This is the formula you get when you cross multiply
width = xp * l / max_xp
# Draws the border bar
self.contents.fill_rect(x + 2, y, l + 1, 1 ,Color.new(50, 50, 50, 255))
self.contents.fill_rect(x + 1, y + 1, l + 3, 1 ,Color.new(50, 50, 50, 255))
self.contents.fill_rect(x, y + 2, l + 5, 3 ,Color.new(50, 50, 50, 255))
self.contents.fill_rect(x + 1, y + 5, l + 3, 1 ,Color.new(50, 50, 50, 255))
self.contents.fill_rect(x + 2, y + 6, l + 1, 1 ,Color.new(50, 50, 50, 255))
# This draws the bar
self.contents.fill_rect(x + 3, y + 1, width - 2, 1 , color)
self.contents.fill_rect(x + 2, y + 2, width, 3 , color)
self.contents.fill_rect(x + 3, y + 5, width - 2, 1 , color)
end
#--------------------------------------------------------------------------
# * Draws a portion of rounded edge Bar
# Shows how much length of bar will be lost if fight is canceled
#--------------------------------------------------------------------------
def draw_portion_roundbar(x, y, l, rp, xp, color)
# Need to show how much length of the bar will be taken off if fight is canceled
# Use a few proportion formulas
# In this formula where rp is the current enemy troop's migrant resistance level and l is length of bar
# find how much of the bar is enemy's resistance
width = rp * l / 12 # width is how much will be lost
# In this formula where xp is the current party's migrant points and l is length of bar
# find how much of the bar is party's migrant points
l2 = xp * l / 12 # The bar's x coordinate needs to plotted off of l2
# This finds out how much of the bar is current migrant points - enemy resistance
x2 = l2 - width # x2 will be used as the bar's x coordinate
# This draws the bar
# Since x2 is dependant on how many migrant points the party has, position
# of width on the bar will change when migrant points are increased or decreased
self.contents.fill_rect(x2 + 3, y + 1, width - 2, 1 , color)
self.contents.fill_rect(x2 + 2, y + 2, width, 3 , color)
self.contents.fill_rect(x2 + 3, y + 5, width - 2, 1 , color)
end
#--------------------------------------------------------------------------
# * Draws the Migrant Points Bar
#--------------------------------------------------------------------------
def draw_migrant_bar(points, x, y, l)
# Get color for bar
color = Color.new(220, 150, 0,255)
# Draw the bar
draw_roundbar(x, y, l, points, 12, color)
end
#--------------------------------------------------------------------------
# * Draws partial Migrants Points Bar
#--------------------------------------------------------------------------
def draw_portion_migrant_bar(np, xp, x, y, l)
# Get color for bar
color = Color.new(220, 150, 0,255)
# Draw the bar
draw_portion_roundbar(x, y, l, np, xp, Color.new(120, 50, 180, 255))
end
end
=begin
#==============================================================================
# ** Scene_Title
#==============================================================================
class Scene_Title
#--------------------------------------------------------------------------
# Alias Methods
#--------------------------------------------------------------------------
alias mig_scene_title_main main
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# Original script
mig_scene_title_main
# Load enemy troops' resistance levels
Troop_Migrant.new
end
end
=end
#==============================================================================
# ** Scene_Battle (part 2)
#------------------------------------------------------------------------------
# This class performs battle screen processing.
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# * Start After Battle Phase
#--------------------------------------------------------------------------
def start_phase5
# Shift to phase 5
@phase = 5
# Play battle end ME
$game_system.me_play($game_system.battle_end_me)
# Return to BGM before battle started
$game_system.bgm_play($game_temp.map_bgm)
# Initialize EXP, amount of gold, and treasure
exp = 0
gold = 0
treasures = []
# Loop
for enemy in $game_troop.enemies
# If enemy is not hidden
unless enemy.hidden
# Add EXP and amount of gold obtained
exp += enemy.exp
gold += enemy.gold
# Determine if treasure appears
if rand(100) < enemy.treasure_prob
if enemy.item_id > 0
treasures.push($data_items[enemy.item_id])
end
if enemy.weapon_id > 0
treasures.push($data_weapons[enemy.weapon_id])
end
if enemy.armor_id > 0
treasures.push($data_armors[enemy.armor_id])
end
end
end
end
# Treasure is limited to a maximum of 6 items
treasures = treasures[0..5]
# Obtaining EXP
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
if actor.cant_get_exp? == false
last_level = actor.level
actor.exp += exp
if actor.level > last_level
@status_window.level_up(i)
end
end
end
# Obtaining gold
$game_party.gain_gold(gold)
# Obtaining treasure
for item in treasures
case item
when RPG::Item
$game_party.gain_item(item.id, 1)
when RPG::Weapon
$game_party.gain_weapon(item.id, 1)
when RPG::Armor
$game_party.gain_armor(item.id, 1)
end
end
# Add a Migrant point to the party for winning a battle if not already at max points
if $game_party.mig_points < 12
$game_party.mig_points +=1
end
# Make battle result window
@result_window = Window_BattleResult.new(exp, gold, treasures)
# Set wait count
@phase5_wait_count = 100
end
end
#==============================================================================
# ** Scene_Map
#------------------------------------------------------------------------------
# This class performs map screen processing.
#==============================================================================
class Scene_Map
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# Make sprite set
@spriteset = Spriteset_Map.new
# Make message window
@message_window = Window_Message.new
# Make migrant window
@migrant_window = Window_Migrant.new
# Migrant System variables
# Set variable equal to party's Migrant Level
@migrant_level = $game_party.mig_level
# Set battle pending to false
@battle_pending = false
# Set delay time to 0
@delay = 0
# Set delay time rate
@time = Graphics.frame_rate / 30
# Transition run
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
# Abort loop if screen is changed
if $scene != self
break
end
end
# Prepare for transition
Graphics.freeze
# Dispose of sprite set
@spriteset.dispose
# Dispose of message window
@message_window.dispose
# Dispose of migrant window
@migrant_window.dispose
# If switching to title screen
if $scene.is_a?(Scene_Title)
# Fade out screen
Graphics.transition
Graphics.freeze
end
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Loop
loop do
# Update map, interpreter, and player order
# (this update order is important for when conditions are fulfilled
# to run any event, and the player isn't provided the opportunity to
# move in an instant)
$game_map.update
$game_system.map_interpreter.update
$game_player.update
# Update system (timer), screen
$game_system.update
$game_screen.update
# Abort loop if player isn't place moving
unless $game_temp.player_transferring
break
end
# Run place move
transfer_player
# Abort loop if transition processing
if $game_temp.transition_processing
break
end
end
# Update sprite set
@spriteset.update
# Update message window
@message_window.update
# If party's Migrant level is changed while on map screen
if @migrant_level != $game_party.mig_level
# Refresh Migrant window
@migrant_window.refresh
# Set variable equal to party's Migrant Level
@migrant_level = $game_party.mig_level
end
# If battle is pending
if @battle_pending
# Add time to @delay
@delay += @time
# Refresh alert sprite
@exclam.refresh
end
# If @delay reaches 50, call battle
if @delay == 50
# Call battle
call_battle_precor
end
# If game over
if $game_temp.gameover
# Switch to game over screen
$scene = Scene_Gameover.new
return
end
# If returning to title screen
if $game_temp.to_title
# Change to title screen
$scene = Scene_Title.new
return
end
# If transition processing
if $game_temp.transition_processing
# Clear transition processing flag
$game_temp.transition_processing = false
# Execute transition
if $game_temp.transition_name == ""
Graphics.transition(20)
else
Graphics.transition(40, "Graphics/Transitions/" +
$game_temp.transition_name)
end
end
# If showing message window
if $game_temp.message_window_showing
return
end
# If encounter list isn't empty, and encounter count is 0 and battle is not pending
if $game_player.encounter_count == 0 and $game_map.encounter_list != [] and
@battle_pending == false
@exclam = Sprite_Alert.new
# If event is running or encounter is not forbidden
unless $game_system.map_interpreter.running? or
$game_system.encounter_disabled
# Confirm troop
n = rand($game_map.encounter_list.size)
@troop_id = $game_map.encounter_list[n]
# Calculate migrant cost for canceling fight
migrant_cost = $data_troops[@troop_id].mig_resist - @migrant_level
# If party's migrant points are greater than 0 and
# if migrant cost is over 12, player can't cancel, start fight.
if $game_party.mig_points > 0 and migrant_cost < $game_party.mig_points
# Play sound
Audio.se_play("Audio/SE/056-Right02" , 100, 100)
# Start count steps again
$game_player.make_encounter_count
# Set battle pending to true
@battle_pending = true
# Make migrant window show how many migrant points will be required to cancel battle
@migrant_window.show_amount(migrant_cost)
# Else if player can't cancel, start fight
else
call_battle_precor
end
end
# If encounter list isn't empty, and encounter count is 0 and battle is pending
elsif $game_player.encounter_count == 0 and $game_map.encounter_list != [] and
@battle_pending == true
# Do nothing
end
# If B button was pressed and battle is pending
if Input.trigger?(Input::B) and @battle_pending == true
# If event is running, or menu is not forbidden
unless $game_system.map_interpreter.running? or
$game_system.menu_disabled
# Play sound
Audio.se_play("Audio/SE/082-Monster04" , 80, 100)
# Set battle pending to false
@battle_pending = false
# Get enemy troops migrant resistance
troop_cost = $data_troops[@troop_id].mig_resist
# Calculate migrant cost by subtracting party's migrant level from troop resistance
migrant_cost = troop_cost - $game_party.mig_level
# If migrant cost is more than 0
if migrant_cost > 0
# Lose migrant points for cancel
$game_party.mig_points -= migrant_cost
end
# Set delay time to 0
@delay = 0
# Get rid of alert sprite
@exclam.dispose
# Refresh migrant window
@migrant_window.refresh
end
# If B button was pressed and battle is not pending
elsif Input.trigger?(Input::B) and @battle_pending == false
# If event is running, or menu is not forbidden
unless $game_system.map_interpreter.running? or
$game_system.menu_disabled
# Set menu calling flag or beep flag
$game_temp.menu_calling = true
$game_temp.menu_beep = true
end
end
# If debug mode is ON and F9 key was pressed
if $DEBUG and Input.press?(Input::F9)
# Set debug calling flag
$game_temp.debug_calling = true
end
# If player is not moving
unless $game_player.moving?
# Run calling of each screen
if $game_temp.battle_calling
call_battle
elsif $game_temp.shop_calling
call_shop
elsif $game_temp.name_calling
call_name
elsif $game_temp.menu_calling
call_menu
elsif $game_temp.save_calling
call_save
elsif $game_temp.debug_calling
call_debug
end
end
end
#--------------------------------------------------------------------------
# * Start Battle
#--------------------------------------------------------------------------
def call_battle_precor
# If troop is valid
if $data_troops[@troop_id] != nil
# Set battle calling flag
$game_temp.battle_calling = true
$game_temp.battle_troop_id = @troop_id
$game_temp.battle_can_escape = true
$game_temp.battle_can_lose = false
$game_temp.battle_proc = nil
# Set delay time to 0
@delay = 0
# Get rid of alert sprite
@exclam.dispose
# Turn battle pending off
@battle_pending = false
# Refresh migrant window
@migrant_window.refresh
end
end
#--------------------------------------------------------------------------
# * Battle Call
#--------------------------------------------------------------------------
def call_battle
# Clear battle calling flag
$game_temp.battle_calling = false
# Clear menu calling flag
$game_temp.menu_calling = false
$game_temp.menu_beep = false
# Make encounter count
$game_player.make_encounter_count
# Memorize map BGM and stop BGM
$game_temp.map_bgm = $game_system.playing_bgm
$game_system.bgm_stop
# Play battle start SE
$game_system.se_play($data_system.battle_start_se)
# Play battle BGM
$game_system.bgm_play($game_system.battle_bgm)
# Straighten player position
$game_player.straighten
# Switch to battle screen
$scene = Scene_Battle.new
end
#--------------------------------------------------------------------------
# * Shop Call
#--------------------------------------------------------------------------
def call_shop
# Clear shop call flag
$game_temp.shop_calling = false
# Straighten player position
$game_player.straighten
# Switch to shop screen
$scene = Scene_Shop.new
end
#--------------------------------------------------------------------------
# * Name Input Call
#--------------------------------------------------------------------------
def call_name
# Clear name input call flag
$game_temp.name_calling = false
# Straighten player position
$game_player.straighten
# Switch to name input screen
$scene = Scene_Name.new
end
#--------------------------------------------------------------------------
# * Menu Call
#--------------------------------------------------------------------------
def call_menu
# Clear menu call flag
$game_temp.menu_calling = false
# If menu beep flag is set
if $game_temp.menu_beep
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Clear menu beep flag
$game_temp.menu_beep = false
end
# Straighten player position
$game_player.straighten
# Switch to menu screen
$scene = Scene_Menu.new
end
#--------------------------------------------------------------------------
# * Save Call
#--------------------------------------------------------------------------
def call_save
# Straighten player position
$game_player.straighten
# Switch to save screen
$scene = Scene_Save.new
end
#--------------------------------------------------------------------------
# * Debug Call
#--------------------------------------------------------------------------
def call_debug
# Clear debug call flag
$game_temp.debug_calling = false
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Straighten player position
$game_player.straighten
# Switch to debug screen
$scene = Scene_Debug.new
end
#--------------------------------------------------------------------------
# * Player Place Move
#--------------------------------------------------------------------------
def transfer_player
# Clear player place move call flag
$game_temp.player_transferring = false
# If move destination is different than current map
if $game_map.map_id != $game_temp.player_new_map_id
# Set up a new map
$game_map.setup($game_temp.player_new_map_id)
end
# Set up player position
$game_player.moveto($game_temp.player_new_x, $game_temp.player_new_y)
# Set player direction
case $game_temp.player_new_direction
when 2 # down
$game_player.turn_down
when 4 # left
$game_player.turn_left
when 6 # right
$game_player.turn_right
when 8 # up
$game_player.turn_up
end
# Straighten player position
$game_player.straighten
# Update map (run parallel process event)
$game_map.update
# Remake sprite set
@spriteset.dispose
@spriteset = Spriteset_Map.new
# If processing transition
if $game_temp.transition_processing
# Clear transition processing flag
$game_temp.transition_processing = false
# Execute transition
Graphics.transition(20)
end
# Run automatic change for BGM and BGS set on the map
$game_map.autoplay
# Frame reset
Graphics.frame_reset
# Update input information
Input.update
end
end
Or any help would be appreciated. Thanks to who ever decides to take on this task.