[VX ACE] [YANFLY] TRYING TO UNDERSTAND THE SCRIPTS I USE.
Posts
Pages:
1
Hello, I am trying to understand Ruby, rgss3, and scripting for RPG Maker VX ACE in general. I'm looking over the code of ¥ Yanfly Engine Ace - Ace Battle Engine v1.22 and I am at a roadblock trying to figure out what a certain line does and am uncertain as to how to look it up in the help file.
in particular this:
It almost seems like that this line will reference either ATK_ANI_1 or atk ani 1 depending on what the scripter uses for that situation. There also seems to be a conversion to decimal and perhaps integer on this line that is multiplied to an array. Perhaps it is related to the enemy notetags mentioned above. "/<" and ">/" is what throwing me off the most.
Another question I have is more towards the classical ATB mod for this script. What line of code prevents it from crashing when an enemy kills off one of your characters while your trying to decide what action said character should take?
Is it perhaps here?
I would like to know in order to fix another script I found. On that subject, is there any pointers any of you can offer in regards to developing a mod/ modifying this battle engine.
Thanks for any help and I hope I was able to make sense.
ATK_ANI1 = /<(?:ATK_ANI_1|atk ani 1):[ ]*(\d+)>/i
in particular this:
/<(?:ATK_ANI_1|atk ani 1):[ ]*(\d+)>/i
It almost seems like that this line will reference either ATK_ANI_1 or atk ani 1 depending on what the scripter uses for that situation. There also seems to be a conversion to decimal and perhaps integer on this line that is multiplied to an array. Perhaps it is related to the enemy notetags mentioned above. "/<" and ">/" is what throwing me off the most.
Another question I have is more towards the classical ATB mod for this script. What line of code prevents it from crashing when an enemy kills off one of your characters while your trying to decide what action said character should take?
Is it perhaps here?
#--------------------------------------------------------------------------
# rewrite method: perform_collapse_check
#--------------------------------------------------------------------------
def perform_collapse_check(target)
return if YEA::BATTLE::MSG_ADDED_STATES
if $game_troop.all_dead? || $game_party.all_dead?
if @actor_window.active || @enemy_window.active
@bug_fix1 = true
@help_window.hide
@actor_window.hide.deactivate
@enemy_window.hide.deactivate
end
@actor_command_window.hide.deactivate
@party_command_window.hide.deactivate
@skill_window.hide.deactivate
@item_window.hide.deactivate
move_info_viewport(64)
end
target.perform_collapse_effect if target.can_collapse?
@log_window.wait
end]
I would like to know in order to fix another script I found. On that subject, is there any pointers any of you can offer in regards to developing a mod/ modifying this battle engine.
Thanks for any help and I hope I was able to make sense.
/<(?:ATK_ANI_1|atk ani 1):[ ]*(\d+)>/i
Is what you call a regex which are commonly used for note tags.
I'll try to break it into parts for you, but I don't know much on them so they'll be my best guess.
/
starts the regex
<(?:ATK_ANI_1|atk ani 1):
begins grabbing the text, which is <ATK_ANI_1: or <atk ani 1:, it's not case sensitive since it checks for cap and lower case version, so can be <Atk_Ani_1:
[]*(\d+)
I'm not sure the is for I'd need to look at how a note tag is set up, could be to split the next part into an array. The * is to start storing the values, or something like that. (\d+) is any digit, 1 or more. Guessing this line would be the same as (\d*) unless that is storing it into arrays.
>
Just the last ending clip so <ATK_ANI_1: 0+ >
/i
Ends the regex and puts the values (*) inside $1
so <ATK_ANI_1: 0> would make $1 = 0, when you check that regex
As for the second part, that snippet is checking if all the enemies are dead of if all the actors are dead and if they are to deactivate all the windows, and hide them. Idk where you would find the line you're looking for since i've never looked at any of his scripts. But normally there's a
return if actor.dead?
or something similar at the beginning of an action def.
Attack animation one perhaps. You should check your database to see your animations.
PS- Are you using Fomar's ATB Script with this?
Actually, I'm using Yami's ATB script.
http://rpgmaker.net/scripts/174/
I must clarify, the ATB script is working fine, I'm just trying to look over it to see how it handles having a character killed off in active mode while the player is in the process of selecting his/her command. There was a bug I discovered in a Earthbound odometer script by cozziekuns ( http://rmrk.net/index.php/topic,47693.0.html )that caused the game to crash while the player selecting a command for a character that has 0 hp.
Anyway thanks for the reply, I'll probably be back to ask some other question.
http://rpgmaker.net/scripts/174/
I must clarify, the ATB script is working fine, I'm just trying to look over it to see how it handles having a character killed off in active mode while the player is in the process of selecting his/her command. There was a bug I discovered in a Earthbound odometer script by cozziekuns ( http://rmrk.net/index.php/topic,47693.0.html )that caused the game to crash while the player selecting a command for a character that has 0 hp.
Anyway thanks for the reply, I'll probably be back to ask some other question.
I think I remember running into a bug where the character would die, but you would have to wait until your next turn for the death state to take effect (I think I was using Yanfly and Fomar.) You should also test out if enemies can escape.
Another option that might work... possibly... Change the order the scripts are listed in your materials. I'm currently running Yanfly battle script and Yami symphony and they need to be ordered correctly to work.
I've recently been trying to modify http://rmrk.net/index.php/topic,47693.0.html (cozziekuns Earthbound odometer script) script to work for Yanfly Engine Ace battle engine 1.22 and I'm having a problem.
https://www.youtube.com/watch?v=L3OiG_rCaH0&feature=youtu.be
1.) When the odometer drain is executed the hp/mp/face bar seems to want to refresh to vanilla format as opposed to Yanfly format. I think that the issue rest in this definition here.
def refresh_hpmp(actor, index)
rect = item_rect(index)
if gauge_area_rect(index) == item_rect(index)
rect.y += line_height * 2
rect.height -= line_height * 2
contents.clear_rect(rect)
else
contents.clear_rect(gauge_area_rect(index))
end
draw_gauge_area(gauge_area_rect(index), actor)
end
perhaps some elements from the draw item definition in the Window_BattleStatus class in Yanfly is key, but what to use there and how I'm uncertain.
def draw_item(index)
return if index.nil?
clear_item(index)
actor = battle_members
rect = item_rect(index)
return if actor.nil?
draw_actor_face(actor, rect.x+2, rect.y+2, actor.alive?)
draw_actor_name(actor, rect.x, rect.y, rect.width-8)
draw_actor_action(actor, rect.x, rect.y)
draw_actor_icons(actor, rect.x, line_height*1, rect.width)
gx = YEA::BATTLE::BATTLESTATUS_HPGAUGE_Y_PLUS
contents.font.size = YEA::BATTLE::BATTLESTATUS_TEXT_FONT_SIZE
draw_actor_hp(actor, rect.x+2, line_height*2+gx, rect.width-4)
if draw_tp?(actor) && draw_mp?(actor)
dw = rect.width/2-2
dw += 1 if $imported && YEA::CORE::GAUGE_OUTLINE
draw_actor_tp(actor, rect.x+2, line_height*3, dw)
dw = rect.width - rect.width/2 - 2
draw_actor_mp(actor, rect.x+rect.width/2, line_height*3, dw)
elsif draw_tp?(actor) && !draw_mp?(actor)
draw_actor_tp(actor, rect.x+2, line_height*3, rect.width-4)
else
draw_actor_mp(actor, rect.x+2, line_height*3, rect.width-4)
end
end
2.) I can still select commands for a character who just died, fortunately this does not produce a crash unlike what happens when the script is used by itself. Is there any suggestions as to how to make the cursor automatically switch to the next character when this happens?
3.) There seems to be a bug that has been documented by other users regarding when there is more that two members, the person last standing seems not to take any damage.
This is the full Earthbound Odometer script that I'm using with my own modifications. Any suggestions is appreciated.
https://www.youtube.com/watch?v=L3OiG_rCaH0&feature=youtu.be
1.) When the odometer drain is executed the hp/mp/face bar seems to want to refresh to vanilla format as opposed to Yanfly format. I think that the issue rest in this definition here.
def refresh_hpmp(actor, index)
rect = item_rect(index)
if gauge_area_rect(index) == item_rect(index)
rect.y += line_height * 2
rect.height -= line_height * 2
contents.clear_rect(rect)
else
contents.clear_rect(gauge_area_rect(index))
end
draw_gauge_area(gauge_area_rect(index), actor)
end
perhaps some elements from the draw item definition in the Window_BattleStatus class in Yanfly is key, but what to use there and how I'm uncertain.
def draw_item(index)
return if index.nil?
clear_item(index)
actor = battle_members
rect = item_rect(index)
return if actor.nil?
draw_actor_face(actor, rect.x+2, rect.y+2, actor.alive?)
draw_actor_name(actor, rect.x, rect.y, rect.width-8)
draw_actor_action(actor, rect.x, rect.y)
draw_actor_icons(actor, rect.x, line_height*1, rect.width)
gx = YEA::BATTLE::BATTLESTATUS_HPGAUGE_Y_PLUS
contents.font.size = YEA::BATTLE::BATTLESTATUS_TEXT_FONT_SIZE
draw_actor_hp(actor, rect.x+2, line_height*2+gx, rect.width-4)
if draw_tp?(actor) && draw_mp?(actor)
dw = rect.width/2-2
dw += 1 if $imported && YEA::CORE::GAUGE_OUTLINE
draw_actor_tp(actor, rect.x+2, line_height*3, dw)
dw = rect.width - rect.width/2 - 2
draw_actor_mp(actor, rect.x+rect.width/2, line_height*3, dw)
elsif draw_tp?(actor) && !draw_mp?(actor)
draw_actor_tp(actor, rect.x+2, line_height*3, rect.width-4)
else
draw_actor_mp(actor, rect.x+2, line_height*3, rect.width-4)
end
end
2.) I can still select commands for a character who just died, fortunately this does not produce a crash unlike what happens when the script is used by itself. Is there any suggestions as to how to make the cursor automatically switch to the next character when this happens?
3.) There seems to be a bug that has been documented by other users regarding when there is more that two members, the person last standing seems not to take any damage.
This is the full Earthbound Odometer script that I'm using with my own modifications. Any suggestions is appreciated.
#==============================================================================
# ** Earthbound-Ish Odometer Roll
#------------------------------------------------------------------------------
# Version: 1.0
# Author: cozziekuns
# Date: February 17, 2013
#==============================================================================
# Description:
#------------------------------------------------------------------------------
# This script attempts to emulate the battle system of the Earthbound/Mother
# series; most notably Earthbound and Earthbound 2 (Mother 2 and 3). This
# certain addon addresses the infamous HP/MP scrolling system that made battles
# that much more intense.
#==============================================================================
# Instructions:
#------------------------------------------------------------------------------
# Paste this script into its own slot in the Script Editor, above Main but
# below Materials. Edit the modules to your liking.
#==============================================================================
# Graphics:
#------------------------------------------------------------------------------
# You must have two Odometer pictures in your Graphics/System folder. One of
# them must be named "Odometer_HP", and the other one must be named
# "Odometer_MP". Obviously, they represent the odometer for HP and MP values,
# respectively
#==============================================================================
#
#==============================================================================
# ** Cozziekuns
#==============================================================================
module Cozziekuns
module Earthboundish
Odometer_Roll_Speed = 4 # Smaller speeds are faster than larger speeds.
end
end
include Cozziekuns
#==============================================================================
# ** Game_Actor
#==============================================================================
class Game_Actor
attr_accessor :odometer_hp
attr_accessor :odometer_mp
alias coz_ebisohd_gmactr_setup setup
def setup(actor_id, *args)
coz_ebisohd_gmactr_setup(actor_id, *args)
@odometer_hp = 0
@odometer_mp = 0
end
alias coz_ebishod_gmactr_execute_damage execute_damage
def execute_damage(user, *args)
if $game_party.in_battle
on_damage(@result.hp_damage) if @result.hp_damage > 0
@odometer_hp += @result.hp_damage
@odometer_mp += @result.mp_damage
user.hp += @result.hp_drain
user.mp += @result.mp_drain
else
coz_ebishod_gmactr_execute_damage(user, *args)
end
make_damage_popups(user)
end
.each { |stat|
alias_method("coz_ebishod_gmactr_item_effect_recover_#{stat}".to_sym, "item_effect_recover_#{stat}".to_sym)
define_method("item_effect_recover_#{stat}".to_sym) { |user, item, effect|
if $game_party.in_battle
value = (send("m#{stat}".to_sym) * effect.value1 + effect.value2) * rec
value *= user.pha if item.is_a?(RPG::Item)
value = value.to_i
@result.send("#{stat}_damage=".to_sym, @result.send("#{stat}_damage".to_sym) - value)
@result.success = true
send("odometer_#{stat}=".to_sym, send("odometer_#{stat}".to_sym) - value)
else
send("coz_ebishod_gmactr_item_effect_recover_#{stat}".to_sym, user, item, effect)
end
}
}
end
#==============================================================================
# ** Window_BattleStatus
#==============================================================================
class Window_BattleStatus
# ** Earthbound-Ish Odometer Roll
#------------------------------------------------------------------------------
# Version: 1.0
# Author: cozziekuns
# Date: February 17, 2013
#==============================================================================
# Description:
#------------------------------------------------------------------------------
# This script attempts to emulate the battle system of the Earthbound/Mother
# series; most notably Earthbound and Earthbound 2 (Mother 2 and 3). This
# certain addon addresses the infamous HP/MP scrolling system that made battles
# that much more intense.
#==============================================================================
# Instructions:
#------------------------------------------------------------------------------
# Paste this script into its own slot in the Script Editor, above Main but
# below Materials. Edit the modules to your liking.
#==============================================================================
# Graphics:
#------------------------------------------------------------------------------
# You must have two Odometer pictures in your Graphics/System folder. One of
# them must be named "Odometer_HP", and the other one must be named
# "Odometer_MP". Obviously, they represent the odometer for HP and MP values,
# respectively
#==============================================================================
#
#==============================================================================
# ** Cozziekuns
#==============================================================================
module Cozziekuns
module Earthboundish
Odometer_Roll_Speed = 4 # Smaller speeds are faster than larger speeds.
end
end
include Cozziekuns
#==============================================================================
# ** Game_Actor
#==============================================================================
class Game_Actor
attr_accessor :odometer_hp
attr_accessor :odometer_mp
alias coz_ebisohd_gmactr_setup setup
def setup(actor_id, *args)
coz_ebisohd_gmactr_setup(actor_id, *args)
@odometer_hp = 0
@odometer_mp = 0
end
alias coz_ebishod_gmactr_execute_damage execute_damage
def execute_damage(user, *args)
if $game_party.in_battle
on_damage(@result.hp_damage) if @result.hp_damage > 0
@odometer_hp += @result.hp_damage
@odometer_mp += @result.mp_damage
user.hp += @result.hp_drain
user.mp += @result.mp_drain
else
coz_ebishod_gmactr_execute_damage(user, *args)
end
make_damage_popups(user)
end
.each { |stat|
alias_method("coz_ebishod_gmactr_item_effect_recover_#{stat}".to_sym, "item_effect_recover_#{stat}".to_sym)
define_method("item_effect_recover_#{stat}".to_sym) { |user, item, effect|
if $game_party.in_battle
value = (send("m#{stat}".to_sym) * effect.value1 + effect.value2) * rec
value *= user.pha if item.is_a?(RPG::Item)
value = value.to_i
@result.send("#{stat}_damage=".to_sym, @result.send("#{stat}_damage".to_sym) - value)
@result.success = true
send("odometer_#{stat}=".to_sym, send("odometer_#{stat}".to_sym) - value)
else
send("coz_ebishod_gmactr_item_effect_recover_#{stat}".to_sym, user, item, effect)
end
}
}
end
#==============================================================================
# ** Window_BattleStatus
#==============================================================================
class Window_BattleStatus
Pages:
1













