On-Map Character Switch
Version: 2
Introduction
It changes who is the main character or the character that you move around with!
Demo/Download
Link
Script
Instructions
ScreenShot:
http://members.lycos.co.uk/illusiongames/switch.PNG[/IMG]
*Just a test screenshot yours can look better!
(The arrows are animated!)
Compatibility
I'm not sure if its compatible with sdk or other map scripts.
Credits and Thanks
Credits goes to me or Illusion Games
Author's Notes
This is a good script for a 1 player game with an ABS, and the idea was off from Drakendgard
Terms and Conditions
Free to use, as long as you credit me(Illusion Games would be best)
Version: 2
Introduction
It changes who is the main character or the character that you move around with!
Demo/Download
Link
Script
Code:
#===================================================
# - CLASS Scene_Switch Begins
# - Version 2
# - By Illusion Games
#===================================================
class Scene_Switch
def main
# Make sprite set
@spriteset = Spriteset_Map.new
@index = 0
@window1 = Window_Chara.new(@index)
@window2 = Sprite.new
@window2.bitmap = RPG::Cache.picture("SwitchBox")
@window2.y = 115
@select = Sprite.new
@select.bitmap = RPG::Cache.picture("Select")
@select.y = 137
@select.x = 10
@a1 = Sprite.new
@a1.bitmap = RPG::Cache.picture("arrow_left")
@a1.y = 180
@a1.x = 0
@a2 = Sprite.new
@a2.bitmap = RPG::Cache.picture("arrow_right")
@a2.y = 180
@a2.x = 222
@face = 1 #0 = show face, 1 = show character sprite, anything above 1 won't show anything
@image = Window_CharaImage.new(@index, @face)
@wait = 0
# Execute transition
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 windows
@image.dispose
@window1.dispose
@window2.dispose
@spriteset.dispose
@a1.dispose
@a2.dispose
@select.dispose
end
def update
@window1.update
@image.update
@wait += 1
# animates the arrows
if @a1.x != 5
if @wait == 5
@a1.x += 1
end
else
@a1.x = 0
end
if @a2.x != 217
if @wait == 5
@a2.x -= 1
end
else
@a2.x = 222
end
# makes the select box animated
if @wait == 5
if @select.opacity > 160
@select.opacity -= 10
else
@select.opacity = 255
end
end
if @index == 0
@select.x = 10
else
@select.x = 120
end
if @wait == 5
@wait = 0
end
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to map screen
$scene = Scene_Map.new
return
end
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
@changer = $game_party.actors[0]
$game_party.actors[0] = $game_party.actors[@index]
$game_party.actors[@index] = @changer
$game_map.refresh
$game_party.refresh
$game_player.refresh
return
end
if Input.trigger?(Input::RIGHT)
$game_system.se_play($data_system.cursor_se)
if @index != $game_party.actors.size - 1
@index += 1
@window1.refresh(@index)
@image.refresh(@index, @face)
end
end
if Input.trigger?(Input::LEFT)
$game_system.se_play($data_system.cursor_se)
if @index != 0
@index -= 1
@window1.refresh(@index)
@image.refresh(@index, @face)
end
end
end
end
# Character Info window
class Window_Chara < Window_Base
def initialize(index, face=0)
super(0, 0, 240,120)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
refresh(index)
end
def refresh(index)
self.contents.clear
actor = $game_party.actors[index]
self.contents.font.color = Color.new(255,255,255)
self.contents.draw_text(0, 0, 211, 33, actor.name)
self.contents.draw_text(0, 32, 211, 33, "ATK:")
self.contents.draw_text(0, 64, 211, 33, "DEF:")
self.contents.draw_text(100, 32, 211, 33, "SPD:")
self.contents.draw_text(100, 64, 211, 33, "MDEF:")
self.contents.draw_text(50, 32, 211, 33, actor.atk.to_s)
self.contents.draw_text(50, 64, 211, 33, actor.pdef.to_s)
self.contents.draw_text(160, 32, 211, 33, actor.dex.to_s)
self.contents.draw_text(160, 64, 211, 33, actor.mdef.to_s)
end
end
class Window_CharaImage < Window_Base
def initialize(index, face=0)
super(0,-15,300,340)
self.contents = Bitmap.new(width - 32, height - 32)
self.windowskin = nil
refresh(index, face)
end
def refresh(index, face)
self.contents.clear
case face
when 0
if index < 1
actor = $game_party.actors[0]
bitmap = RPG::Cache.character("faces/"+actor.name, 0)
cw = bitmap.rect.width
ch = bitmap.rect.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(0, 140, bitmap, src_rect)
actor2 = $game_party.actors[1]
bitmap = RPG::Cache.character("faces/"+actor2.name, 0)
cw = bitmap.rect.width
ch = bitmap.rect.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(110, 140, bitmap, src_rect)
else
actor = $game_party.actors[index-1]
bitmap = RPG::Cache.character("faces/"+actor.name, 0)
cw = bitmap.rect.width
ch = bitmap.rect.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(0, 140, bitmap, src_rect)
actor2 = $game_party.actors[index]
bitmap = RPG::Cache.character("faces/"+actor2.name, 0)
cw = bitmap.rect.width
ch = bitmap.rect.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(110, 140, bitmap, src_rect)
end
when 1
if index < 1
actor = $game_party.actors[0]
bitmap = RPG::Cache.character(actor.character_name, 0)
cw = bitmap.rect.width / 4
ch = bitmap.rect.height / 4
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(30, 165, bitmap, src_rect)
actor2 = $game_party.actors[1]
bitmap = RPG::Cache.character(actor2.character_name, 0)
cw = bitmap.rect.width / 4
ch = bitmap.rect.height / 4
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(140, 165, bitmap, src_rect)
else
actor = $game_party.actors[index-1]
bitmap = RPG::Cache.character(actor.character_name, 0)
cw = bitmap.rect.width / 4
ch = bitmap.rect.height / 4
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(30, 165, bitmap, src_rect)
actor2 = $game_party.actors[index]
bitmap = RPG::Cache.character(actor2.character_name, 0)
cw = bitmap.rect.width / 4
ch = bitmap.rect.height / 4
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(140, 165, bitmap, src_rect)
end
end
end
end
Instructions
Add that script above main!
And Open your Scene_Map and find
Add this above that:
now if you get an error trying it add this to your Main script:
(Just change the font to the font you want to use)
Below
Add these images in your picture folder!
Select
http://members.lycos.co.uk/illusiongame ... Select.PNG[/IMG]
SwitchBox
http://members.lycos.co.uk/illusiongame ... tchBox.PNG[/IMG]
Arrows
http://members.lycos.co.uk/illusiongame ... w_left.PNG[/IMG]
http://members.lycos.co.uk/illusiongame ... _right.PNG[/IMG]
Also make a Folder called "faces" in your character folder and name the images for the character it is for(If you're using faces)
go ahead and use that template or if you want but you can always use your own!
And Open your Scene_Map and find
Code:
# If B button was pressed
if Input.trigger?(Input::B)
# 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
Add this above that:
Code:
# Change Shift to the key you want to open the switch scene
if Input.trigger?(Input::SHIFT)
$game_system.se_play($data_system.decision_se)
$scene = Scene_Switch.new
end
now if you get an error trying it add this to your Main script:
(Just change the font to the font you want to use)
Code:
# This variable determines the default font type
$defaultfonttype = "Arial Rounded MT Bold"
# This variable determines the default font size
$defaultfontsize = 15
Code:
#==============================================================================
# ** Main
#------------------------------------------------------------------------------
# After defining each class, actual processing begins here.
#==============================================================================
begin
Select
http://members.lycos.co.uk/illusiongame ... Select.PNG[/IMG]
SwitchBox
http://members.lycos.co.uk/illusiongame ... tchBox.PNG[/IMG]
Arrows
http://members.lycos.co.uk/illusiongame ... w_left.PNG[/IMG]
http://members.lycos.co.uk/illusiongame ... _right.PNG[/IMG]
Also make a Folder called "faces" in your character folder and name the images for the character it is for(If you're using faces)
go ahead and use that template or if you want but you can always use your own!
ScreenShot:
http://members.lycos.co.uk/illusiongames/switch.PNG[/IMG]
*Just a test screenshot yours can look better!
(The arrows are animated!)
Compatibility
I'm not sure if its compatible with sdk or other map scripts.
Credits and Thanks
Credits goes to me or Illusion Games
Author's Notes
This is a good script for a 1 player game with an ABS, and the idea was off from Drakendgard
Terms and Conditions
Free to use, as long as you credit me(Illusion Games would be best)