Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #===============================================================================
- # * [ACE] Add/Remove State Battle Log Addon for the Damage Formula Box
- #===============================================================================
- # * Made by: Sixth (www.rpgmakervxace.net, www.forums.rpgmakerweb.com)
- # * Version: 1.0
- # * Updated: 16/04/2016
- # * Requires: ----------
- #-------------------------------------------------------------------------------
- # * < Change Log >
- #-------------------------------------------------------------------------------
- # * Version 1.0 (16/04/2016)
- # - Initial release.
- #-------------------------------------------------------------------------------
- # * < Description >
- #-------------------------------------------------------------------------------
- # * By default, when you enter "a.add_state(ID)" or "b.remove_state(ID)" in the
- # damage formula, the log window in battle will not display the state changes
- # done by these. This script adds 2 new script calls usable in the damage
- # formula box for adding/removing states with the addition of showing the
- # relevant battle logs for them whenever you want to show them.
- #-------------------------------------------------------------------------------
- # * < Script Calls >
- #-------------------------------------------------------------------------------
- # * You can use the following script calls in the damage formula:
- #
- # target.add_state_with_log(state_id,chance) # For adding states
- # target.rem_state_with_log(state_id,chance) # For removing state
- #
- # The 'target' can be either 'a' (for the attacker) or 'b' (for the target).
- #
- # The state_id is the ID of the state you want to add/remove.
- #
- # The chance is the chance of success for the operation in percentages.
- # 1 means 1%, 20 means 20%, 100 means 100%, and so on.
- # This argument is optional. If you omit it, 100 will be used by default,
- # which means that it will be executed always (100%).
- #
- # Examples:
- #
- # b.add_state_with_log(2,25)
- # This adds state 2 (Poison by default) on the target with a 25% success
- # chance. Depending on the result of this action (state is inflicted or not),
- # a different battle log can be shown (if you set up different texts for
- # the different outcomes, at least).
- # If the state is inflicted, it will use the default state messages from the
- # database, which means that the target's name will be displayed along with
- # the 1st (if the target was an actor) or 2nd (if the target was an enemy)
- # state message from the database.
- # If the state did not get applied, it will use the texts set up in this
- # script. If a state do not has a text set up in this script for failure,
- # nothing will show up in the battle log.
- # When I say target, I don't mean the target of the skill itself, but the
- # target of this script call! Remember, the target of this script call is
- # controlled by the target options available in the damage formula box!
- #
- # a.remove_state_with_log(3,50)
- # This will remove state 3 (Blind by default) from the target with a 50%
- # success chance.
- # Other than removing a state instead of adding it, it acts the same way like
- # the other script call for adding a state. It shows a different battle log
- # message depending on the outcome of the script call.
- #-------------------------------------------------------------------------------
- # * < Installation >
- #-------------------------------------------------------------------------------
- # * Place this script between Materials and Main!
- #-------------------------------------------------------------------------------
- # * < Compatibility Info >
- #-------------------------------------------------------------------------------
- # * No known compatibility issues.
- #-------------------------------------------------------------------------------
- # * < Known Issues >
- #-------------------------------------------------------------------------------
- # * No known issues so far.
- #-------------------------------------------------------------------------------
- # * < Terms of Use >
- #-------------------------------------------------------------------------------
- # * Free to use for whatever purposes you want.
- # * Credit me (Sixth) in your game, pretty please! :P
- # * Posting modified versions of this script is allowed as long as you notice me
- # about it with a link to it!
- #===============================================================================
- $imported = {} if $imported.nil?
- $imported["SixthLogWinAddonStates"] = true
- #===============================================================================
- # Settings:
- #===============================================================================
- module CustomBattleLogs
- #-----------------------------------------------------------------------------
- # State Change Fail Battle Log Settings:
- #-----------------------------------------------------------------------------
- # When a state infliction/removal fails because of a success chance check
- # failure, you can show up a custom text for each states if you set up some
- # texts for them here.
- #
- # All of these settings are optional!
- # If you don't want any battle log showing up for a failed state change
- # attempt, you simply don't need to add any settings for them here.
- # If you only want to show a text when the target was an actor/enemy, you
- # just add a setting for actor/enemy and can omit the other.
- # If you only want a text when the user failed to inflict a state on the
- # target but not when the state failed to cure the target from the state,
- # you just add a setting for state addition and omit the removal text setting.
- # So, everything is optional!
- #
- # Format:
- #
- # state_id => {
- # :actor => { # Texts showing when the target is an actor
- # :add => "state infliction failure text",
- # :rem => "state removal failure text",
- # },
- # :enemy => { # Texts showing when the target is an enemy
- # :add => "state infliction failure text",
- # :rem => "state removal failure text",
- # },
- # },
- #
- # The format above kinda tells what these do, but if you are not sure, check
- # the sample settings.
- #
- # If you don't want to use these battle logs at all, feel free to remove the
- # sample settings, but do NOT delete the hash itself!
- # So, leave it like this:
- # FailLogs = {}
- # That must be here!
- #-----------------------------------------------------------------------------
- FailLogs = {
- 2 => { # Poison
- :actor => { # Texts showing when the target is an actor
- :add => " resisted the poison!",
- :rem => " could not be cured from poison!",
- },
- :enemy => { # Texts showing when the target is an enemy
- :add => " resisted the poison!",
- :rem => " could not be cured from poison!",
- },
- },
- 3 => { # Blind
- :actor => { # Texts showing when the target is an actor
- :add => " did not became blind!",
- },
- :enemy => { # Texts showing when the target is an enemy
- :rem => " still can't see anything!",
- },
- },
- # Add more settings here if needed!
- }
- end
- #===============================================================================
- # End of Settings! Editing anything below may lead to... You know what, right?
- #===============================================================================
- class Scene_Battle < Scene_Base
- attr_accessor :log_window
- end
- class Game_Battler < Game_BattlerBase
- def add_state_with_log(state_id,chance=100)
- success = rand(100)
- skip_txt = true if state?(state_id)
- if success < chance
- add_state(state_id)
- txt = get_added_state_txt(state_id,true)
- else
- txt = get_added_state_txt(state_id,false)
- end
- return if skip_txt
- if SceneManager.scene_is?(Scene_Battle) && txt[1] && !txt[1].empty?
- SceneManager.scene.log_window.add_text(txt[0] + txt[1])
- SceneManager.scene.log_window.wait
- SceneManager.scene.log_window.wait_for_effect
- end
- end
- def rem_state_with_log(state_id,chance=100)
- return if !state?(state_id)
- success = rand(100)
- if success < chance
- remove_state(state_id)
- txt = get_removed_state_txt(state_id,true)
- else
- txt = get_removed_state_txt(state_id,false)
- end
- if SceneManager.scene_is?(Scene_Battle) && txt[1] && !txt[1].empty?
- SceneManager.scene.log_window.add_text(txt[0] + txt[1])
- SceneManager.scene.log_window.wait
- SceneManager.scene.log_window.wait_for_effect
- end
- end
- def get_added_state_txt(state_id,success=true)
- if success
- if self.is_a?(Game_Actor)
- txt = [actor.name,$data_states[state_id].message1]
- else
- txt = [enemy.name,$data_states[state_id].message2]
- end
- else
- return ["",""] unless CustomBattleLogs::FailLogs[state_id]
- if self.is_a?(Game_Actor)
- return ["",""] unless CustomBattleLogs::FailLogs[state_id][:actor]
- txt = [actor.name,CustomBattleLogs::FailLogs[state_id][:actor][:add]]
- else
- return ["",""] unless CustomBattleLogs::FailLogs[state_id][:enemy]
- txt = [enemy.name,CustomBattleLogs::FailLogs[state_id][:enemy][:add]]
- end
- end
- end
- def get_removed_state_txt(state_id,success=true)
- if success
- if self.is_a?(Game_Actor)
- txt = [actor.name,$data_states[state_id].message4]
- else
- txt = [enemy.name,$data_states[state_id].message4]
- end
- else
- return ["",""] unless CustomBattleLogs::FailLogs[state_id]
- if self.is_a?(Game_Actor)
- return ["",""] unless CustomBattleLogs::FailLogs[state_id][:actor]
- txt = [actor.name,CustomBattleLogs::FailLogs[state_id][:actor][:rem]]
- else
- return ["",""] unless CustomBattleLogs::FailLogs[state_id][:enemy]
- txt = [enemy.name,CustomBattleLogs::FailLogs[state_id][:enemy][:rem]]
- end
- end
- end
- end
- #==============================================================================
- # !!END OF SCRIPT - OHH, NOES!!
- #==============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement