#======================================
# ■ Anti Event Lag Script
#======================================
# By: Near Fantastica
# Date: 12.06.05
# Version: 3
#======================================
#======================================
# ■ Game_Map
#======================================
class Game_Map
#--------------------------------------------------------------------------
def in_range?(object)
screne_x = $game_map.display_x
screne_x -= 256
screne_y = $game_map.display_y
screne_y -= 256
screne_width = $game_map.display_x
screne_width += 2816
screne_height = $game_map.display_y
screne_height += 2176
return false if object.real_x <= screne_x-32
return false if object.real_x >= screne_width+32
return false if object.real_y <= screne_y-32
return false if object.real_y >= screne_height+32
return true
end
#--------------------------------------------------------------------------
def update
if $game_map.need_refresh
refresh
end
if @scroll_rest > 0
distance = 2 ** @scroll_speed
case @scroll_direction
when 2
scroll_down(distance)
when 4
scroll_left(distance)
when 6
scroll_right(distance)
when 8
scroll_up(distance)
end
@scroll_rest -= distance
end
for event in @events.values
if in_range?(event) or event.trigger == 3 or event.trigger == 4
event.update
end
end
for common_event in @common_events.values
common_event.update
end
@fog_ox -= @fog_sx / 8.0
@fog_oy -= @fog_sy / 8.0
if @fog_tone_duration >= 1
d = @fog_tone_duration
target = @fog_tone_target
@fog_tone.red = (@fog_tone.red * (d - 1) + target.red) / d
@fog_tone.green = (@fog_tone.green * (d - 1) + target.green) / d
@fog_tone.blue = (@fog_tone.blue * (d - 1) + target.blue) / d
@fog_tone.gray = (@fog_tone.gray * (d - 1) + target.gray) / d
@fog_tone_duration -= 1
end
if @fog_opacity_duration >= 1
d = @fog_opacity_duration
@fog_opacity = (@fog_opacity * (d - 1) + @fog_opacity_target) / d
@fog_opacity_duration -= 1
end
end
end
#======================================
# ■ Spriteset_Map
#======================================
class Spriteset_Map
#--------------------------------------------------------------------------
def in_range?(object)
screne_x = $game_map.display_x
screne_x -= 256
screne_y = $game_map.display_y
screne_y -= 256
screne_width = $game_map.display_x
screne_width += 2816
screne_height = $game_map.display_y
screne_height += 2176
return false if object.real_x <= screne_x
return false if object.real_x >= screne_width
return false if object.real_y <= screne_y
return false if object.real_y >= screne_height
return true
end
#--------------------------------------------------------------------------
def update
if @panorama_name != $game_map.panorama_name or
@panorama_hue != $game_map.panorama_hue
@panorama_name = $game_map.panorama_name
@panorama_hue = $game_map.panorama_hue
if @panorama.bitmap != nil
@panorama.bitmap.dispose
@panorama.bitmap = nil
end
if @panorama_name != ""
@panorama.bitmap = RPG::Cache.panorama(@panorama_name, @panorama_hue)
end
Graphics.frame_reset
end
if @fog_name != $game_map.fog_name or @fog_hue != $game_map.fog_hue
@fog_name = $game_map.fog_name
@fog_hue = $game_map.fog_hue
if @fog.bitmap != nil
@fog.bitmap.dispose
@fog.bitmap = nil
end
if @fog_name != ""
@fog.bitmap = RPG::Cache.fog(@fog_name, @fog_hue)
end
Graphics.frame_reset
end
@tilemap.ox = $game_map.display_x / 4
@tilemap.oy = $game_map.display_y / 4
@tilemap.update
@panorama.ox = $game_map.display_x / 8
@panorama.oy = $game_map.display_y / 8
@fog.zoom_x = $game_map.fog_zoom / 100.0
@fog.zoom_y = $game_map.fog_zoom / 100.0
@fog.opacity = $game_map.fog_opacity
@fog.blend_type = $game_map.fog_blend_type
@fog.ox = $game_map.display_x / 4 + $game_map.fog_ox
@fog.oy = $game_map.display_y / 4 + $game_map.fog_oy
@fog.tone = $game_map.fog_tone
i=0
for sprite in @character_sprites
if sprite.character.is_a?(Game_Event)
if in_range?(sprite.character) or sprite.character.trigger == 3 or sprite.character.trigger == 4
sprite.update
i+=1
end
else
sprite.update
i+=1
end
end
#p i
@weather.type = $game_screen.weather_type
@weather.max = $game_screen.weather_max
@weather.ox = $game_map.display_x / 4
@weather.oy = $game_map.display_y / 4
@weather.update
for sprite in @picture_sprites
sprite.update
end
@timer_sprite.update
@viewport1.tone = $game_screen.tone
@viewport1.ox = $game_screen.shake
@viewport3.color = $game_screen.flash_color
@viewport1.update
@viewport3.update
end
end
Geposted von Macros.
#================================================
# Aliases and redefines draw_text so that a sadow is drawn
# Made by: Ultimate Jesus
#================================================
class Bitmap
ShadowIndent = 2 # Size of the shadow (usually 1..3)
ShadowColour = Color.new(0, 0, 0, 200)# the colour of the shadow
# the 4th value is transparency (0-255)
unless @ja_ta_feito == 1 # Fix for F12 Rebot by P@nCHo
alias draw_text_plain draw_text
@ja_ta_feito = 1
end
def draw_text(arg1 = 0, arg2 = 0, arg3 = 0, arg4 = 0, arg5 = 0, arg6 = 0)
if arg1.is_a?(Rect)
x = arg1.x
y = arg1.y
width = arg1.width
height = arg1.height
string = arg2
align = arg3
else
x = arg1
y = arg2
width = arg3
height = arg4
string = arg5
align = arg6
end
colour = self.font.color.dup
self.font.color = ShadowColour
draw_text_plain(x + ShadowIndent, y + ShadowIndent, width, height, string, align)
self.font.color = colour
draw_text_plain(x, y, width, height, string, align)
end
end
Geposted von Hot Blizzard.
Zitat von Jerome Denis Andre
Bei Spielen, die mit den RPG Maker 2000 oder 2003 erstellt wurden, wurden am Anfang immer 1 bis 3 Logos gezeigt. Diese Funktion kann auch in den RPG Maker XP eingebaut werden.
Folgendes Skript wie im Header beschrieben einbauen. Weitere Instruktionen sind ebenfalls im Skript zu finden.
Credits an:
~DeR ErZenGeL~
Source code:
#Im Scene_Title Skript unter
# # Make system object
# $game_system = Game_System.new
#einfügen (Standard: Zeile 33)
#===============================INTROSCREEN 2.0===============================#
$game_system.bgm_play($data_system.title_bgm)
unless introscreen
@sprite = Sprite.new
# Name des Bildes mit Endung in Lila, Anführungszeichen und Klammern
# Diese zwei Punkte sind zu beachten und befolgen:
# hat Größe: max. 640x480 sonst zentriert
# in Ordner: Graphics/Titles
@sprite.bitmap = RPG::Cache.title("001-Title01.png")
# Anzeigeposition x und y des Bildes
@sprite.x = (640 - @sprite.bitmap.width) / 2
@sprite.y = (480 - @sprite.bitmap.height) / 2
# Transparenz des Bildes [Rot]
@sprite.opacity = 255
# Einblendzeit des Bildes [Rot und in Klammern]
Graphics.transition(40)
for i in 0..40
Graphics.update
end
Graphics.freeze
@sprite.bitmap.dispose
@sprite.dispose
# Ausblendzeit des Bildes [Rot und in Klammern]
Graphics.transition(40)
Graphics.freeze
end
# Bei Neustart [F12] kein zweites Anzeigen des Bildes
introscreen = true
Um mehrere Bilder anzuzeigen einfach
@sprite = Sprite.new
@sprite.bitmap = RPG::Cache.title("001-Title01.png")
@sprite.x = (640 - @sprite.bitmap.width) / 2
@sprite.y = (480 - @sprite.bitmap.height) / 2
@sprite.opacity = 255
Graphics.transition(40)
for i in 0..40
Graphics.update
end
Graphics.freeze
@sprite.bitmap.dispose
@sprite.dispose
Graphics.transition(40)
Graphics.freeze
Beim Aufruf von "Quicksave.save" wird das Spiel in eine Datei namens "quicksave.sav" gespeichert. Beim Aufruf von "Quicksave.load" wird der Spielstand aus dieser Datei, sofern vorhanden, geladen.
Damit das Schnellspeichern jederzeit auf der Map per Tastendruck, z.B. F5, funktioniert, muss im Script Scene_Map in der update-Methode was eingefügt werden:
...
if $DEBUG and Input.press?(Input::F9)
$game_temp.debug_calling = true
end
#~~~~~~~~~~~~~~~
if Input.trigger?(Input::F5)
Quicksave.save
end
if Input.trigger?(Input::F6)
Quicksave.load
end
#~~~~~~~~~~~~~~~
unless $game_player.moving?
if $game_temp.battle_calling
call_battle
elsif $game_temp.shop_calling
...
F5 -> Speichern
F6 -> Laden
Es können auch andere Tasten verwendet werden, dann muss man statt F5 und F6 eben was anderes schreiben, möglich ist F5-F9.
Das alles funktioniert ohne jegliche Dialoge. Zumindest mich nervt es, wenn ich für jedes Speichern erst mal das Menü aufrufen, den Menüpunkt Speichern anwählen und einen Spielstand bestimmen muss.
Bei Verwendung wie immer bitte Creditseintrag^^
So hier ist das Menüscript von Prexus
Einfach ein neues Script über Main einfügen und Bilder mit den Namen eurer Charas in den Pictures Ordner tun^^
# Advanced CMS Menu by Prexus
class Scene_Menu
def initialize(menu_index = 0)
@menu_index = menu_index
end
def main
s1 = $data_system.words.item
s2 = $data_system.words.skill
s3 = $data_system.words.equip
s4 = "Statut"
s5 = "Sauvegarder"
s6 = "Quitter"
@command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6])
@command_window.index = @menu_index
if $game_party.actors.size == 0
@command_window.disable_item(0)
@command_window.disable_item(1)
@command_window.disable_item(2)
@command_window.disable_item(3)
end
if $game_system.save_disabled
@command_window.disable_item(4)
end
@command_window.x = 32
@command_window.y = 32
@command_window.z = 3005
@command_window.back_opacity = 128
@playtime_window = Window_PlayTime.new
@playtime_window.x = 32
@playtime_window.y = 480-32-@playtime_window.height
@playtime_window.back_opacity = 128
@playtime_window.z = 3005
@gold_window = Window_Gold.new
@gold_window.x = 640-32-@gold_window.width
@gold_window.y = 480-32-@gold_window.height
@gold_window.back_opacity = 128
@gold_window.z = 3005
@chr_status = Window_CharacterStatus.new
@chr_status.visible = false
@status_window = Window_MenuStatus.new
@status_window.chr_status = @chr_status
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@command_window.dispose
@chr_status.dispose
@status_window.dispose
@gold_window.dispose
@playtime_window.dispose
end
def update
if @status_window.active and (@command_window.x != -128 or @playtime_window.x != 32-@playtime_window.width)
if @command_window.x != -128
@command_window.z = 3001
@command_window.x -= 5
end
if @playtime_window.x != 32-@playtime_window.width
@playtime_window.x -= 5
end
return
end
if @command_window.active and (@command_window.x != 32 or @playtime_window.x != 32)
if @command_window.x != 32
@command_window.z = 3005
@command_window.x += 5
end
if @playtime_window.x != 32
@playtime_window.x += 5
end
return
end
@command_window.update
@status_window.update
@gold_window.update
@playtime_window.update
@chr_status.update
if @command_window.active
update_command
@chr_status.visible = false
return
end
if @status_window.active
update_status
@chr_status.visible = true
return
end
end
def update_command
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
return
end
if Input.trigger?(Input::C)
if $game_party.actors.size == 0 and @command_window.index < 4
$game_system.se_play($data_system.buzzer_se)
return
end
case @command_window.index
when 0
$game_system.se_play($data_system.decision_se)
$scene = Scene_Item.new
when 1
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 2
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 3
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 4
if $game_system.save_disabled
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
$scene = Scene_Save.new
when 5
$game_system.se_play($data_system.decision_se)
$scene = Scene_End.new
end
return
end
end
def update_status
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@command_window.active = true
@status_window.active = false
@status_window.index = -1
return
end
if Input.trigger?(Input::C)
case @command_window.index
when 1
if $game_party.actors[@status_window.index].restriction >= 2
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
$scene = Scene_Skill.new(@status_window.index)
when 2
$game_system.se_play($data_system.decision_se)
$scene = Scene_Equip.new(@status_window.index)
when 3
$game_system.se_play($data_system.decision_se)
$scene = Scene_Status.new(@status_window.index)
end
return
end
end
end
class Window_CharacterStatus < Window_Base
def initialize
super(480-32, 0, 192, 128)
self.contents = Bitmap.new(width-32, height-32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
self.back_opacity = 0
self.z = 3006
end
def refresh(index)
self.contents.clear
if index >= 0
actor = $game_party.actors[index]
draw_actor_name(actor, 0, 0)
draw_actor_level(actor, 0, 24)
draw_actor_hp(actor, 0, 48)
draw_actor_sp(actor, 0, 72)
end
end
end
class Window_MenuStatus < Window_Base
attr_reader :index
attr_reader :chr_status
def initialize
@viewport = Viewport.new(0, 0, 640, 480)
@viewport.z = 3001
super(-16, -16, 640+32, 480+32)
self.contents = Bitmap.new(width-32, height-32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
self.active = false
self.z = 3000
@index = -1
@column_max = 1
@sprites = []
refresh
end
def index=(index)
@index = index
if self.active and @chr_status != nil
update_chr_status
end
update_cursor_rect
refresh
end
def refresh
self.contents.clear
for i in 0...@sprites.size
@sprites[i].dispose
end
@sprites = []
@item_max = $game_party.actors.size
for i in 0...@item_max
actor = $game_party.actors[@item_max-i-1]
@sprites[@item_max-i-1] = Sprite.new(@viewport)
@sprites[@item_max-i-1].bitmap = RPG::Cache.picture(actor.image_name)
@sprites[@item_max-i-1].x = 560-((i+1)*120)
@sprites[@item_max-i-1].y = 480-@sprites[@item_max-i-1].bitmap.height
@sprites[@item_max-i-1].opacity = 255
@sprites[@item_max-i-1].z = 3004-i
end
end
def update_cursor_rect
if @index < 0
for i in 0...@sprites.size
@sprites[i].opacity = 255
end
else
for i in 0...@sprites.size
if i == @index
@sprites[i].opacity = 255
@sprites[i].z += 4
else
@sprites[i].opacity = 200
@sprites[i].z = 3001+i
end
end
end
end
def dispose
super
for i in 0...@sprites.size
@sprites[i].dispose
end
end
def chr_status=(chr_status)
@chr_status = chr_status
if self.active and @chr_status != nil
update_chr_status
end
end
def update
super
if self.active and @item_max > 0 and @index >= 0
if Input.repeat?(Input::RIGHT)
if Input.trigger?(Input::RIGHT) or @index < @item_max - @column_max
$game_system.se_play($data_system.cursor_se)
@index = (@index + @column_max) % @item_max
end
end
if Input.repeat?(Input::LEFT)
if Input.trigger?(Input::LEFT) or @index >= @column_max
$game_system.se_play($data_system.cursor_se)
@index = (@index - @column_max + @item_max) % @item_max
end
end
end
if self.active and @chr_status != nil
update_chr_status
elsif @chr_status != nil
@chr_status.refresh(-1)
end
update_cursor_rect
end
def update_chr_status
@chr_status.refresh(@index)
end
end
class Window_Base
def shadow_color
return Color.new(0, 0, 0, 255)
end
def draw_actor_name(actor, x, y)
self.contents.font.color = shadow_color
self.contents.draw_text(x+1, y+1, 120, 32, actor.name)
self.contents.font.color = normal_color
self.contents.draw_text(x, y, 120, 32, actor.name)
end
def draw_actor_level(actor, x, y)
self.contents.font.color = shadow_color
self.contents.draw_text(x+1, y+1, 32, 32, "Lv")
self.contents.draw_text(x + 33, y + 1, 24, 32, actor.level.to_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 32, 32, "Lv")
self.contents.font.color = normal_color
self.contents.draw_text(x + 32, y, 24, 32, actor.level.to_s, 2)
end
def draw_actor_hp(actor, x, y, width = 144)
self.contents.font.color = shadow_color
self.contents.draw_text(x+1, y+1, 32, 32, $data_system.words.hp)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 32, 32, $data_system.words.hp)
if width - 32 >= 108
hp_x = x + width - 108
flag = true
elsif width - 32 >= 48
hp_x = x + width - 48
flag = false
end
ich habe mal ein kleines billiges Skript gemacht, womit man die Steuerung des Helden vertauschen kann. Ich nenne das ganze das "Drunken Mode" Skript ;-)
Folgende Modi sind vorgegeben:
Modus 0:
Pfeil Unten -> Nach Oben gehen
Pfeil Links -> Nach Rechts gehen
Pfeil Rechts -> Nach Links gehen
Pfeil Oben -> Nach Unten gehen
Modus 1:
Pfeil Unten -> Nach Rechts gehen
Pfeil Links -> Nach Unten gehen
Pfeil Rechts -> Nach Oben gehen
Pfeil Oben -> Nach Links gehen
Modus 2:
Pfeil Unten -> Nach Links gehen
Pfeil Links -> Nach Oben gehen
Pfeil Rechts -> Nach Unten gehen
Pfeil Oben -> Nach Rechts gehen
Einbau:
1. Folgenden Code über "Main" einfügen:
#=======Drunken Mode Skript=======#
#============by Monsta============#
#====Version 1.0=== 31.1.2006 ====#
#=========www.Monsta.aw3.de=======#
class Game_Player < Game_Character
SWITCH_ID = 1
MODES = [["move_up","move_right","move_left","move_down"],
["move_right","move_down","move_up","move_left"],
["move_left","move_up","move_down","move_right"]]
def drunken_moving
case Input.dir4
when 2
if $game_switches[SWITCH_ID]
eval(MODES[@mode][0])
else
move_down
end
when 4
if $game_switches[SWITCH_ID]
eval(MODES[@mode][1])
else
move_left
end
when 6
if $game_switches[SWITCH_ID]
eval(MODES[@mode][2])
else
move_right
end
when 8
if $game_switches[SWITCH_ID]
eval(MODES[@mode][3])
else
move_up
end
end
end
def mode(mode)
@mode = mode
end
alias drunken_ini initialize
def initialize
@mode = 0
drunken_ini
end
end
2. Im Skript "Game_Player" die Zeilen 214 - 223:
case Input.dir4
when 2
move_down
when 4
move_left
when 6
move_right
when 8
move_up
end
durch diesen Code ersetzen:
drunken_moving
drunken_moving
3. Im Skript bei "SWITCH_ID" den Switch eintragen, der das Skript An und Aus Schalten soll.
Zusätzlich kann man in der Konstante "MODES" noch eigene Tastenrichtungen vorgeben.
Im Spiel kann man den Modus des Skriptes ändern, indem man dies in ein Event Skript folgendes Schreibt (Modus 0-2 sind vorgegeben):
$game_player.mode(0)
Vielleicht kanns ja jemand fürn Minigame oder so gebrauchen^^ Viel Spaß damit...
Mfg Monsta
Hallo Community,
vor ein paar Tagen habe ich angefangen,
mich mit RGSS zu beschäftigen...
Ich bekam immer mehr Ideen
und wollte diese natürlich umsetzten **
Sodass ich mich an einen Creditsscript gewagt hab
und hier ist es :
Ein neues Script unter Scene_Title erstellen und den Scene_Credits nennen:
#--------------------------------------------------------------------------
# * Credits Script by Firephoenix / Visit www.rpgxp-world.net / www.ysites.de/rmtoplist/
#--------------------------------------------------------------------------
# * Versions Log: - v0.1 Relase
#--------------------------------------------------------------------------
# * Thanx to !Tocs! for his help. I'm a beginner and so he explain me a lot...
#--------------------------------------------------------------------------
class Window1 < Window_Base
#------------------------------------------------------------------------
# * Object Initialization
#------------------------------------------------------------------------
def initialize
Audio.bgm_fade(1500)
Audio.bgs_fade(1500)
Audio.me_fade(1500)
super(0, 0, 640, 240)
self.contents = Bitmap.new(width - 32, height - 32)
# Hier kann man die Transparenz des oberen Fensters ändern
# 0 = Die "Box" ist nicht sichtbar | 255 = Keine Transparenz
self.opacity = 240
refresh
end
#-----------------------------------------------------------------------
# * Refresh
#------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = normal_color
# Hier kann der Text geändert werden
self.contents.draw_text(0, -108, 640, 240, "Erste Zeile", 0)
self.contents.draw_text(0, -85, 640, 240, "Zweite Zeile", 0)
self.contents.draw_text(0, -60, 640, 240, "Dritte Zeile", 0)
self.contents.draw_text(0, -35, 640, 240, "Vierte Zeile", 0)
self.contents.draw_text(0, -10, 640, 240, "Fünfte Zeile", 0)
self.contents.draw_text(0, 15, 640, 240, "Sexte Zeile", 0)
self.contents.draw_text(0, 40, 640, 240, "Achte Zeile", 0)
self.contents.draw_text(0, 67, 640, 240, "Neunte Zeile", 0)
end
end
class Window2 < Window_Base
#------------------------------------------------------------------------
# * Object Initialization
#------------------------------------------------------------------------
def initialize
super(0, 240, 640, 240)
self.contents = Bitmap.new(width - 32, height - 32)
# Hier kann man die Transparenz des unteren Fensters ändern
# 0 = Die "Box" ist nicht sichtbar | 255 = Keine Transparenz
self.opacity = 240
refresh
end
#------------------------------------------------------------------------
# * Refresh
#------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = normal_color
# Hier kann der Text geändert werden
self.contents.draw_text(0, -108, 640, 240, "Erste Zeile", 0)
self.contents.draw_text(0, -85, 640, 240, "Zweite Zeile", 0)
self.contents.draw_text(0, -60, 640, 240, "Dritte Zeile", 0)
self.contents.draw_text(0, -35, 640, 240, "Vierte Zeile", 0)
self.contents.draw_text(0, -10, 640, 240, "Fünfte Zeile", 0)
self.contents.draw_text(0, 15, 640, 240, "Sexte Zeile", 0)
self.contents.draw_text(0, 40, 640, 240, "Achte Zeile", 0)
self.contents.draw_text(0, 67, 640, 240, "Neunte Zeile", 0)
end
end
class Credits
#------------------------------------------------------------------------
# * Main Processing
#------------------------------------------------------------------------
#------------------------------------------------------------------------
# * Object Initialization
# menu_index : command cursor's initial position
#------------------------------------------------------------------------
def initialize(menu_index = 0)
@menu_index = menu_index
end
#------------------------------------------------------------------------
# * Main Processing
#------------------------------------------------------------------------
def main
@window1 = Window1.new
@window2 = Window2.new
# 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
@window1.dispose
@window2.dispose
end
#------------------------------------------------------------------------
# * Frame Update
#------------------------------------------------------------------------
def update
@window1.update
@window2.update
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to map screen
$scene = Scene_Title.new
return
end
end
end
Scene_Title mit dem hier ersetzten:
#=============================================
# ** Scene_Title
#------------------------------------------------------------------------------
# This class performs title screen processing.
#=============================================
class Scene_Title
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# If battle test
if $BTEST
battle_test
return
end
# Load database
$data_actors = load_data("Data/Actors.rxdata")
$data_classes = load_data("Data/Classes.rxdata")
$data_skills = load_data("Data/Skills.rxdata")
$data_items = load_data("Data/Items.rxdata")
$data_weapons = load_data("Data/Weapons.rxdata")
$data_armors = load_data("Data/Armors.rxdata")
$data_enemies = load_data("Data/Enemies.rxdata")
$data_troops = load_data("Data/Troops.rxdata")
$data_states = load_data("Data/States.rxdata")
$data_animations = load_data("Data/Animations.rxdata")
$data_tilesets = load_data("Data/Tilesets.rxdata")
$data_common_events = load_data("Data/CommonEvents.rxdata")
$data_system = load_data("Data/System.rxdata")
# Make system object
$game_system = Game_System.new
# Make title graphic
@sprite = Sprite.new
@sprite.bitmap = RPG::Cache.title($data_system.title_name)
# Make command window
s1 = "Beginnen"
s2 = "Fortfahren"
s3 = "Beenden"
s4 = "Credits"
@command_window = Window_Command.new(250, [s1, s2, s4, s3])
@command_window.back_opacity = 40
@command_window.x = 320 - @command_window.width / 2
@command_window.y = 300
# Continue enabled determinant
# Check if at least one save file exists
# If enabled, make @continue_enabled true; if disabled, make it false
@continue_enabled = false
for i in 0..3
if FileTest.exist?("Save#{i+1}.rxdata")
@continue_enabled = true
end
end
# If continue is enabled, move cursor to "Continue"
# If disabled, display "Continue" text in gray
if @continue_enabled
@command_window.index = 1
else
@command_window.disable_item(1)
end
# Play title BGM
$game_system.bgm_play($data_system.title_bgm)
# Stop playing ME and BGS
Audio.me_stop
Audio.bgs_stop
# 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 command window
@command_window.dispose
#@command_TEXT.dispose
# Dispose of title graphic
@sprite.bitmap.dispose
@sprite.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Update command window
@command_window.update
# If C button was pressed
if Input.trigger?(Input::C)
# Branch by command window cursor position
case @command_window.index
when 0 # New game
command_new_game
when 1 # Continue
command_continue
when 3 # Shutdown
command_shutdown
when 2 # Credits
command_credits
end
end
end
#--------------------------------------------------------------------------
# * Command: New Game
#--------------------------------------------------------------------------
def command_new_game
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Stop BGM
Audio.bgm_stop
# Reset frame count for measuring play time
Graphics.frame_count = 0
# Make each type of game object
$game_temp = Game_Temp.new
$game_system = Game_System.new
$game_switches = Game_Switches.new
$game_variables = Game_Variables.new
$game_self_switches = Game_SelfSwitches.new
$game_screen = Game_Screen.new
$game_actors = Game_Actors.new
$game_party = Game_Party.new
$game_troop = Game_Troop.new
$game_map = Game_Map.new
$game_player = Game_Player.new
# Set up initial party
$game_party.setup_starting_members
# Set up initial map position
$game_map.setup($data_system.start_map_id)
# Move player to initial position
$game_player.moveto($data_system.start_x, $data_system.start_y)
# Refresh player
$game_player.refresh
# Run automatic change for BGM and BGS set with map
$game_map.autoplay
# Update map (run parallel process event)
$game_map.update
# Switch to map screen
$scene = Scene_Map.new
end
#--------------------------------------------------------------------------
# * Command: Continue
#--------------------------------------------------------------------------
def command_continue
# If continue is disabled
unless @continue_enabled
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to load screen
$scene = Scene_Load.new
end
#--------------------------------------------------------------------------
# * Command: Shutdown
#--------------------------------------------------------------------------
def command_shutdown
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Fade out BGM, BGS, and ME
Audio.bgm_fade(800)
Audio.bgs_fade(800)
Audio.me_fade(800)
# Shutdown
$scene = nil
end
#--------------------------------------------------------------------------
# * Command: Credits
#--------------------------------------------------------------------------
def command_credits
$scene = Credits.new
end
#--------------------------------------------------------------------------
# * Battle Test
#--------------------------------------------------------------------------
def battle_test
# Load database (for battle test)
$data_actors = load_data("Data/BT_Actors.rxdata")
$data_classes = load_data("Data/BT_Classes.rxdata")
$data_skills = load_data("Data/BT_Skills.rxdata")
$data_items = load_data("Data/BT_Items.rxdata")
$data_weapons = load_data("Data/BT_Weapons.rxdata")
$data_armors = load_data("Data/BT_Armors.rxdata")
$data_enemies = load_data("Data/BT_Enemies.rxdata")
$data_troops = load_data("Data/BT_Troops.rxdata")
$data_states = load_data("Data/BT_States.rxdata")
$data_animations = load_data("Data/BT_Animations.rxdata")
$data_tilesets = load_data("Data/BT_Tilesets.rxdata")
$data_common_events = load_data("Data/BT_CommonEvents.rxdata")
$data_system = load_data("Data/BT_System.rxdata")
# Reset frame count for measuring play time
Graphics.frame_count = 0
# Make each game object
$game_temp = Game_Temp.new
$game_system = Game_System.new
$game_switches = Game_Switches.new
$game_variables = Game_Variables.new
$game_self_switches = Game_SelfSwitches.new
$game_screen = Game_Screen.new
$game_actors = Game_Actors.new
$game_party = Game_Party.new
$game_troop = Game_Troop.new
$game_map = Game_Map.new
$game_player = Game_Player.new
# Set up party for battle test
$game_party.setup_battle_test_members
# Set troop ID, can escape flag, and battleback
$game_temp.battle_troop_id = $data_system.test_troop_id
$game_temp.battle_can_escape = true
$game_map.battleback_name = $data_system.battleback_name
# Play battle start SE
$game_system.se_play($data_system.battle_start_se)
# Play battle BGM
$game_system.bgm_play($game_system.battle_bgm)
# Switch to battle screen
$scene = Scene_Battle.new
end
end
Nun sollte alles funktionieren...
Wer Vorschläge/Kritik/ *g* Lob hat,
nur her damit ^^...
MFG Firephoenix
I know that there are a few scripts that let the player distribute their own stat points when they level up, but I wasn't too happen with the one I downloaded when it conflicted with some other scripts I had. So I decided to script my own level up system. As of the moment, you can change the hero's maxhp, maxsp, str, dex, agi, and int. I am working on how to get around the error that shows up when I try to include atk, pdef, and mdef. Anyways, those 3 last attributes have been commented out from this version of the script, so it should work fine. I have also added instructions on how to implement a pop up window when they enter the status menu asking the player if he/she wants to distribute any remaining AP of the selected hero if and only if the selected hero has remaining AP.
Anyways, here is the script. Just paste it above Main in the script editor.
I have added a lot of commented instructions at the top of the script. Please follow it carefully.
To call the script, use "$scene = Scene_AP_Distribute.new(@actor_index)"
@actor_index being the position of the heroes currently in the party.
So if Arshes was in the first position in party, he would be @actor_index = 0
Report any bugs here if you find them. Anyways, enjoy !!!
#=========================================================================
=====
# * Scene_AP_Distribute
#------------------------------------------------------------------------------
# * by Skyboar
# * made August 2007
#
# * Script allows the player to freely customizing the Hero's stat points
# * including max hp, max sp, technique, critical, agility, and spirit
#
#==============================================================================
# *Instructions on how to use*
#
# Just Insert this script above "Main" in script editor.
#
#------------------------------------------------------------------------------
# Insert the following code in "Window_BattleStatus"
#
# this code: actor.stat_points += $AP
#
# under this code: if @level_up_flags[i]
#------------------------------------------------------------------------------
#
#Insert the following code in "Game_Actor"
#
# this code: attr_accessor :stat_points
#
# under this code: class Game_Actor < Game_Battler
#
#------------------------------------------------------------------------------
#
#Insert the following code in "Game_Actor"
#
# this code: @stat_points = 0
#
# under this code: def setup(actor_id)
# actor = $data_actors[actor_id]
#
# #------------------------------------------------------------------------------
#
# * Instructions on how to implement a pop up window asking the player if he/she would
# * like to distribute any remaining AP that the selected hero has.
#
#------------------------------------------------------------------------------
#
#Insert the following code in "Scene_Status"
#
# this code:
##--------------[Used for Level Up AP System]-----------------------
#
# if @actor.stat_points > 0
# @alert = true
# else
# @alert = false
# end
# @alert_window = Window_AP_RemainAlert.new(@actor)
# @alert_window.x = 320 - (@alert_window.width / 2)
# @alert_window.y = 120
# @alert_window.z = 10000
# if @alert == true
# @alert_window.visible = true
# elsif @alert == false
# @alert_window.visible = false
# end
# @alertconfirm_window = Window_AP_RemainConfirm.new(@actor)
# @alertconfirm_window.x = 320 - (@alertconfirm_window.width / 2)
# @alertconfirm_window.y = 230
# @alertconfirm_window.z = 10001
# @alertconfirm_window.index = 0
# if @alert == true
# @alertconfirm_window.visible = true
# @alertconfirm_window.active = true
# elsif @alert == false
# @alertconfirm_window.visible = false
# @alertconfirm_window.active = false
# end
##--------------[Used for Level Up AP System]-----------------------
#
# under this code: def main
# @actor = $game_party.actors[@actor_index]
#
#------------------------------------------------------------------------------
#
#Insert the following code in "Scene_Status"
#
# this code:
##--------------[Used for Level Up AP System]-----------------
# @alert_window.dispose
# @alertconfirm_window.dispose
##--------------[Used for Level Up AP System]-----------------------
#
# under this code: Graphics.freeze
#
#
#------------------------------------------------------------------------------
#
#Insert the following code in "Scene_Status"
#
# this code:
##--------------[Used for Level Up AP System]-----------------
#@alertconfirm_window.update
# if @alertconfirm_window.active
# update_alertconfirm
# return
# end
##--------------[Used for Level Up AP System]-----------------------
#
# under this code: def update
#
# Insert the following code in "Scene_Status"
# under "def update's 'end' " but before the class's end (the very last 'end' in the scene) "
# code to be inserted into Scene_Status:
##--------------[Used for Level Up AP System]-----------------
#def update_alertconfirm
# if Input.trigger?(Input::B)
# $game_system.se_play($data_system.cancel_se)
# @alert_window.visible = false
# @alertconfirm_window.active = false
# @alertconfirm_window.visible = false
# @alert = false
# return
# end
# if Input.trigger?(Input::C)
# $game_system.se_play($data_system.decision_se)
# case @alertconfirm_window.index
# when 0
# $scene = Scene_AP_Distribute.new(@actor_index)
# when 1
# @alert_window.visible = false
# @alertconfirm_window.active = false
# @alertconfirm_window.visible = false
# @alert = false
# return
# end
#end
#--------------[Used for Level Up AP System]-----------------
#------------------------------------------------------------------------------
#
# *Now you are ready to define the variables for the leveling up stats scene
# *You are welcome to freely change the variables instead of using the default
# *that I set up the script up with.
#
# *Enjoy!!!
#
#==============================================================================
#-------------[global variables for leveling up system]--------------------------------
#-------------[Change the VALUES BELOW to your liking]---------------------------
#-------------[global variables for leveling up system]--------------------------------
$AP = 9 #determines how much Attribute Points each hero gets upon Level Up
#change the following values to how much is added to each hero's attribute upon AP distribution
$add_stat_maxhp = 10 #for example value 10 means that 10 will be added to the hero's max hp
$add_stat_maxsp = 3
$add_stat_atk = 1
$add_stat_pdef = 1
$add_stat_mdef = 1
$add_stat_tech = 1
$add_stat_crit = 1
$add_stat_agi = 1
$add_stat_spr = 1
#-------------[global variables for leveling up system]--------------------------------
#-------------[Change the VALUES BELOW to your liking]---------------------------
#-------------[global variables for leveling up system]--------------------------------
#==============================================================================
# * Window_AP_RemainAlert
#prompts the player asking to distribute remaining AP if and only if they have any remaining.
#------------------------------------------------------------------------------
#==============================================================================
class Window_AP_RemainAlert< Window_Base
#--------------------------------------------------------------------------
# - Object initialization
#--------------------------------------------------------------------------
def initialize(actor)
super(0, 0, 300, 120)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
@actor = actor
refresh
end
#--------------------------------------------------------------------------
# - Refreshment
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = normal_color
self.contents.draw_text(-15, -5, 300, 32, "!!! Alert !!!", 1)
self.contents.font.color = normal_color
self.contents.draw_text(-15, 25, 300, 32, @actor.name + " has " + @actor.stat_points.to_s + " AP remaining.", 1)
self.contents.draw_text(-15, 55, 300, 32, "Distribute the remaining " + @actor.stat_points.to_s + " AP ?", 1)
end
end
#==============================================================================
# * Window_AP_RemainConfirm
#prompts the player asking if he/she permanently wants to distribute remaining AP.
#------------------------------------------------------------------------------
#==============================================================================
class Window_AP_RemainConfirm < Window_Selectable
#--------------------------------------------------------------------------
# - Object initialization
#--------------------------------------------------------------------------
def initialize(actor)
super(0, 0, 200, 55)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
@item_max = 2
@row_max = 1
@column_max = 2
@actor = actor
@commands = ["Yes", "No"]
refresh
end
#--------------------------------------------------------------------------
# - Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
t = @commands.size
for i in 0...@commands.size
x = (i % 2) * 100
y = (i / 2) * 32
self.contents.font.color = normal_color
self.contents.draw_text(x - 15, y - 5 , 100, 32, @commands[i], 1)
end
end
#--------------------------------------------------------------------------
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
else
self.cursor_rect.set((@index * 100), -5, 70, 32)
end
end
#--------------------------------------------------------------------------
end
#==============================================================================
# * Window_AP_Warning #prompts the player asking if he/she permanently wants to use the ap they distributed
#------------------------------------------------------------------------------
#==============================================================================
class Window_AP_Warning< Window_Base
#--------------------------------------------------------------------------
# - Object initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0, 300, 120)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
refresh
end
#--------------------------------------------------------------------------
# - Refreshment
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = normal_color
self.contents.draw_text(-15, -5, 300, 32, "!!! WARNING !!!", 1)
self.contents.font.color = normal_color
self.contents.draw_text(-15, 25, 300, 32, "AP distributed will be permanently removed", 1)
self.contents.draw_text(-15, 55, 300, 32, "from Hero's Remaining AP count.", 1)
end
end
#==============================================================================
# * Window_AP_WarningConfirm #prompts the player asking if he/she permanently wants to use the ap they distributed
#------------------------------------------------------------------------------
#==============================================================================
class Window_AP_WarningConfirm < Window_Selectable
#--------------------------------------------------------------------------
# - Object initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0, 200, 55)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
@item_max = 2
@row_max = 1
@column_max = 2
@commands = ["Confirm", "Cancel"]
refresh
end
#--------------------------------------------------------------------------
# - Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
t = @commands.size
for i in 0...@commands.size
x = (i % 2) * 100
y = (i / 2) * 32
self.contents.font.color = normal_color
self.contents.draw_text(x - 15, y - 5 , 100, 32, @commands[i], 1)
end
end
#--------------------------------------------------------------------------
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
else
self.cursor_rect.set((@index * 100), -5, 70, 32)
end
end
#--------------------------------------------------------------------------
end
#==============================================================================
# * Window_AP_HeroFace
#------------------------------------------------------------------------------
#displays the hero's portrait or battler graphic as well as name, lv, class, and remaining AP.
#==============================================================================
class Window_AP_HeroFace < Window_Base
#--------------------------------------------------------------------------
# - Object initialization
#--------------------------------------------------------------------------
def initialize(actor)
super(50, 40, 160, 300)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
@actor = actor
self.z = 10
refresh
end
#======[use this for displaying hero's portrait]===============
def draw_actor_face_portrait(actor, x, y)
bitmap = RPG::Cache.picture(actor.id.to_s)
src_rect = Rect.new(0, 0, 96, 192)
self.contents.blt(28, 0, bitmap, src_rect)
end
#======[use this for displaying hero's battler portrait]===============
def draw_actor_battler(actor, x, y)
bitmap = RPG::Cache.battler(@actor.battler_name, @actor.battler_hue)
src_rect = Rect.new(0, 0, 96, 192)
self.contents.blt(0, 0, bitmap, Rect.new(0, 0, 200, 480))
end
#======================================
#--------------------------------------------------------------------------
# - Refreshment
#--------------------------------------------------------------------------
def refresh
self.contents.clear
x = 0
y = 0
draw_actor_battler(@actor,0,0) #used for displaying battler
#draw_actor_face_portrait(@actor, x + 28, y + 0) #used for displaying hero portrait
draw_actor_name(@actor, x + 28, y + 165)
draw_actor_level(@actor, x + 28, y + 190)
draw_actor_class(@actor, x + 28, y + 215)
self.contents.font.color = normal_color
self.contents.draw_text(x + 28, y + 240, 320, 32, "AP", 0)
self.contents.font.color = normal_color
self.contents.draw_text(x - 40, y + 240, 160, 32, @actor.stat_points.to_s, 2)
end
end
#==============================================================================
# * Window_AP_HeroStatus
#------------------------------------------------------------------------------
# displays the Hero's current status before the AP is distributed and the stat points are changed.
#==============================================================================
class Window_AP_HeroStatus < Window_Base
#--------------------------------------------------------------------------
# - Object initialization
# actor : Actor
#--------------------------------------------------------------------------
def initialize(actor)
super(10, 200, 300, 360)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
@actor = actor
refresh
end
#--------------------------------------------------------------------------
# - Refreshment
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(105, -5, 120, 32, "Current Stats", 0)
self.contents.font.color = normal_color
self.contents.draw_text(105, 30, 120, 32, "Max HP", 0)
self.contents.font.color = normal_color
self.contents.draw_text(105, 55, 120, 32, "Max SP", 0)
self.contents.font.color = normal_color
self.contents.draw_text(122, 30, 120, 32, @actor.maxhp.to_s, 2)
self.contents.draw_text(122, 55, 120, 32, @actor.maxsp.to_s, 2)
draw_actor_parameter(@actor, 105, 105, 0)#char's attack
draw_actor_parameter(@actor, 105, 130, 1)#char's phy def
draw_actor_parameter(@actor, 105, 155, 2)#char's mag def
draw_actor_parameter(@actor, 105, 205, 3)#char's Tech
draw_actor_parameter(@actor, 105, 230, 4)#char's Critical
draw_actor_parameter(@actor, 105, 255, 5)#char's Agility
draw_actor_parameter(@actor, 105, 280, 6)#char's Spirit
end
end
#==============================================================================
# * Window_AP_Add
#------------------------------------------------------------------------------
# displays and updates the values of the subtotal and total AP distribution and stat points
#==============================================================================
class Window_AP_Add < Window_Selectable
#--------------------------------------------------------------------------
# - Object initialization
# actor : Actor
#--------------------------------------------------------------------------
def initialize(actor)
super(10, 200, 340, 360)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
@item_max = 11
@row_max = 11
@column_max = 1
@actor = actor
refresh
end
#--------------------------------------------------------------------------
# - Refreshment
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(5, 0, 120, 32, "Added Stats", 0)
#-----[global variables subtotal display]----------------------------------------------------
self.contents.font.color = normal_color
self.contents.draw_text(-65, 35, 120, 32, $subtotal_stat_maxhp.to_s, 2)
self.contents.draw_text(-65, 60, 120, 32, $subtotal_stat_maxsp.to_s, 2)
self.contents.draw_text(-65, 110, 120, 32, $subtotal_stat_atk.to_s, 2)
self.contents.draw_text(-65, 135, 120, 32, $subtotal_stat_pdef.to_s, 2)
self.contents.draw_text(-65, 160, 120, 32, $subtotal_stat_mdef.to_s, 2)
self.contents.draw_text(-65, 210, 120, 32, $subtotal_stat_tech.to_s, 2)
self.contents.draw_text(-65, 235, 120, 32, $subtotal_stat_crit.to_s, 2)
self.contents.draw_text(-65, 260, 120, 32, $subtotal_stat_agi.to_s, 2)
self.contents.draw_text(-65, 285, 120, 32, $subtotal_stat_spr.to_s, 2)
#-----["=" sign display]----------------------------------------------------
self.contents.font.color = normal_color
self.contents.draw_text(22, 35, 120, 32, "=", 2)
self.contents.draw_text(22, 60, 120, 32, "=", 2)
self.contents.draw_text(22, 110, 120, 32, "=", 2)
self.contents.draw_text(22, 135, 120, 32, "=", 2)
self.contents.draw_text(22, 160, 120, 32, "=", 2)
self.contents.draw_text(22, 210, 120, 32, "=", 2)
self.contents.draw_text(22, 235, 120, 32, "=", 2)
self.contents.draw_text(22, 260, 120, 32, "=", 2)
self.contents.draw_text(22, 285, 120, 32, "=", 2)
#-----[global variables total display]----------------------------------------------------
self.contents.font.color = system_color
self.contents.draw_text(125, 0, 120, 32, "New Stats", 2)
self.contents.font.color = normal_color
self.contents.draw_text(125, 35, 120, 32, $total_stat_maxhp.to_s, 2)
self.contents.draw_text(125, 60, 120, 32, $total_stat_maxsp.to_s, 2)
self.contents.draw_text(125, 110, 120, 32, $total_stat_atk.to_s, 2)
self.contents.draw_text(125, 135, 120, 32, $total_stat_pdef.to_s, 2)
self.contents.draw_text(125, 160, 120, 32, $total_stat_mdef.to_s, 2)
self.contents.draw_text(125, 210, 120, 32, $total_stat_tech.to_s, 2)
self.contents.draw_text(125, 235, 120, 32, $total_stat_crit.to_s, 2)
self.contents.draw_text(125, 260, 120, 32, $total_stat_agi.to_s, 2)
self.contents.draw_text(125, 285, 120, 32, $total_stat_spr.to_s, 2)
end
#-----[update of cursor]----------------------------------------------------
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
else
self.cursor_rect.set(0, (@index * 25) + 35, 280, 28)
end
end
end
#==============================================================================
# * Window_AP_Confirm #gives options for confirming, distribute, and resetting AP.
#------------------------------------------------------------------------------
#==============================================================================
class Window_AP_Confirm < Window_Selectable
#--------------------------------------------------------------------------
# - Object initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0, 300, 60)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
@item_max = 3
@row_max = 1
@column_max = 3
@commands = ["Confirm", "Distribute", "Reset"]
refresh
end
#--------------------------------------------------------------------------
# - Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
t = @commands.size
for i in 0...@commands.size
x = (i % 3) * 100
y = (i / 3) * 32
self.contents.font.color = normal_color
self.contents.draw_text(x - 15, y - 5 , 100, 32, @commands[i], 1)
end
end
#--------------------------------------------------------------------------
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
else
self.cursor_rect.set((@index * 100), -5, 70, 32)
end
end
end
#==============================================================================
class Scene_AP_Distribute #this is where all the magic happens
#--------------------------------------------------------------------------
# - Main processing
#--------------------------------------------------------------------------
def initialize(actor_index = 0, equip_index = 0)
@actor_index = actor_index
end
#--------------------------------------------------------------------------
def main
@actor = $game_party.actors[@actor_index]
#-------------[global variables for leveling up system]--------------------------------
#-------------[DO NOT TAMPER WITH THESE VALUES BELOW]-------------------
#-------------[global variables for leveling up system]--------------------------------
@old_stat_points = @actor.stat_points #used to keep track of AP amount before distribution
$total_stat_maxhp = @actor.maxhp
$total_stat_maxsp = @actor.maxsp
$total_stat_atk = @actor.atk
$total_stat_pdef = @actor.pdef
$total_stat_mdef = @actor.mdef
$total_stat_tech = @actor.str
$total_stat_crit = @actor.dex
$total_stat_agi = @actor.agi
$total_stat_spr = @actor.int
$subtotal_stat_maxhp = 0
$subtotal_stat_maxsp = 0
$subtotal_stat_atk = 0
$subtotal_stat_pdef = 0
$subtotal_stat_mdef = 0
$subtotal_stat_tech = 0
$subtotal_stat_crit = 0
$subtotal_stat_agi = 0
$subtotal_stat_spr = 0
#-------------[global variables for leveling up system]-------------------------------
#-------------[DO NOT TAMPER WITH THESE VALUES ABOVE]-------------------
#-------------[global variables for leveling up system]--------------------------------
@map_sprite = Spriteset_Map.new
@alert_window = Window_AP_Warning.new
@alert_window.x = 320 - (@alert_window.width / 2)
@alert_window.y = 120
@alert_window.z = 100000
@alert_window.opacity = 240
@alert_window.visible = false
@alertconfirm_window = Window_AP_WarningConfirm.new
@alertconfirm_window.x = 320 - (@alertconfirm_window.width / 2)
@alertconfirm_window.y = 230
@alertconfirm_window.z = 100000
@alertconfirm_window.opacity = 240
@alertconfirm_window.active = false
@alertconfirm_window.visible = false
@alertconfirm_window.index = 0
@confirm_window = Window_AP_Confirm.new
@confirm_window.x = 320 - (@confirm_window.width / 2)
@confirm_window.y = 380
@confirm_window.z = 10000
@confirm_window.opacity = 200
@confirm_window.active = true
@confirm_window.index = 1
@hero_window = Window_AP_HeroFace.new(@actor)
@hero_window.x = -10
@hero_window.y = 30
@hero_window.z = 10000
@hero_window.opacity = 200
@herostatus_window = Window_AP_HeroStatus.new(@actor)
@herostatus_window.x = 40
@herostatus_window.y = 40
@herostatus_window.z = 1000
@herostatus_window.opacity = 200
@ap_add_window = Window_AP_Add.new(@actor)
@ap_add_window.x = 320
@ap_add_window.y = 35
@ap_add_window.z = 1000
@ap_add_window.opacity = 200
@ap_add_window.active = false
@ap_add_window.index = -1
# Transition execution
Graphics.transition
# Main loop
loop do
# Renewing the game picture
Graphics.update
# Updating the information of input
Input.update
# Frame renewal
update
# When the picture changes, discontinuing the loop
if $scene != self
break
end
end
# Transition preparation
Graphics.freeze
# Releasing the window
@confirm_window.dispose
@hero_window.dispose
@herostatus_window.dispose
@ap_add_window.dispose
@alert_window.dispose
@alertconfirm_window.dispose
@map_sprite.dispose
# When it changes to the title picture and it is in
if $scene.is_a?(Scene_Title)
# Fading out picture
Graphics.transition
Graphics.freeze
end
end
#--------------------------------------------------------------------------
# - Frame renewal
#--------------------------------------------------------------------------
def update
@ap_add_window.update
@confirm_window.update
@alertconfirm_window.update
if @confirm_window.active
update_confirm
return
end
if @ap_add_window.active
update_ap_add
return
end
if @alertconfirm_window.active
update_alertconfirm
return
end
end
# --------------------------------
def update_confirm
if Input.trigger?(Input::B) #cancel
$game_system.se_play($data_system.cancel_se)
if @actor.stat_points != @old_stat_points #checks to see if player has used any of the remaining AP
@alert_window.visible = true
@alertconfirm_window.active = true
@alertconfirm_window.visible = true
@confirm_window.active = false
@confirm_window.index = -1
else
$scene = Scene_Status.new(@actor_index)
end
return
end
if Input.trigger?(Input::C) #confirm
case @confirm_window.index
when 0 #confirm distribution of ap
$game_system.se_play($data_system.decision_se)
if @actor.stat_points != @old_stat_points #checks to see if player has used any of the remaining AP
@alert_window.visible = true
@alertconfirm_window.active = true
@alertconfirm_window.visible = true
@confirm_window.active = false
@confirm_window.index = -1
else
$scene = Scene_Status.new(@actor_index)
end
when 1 #distribute ap
$game_system.se_play($data_system.decision_se)
@confirm_window.active = false
@confirm_window.index = -1
@ap_add_window.active = true
@ap_add_window.index = 0
when 2 #reset distributed ap
$game_system.se_play($data_system.decision_se)
$subtotal_stat_maxhp = 0
$subtotal_stat_maxsp = 0
$subtotal_stat_atk = 0
$subtotal_stat_pdef = 0
$subtotal_stat_mdef = 0
$subtotal_stat_tech = 0
$subtotal_stat_crit = 0
$subtotal_stat_agi = 0
$subtotal_stat_spr = 0
$total_stat_maxhp = @actor.maxhp
$total_stat_maxsp = @actor.maxsp
$total_stat_atk = @actor.atk
$total_stat_pdef = @actor.pdef
$total_stat_mdef = @actor.mdef
$total_stat_tech = @actor.str
$total_stat_crit = @actor.dex
$total_stat_agi = @actor.agi
$total_stat_spr = @actor.int
@actor.stat_points = @old_stat_points
@hero_window.refresh
@herostatus_window.refresh
@ap_add_window.refresh
end
return
end
end
# --------------------------------
def update_ap_add #updates the distribution of the AP to hero's attributes
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@ap_add_window.active = false
@ap_add_window.index = -1
@confirm_window.active = true
@confirm_window.index = 1
return
end
if Input.trigger?(Input::A) #resets AP
$game_system.se_play($data_system.decision_se)
$subtotal_stat_maxhp = 0
$subtotal_stat_maxsp = 0
$subtotal_stat_atk = 0
$subtotal_stat_pdef = 0
$subtotal_stat_mdef = 0
$subtotal_stat_tech = 0
$subtotal_stat_crit = 0
$subtotal_stat_agi = 0
$subtotal_stat_spr = 0
$total_stat_maxhp = @actor.maxhp
$total_stat_maxsp = @actor.maxsp
$total_stat_atk = @actor.atk
$total_stat_pdef = @actor.pdef
$total_stat_mdef = @actor.mdef
$total_stat_tech = @actor.str
$total_stat_crit = @actor.dex
$total_stat_agi = @actor.agi
$total_stat_spr = @actor.int
@actor.stat_points = @old_stat_points
@hero_window.refresh
@herostatus_window.refresh
@ap_add_window.refresh
return
end
if Input.repeat?(Input::LEFT) #subtract AP
$game_system.se_play($data_system.cursor_se)
case @ap_add_window.index
when 0 #subtract from maxhp
if$subtotal_stat_maxhp > 0
@actor.stat_points += 1
$subtotal_stat_maxhp = $subtotal_stat_maxhp - $add_stat_maxhp #update subtotal
$total_stat_maxhp = $total_stat_maxhp - $add_stat_maxhp #update total
else
$game_system.se_play($data_system.buzzer_se)
end
when 1 #subtract from maxsp
if$subtotal_stat_maxsp > 0
@actor.stat_points += 1
$subtotal_stat_maxsp = $subtotal_stat_maxsp - $add_stat_maxsp
$total_stat_maxsp = $total_stat_maxsp - $add_stat_maxsp #update total
else
$game_system.se_play($data_system.buzzer_se)
end
# when 3 #subtract from atk
# if$subtotal_stat_atk > 0
# @actor.stat_points += 1
# $subtotal_stat_atk = $subtotal_stat_atk - $add_stat_atk
# $total_stat_atk = $total_stat_atk - $add_stat_atk #update total
# else
# $game_system.se_play($data_system.buzzer_se)
# end
# when 4 #subtract from pdef
# if$subtotal_stat_pdef > 0
# @actor.stat_points += 1
# $subtotal_stat_pdef = $subtotal_stat_pdef - $add_stat_pdef
# $total_stat_pdef = $total_stat_pdef - $add_stat_pdef #update total
# else
# $game_system.se_play($data_system.buzzer_se)
# end
# when 5 #subtract from mdef
# if$subtotal_stat_mdef > 0
# @actor.stat_points += 1
# $subtotal_stat_mdef = $subtotal_stat_mdef - $add_stat_mdef
# $total_stat_mdef = $total_stat_mdef - $add_stat_mdef #update total
# else
# $game_system.se_play($data_system.buzzer_se)
# end
when 7 #subtract from tech
if$subtotal_stat_tech > 0
@actor.stat_points += 1
$subtotal_stat_tech = $subtotal_stat_tech - $add_stat_tech
$total_stat_tech = $total_stat_tech - $add_stat_tech #update total
else
$game_system.se_play($data_system.buzzer_se)
end
when 8 #subtract from crit
if$subtotal_stat_crit > 0
@actor.stat_points += 1
$subtotal_stat_crit = $subtotal_stat_crit - $add_stat_crit
$total_stat_crit = $total_stat_crit - $add_stat_crit #update total
else
$game_system.se_play($data_system.buzzer_se)
end
when 9 #subtract from agi
if$subtotal_stat_agi > 0
@actor.stat_points += 1
$subtotal_stat_agi = $subtotal_stat_agi - $add_stat_agi
$total_stat_agi = $total_stat_agi - $add_stat_agi #update total
else
$game_system.se_play($data_system.buzzer_se)
end
when 10 #subtract from spr
if$subtotal_stat_spr > 0
@actor.stat_points += 1
$subtotal_stat_spr = $subtotal_stat_spr - $add_stat_spr
$total_stat_spr = $total_stat_spr - $add_stat_spr #update total
else
$game_system.se_play($data_system.buzzer_se)
end
end
@hero_window.refresh
@herostatus_window.refresh
@ap_add_window.refresh
return
end
if Input.repeat?(Input::RIGHT) #add AP
if @actor.stat_points > 0
$game_system.se_play($data_system.cursor_se)
case @ap_add_window.index
when 0 #add to maxhp
@actor.stat_points -= 1
$subtotal_stat_maxhp = $subtotal_stat_maxhp + $add_stat_maxhp #update subtotal
$total_stat_maxhp = $total_stat_maxhp + $add_stat_maxhp #update total
when 1 #add to maxsp
@actor.stat_points -= 1
$subtotal_stat_maxsp = $subtotal_stat_maxsp + $add_stat_maxsp
$total_stat_maxsp = $total_stat_maxsp + $add_stat_maxsp
#when 3 #add to atk
# @actor.stat_points -= 1
# $subtotal_stat_atk = $subtotal_stat_atk + $add_stat_atk
# $total_stat_atk = $total_stat_atk + $add_stat_atk
# when 4 #add to pdef
# @actor.stat_points -= 1
# $subtotal_stat_pdef = $subtotal_stat_pdef + $add_stat_pdef
# $total_stat_pdef = $total_stat_pdef + $add_stat_pdef
# when 5 #add to mdef
# @actor.stat_points -= 1
# $subtotal_stat_mdef = $subtotal_stat_mdef + $add_stat_mdef
# $total_stat_mdef = $total_stat_mdef + $add_stat_mdef
when 7 #add to tech
@actor.stat_points -= 1
$subtotal_stat_tech = $subtotal_stat_tech + $add_stat_tech
$total_stat_tech = $total_stat_tech + $add_stat_tech
when 8 #add to crit
@actor.stat_points -= 1
$subtotal_stat_crit = $subtotal_stat_crit + $add_stat_crit
$total_stat_crit = $total_stat_crit + $add_stat_crit
when 9 #add to agi
@actor.stat_points -= 1
$subtotal_stat_agi = $subtotal_stat_agi + $add_stat_agi
$total_stat_agi = $total_stat_agi + $add_stat_agi
when 10 #add to spr
@actor.stat_points -= 1
$subtotal_stat_spr = $subtotal_stat_spr + $add_stat_spr
$total_stat_spr = $total_stat_spr + $add_stat_spr
end
@hero_window.refresh
@herostatus_window.refresh
@ap_add_window.refresh
else
$game_system.se_play($data_system.buzzer_se)
end
return
end
end
# --------------------------------
def update_alertconfirm
if Input.trigger?(Input::B) #cancel
$game_system.se_play($data_system.cancel_se)
@alert_window.visible = false
@alertconfirm_window.active = false
@alertconfirm_window.visible = false
@confirm_window.active = true
@confirm_window.index = 0
return
end
if Input.trigger?(Input::C)
case @alertconfirm_window.index
when 0 #when confirm adds distributed AP to stats permanently
$game_system.se_play($data_system.decision_se)
@actor.maxhp = $total_stat_maxhp
@actor.maxsp = $total_stat_maxsp
@actor.hp = @actor.maxhp #restores the hero's hp to max
@actor.sp = @actor.maxsp #restores the hero's sp to max
#@actor.base_atk = $total_stat_atk
#@actor.base_pdef = $total_stat_pdef
#@actor.base_mdef = $total_stat_mdef
@actor.str = $total_stat_tech
@actor.dex = $total_stat_crit
@actor.agi = $total_stat_agi
@actor.int = $total_stat_spr
$scene = Scene_Status.new(@actor_index)
when 1 #cancel
$game_system.se_play($data_system.cancel_se)
@alert_window.visible = false
@alertconfirm_window.active = false
@alertconfirm_window.visible = false
@confirm_window.active = true
@confirm_window.index = 0
end
end
end
end
I hope this is the right sub forum for this .
Well that aside this script basically allows you to have the players Strength as their Attack power when they have no weapons equiped isntead of magically losing all of their attack powers for having no weapon.
To use it's very simple just put it above main and look for this in the script:
WEAPON_ANIMATION_ID = 4
Then change the number 4 to the ID of the animation you want it to have when the player attacks with no weapon.
#======================================================================
========
# TDS Attack with no weapon
# Version: 1.0
# This script aliases the base_atk method and the animation2_id method.
#==============================================================================
#------------------------------------------------------------------------------
# This script allows to attack with now weapons.
#==============================================================================
# When no weapon is equiped animation ID
WEAPON_ANIMATION_ID = 4
#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
# This class handles the actor. It's used within the Game_Actors class
# ($game_actors) and refers to the Game_Party class ($game_party).
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# * Get Basic Attack Power
#--------------------------------------------------------------------------
alias tds_no_weapon_attack_base_atk base_atk
def base_atk
tds_no_weapon_attack_base_atk
weapon = $data_weapons[@weapon_id]
return weapon != nil ? weapon.atk : base_str
end
#--------------------------------------------------------------------------
# * Get Offensive Animation ID for Normal Attacks
#--------------------------------------------------------------------------
alias tds_no_weapon_attack_animation2_id animation2_id
def animation2_id
tds_no_weapon_attack_animation2_id
weapon = $data_weapons[@weapon_id]
return weapon != nil ? weapon.animation2_id : WEAPON_ANIMATION_ID
end
end
Battle Report
Version: 1.6
Introduction
A script that shows the battle result like in the Final Fantasy games.
Features
Scrolling down Exp
Edits:
Exp Bars filling up
Possible displaying of Facesets instead of Charactersets
Exp scrolling down faster, depending on how much exp you gain after battle.
Play a ME as long as you want in the result window.
Script:
class Game_Actor < Game_Battler
def exp=(exp)
@exp = [[exp, 9999999].min, 0].max
while @exp >= @exp_list[@level+1] and @exp_list[@level+1] > 0
@level += 1
# NEW - David
$d_new_skill = nil
for j in $data_classes[@class_id].learnings
if j.level == @level
learn_skill(j.skill_id)
# NEW - David
skill = $data_skills[j.skill_id]
$d_new_skill = skill.name
end
end
end
while @exp < @exp_list[@level]
@level -= 1
end
@hp = [@hp, self.maxhp].min
@sp = [@sp, self.maxsp].min
end
#--------------------------------------------------------------------------
# * Get the current EXP
#--------------------------------------------------------------------------
def now_exp
return @exp - @exp_list[@level]
end
#--------------------------------------------------------------------------
# * Get the next level's EXP
#--------------------------------------------------------------------------
def next_exp
return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
end
end
class Window_LevelUp < Window_Base
#----------------------------------------------------------------
def initialize(actor, pos)
#change this to false to show the actor's graphic
@face = false
@actor = actor
y = (pos * 120)
super(280, y, 360, 120)
self.contents = Bitmap.new(width - 32, height - 32)
self.back_opacity = 255
if $d_dum == false
refresh
end
end
#----------------------------------------------------------------
def dispose
super
end
#----------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.size = 18
if @face == true
draw_actor_face(@actor, 4, 0)
else
draw_actor_graphic(@actor, 50, 80)
end
draw_actor_name(@actor, 111, 0)
draw_actor_level(@actor, 186, 0)
show_next_exp = @actor.level == 99 ? "---" : "#{@actor.next_exp}"
min_bar = @actor.level == 99 ? 1 : @actor.now_exp
max_bar = @actor.level == 99 ? 1 : @actor.next_exp
draw_slant_bar(115, 80, min_bar, max_bar, 190, 6, bar_color = Color.new(0, 100, 0, 255), end_color = Color.new(0, 255, 0, 255))
self.contents.draw_text(115, 24, 300, 32, "Exp:#{@actor.now_exp}")
self.contents.draw_text(115, 48, 300, 32, "Level Up:" + show_next_exp)
end
#----------------------------------------------------------------
def level_up
self.contents.font.color = system_color
self.contents.draw_text(230, 48, 80, 32, "LEVEL UP!")
end
#----------------------------------------------------------------
def update
super
end
end # of Window_LevelUp
#=================================
#Window_EXP
# Written by: David Schooley
#=================================
class Window_EXP < Window_Base
#----------------------------------------------------------------
def initialize(exp)
super(0, 0, 280, 60)
self.contents = Bitmap.new(width - 32, height - 32)
self.back_opacity = 255
refresh(exp)
end
#----------------------------------------------------------------
def dispose
super
end
#----------------------------------------------------------------
def refresh(exp)
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(0, 0, 150, 32, "Exp Earned:")
self.contents.font.color = normal_color
self.contents.draw_text(180, 0, 54, 32, exp.to_s, 2)
end
#----------------------------------------------------------------
def update
super
end
end # of Window_EXP
#=================================
#Window_Money_Items
# Written by: David Schooley
#=================================
class Window_Money_Items < Window_Base
#----------------------------------------------------------------
def initialize(money, treasures)
@treasures = treasures
super(0, 60, 280, 420)
self.contents = Bitmap.new(width - 32, height - 32)
self.back_opacity = 255
refresh(money)
end
#----------------------------------------------------------------
def dispose
super
end
#----------------------------------------------------------------
def refresh(money)
@money = money
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(4, 4, 100, 32, "Items Found:")
self.contents.font.color = normal_color
y = 32
for item in @treasures
draw_item_name(item, 4, y)
y += 32
end
cx = contents.text_size($data_system.words.gold).width
self.contents.font.color = normal_color
self.contents.draw_text(4, 340, 220-cx-2, 32, $game_party.gold.to_s, 2)
self.contents.font.color = normal_color
self.contents.draw_text(4, 300, 220-cx-2, 32, "+ " + @money.to_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(124-cx, 340, cx + 100, 32, $data_system.words.gold, 2)
end
def update
super
end
end # of Window_Money_Items
class Scene_Battle
alias raz_battle_report_main main
alias raz_battle_report_be battle_end
def main
# NEW - David
#$battle_end = false
@lvup_window = []
@show_dummies = true # Show dummy windows or not?
raz_battle_report_main
# NEW - David
@lvup_window = nil
@level_up = nil
@ch_stats = nil
@ch_compare_stats = nil
Audio.me_stop
end
def battle_end(result)
raz_battle_report_be(result)
# NEW - David
@status_window.visible = false
@spriteset.dispose
Graphics.transition
if result == 0
display_lv_up(@exp, @gold, @treasures)
loop do
Graphics.update
Input.update
if Input.trigger?(Input::C)
break
end
end
trash_lv_up
end
end
def start_phase5
@phase = 5
$game_system.me_play($game_system.battle_end_me)
$game_system.bgm_play($game_temp.map_bgm)
exp = 0
gold = 0
treasures = []
for enemy in $game_troop.enemies
unless enemy.hidden
exp += enemy.exp
gold += enemy.gold
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
treasures = treasures[0..5]
# NEW - David
@treasures = treasures
@exp = exp
@gold = gold
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
@phase5_wait_count = 10
end
def update_phase5
if @phase5_wait_count > 0
@phase5_wait_count -= 1
if @phase5_wait_count == 0
# NEW - David
$game_temp.battle_main_phase = false
end
return
end
# NEW - David
battle_end(0)
end
def display_lv_up(exp, gold, treasures)
$d_dum = false
d_extra = 0
i = 0
for actor in $game_party.actors
# Fill up the Lv up windows
@lvup_window[i] = Window_LevelUp.new($game_party.actors[i], i)
i += 1
end
# Make Dummies
if @show_dummies == true
$d_dum = true
for m in i..3
@lvup_window[m] = Window_LevelUp.new(m, m)
end
end
@exp_window = Window_EXP.new(exp)
@m_i_window = Window_Money_Items.new(gold, treasures)
@press_enter = nil
gainedexp = exp
@level_up = [0, 0, 0, 0]
@d_new_skill = ["", "", "", ""]
@d_breakout = false
@m_i_window.refresh(gold)
wait_for_OK
@d_remember = $game_system.bgs_memorize
Audio.bgs_play("Audio/SE/032-Switch01", 100, 300)
# NEW - David
max_exp = exp
value = 28
if exp < value
value = exp
end
if value == 0
value = 1
end
for n in 0..gainedexp - (max_exp / value)
exp -= (max_exp / value)
if @d_breakout == false
Input.update
end
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 += (max_exp / value)
# Fill up the Lv up windows
if @d_breakout == false
@lvup_window[i].refresh
@exp_window.refresh(exp)
end
if actor.level > last_level
@level_up[i] = 5
Audio.se_play("Audio/SE/056-Right02.ogg", 70, 150)
if $d_new_skill
@d_new_skill[i] = $d_new_skill
end
end
if @level_up[i] == 0
@d_new_skill[i] = ""
end
if @level_up[i] > 0
@lvup_window[i].level_up
end
if Input.trigger?(Input::C) or exp <= 0
@d_breakout = true
end
end
if @d_breakout == false
if @level_up[i] >0
@level_up[i] -= 1
end
Graphics.update
end
end
if @d_breakout == true
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
if actor.cant_get_exp? == false
actor.exp += exp
end
end
exp = 0
break
end
end
Audio.bgs_stop
@d_remember = $game_system.bgs_restore
for i in 0...$game_party.actors.size
@lvup_window[i].refresh
end
@exp_window.refresh(exp)
Audio.se_play("Audio/SE/006-System06.ogg", 70, 150)
$game_party.gain_gold(gold)
@m_i_window.refresh(0)
Graphics.update
end
def trash_lv_up
# NEW - David
i=0
for i in 0 ... 4
@lvup_window[i].visible = false
end
@exp_window.visible = false
@m_i_window.visible = false
@lvup_window = nil
@exp_window = nil
@m_i_window = nil
end
# Wait until OK key is pressed
def wait_for_OK
loop do
Input.update
Graphics.update
if Input.trigger?(Input::C)
break
end
end
end
end
class Window_Base < Window
def draw_actor_face(actor, x, y)
bitmap = RPG::Cache.picture("Faces/" + actor.character_name)
self.contents.blt(x, y, bitmap, Rect.new(0,0,96,96))
end
#--------------------------------------------------------------------------
# * Draw Slant Bar(by SephirothSpawn)
#--------------------------------------------------------------------------
def draw_slant_bar(x, y, min, max, width = 152, height = 6,
bar_color = Color.new(150, 0, 0, 255), end_color = Color.new(255, 255, 60, 255))
# Draw Border
for i in 0..height
self.contents.fill_rect(x + i, y + height - i, width + 1, 1, Color.new(50, 50, 50, 255))
end
# Draw Background
for i in 1..(height - 1)
r = 100 * (height - i) / height + 0 * i / height
g = 100 * (height - i) / height + 0 * i / height
b = 100 * (height - i) / height + 0 * i / height
a = 255 * (height - i) / height + 255 * i / height
self.contents.fill_rect(x + i, y + height - i, width, 1, Color.new(r, b, g, a))
end
# Draws Bar
for i in 1..( (min / max.to_f) * width - 1)
for j in 1..(height - 1)
r = bar_color.red * (width - i) / width + end_color.red * i / width
g = bar_color.green * (width - i) / width + end_color.green * i / width
b = bar_color.blue * (width - i) / width + end_color.blue * i / width
a = bar_color.alpha * (width - i) / width + end_color.alpha * i / width
self.contents.fill_rect(x + i + j, y + height - j, 1, 1, Color.new(r, g, b, a))
end
end
end
end
Instructions
Place this script above main. Make a folder in the pictures folder and call it Faces. When using a face picture, make sure it's named like the character's file. To turn facesets on search for @face = false and set it to true to turn facesets on.
FAQ
None yet.
Compatibility
May be incompatible with your CBS.
Is incompatible with Cogwheels RTAB script and please don't ask it to be merged, as I won't do it.
Credits and Thanks
I only want to say that this script was made by illustrationism not by me.
I only made the edits.
Thanks to neonshadow for fixing a bug.
This post has been edited by Raziel: Sep 13 2006, 03:17 PM
not sure if this already exists here.
if it does please just delete this topic or something.
i found this great script for up to 99 save slots on xp!
just replace Scene_File with this.
class Scene_File
SAVEFILE_MAX = 99
# -------------------
def initialize(help_text)
@help_text = help_text
end
# -------------------
def main
@help_window = Window_Help.new
@help_window.set_text(@help_text)
@savefile_windows = []
@cursor_displace = 0
for i in 0..3
@savefile_windows.push(Window_SaveFile.new(i, make_filename(i), i))
end
@file_index = 0
@savefile_windows[@file_index].selected = true
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@help_window.dispose
for i in @savefile_windows
i.dispose
end
end
# -------------------
def update
@help_window.update
for i in @savefile_windows
i.update
end
if Input.trigger?(Input::C)
on_decision(make_filename(@file_index))
$game_temp.last_file_index = @file_index
return
end
if Input.trigger?(Input::B)
on_cancel
return
end
if Input.repeat?(Input::DOWN)
if Input.trigger?(Input::DOWN) or @file_index < SAVEFILE_MAX - 1
if @file_index == SAVEFILE_MAX - 1
$game_system.se_play($data_system.buzzer_se)
return
end
@cursor_displace += 1
if @cursor_displace == 4
@cursor_displace = 3
for i in @savefile_windows
i.dispose
end
@savefile_windows = []
for i in 0..3
f = i - 2 + @file_index
name = make_filename(f)
@savefile_windows.push(Window_SaveFile.new(f, name, i))
@savefile_windows[i].selected = false
end
end
$game_system.se_play($data_system.cursor_se)
@file_index = (@file_index + 1)
if @file_index == SAVEFILE_MAX
@file_index = SAVEFILE_MAX - 1
end
for i in 0..3
@savefile_windows[i].selected = false
end
@savefile_windows[@cursor_displace].selected = true
return
end
end
if Input.repeat?(Input::UP)
if Input.trigger?(Input::UP) or @file_index > 0
if @file_index == 0
$game_system.se_play($data_system.buzzer_se)
return
end
@cursor_displace -= 1
if @cursor_displace == -1
@cursor_displace = 0
for i in @savefile_windows
i.dispose
end
@savefile_windows = []
for i in 0..3
f = i - 1 + @file_index
name = make_filename(f)
@savefile_windows.push(Window_SaveFile.new(f, name, i))
@savefile_windows[i].selected = false
end
end
$game_system.se_play($data_system.cursor_se)
@file_index = (@file_index - 1)
if @file_index == -1
@file_index = 0
end
for i in 0..3
@savefile_windows[i].selected = false
end
@savefile_windows[@cursor_displace].selected = true
return
end
end
end
# -------------------
def make_filename(file_index)
return "Save#{file_index + 1}.rxdata"
end
# -------------------
end
and replace the Window_SaveFile initialize method with this
you can edit the 99 part in the first script to however many save slots you want.
remember!
this is not mine, i simply found this!
should work with almost everything ive tried!
Instructions
Very simple really, just paste the script right above main and thats it XD
Also, you must go into your database and put the name of the item before the description e.g. "Potion: Heals character by 500". In the end i thought it would be more beneficial to make it like this rather then call upon another window to display the name.
#==============================================================================
# Icon Inventory System - Scripted By Mac
#------------------------------------------------------------------------------
# This window displays the Icons and the amount of the item you have.
#==============================================================================
class Window_Item < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 63, 640, 417)
@column_max = 10
refresh
self.index = 0
# If in battle, move window to center of screen
# and make it semi-transparent
if $game_temp.in_battle
self.y = 64
self.height = 256
self.back_opacity = 160
end
end
#--------------------------------------------------------------------------
# * Get Item
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
# Add item
for i in 1...$data_items.size
if $game_party.item_number(i) > 0
@data.push($data_items[i])
end
end
# Also add weapons and items if outside of battle
unless $game_temp.in_battle
for i in 1...$data_weapons.size
if $game_party.weapon_number(i) > 0
@data.push($data_weapons[i])
end
end
for i in 1...$data_armors.size
if $game_party.armor_number(i) > 0
@data.push($data_armors[i])
end
end
end
# If item count is not 0, make a bit map and draw all items
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_item(i)
end
end
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
case item
when RPG::Item
number = $game_party.item_number(item.id)
when RPG::Weapon
number = $game_party.weapon_number(item.id)
when RPG::Armor
number = $game_party.armor_number(item.id)
end
if item.is_a?(RPG::Item) and
$game_party.item_can_use?(item.id)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
x = 4 + index % 10 * (32 + 32)
y = index / 10 * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(item.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x, y + 9, 24, 32, number.to_s, 2)
end
#--------------------------------------------------------------------------
# * Help Text Update
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.item == nil ? "" : self.item.description)
end
end
Credits
Me! XD
by Near Fantastica & Fuso
Credit due: Fuso made the main part of this script all I did was make it work… Fuso needs as much credit or more then I do for this script…
Features:
NO MORE CUSTOM MOVEMENTS ~! This script uses path finding to return the shortest path from the START XY to the END XY then uses the custom movement to move the character… You can chain this path finds together to path link between 2 points or more...
As well an Error message will be displayed if you try to send an event to a place it can not get to…. “Target Is Unreachable for Event ID�
index = the index of the event
repeat = set the repeat flag to true and the define movement will repeat false it will not repeat..
skippable = set skippable flag to true and the event will move ever when blocked
NOTE : This is not wanted in must cases that is why its defaulted to false
repeat = set the repeat flag to true and the define movement will repeat false it will not repeat..
skippable = set skippable flag to true and the event will move ever when blocked
NOTE : This is not wanted in must cases that is why its defaulted to false
src_x = source x
src_y = source y
trg_x = target x
trg_y = target y
How to use:
You need to setup a movement event before you can add a path or commands this is done with the $AEMS.setup(index, repeat) command then you can add a command or a path this is done by $AEMS.add_command(index, code, parameters = []) or $AEMS.add_paths(index, src_x, src_y, trg_x, trg_y) commands. Now you can add as many commands and paths as you want to event by adding more of these… this is called path linking… then when you are ready to start the movement use $AEMS.start_movement(index)
Now this can be done in 2 places in the events command window or in the custom movement of an event. If you do it in the movement window to start use this
return $AEMS.start_movement(index) or the code will not work right…
As well I found out something interesting if you have a repeating movement event using this movement with a defined wait the wait will repeat everytime… but if you add a normal move event wait it will only operate once… this can be a good things to add this delay so not all the events start at once yet do not repeat that wait later…
#======================================
# â–� Advanced Event Movement System
#------------------------------------------------------------------------------
#  By: Near Fantastica
# Date: 23/3/05
#
# Advanced Event Movement using Path Fiding and the Game
# Characters force_move_route method
#======================================
class AEMS
#--------------------------------------------------------------------------
def initialize
@event_route = []
@player_route = nil
end
#--------------------------------------------------------------------------
def setup_event(index, repeat, skippable = false)
@event_route[index] = RPG::MoveRoute.new
@event_route[index].repeat = repeat
@event_route[index].skippable = skippable
@event_route[index].list.clear
end
#--------------------------------------------------------------------------
def add_command_event(index, code, parameters = [])
@event_route[index].list.push RPG::MoveCommand.new(code,parameters)
end
#--------------------------------------------------------------------------
def start_movement_event(index)
@event_route[index].list.push RPG::MoveCommand.new(0)
$game_map.events[index].move_route = @event_route[index]
$game_map.events[index].move_route_index = 0
end
#--------------------------------------------------------------------------
def add_paths_event(index, src_x,src_y,trg_x,trg_y)
paths = $game_map.find_short_paths(src_x,src_y,trg_x,trg_y)
if paths == nil
print "Target Is Unreachable for Event " + index.to_s
return
end
for i in 0...paths.size
case paths[i]
when 2
@event_route[index].list.push RPG::MoveCommand.new(4)
when 4
@event_route[index].list.push RPG::MoveCommand.new(2)
when 6
@event_route[index].list.push RPG::MoveCommand.new(3)
when 8
@event_route[index].list.push RPG::MoveCommand.new(1)
end
end
end
#--------------------------------------------------------------------------
def setup_player(repeat, skippable = false)
@player_route = RPG::MoveRoute.new
@player_route.repeat = repeat
@player_route.skippable = skippable
@player_route.list.clear
end
#--------------------------------------------------------------------------
def add_command_player(code, parameters = [])
@player_route.list.push RPG::MoveCommand.new(code,parameters)
end
#--------------------------------------------------------------------------
def start_movement_player
@player_route.list.push RPG::MoveCommand.new(0)
$game_player.move_route = @player_route
$game_player.move_route_index = 0
end
#--------------------------------------------------------------------------
def add_paths_player(src_x,src_y,trg_x,trg_y)
paths = $game_map.find_short_paths(src_x,src_y,trg_x,trg_y)
if paths == nil
print "Target Is Unreachable for Player "
return
end
for i in 0...paths.size
case paths[i]
when 2
@player_route.list.push RPG::MoveCommand.new(4)
when 4
@player_route.list.push RPG::MoveCommand.new(2)
when 6
@player_route.list.push RPG::MoveCommand.new(3)
when 8
@player_route.list.push RPG::MoveCommand.new(1)
end
end
end
end
#======================================
# â–� Path Finding
#------------------------------------------------------------------------------
#  By: Fuso
#======================================
class Game_Map
#--------------------------------------------------------------------------
attr_accessor :events
#--------------------------------------------------------------------------
def initialize
@events = {}
end
#--------------------------------------------------------------------------
UP = 2
LEFT = 4
RIGHT = 6
DOWN = 8
#--------------------------------------------------------------------------
def find_short_paths(src_x,src_y,trg_x,trg_y,depth = 100, self_event = nil, option_close = false)
return [] if not (passable?(trg_x, trg_y, UP, self_event) or
passable?(trg_x, trg_y, LEFT, self_event) or
passable?(trg_x, trg_y, RIGHT, self_event) or
passable?(trg_x, trg_y, DOWN, self_event))
# Paths will hold the succeeding paths.
paths = []
# path_map will hold what paths has already been visited, to prevent that we attempt to
# walk on the same tile twice.
path_map = [src_x + src_y / 10000.0]
trackers = []
new_trackers = [[src_x, src_y, []]]
if not option_close
depth.times {
trackers = new_trackers
new_trackers = []
for tracker in trackers
if tracker[0] == trg_x and tracker[1] == trg_y
paths.push tracker[2].compact
next
end
path_map.push tracker[0] + tracker[1] / 10000.0
if passable?(tracker[0], tracker[1], DOWN, self_event) and
passable?(tracker[0], tracker[1] - 1, UP) and
not path_map.include? tracker[0] + (tracker[1] - 1) / 10000.0
path_map.push tracker[0] + (tracker[1] - 1) / 10000.0
new_trackers.push [tracker[0], tracker[1] - 1, [tracker[2], UP].flatten]
end
if passable?(tracker[0], tracker[1], RIGHT, self_event) and
passable?(tracker[0] - 1, tracker[1], LEFT) and
not path_map.include? tracker[0] - 1 + tracker[1] / 10000.0
path_map.push tracker[0] - 1 + tracker[1] / 10000.0
new_trackers.push [tracker[0] - 1, tracker[1], [tracker[2], LEFT].flatten]
end
if passable?(tracker[0], tracker[1], LEFT, self_event) and
passable?(tracker[0] + 1, tracker[1], RIGHT) and
not path_map.include? tracker[0] + 1 + tracker[1] / 10000.0
path_map.push tracker[0] + 1 + tracker[1] / 10000.0
new_trackers.push [tracker[0] + 1, tracker[1], [tracker[2], RIGHT].flatten]
end
if passable?(tracker[0], tracker[1], UP, self_event) and
passable?(tracker[0], tracker[1] + 1, DOWN) and
not path_map.include? tracker[0] + (tracker[1] + 1) / 10000.0
path_map.push tracker[0] + (tracker[1] + 1) / 10000.0
new_trackers.push [tracker[0], tracker[1] + 1, [tracker[2], DOWN].flatten]
end
end
break if paths.size > 0
}
else
paths_distance = 10000 ** 2 * 2
depth.times {
trackers = new_trackers
new_trackers = []
for tracker in trackers
if tracker[0] == trg_x and tracker[1] == trg_y
if paths_distance > 0
paths_distance = 0
paths.clear
end
paths.push tracker[2].compact
next
end
distance = (tracker[0] - trg_x) ** 2 + (tracker[1] - trg_y) ** 2
if distance <= paths_distance
if distance < paths_distance
paths.clear
paths_distance = distance
end
paths.push tracker[2].compact
end
path_map.push tracker[0] + tracker[1] / 10000.0
if passable?(tracker[0], tracker[1], DOWN, self_event) and
passable?(tracker[0], tracker[1] - 1, UP) and
not path_map.include? tracker[0] + (tracker[1] - 1) / 10000.0
path_map.push tracker[0] + (tracker[1] - 1) / 10000.0
new_trackers.push [tracker[0], tracker[1] - 1, [tracker[2], UP].flatten]
end
if passable?(tracker[0], tracker[1], RIGHT, self_event) and
passable?(tracker[0] - 1, tracker[1], LEFT) and
not path_map.include? tracker[0] - 1 + tracker[1] / 10000.0
path_map.push tracker[0] - 1 + tracker[1] / 10000.0
new_trackers.push [tracker[0] - 1, tracker[1], [tracker[2], LEFT].flatten]
end
if passable?(tracker[0], tracker[1], LEFT, self_event) and
passable?(tracker[0] + 1, tracker[1], RIGHT) and
not path_map.include? tracker[0] + 1 + tracker[1] / 10000.0
path_map.push tracker[0] + 1 + tracker[1] / 10000.0
new_trackers.push [tracker[0] + 1, tracker[1], [tracker[2], RIGHT].flatten]
end
if passable?(tracker[0], tracker[1], UP, self_event) and
passable?(tracker[0], tracker[1] + 1, DOWN) and
not path_map.include? tracker[0] + (tracker[1] + 1) / 10000.0
path_map.push tracker[0] + (tracker[1] + 1) / 10000.0
new_trackers.push [tracker[0], tracker[1] + 1, [tracker[2], DOWN].flatten]
end
end
break if distance == 0 and paths.size > 0
}
end
route = paths[0]
return route
end
end
#======================================
class Scene_Title
#--------------------------------------------------------------------------
alias aems_scene_title_update update
#--------------------------------------------------------------------------
def update
$AEMS = AEMS.new
aems_scene_title_update
end
end
#======================================
class Game_Character
attr_accessor :move_route
attr_accessor :move_route_index
end
...
Mode07 on the Map!
Includes:
Mode07 v0.6
Overworld Sprite Resize
Written by mewsterus
Special Thanks:
Fanha Giang (for a reverse engineered Tilemap class)
--------------------------------------------------------------------------------
Instructions:
--------------------------------------------------------------------------------
To install, just insert this in a descriptive code slot right above Main.
This is different than previous instructions; please read the next paragraph.
If you had a previous install of this script and need an original version of
Spriteset_Map, one can be found at:
http://www.rpg-palace.com/scripts/spriteset_map.txt
To activate Mode07, add [#XX] to the map's name, replacing XX with the
percentage of Mode07 to apply. Greater numbers will result in a more slanted
world.
To activate overworld sprite resize, add [OV] to the map's name. This will make
sprites smaller on that map.
For the purposes of location scripts, these identifiers will not appear.
Examples:
"Overworld[#40]" will result in a slant identical to the second screenshot.
"Underworld[OV]" will resize only the player character to a small size, as if
seen from high above.
"Atthelevelworld[OV][#12]" will result in the player being resized, and a modest
slant of 12%
"JustPlainWorld" will result in the same old map you've always seen.
To add a sky, simply use the panorama with the tileset. Also, events will not
be drawn flat with the map. Any vertical objects such as trees should be put
in events and displayed that way.
You can also add a sky by adding a fog. If you add this, you can make it look
like the first screenshot.
A note on the $strip_size variable; the default value is 8, however there is
extremely minimal, almost nonexistant lag with 16. The screen is extremely
smooth with 4, or even 2. If you're having major problems with lag, you may
need to use 32, but it won't look too pretty.
--------------------------------------------------------------------------------
* Draw_Tilemap v1.72-0.6
Fanha Giang, 02/12/2006 (mm/dd/yyyy)
Edited for Mode07 by mewsterus 08/08/2006 (mm/dd/yyyy)
=end
#===============================================================================
$width = 640 # Screen width (will not change resolution,
$height = 480 # Screen height here for compatibility)
$ov_zoom = 0.6 # Overworld zoom multiplier
$strip_size = 8 # Size of each strip of the map. Higher numbers will lag less.
# Recommended that this number be a power of 2.
# Do not make higher than 64.
$curve = true # Whether the map is curled, for overworlds (old method)
$data_map = load_data("Data/MapInfos.rxdata")
#===============================================================================
class RPG::MapInfo
def name # Definition prevents location scripts from reading anything within
return @name.gsub(/\[.*\]/) {""} # brackets, including the brackets
end
#-----------------------------------------------------------------------------
def original_name
return @name
end
#-----------------------------------------------------------------------------
def overworld?
return @name.scan(/[OV]/).size > 0
end
#-----------------------------------------------------------------------------
def pitch
@name =~ /\[#[ ]*([00-99]+)\]/i
return $1
end
end
#===============================================================================
class Draw_Tilemap # This class controls a set of sprites, with different Z
# values, arranged into horizontal bars
attr_accessor :tileset
attr_accessor :map_data
attr_accessor :priorities
attr_accessor :autotiles
attr_accessor :bitmaps
attr_accessor :pitch
attr_accessor :ox
attr_accessor :oy
attr_accessor :plus_y
INDEX = # Autotile definitions
[
26, 27, 32, 33, 4, 27, 32, 33, 26, 5, 32, 33, 4, 5, 32, 33,
26, 27, 32, 11, 4, 27, 32, 11, 26, 5, 32, 11, 4, 5, 32, 11,
26, 27, 10, 33, 4, 27, 10, 33, 26, 5, 10, 33, 4, 5, 10, 33,
26, 27, 10, 11, 4, 27, 10, 11, 26, 5, 10, 11, 4, 5, 10, 11,
24, 25, 30, 31, 24, 5, 30, 31, 24, 25, 30, 11, 24, 5, 30, 11,
14, 15, 20, 21, 14, 15, 20, 11, 14, 15, 10, 21, 14, 15, 10, 11,
28, 29, 34, 35, 28, 29, 10, 35, 4, 29, 34, 35, 4, 29, 10, 35,
38, 39, 44, 45, 4, 39, 44, 45, 38, 5, 44, 45, 4, 5, 44, 45,
24, 29, 30, 35, 14, 15, 44, 45, 12, 13, 18 ,19, 12, 13, 18, 11,
16, 17, 22, 23, 16, 17, 10, 23, 40, 41, 46, 47, 4, 41, 46, 47,
36, 37, 42, 43, 36, 5, 42, 43, 12, 17, 18, 23, 12, 13, 42, 43,
36, 41, 42, 47, 16, 17, 46, 47, 12, 17, 42, 47, 0, 1, 6, 7
]
X = [0, 1, 0, 1] # Used in 16x16 autotile drawing; left, right, left, right
Y = [0, 0, 1, 1] # Used in 16x16 autotile drawing; up, up, down, down
#-----------------------------------------------------------------------------
def initialize
# Get initial data from Game_Map
@tileset = RPG::Cache.tileset($game_map.tileset_name)
@map_data = $game_map.data
@priorities = $game_map.priorities
@autotiles = []
for i in 0..6
@autotiles[i] = RPG::Cache.autotile($game_map.autotile_names[i])
end
# Provide blank data in proper object form
@ox = 0
@oy = 0
# Bitmaps used for each priority's drawing. Priorities 2-5 are combined.
@bitmaps = [Bitmap.new($game_map.width*32, $game_map.height*32+$strip_size),
Bitmap.new($game_map.width*32, $game_map.height*32+$strip_size),
Bitmap.new($game_map.width*32, $game_map.height*32+$strip_size)]
# Generate blank sprites
@sprites = [[], [], []]
for i in 0..2 # For each layer
for j in 0..$game_map.height * (32 / $strip_size) - 1
# For each horizontal strip of $strip_size height, make a blank sprite
@sprites[i].push(Sprite.new)
@sprites[i][j].bitmap = Bitmap.new($game_map.width*32, $strip_size*2)
@sprites[i][j].x = $width / 2
@sprites[i][j].y = -64
@sprites[i][j].z = -5 + (i * 10)
end
end
@disposed = false
draw
end
#-----------------------------------------------------------------------------
def update
# Retrieve variable values for slant drawing; these values accesible by event
@pitch = $game_map.pitch.to_f
@plus_y = $game_map.plus_y
for i in 0..2 # For each layer
for j in [0, (($height / 2) - (($height * 60) /
@pitch) + @oy) / $strip_size].max.to_i..[@sprites[i].size - 1,
(@oy + $height) / $strip_size].min.to_i
# For each strip within the visible screen, update OX/Y
@sprites[i][j].x = $width / 2
@sprites[i][j].y = j * $strip_size - @oy
unless @pitch == 0 # Apply X Zoom
@sprites[i][j].zoom_x = (@sprites[i][j].y - $height / 2) *
(@pitch / ($height * 25)) + 1
if $curve # Zoom Y values same as X, and compensate
@sprites[i][j].zoom_y = @sprites[i][j].zoom_x
@sprites[i][j].y += $strip_size * (1 - @sprites[i][j].zoom_y) *
((1 - @sprites[i][j].zoom_y) /
(2 * ((@pitch / 100) /
($height / ($strip_size * 2)))) + 0.5)
end
end
@sprites[i][j].ox = @ox + $width / 2
# Add plus_y value; used in airship script
@sprites[i][j].y += @plus_y
end
end
end
#-----------------------------------------------------------------------------
def dispose
# Dispose all sprites
for i in 0..2
for j in @sprites[i]
j.bitmap.dispose
j.dispose
end
end
for i in @bitmaps
i.dispose
end
@tileset.dispose
for i in 0..6
@autotiles[i].dispose
end
@disposed = true
end
#-----------------------------------------------------------------------------
def disposed?
return @disposed
end
#-----------------------------------------------------------------------------
def draw
# Draw each individual position by XY value
for x in 0...@map_data.xsize
for y in 0...@map_data.ysize
draw_position(x, y)
end
end
for i in 0..2 # For each priority
for j in 0..@sprites[i].size - 1
# For each horizontal strip, transfer the bitmap appropriately
@sprites[i][j].bitmap.blt(0, 0, @bitmaps[i],
Rect.new(0, j * $strip_size, $game_map.width * 32, $strip_size * 2))
end
end
end
#-----------------------------------------------------------------------------
def draw_position(x, y)
for layer in 0..2
pos = @map_data[x, y, layer]
@priorities[pos] = 2 if @priorities[pos] > 2 # Round priorities down to 2
if pos >= 384 # If it is a tile
# src_rect = 32x32 Rect on the tileset for source bitmap
src_rect = Rect.new(((pos-384)%8)*32, ((pos-384)/8)*32, 32, 32)
# Transfer source bitmap on the tileset to the current map tile
@bitmaps[@priorities[pos]].blt(x * 32, y * 32, @tileset, src_rect)
elsif pos >= 48 and pos < 384 # If it is an autotile
id = pos / 48 - 1 # Which autotile is used (0-6)
# plus_x is in development for animated autotiles
plus_x = 0 #((@anim / 4) % (@autotiles[id].width / 96)) * 96
for corner in 0..3
h = 4 * (pos % 48) + corner # Used to access INDEX
# src_rect = 16x16 Rect on the autotile for source bitmap
src_rect = Rect.new((INDEX[h]%6)*16+plus_x, (INDEX[h]/6)*16, 16, 16)
# Transfer source bitmap on the autotile to the current 16x16 tile
@bitmaps[@priorities[pos]].blt(x*32+X[corner]*16, y*32+Y[corner]*16,
@autotiles[id], src_rect)
end
end
end
end
end
#===============================================================================
class Game_Map
attr_accessor :pitch
attr_accessor :plus_y
#-----------------------------------------------------------------------------
alias setup_or :setup
def setup(map_id)
setup_or(map_id)
@pitch = $data_map[$game_map.map_id].pitch
@plus_y = 0
end
#-----------------------------------------------------------------------------
def name
return $data_map[@map_id].name
end
end
#===============================================================================
class Sprite_Character < RPG::Sprite
attr_accessor :character
#-----------------------------------------------------------------------------
def initialize(character = nil)
super()
@character = character
update
end
#-----------------------------------------------------------------------------
alias update_or :update
def update
update_or
# Update pitch value, and update zoom values to match
@pitch = $data_map[$game_map.map_id].pitch.to_f
self.zoom_x =
self.zoom_y = ((@character.screen_y - 16) - ($height / 2)) *
(@pitch / ($height * 25)) + 1
# Set sprite coordinates. X value is multiplied by zoom value from the center
self.x = ($width / 2) + ((@character.screen_x - ($width / 2)) * self.zoom_x)
self.y = @character.screen_y
# Add Y value for zoom compensation while in curve mode
if $curve and @pitch != 0
self.y += (8 * (1 - self.zoom_y) * ((1 - self.zoom_y) /
(2 * ((@pitch / 100) / ($height / 16.0))) + 0.5))
end
# Add plus_y value; used in airship script
self.y += $game_map.plus_y unless @character.is_a?(Game_Player)
self.z = @character.screen_z(@ch) - (self.zoom_y < 0.5 ? 1000 : 0)
if $data_map[$game_map.map_id].overworld? and
@character.is_a?(Game_Player) # Multiply zoom by Overworld factor if
self.zoom_x *= $ov_zoom # the map is marked with [OV] and event
self.zoom_y *= $ov_zoom # is a Game_Player
end
end
end
#===============================================================================
class Spriteset_Map
def initialize
# Make viewports
@viewport1 = Viewport.new(0, 0, 640, 480)
@viewport2 = Viewport.new(0, 0, 640, 480)
@viewport3 = Viewport.new(0, 0, 640, 480)
@viewport2.z = 2000
@viewport3.z = 5000
# Make tilemap
@tilemap = Draw_Tilemap.new
# Make panorama plane
@panorama = Plane.new
@panorama.z = -2000
# Make fog plane
@fog = Plane.new
@fog.z = 3000
# Make character sprites
@character_sprites = []
for i in $game_map.events.keys.sort
sprite = Sprite_Character.new($game_map.events[i])
@character_sprites.push(sprite)
end
@character_sprites.push(Sprite_Character.new($game_player))
# Make weather
@weather = RPG::Weather.new(@viewport1)
# Make picture sprites
@picture_sprites = []
for i in 1..50
@picture_sprites.push(Sprite_Picture.new(@viewport2,
$game_screen.pictures[i]))
end
# Make timer sprite
@timer_sprite = Sprite_Timer.new
# Frame update
update
end
#-----------------------------------------------------------------------------
def dispose
# Dispose of tilemap
@tilemap.dispose
# Dispose of panorama plane
@panorama.dispose
# Dispose of fog plane
@fog.dispose
# Dispose of character sprites
for sprite in @character_sprites
sprite.dispose
end
# Dispose of weather
@weather.dispose
# Dispose of picture sprites
for sprite in @picture_sprites
sprite.dispose
end
# Dispose of timer sprite
@timer_sprite.dispose
# Dispose of viewports
@viewport1.dispose
@viewport2.dispose
@viewport3.dispose
end
end