- Joined
- Mar 13, 2012
- Messages
- 330
- Reaction score
- 97
- First Language
- English
- Primarily Uses
- RMMZ
I'll be using this thread to compile script snippets I've posted in the VX Ace help section. These work automatically once pasted into the Materials section, and are only tested with the default scripts. For maximum compatibility, put these before any custom scripts you may be using.
Enemy Turn Count Fix
By default, enemy actions are determined at the start of the round but before the turn counter is increased. This means that any monster's turn-specific actions actually execute one turn late, so actions set to happen on round 1 won't happen until round 2.
A side effect of this script is that actions set to happen on turn 0 + 0 will not happen at all (though 0 + X actions will happen normally). According to the tooltip, this is the intended behavior in VX Ace.
Randomized Enemy Self-Targeting
By default, enemy actions set to target a member of their own group will always, without exception, target the last enemy in the list, making buffs and healing commands essentially worthless when given to groups of enemies. This patch implements an extra step to keep enemies from skipping target selection for ally actions.
Note that this does not implement any enemy AI, it only restores the random behavior found in earlier versions of RPG Maker.
Custom Font Junk Symbol Fix
By default, the draw_text_ex method handles specific non-printable characters, like line breaks, but does so in such a way as to leave non-printable junk characters behind. While the normal font draws those as blank spaces, any custom fonts used will render these junk characters as character-not-found glyphs. This adds an extra step to character processing to ensure that only printable characters are drawn to the screen.
I didn't really do anything that impressive with any of the above, so you don't need to credit me in your game. But thanks are nice.
Update: If you're using Yanfly's Core Engine Fixes with the Turn Count Fix above, put all snippets after the Core Engine and include this snippet, or the turn count will increment twice, breaking all your Battle Events.
Enemy Turn Count Fix
By default, enemy actions are determined at the start of the round but before the turn counter is increased. This means that any monster's turn-specific actions actually execute one turn late, so actions set to happen on round 1 won't happen until round 2.
Code:
module BattleManager
def self.input_start
if @phase != :input
@phase = :input
$game_troop.increase_turn
$game_party.make_actions
$game_troop.make_actions
clear_actor
end
return !@surprise && $game_party.inputable?
end
def self.turn_start
@phase = :turn
clear_actor
make_action_orders
end
end
Randomized Enemy Self-Targeting
By default, enemy actions set to target a member of their own group will always, without exception, target the last enemy in the list, making buffs and healing commands essentially worthless when given to groups of enemies. This patch implements an extra step to keep enemies from skipping target selection for ally actions.
Code:
class Game_Action
def targets_for_friends
if item.for_user?
[subject]
elsif item.for_dead_friend?
if item.for_one?
[friends_unit.smooth_dead_target(@target_index)]
else
friends_unit.dead_members
end
elsif item.for_friend?
if item.for_one?
if @target_index < 0
[friends_unit.random_target]
else
[friends_unit.smooth_target(@target_index)]
end
else
friends_unit.alive_members
end
end
end
end
Custom Font Junk Symbol Fix
By default, the draw_text_ex method handles specific non-printable characters, like line breaks, but does so in such a way as to leave non-printable junk characters behind. While the normal font draws those as blank spaces, any custom fonts used will render these junk characters as character-not-found glyphs. This adds an extra step to character processing to ensure that only printable characters are drawn to the screen.
Code:
class Window_Base
alias :process_normal_character_vxa :process_normal_character
def process_normal_character(c, pos)
return unless c >= ' '
process_normal_character_vxa(c, pos)
end
end
Update: If you're using Yanfly's Core Engine Fixes with the Turn Count Fix above, put all snippets after the Core Engine and include this snippet, or the turn count will increment twice, breaking all your Battle Events.
Code:
module BattleManager
class <<self
alias :this_is_how_you_alias_modules :turn_start
end
def self.turn_start
@performed_battlers = []
this_is_how_you_alias_modules
end
end
Last edited by a moderator: