Bienvenue visiteur !
|
Désactiver la neige
Statistiques
Liste des membres
Contact
Mentions légales
447 connectés actuellement
30912688 visiteurs depuis l'ouverture
2324 visiteurs aujourd'hui
Partenaires
Tous nos partenaires
Devenir partenaire
|
Metatr0nicks -
posté le 03/08/2020 à 16:13:13 (20 messages postés)
| | Domaine concerné: Script
Logiciel utilisé: RMXP
Bonjour,
J'ai trouvé un script fort intéressant il y a peu, dans une démo. Il rajoute une fenêtre post-combat donnant un aperçu de ce qui a été gagné suite à la bataille.
Cependant, depuis que j'ai ajouté ce script, à la fin de chaque combat, une fois que cette nouvelle fenêtre se ferme, j'ai une fenêtre d'erreur qui ferme le jeu avec le message suivant :
Spoiler (cliquez pour afficher) Script 'Window_Base' line 30: RGSSError occured
disposed window
J'ai cherché partout sur le net, j'ai tenté de trouver un post, une mise à jour du script et de contacter l'auteur de la démo en vain. Je n'arrive pas à régler l'erreur non plus, malgré mes trifouillages. A noter que l'erreur est aussi présente dans la démo.
Voici donc le script concerné :
Spoiler (cliquez pour afficher)
#==============================================================================
# ** Battle Report v 1.6 by Illustrationism
# * Posted & Edited by Raziel
#==============================================================================
# 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.
#==============================================================================
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
# Calculate Bar Gradiation
if max_bar != 0
rate = min_bar.to_f / max_bar
else
rate = 1
end
# Adjust Bar Color based on Gradiation
color1 = Color.new(14 * rate, 80 - 24 * rate, 80 * rate, 192)
color2 = Color.new(62 * rate, 240 - 72 * rate, 240 * rate, 192)
draw_width = 152 * min_bar.to_f / max_bar
# Draw Bar Graph
cw_gauge(115, 80, 152, 10, draw_width, 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 learn_skill(skill)
self.contents.font.color = normal_color
unless $d_new_skill == nil
Audio.se_play("Audio/SE/105-Heal01")
self.contents.draw_text(186, 24, 80, 32, "Learned:")
self.contents.font.color = system_color
self.contents.draw_text(261, 24, 90, 32, skill)
end
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 = nil
@spriteset.dispose
@actor_command_window.dispose
# Added for RTAB Patch version
@party_command_window.dispose
@help_window.dispose
@status_window.dispose
@message_window.dispose
# End of RTAB Patch Version
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 = Window_LevelUp.new($game_party.actors, 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
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.refresh
@exp_window.refresh(exp)
end
if actor.level > last_level
@level_up = 5
Audio.se_play("Audio/SE/056-Right02.ogg", 70, 150)
if $d_new_skill
@d_new_skill = $d_new_skill
end
end
if @level_up == 0
@d_new_skill = ""
end
if @level_up > 0
@lvup_window.level_up
if @d_new_skill != ""
@lvup_window.learn_skill(@d_new_skill)
end
end
if Input.trigger?(Input::C) or exp <= 0
@d_breakout = true
end
end
if @d_breakout == false
if @level_up >0
@level_up -= 1
end
Graphics.update
end
end
if @d_breakout == true
for i in 0...$game_party.actors.size
actor = $game_party.actors
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.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.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
Notez que ce script a besoin de deux autres pour fonctionner, qui eux ne génèrent pas d'erreur. Je les mets au cas-où ce serait cependant lié.
Les voici :
Spoiler (cliquez pour afficher)
# HP/SP/EXP Gauge Script v1.00
# Distribution original support URL
# http://members.jcom.home.ne.jp/cogwheel/
#==============================================================================
# ** 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
def now_exp
return @exp - @exp_list[@level]
end
def next_exp
return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
end
end
#==============================================================================
# ** Window_Base
#------------------------------------------------------------------------------
# This class is for all in-game windows.
#==============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# * Draw HP Gauge
#--------------------------------------------------------------------------
# Modification of the original Draw HP process
alias :draw_actor_hp_hpsp :draw_actor_hp
def draw_actor_hp(actor, x, y, width = 144)
# Determine the rate of fill based on the actor's HP and HP Max
if actor.maxhp != 0
rate = actor.hp.to_f / actor.maxhp
else
rate = 0
end
# plus_x: revised x-coordinate
# rate_x: revised X-coordinate as (%)
# plus_y: revised y-coordinate
# plus_width: revised width
# rate_width: revised width as (%)
# height: Vertical width
# align1: Type 1 ( 0: left justify 1: center justify 2: right justify )
# align2: Type 2 ( 0: Upper stuffing 1: Central arranging 2:Lower stuffing )
# align3: Gauge type 0:Left justify 1: Right justify
plus_x = 0
rate_x = 0
plus_y = 25
plus_width = 0
rate_width = 100
height = 10
align1 = 1
align2 = 2
align3 = 0
# Gradation settings: grade1: Empty gauge grade2:Actual gauge
# (0:On side gradation 1:Vertically gradation 2: Slantedly gradation)
grade1 = 1
grade2 = 0
# Color setting. color1: Outermost framework, color2: Medium framework
# color3: Empty framework dark color, color4: Empty framework light/write color
color1 = Color.new(0, 0, 0, 192)
color2 = Color.new(255, 255, 192, 192)
color3 = Color.new(0, 0, 0, 192)
color4 = Color.new(64, 0, 0, 192)
# Color setting of gauge
# Usually color setting of the time
color5 = Color.new(80 - 24 * rate, 80 * rate, 14 * rate, 192)
color6 = Color.new(240 - 72 * rate, 240 * rate, 62 * rate, 192)
# Determine the gauge's width & fill based on the actor's HP
if actor.maxhp != 0
hp = (width + plus_width) * actor.hp * rate_width / 100 / actor.maxhp
else
hp = 0
end
# Drawing of gauge
gauge_rect(x + plus_x + width * rate_x / 100, y + plus_y,
width, plus_width + width * rate_width / 100,
height, hp, align1, align2, align3,
color1, color2, color3, color4, color5, color6, grade1, grade2)
# Call the original Draw HP process
draw_actor_hp_hpsp(actor, x, y, width)
end
#--------------------------------------------------------------------------
# * Draw SP Gauge
#--------------------------------------------------------------------------
# Modification of the original Draw SP process
alias :draw_actor_sp_hpsp :draw_actor_sp
def draw_actor_sp(actor, x, y, width = 144)
# Determine the rate of fill based on the actor's SP and SP Max
if actor.maxsp != 0
rate = actor.sp.to_f / actor.maxsp
else
rate = 1
end
# plus_x: revised x-coordinate
# rate_x: revised X-coordinate as (%)
# plus_y: revised y-coordinate
# plus_width: revised width
# rate_width: revised width as (%)
# height: Vertical width
# align1: Type 1 ( 0: left justify 1: center justify 2: right justify )
# align2: Type 2 ( 0: Upper stuffing 1: Central arranging 2:Lower stuffing )
# align3: Gauge type 0:Left justify 1: Right justify
plus_x = 0
rate_x = 0
plus_y = 25
plus_width = 0
rate_width = 100
height = 10
align1 = 1
align2 = 2
align3 = 0
# Gradation settings: grade1: Empty gauge grade2:Actual gauge
# (0:On side gradation 1:Vertically gradation 2: Slantedly gradation)
grade1 = 1
grade2 = 0
# Color setting. color1: Outermost framework, color2: Medium framework
# color3: Empty framework dark color, color4: Empty framework light/write color
color1 = Color.new(0, 0, 0, 192)
color2 = Color.new(255, 255, 192, 192)
color3 = Color.new(0, 0, 0, 192)
color4 = Color.new(0, 64, 0, 192)
# Color setting of gauge
# Usually color setting of the time
color5 = Color.new(14 * rate, 80 - 24 * rate, 80 * rate, 192)
color6 = Color.new(62 * rate, 240 - 72 * rate, 240 * rate, 192)
# Determine the gauge's width & fill based on the actor's SP
if actor.maxsp != 0
sp = (width + plus_width) * actor.sp * rate_width / 100 / actor.maxsp
else
sp = (width + plus_width) * rate_width / 100
end
# Drawing of gauge
gauge_rect(x + plus_x + width * rate_x / 100, y + plus_y,
width, plus_width + width * rate_width / 100,
height, sp, align1, align2, align3,
color1, color2, color3, color4, color5, color6, grade1, grade2)
# Call the original Draw HP process
draw_actor_sp_hpsp(actor, x, y, width)
end
#--------------------------------------------------------------------------
# * Draw EXP Gauge
#--------------------------------------------------------------------------
# Modification of the original Draw HP process
alias :draw_actor_exp_hpsp :draw_actor_exp
def draw_actor_exp(actor, x, y, width = 204)
# Determine the rate of fill based on the actor's EXP and Next EXP
if actor.next_exp != 0
rate = actor.now_exp.to_f / actor.next_exp
else
rate = 1
end
# plus_x: revised x-coordinate
# rate_x: revised X-coordinate as (%)
# plus_y: revised y-coordinate
# plus_width: revised width
# rate_width: revised width as (%)
# height: Vertical width
# align1: Type 1 ( 0: left justify 1: center justify 2: right justify )
# align2: Type 2 ( 0: Upper stuffing 1: Central arranging 2:Lower stuffing )
# align3: Gauge type 0:Left justify 1: Right justify
plus_x = 0
rate_x = 0
plus_y = 25
plus_width = 0
rate_width = 100
height = 10
align1 = 1
align2 = 2
align3 = 0
# Gradation settings: grade1: Empty gauge grade2:Actual gauge
# (0:On side gradation 1:Vertically gradation 2: Slantedly gradation)
grade1 = 1
grade2 = 0
# Color setting. color1: Outermost framework, color2: Medium framework
# color3: Empty framework dark color, color4: Empty framework light/write color
color1 = Color.new(0, 0, 0, 192)
color2 = Color.new(255, 255, 192, 192)
color3 = Color.new(0, 0, 0, 192)
color4 = Color.new(64, 0, 0, 192)
# Color setting of gauge
# Usually color setting of the time
color5 = Color.new(80 * rate, 80 - 80 * rate ** 2, 80 - 80 * rate, 192)
color6 = Color.new(240 * rate, 240 - 240 * rate ** 2, 240 - 240 * rate, 192)
# Determine the gauge's width & fill based on the actor's Next EXP
if actor.next_exp != 0
exp = (width + plus_width) * actor.now_exp * rate_width /
100 / actor.next_exp
else
exp = (width + plus_width) * rate_width / 100
end
# Drawing of gauge
gauge_rect(x + plus_x + width * rate_x / 100, y + plus_y,
width, plus_width + width * rate_width / 100,
height, exp, align1, align2, align3,
color1, color2, color3, color4, color5, color6, grade1, grade2)
# Call the original Draw EXP process
draw_actor_exp_hpsp(actor, x, y)
end
#--------------------------------------------------------------------------
# * Drawing of gauge
#--------------------------------------------------------------------------
def gauge_rect(x, y, rect_width, width, height, gauge, align1, align2, align3,
color1, color2, color3, color4, color5, color6, grade1, grade2)
case align1
when 1
x += (rect_width - width) / 2
when 2
x += rect_width - width
end
case align2
when 1
y -= height / 2
when 2
y -= height
end
# Framework Drawing
self.contents.fill_rect(x, y, width, height, color1)
self.contents.fill_rect(x + 1, y + 1, width - 2, height - 2, color2)
if align3 == 0
if grade1 == 2
grade1 = 3
end
if grade2 == 2
grade2 = 3
end
end
if (align3 == 1 and grade1 == 0) or grade1 > 0
color = color3
color3 = color4
color4 = color
end
if (align3 == 1 and grade2 == 0) or grade2 > 0
color = color5
color5 = color6
color6 = color
end
# Drawing of empty gauge
self.contents.gradation_rect(x + 2, y + 2, width - 4, height - 4,
color3, color4, grade1)
if align3 == 1
x += width - gauge
end
# Drawing of actual gauge
self.contents.gradation_rect(x + 2, y + 2, gauge - 4, height - 4,
color5, color6, grade2)
end
end
#------------------------------------------------------------------------------
# New routine added to the Bitmap class.
#==============================================================================
class Bitmap
#--------------------------------------------------------------------------
# * Rectangle Gradation Indicator
# color1: Start color
# color2: Ending color
# align: 0: On side gradation
# 1: Vertically gradation
# 2: The gradation (intense concerning slantedly heavily note)
#--------------------------------------------------------------------------
def gradation_rect(x, y, width, height, color1, color2, align = 0)
if align == 0
for i in x...x + width
red = color1.red + (color2.red - color1.red) * (i - x) / (width - 1)
green = color1.green +
(color2.green - color1.green) * (i - x) / (width - 1)
blue = color1.blue +
(color2.blue - color1.blue) * (i - x) / (width - 1)
alpha = color1.alpha +
(color2.alpha - color1.alpha) * (i - x) / (width - 1)
color = Color.new(red, green, blue, alpha)
fill_rect(i, y, 1, height, color)
end
elsif align == 1
for i in y...y + height
red = color1.red +
(color2.red - color1.red) * (i - y) / (height - 1)
green = color1.green +
(color2.green - color1.green) * (i - y) / (height - 1)
blue = color1.blue +
(color2.blue - color1.blue) * (i - y) / (height - 1)
alpha = color1.alpha +
(color2.alpha - color1.alpha) * (i - y) / (height - 1)
color = Color.new(red, green, blue, alpha)
fill_rect(x, i, width, 1, color)
end
elsif align == 2
for i in x...x + width
for j in y...y + height
red = color1.red + (color2.red - color1.red) *
((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
green = color1.green + (color2.green - color1.green) *
((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
blue = color1.blue + (color2.blue - color1.blue) *
((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
alpha = color1.alpha + (color2.alpha - color1.alpha) *
((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
color = Color.new(red, green, blue, alpha)
set_pixel(i, j, color)
end
end
elsif align == 3
for i in x...x + width
for j in y...y + height
red = color1.red + (color2.red - color1.red) *
((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
green = color1.green + (color2.green - color1.green) *
((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
blue = color1.blue + (color2.blue - color1.blue) *
((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
alpha = color1.alpha + (color2.alpha - color1.alpha) *
((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
color = Color.new(red, green, blue, alpha)
set_pixel(i, j, color)
end
end
end
end
end
Spoiler (cliquez pour afficher)
#==============================================================================
# ** COGWHEEL Plug 'n' Play Menu Bars (based on Syvkal's revisions)
#-------------------------------------------------------------------------------
# by DerVVulfman
# Version 1
# 06-13-06
#------------------------------------------------------------------------------
# This is a revision of Cogwheel's famous bargraph system, now set as an inser-
# table script to display bargraphs behind values in the menus.
#
# To prevent conflict with Cogwheel's RTAB system, two key definitions have been
# renamed: "gauge_rect" to "cw_gauge" & "gradation_rect" to "cw_grad_rect."
#
#
# Affected Systems: Main Menu
# Skill Menu
# Status Menu
# Hero Select Menu (for Items & Skills)
# Equipment Menu
# BattleStatus Menu
#
# The system uses a series of CONSTANTS that can be edited here. They control
# the basic gauge colors and the manner the gauge is filled:
# Gauge Border Colors
COG_COLOR1 = Color.new(0, 0, 0, 192) # Outer Border
COG_COLOR2 = Color.new(255, 255, 192, 192) # Inner Border
# Gauge Empty filler
COG_COLOR3 = Color.new(0, 0, 0, 192) # Half of Inner Shading
COG_COLOR4 = Color.new(64, 0, 0, 192) # Half of Inner Shading
# Alignment
COG_ALIGN1 = 1 # Type 1: (0: Left / 1: Center / 2: Right Justify)
COG_ALIGN2 = 2 # Type 2: (0: Upper / 1: Central / 2: Lower)
COG_ALIGN3 = 0 # FILL ALIGNMENT (0: Left Justify / 1: Right Justify)
# Gauge Settings
COG_GRADE1 = 1 # EMPTY gauge (0: Side / 1: Vertical / 2: Slanted)
COG_GRADE2 = 0 # FILLER gauge (0: Side / 1: Vertical / 2: Slanted)
#==============================================================================
# ** 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 EXP - numeric for calculations
#--------------------------------------------------------------------------
def now_exp
return @exp - @exp_list[@level]
end
#--------------------------------------------------------------------------
# * Get Next Level EXP - numeric for calculations
#--------------------------------------------------------------------------
def next_exp
return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
end
#--------------------------------------------------------------------------
# * End of Class
#--------------------------------------------------------------------------
end
#==============================================================================
# ** Window_Base
#------------------------------------------------------------------------------
# This class is for all in-game windows.
#==============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# * Draw EXP w/ Bars
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
#--------------------------------------------------------------------------
alias draw_actor_exp_original draw_actor_exp
def draw_actor_exp(actor, x, y, width = 204)
if actor.next_exp != 0
rate = actor.now_exp.to_f / actor.next_exp
else
rate = 1
end
# Calculate Bar Gradiation
if actor.next_exp != 0
rate = actor.now_exp.to_f / actor.next_exp
else
rate = 1
end
# Adjust Bar Color based on Gradiation
color1 = Color.new(80 * rate, 80 - 80 * rate ** 2, 80 - 80 * rate, 192)
color2 = Color.new(240 * rate, 240 - 240 * rate ** 2, 240 - 240 * rate, 192)
# Calculate Bar Width
if actor.next_exp != 0
exp = width * actor.now_exp / actor.next_exp
else
exp = width
end
# Draw Bar Graph
cw_gauge(x, y + 25, width, 10, exp, color1, color2)
# Call original EXP
draw_actor_exp_original(actor, x, y)
end
#--------------------------------------------------------------------------
# * Draw HP w/ Bars
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# width : draw spot width
#--------------------------------------------------------------------------
alias draw_actor_hp_original draw_actor_hp
def draw_actor_hp(actor, x, y, width = 144)
# Calculate Bar Gradiation
if actor.maxhp != 0
rate = actor.hp.to_f / actor.maxhp
else
rate = 0
end
# Adjust Bar Color based on Gradiation
color1 = Color.new(80 - 24 * rate, 80 * rate, 14 * rate, 192)
color2 = Color.new(240 - 72 * rate, 240 * rate, 62 * rate, 192)
# Calculate Bar Width
if actor.maxhp != 0
hp = width * actor.hp / actor.maxhp
else
hp = 0
end
# Draw Bar Graph
cw_gauge(x, y + 25, width, 10, hp, color1, color2)
# Call original HP
draw_actor_hp_original(actor, x, y, width)
end
#--------------------------------------------------------------------------
# * Draw SP w/ Bars
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# width : draw spot width
#--------------------------------------------------------------------------
alias draw_actor_sp_original draw_actor_sp
def draw_actor_sp(actor, x, y, width = 144)
# Calculate Bar Gradiation
if actor.maxsp != 0
rate = actor.sp.to_f / actor.maxsp
else
rate = 1
end
# Adjust Bar Color based on Gradiation
color1 = Color.new(14 * rate, 80 - 24 * rate, 80 * rate, 192)
color2 = Color.new(62 * rate, 240 - 72 * rate, 240 * rate, 192)
# Calculate Bar Width
if actor.maxsp != 0
sp = width * actor.sp / actor.maxsp
else
sp = width
end
# Draw Bar Graph
cw_gauge(x + width * 0 / 100, y + 25, width, 10, sp, color1, color2)
# Call original SP
draw_actor_sp_original(actor, x, y, width)
end
#--------------------------------------------------------------------------
# * Draw Parameter w/ Bars
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# type : parameter type (0-6)
#--------------------------------------------------------------------------
alias draw_actor_parameter_original draw_actor_parameter
def draw_actor_parameter(actor, x, y, type)
# Choose Color & Parameter Type
case type
when 0
e1 = actor.atk
c6 = Color.new(253, 53, 56, 192)
c5 = Color.new(242, 2, 6, 192)
when 1
e1 = actor.pdef
c6 = Color.new(238, 254, 124, 192)
c5 = Color.new(228, 253, 48, 192)
when 2
e1 = actor.mdef
c6 = Color.new(150, 37, 184, 192)
c5 = Color.new(170, 57, 204, 192)
when 3
e1 = actor.str
c6 = Color.new(253, 163, 33, 192)
c5 = Color.new(254, 209, 154, 192)
when 4
e1 = actor.dex
c6 = Color.new(255, 255, 255, 192)
c5 = Color.new(222, 222, 222, 192)
when 5
e1 = actor.agi
c6 = Color.new(124, 254, 155, 192)
c5 = Color.new(33, 253, 86, 192)
when 6
e1 = actor.int
c6 = Color.new(119, 203, 254, 192)
c5 = Color.new(8, 160, 253, 192)
end
# Calculate Bar Gradiation
e2 = 999
if e1.to_f != 0
rate = e1.to_f / e2.to_f
else
rate = 1
end
# Adjust Bar Color based on Gradiation & Parameter Type
for i in 0..7
r = c6.red * rate
g = (c6.green - 10) * rate
b = c6.blue * rate
a = c6.alpha
end
# Calculate Bar Width
width = 168
if e1.to_f != 0
par = width * e1.to_f / e2.to_f
else
par = width
end
# Draw Bar Graph
cw_gauge(x , y + 25, width, 7, par, c5, Color.new(r, g, b, a))
# Call Original Parameter
draw_actor_parameter_original(actor, x, y, type)
end
#--------------------------------------------------------------------------
# * Gauge Rectangle (New to Class)
#--------------------------------------------------------------------------
def cw_gauge(x, y, width, height, gauge, color1, color2)
# Use Cogwheel PRESETS
color3 = COG_COLOR1
color4 = COG_COLOR2
color5 = COG_COLOR3
color6 = COG_COLOR4
align1 = COG_ALIGN1
align2 = COG_ALIGN2
align3 = COG_ALIGN3
grade1 = COG_GRADE1
grade2 = COG_GRADE2
# Create Rectangle Width based on gauge max.
rect_width = width
case align1
when 1
x += (rect_width - width) / 2
when 2
x += rect_width - width
end
case align2
when 1
y -= height / 2
when 2
y -= height
end
self.contents.fill_rect(x, y, width, height, color3)
self.contents.fill_rect(x + 1, y + 1, width - 2, height - 2, color4)
if align3 == 0
if grade1 == 2
grade1 = 3
end
if grade2 == 2
grade2 = 3
end
end
if (align3 == 1 and grade1 == 0) or grade1 > 0
color = color5
color5 = color6
color6 = color
end
if (align3 == 1 and grade2 == 0) or grade2 > 0
color = color1
color1 = color2
color2 = color
end
self.contents.cw_grad_rect(x + 2, y + 2, width - 4, height - 4, color5, color6, grade1)
if align3 == 1
x += width - gauge
end
self.contents.cw_grad_rect(x + 2, y + 2, gauge - 4, height - 4, color1, color2, grade2)
end
#--------------------------------------------------------------------------
# * End of Class
#--------------------------------------------------------------------------
end
#==============================================================================
# ** Bitmap
#==============================================================================
class Bitmap
#--------------------------------------------------------------------------
# * Gradation Rectangle
#--------------------------------------------------------------------------
def cw_grad_rect(x, y, width, height, color3, color4, align = 0)
if align == 0
for i in x...x + width
red = color3.red + (color4.red - color3.red) * (i - x) / (width - 1)
green = color3.green +
(color4.green - color3.green) * (i - x) / (width - 1)
blue = color3.blue +
(color4.blue - color3.blue) * (i - x) / (width - 1)
alpha = color3.alpha +
(color4.alpha - color3.alpha) * (i - x) / (width - 1)
color = Color.new(red, green, blue, alpha)
fill_rect(i, y, 1, height, color)
end
elsif align == 1
for i in y...y + height
red = color3.red +
(color4.red - color3.red) * (i - y) / (height - 1)
green = color3.green +
(color4.green - color3.green) * (i - y) / (height - 1)
blue = color3.blue +
(color4.blue - color3.blue) * (i - y) / (height - 1)
alpha = color3.alpha +
(color4.alpha - color3.alpha) * (i - y) / (height - 1)
color = Color.new(red, green, blue, alpha)
fill_rect(x, i, width, 1, color)
end
elsif align == 2
for i in x...x + width
for j in y...y + height
red = color3.red + (color4.red - color3.red) *
((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
green = color3.green + (color4.green - color3.green) *
((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
blue = color3.blue + (color4.blue - color3.blue) *
((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
alpha = color3.alpha + (color4.alpha - color3.alpha) *
((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
color = Color.new(red, green, blue, alpha)
set_pixel(i, j, color)
end
end
elsif align == 3
for i in x...x + width
for j in y...y + height
red = color3.red + (color4.red - color3.red) *
((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
green = color3.green + (color4.green - color3.green) *
((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
blue = color3.blue + (color4.blue - color3.blue) *
((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
alpha = color3.alpha + (color4.alpha - color3.alpha) *
((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
color = Color.new(red, green, blue, alpha)
set_pixel(i, j, color)
end
end
end
end
#--------------------------------------------------------------------------
# * End of Class
#--------------------------------------------------------------------------
end
Merci aux amis scripteurs qui auront la gentillesse de se pencher sur mon cas, car je suis dé-ses-pé-ré...
|
Psaume 23:4 "Quand je marche dans la vallée de l'ombre de la mort, Je ne crains aucun mal, car Tu es avec moi." |
gif -
posté le 03/08/2020 à 16:16:52 (4782 messages postés)
- | Egotrip Gigamaxé | Salut ,
T'as essayé sur un projet vierge ?
Edit : ah zut j'avais pas vu que tu avais aussi le soucis avec la démo (t'as un lien ?).
|
Itch.io | Twitter | Une IA qui génère des sprites de Pokémon | Cochouchou à la coupe du monde ! | le concours hebdomadaire du meilleur screen ! |
Metatr0nicks -
posté le 03/08/2020 à 17:33:19 (20 messages postés)
| | gif a dit:
Salut ,
T'as essayé sur un projet vierge ?
Edit : ah zut j'avais pas vu que tu avais aussi le soucis avec la démo (t'as un lien ?).
|
Oui, je l'ai pris sur cette page : https://app.box.com/s/god9hc5pn7psjibsrgaj
|
Psaume 23:4 "Quand je marche dans la vallée de l'ombre de la mort, Je ne crains aucun mal, car Tu es avec moi." |
Mack -
posté le 03/08/2020 à 17:39:53 (2313 messages postés)
- | | En gros, le problème c'est que ton script s’exécute après un autre, qui à déjà fermé la fenêtre concerné.
( En regardant très très vite fait, je vois pas trop d'où ça viens, mais j'avoue m'y être penché que d'un quart d’œil )
J'ai un peu la flemme de vraiment regarder ( surtout que l'indentation avec les spoilers est ignoble, recopie / colle avec les balise code, histoire qu'elle soit correcte ), mais déjà, de ce que je vois, la fonction draw_actor_hp est réécrite dans les deux autres scripts que tu donnes, et j'avoue qu ça me parait bizarre.
Les deux autres script sont vraiment nécessaire ?
Envoie une démo de ton projet avec l'erreur, je verrais plus tard pour essayer de comprendre l'erreur.
Edit : Ah, bah, t'as déjà mis la démo, je vais m'y pencher de suite au final xD
Edit 2 :
Après avoir regarder un peu plus en détail, je comprend même pas comment ce script peut marcher Oo.
En gros le problème, c'est que le script Battle Report v 1.6 dispose ( efface si tu préfères ) les fenêtres de base, comme la fenêtre de statut, de message, d'aide ... Alors que toutes ces fenêtres sont de nouveau dispose dans le script Scene_Battle1 lors du changement de scène.
Chose qui fait tout bugguer puisque la fenêtre à déjà été dispose, et ne peut donc pas être à nouveau dispose.
Remplace ton script Battle Report v 1.6 par :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
| #==============================================================================
# ** Battle Report v 1.6 by Illustrationism
# * Posted & Edited by Raziel
#==============================================================================
# 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.
#==============================================================================
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
# Calculate Bar Gradiation
if max_bar != 0
rate = min_bar.to_f / max_bar
else
rate = 1
end
# Adjust Bar Color based on Gradiation
color1 = Color.new(14 * rate, 80 - 24 * rate, 80 * rate, 192)
color2 = Color.new(62 * rate, 240 - 72 * rate, 240 * rate, 192)
draw_width = 152 * min_bar.to_f / max_bar
# Draw Bar Graph
cw_gauge(115, 80, 152, 10, draw_width, 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 learn_skill(skill)
self.contents.font.color = normal_color
unless $d_new_skill == nil
Audio.se_play("Audio/SE/105-Heal01")
self.contents.draw_text(186, 24, 80, 32, "Learned:")
self.contents.font.color = system_color
self.contents.draw_text(261, 24, 90, 32, skill)
end
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
if @d_new_skill[i] != ""
@lvup_window[i].learn_skill(@d_new_skill[i])
end
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 |
Ça réglera le problème.
Par contre, je comprend même pas comment ce script aurait pu marcher, la seule option que je vois c'est qu'il manque un autre script qui changerait la fonction main du Scene_Battle en profondeur, mais en jetant vite fait un œil, c'est pas le cas.
Donc j'ai vraiment l'impression que ce script à été fait soit à l'arrache sans avoir été testé, soit dans un but plus précis, et qu'il te manque un script.
( Mais ma correction devrait marcher, même si c'est pas forcement parfait ).
|
( Je prend note de tout les commentaires, même si je n'y répond pas ) |
Metatr0nicks -
posté le 04/08/2020 à 16:51:41 (20 messages postés)
| | Super, merci beaucoup, ça marche nickel chrome à présent !
|
Psaume 23:4 "Quand je marche dans la vallée de l'ombre de la mort, Je ne crains aucun mal, car Tu es avec moi." |
Index du forum > Entraide > [RESOLU] [RMXP][RESOLU] Script entrainant erreur dans Window_Base
|
|
|