Announcement
Announcement
| 2nd Quarter Contest Announcement posted! See the Community Announcements section. |
![]() ![]() |
Aug 12 2011, 11:02 AM
Post
#1
|
|
![]() ![]() Type: Writer Alignment: Lawful Good |
Greetings,
My game, which uses the standard battle system, relies heavily on a Cover skill script that allows a character to mimic the way the paladin Cecil in Final Fantasy IV can intercept enemies' attacks on behalf of another character. However, unlike the Final Fantasy Cover ability, this skill makes the character intercept all enemies' attacks and/or skills all the time. To use this script, a skill and a state must be made in the database. In the notebox of the state, you add "Protect." You make a protect skill to apply the state. Right now, the state can defend against all attacks and/or skills. I would like for it to defend against some skills, but not all. For instance, Dual Attack and Poison Attack, but not Paralysis Glare or Flame Breath. What I would most like to have done to the script -- and would very much appreciate the time and effort that would be put into doing so -- is to change the state so it would only function against a skill with a tag in its notebox, or vice verse. Also, if the character using the cover skill is paralyzed, stunned, confused, etc., he continues to cover his ally, which defies logic. It may be more complicated to implement, but I would also like to have an option to set the state to automatically be removed when the defending character is low on HP. Furthermore, it would be nice for any character who has this skill to automatically cover an ally with low HP. This is all of secondary importance, though. Or, if you just feel like writing your own script that accomplishes these goals, that would work as well. The script was written by Kal and updated by Ikono. Here is a link to the thread for the completed script: http://www.rpgmakervx.net/index.php?showtopic=29650&st=0 Here is Ikono's update of the script (NOTE: though it bares the same version number as Kal's script, it has been updated by Ikono so it is not the same version): CODE Protect Skill v 1.2.3 # by Kal # # ===== How to use ===== # # Make a state that has the magic word in it's note box. When that state # is inflicted on an ally, the person who inflicted the state (by casting # a spell that adds the state, for example) will receive all the damage # that is done to the ally. # # ===== What battle system is this for? ===== # # The script was designed for the default battle system but it's also works # with Tankentai (and ATB). However, there is no animation support for # Tankentai at the moment (i.e. protector jumping in front of protectee) and # the damage numbers need to be fixed. # # ===== Version history ===== # # 1.0 - Finished script # # 1.1 - Added message text configuration in the config module. # - Status effect will be removed immediately after the protector dies # - Fixed a bug where a dead protector would still protect under certain # circumstances. # - Fixed a bug where the protect message got drawn when it shouldn't. # # 1.2 - Added ability to increase/decrease the amount of damage a protector # takes when protecting. # # 1.2.1 - Fixed using items on protector bug with Tankentai + ATB. # # 1.2.2 - Fixed a bug where you could not cast the state again after a battle. # # 1.2.3 - Fixed a bug with Tankentai + ATB where the protect state would not # be removed when the protector died. module ProtectConfig MAGIC_WORD = "Protect" # Add this word in the "Note" box for any status in order to enable protect # for that status. PROTECT_PHYSICAL = true PROTECT_SKILLS = true # Set these to true/false to enable/disable protection from physical damage # and protection from skills damage. PROTECT_LIMIT = 1 # This is the number of allies one character can protect at the same time. DAMAGE_EFFECT = 100 # This is a percentage of damage the protector will take when protecting # an ally. For example, if this value is set to 50, the protector will take # half damage when protecting an ally. MP_DAMAGE_EFFECT = false # Should DAMAGE_EFFECT apply to MP damage? MESSAGE = lambda do |context| eval "protector.name + ' protected ' + target.name + '!'", context # Edit this line to change the message that is displayed when an actor # protects an ally. protector.name is the protector's name and # target.name is the protected ally's name. Any text you want to add # needs to be in single quote strings, as above. # Note: not working for Tankentai at the moment. end end class RPG::State attr_accessor :skill_user def protect? set_protect if @protect.nil? @protect end def set_protect if @note.downcase =~ /#{ProtectConfig::MAGIC_WORD.downcase}/ @protect = true else @protect = false end end end class Scene_Battle unless $@ alias :kal_old_display_action_effects :display_action_effects alias :kal_old_process_action :process_action end # NOTE: not being called at all with Tankentai and ATB. Fix? def display_action_effects(target, obj = nil) # If this is a physical attack (obj == nil) and PROTECT_PHYSICAL is false if !ProtectConfig::PROTECT_PHYSICAL and obj.nil? kal_old_display_action_effects(target, obj) # call original method and return return # If this is a skills attack and PROTECT_SKILLS is false elsif !ProtectConfig::PROTECT_SKILLS and obj kal_old_display_action_effects(target, obj) # call original method and return return end if target.protect? protector = target.states.find { |state| state.protect? }.skill_user protector.display_protect = true unless protector.dead? if protector != @active_battler and protector.display_protect protector.display_protect = false if protector.dead? text = ProtectConfig::MESSAGE.call(binding) @message_window.add_instant_text(text) wait(30) kal_old_display_action_effects(protector) return end end kal_old_display_action_effects(target, obj) end # Check if any protector is dead after an action has been processed. # If dead remove the state. def process_action kal_old_process_action $game_party.members.each do |member| member.states.each do |state| if state.protect? if state.skill_user.dead? state.skill_user.protected_allies = 0 member.remove_state(state.id) @status_window.refresh end end end end end end class Game_Battler attr_accessor :protected_allies, :display_protect, :protecting unless $@ alias :kal_old_initialize :initialize alias :kal_old_make_attack_damage_value :make_attack_damage_value alias :kal_old_add_state :add_state alias :kal_old_remove_state :remove_state alias :kal_old_skill_effect :skill_effect alias :kal_old_make_obj_damage_value :make_obj_damage_value end def initialize @protected_allies = 0 @display_protect = true @protecting = false kal_old_initialize end def make_attack_damage_value(attacker, effect = nil) kal_old_make_attack_damage_value(attacker) if ProtectConfig::PROTECT_PHYSICAL states.each do |state| if state.protect? and !state.skill_user.dead? @hp_damage = 0 state.skill_user.protecting = true state.skill_user.attack_effect(attacker) end end if @protecting @hp_damage *= (ProtectConfig::DAMAGE_EFFECT / 100) @protecting = false end end end def make_obj_damage_value(user, obj) kal_old_make_obj_damage_value(user, obj) if ProtectConfig::PROTECT_SKILLS and !$game_party.members.include?(user) states.each do |state| if state.protect? and !state.skill_user.dead? @hp_damage = 0 @mp_damage = 0 state.skill_user.protecting = true state.skill_user.skill_effect(user, obj) end end if @protecting @hp_damage *= (ProtectConfig::DAMAGE_EFFECT / 100) @mp_damage *= (ProtectConfig::DAMAGE_EFFECT / 100) if ProtectConfig::MP_DAMAGE_EFFECT @protecting = false end end end def add_state(state_id) state = $data_states[state_id] if state.protect? state.skill_user = @skill_user @skill_user.protected_allies += 1 end kal_old_add_state(state_id) end def remove_state(state_id) state = $data_states[state_id] if state.protect? state.skill_user = @skill_user @skill_user.protected_allies -= 1 end kal_old_remove_state(state_id) end def skill_effect(user, skill) @skill_user = user kal_old_skill_effect(user, skill) end def protect? states.any? {|state| state.protect?} end end class Game_Actor alias :kal_old_state_resist? :state_resist? unless $@ def state_resist?(state_id) # Prevent castng protect on self if @skill_user == self and $data_states[state_id].protect? @skill_user.protected_allies -= 1 return true # Prevent casting protect on a char that is already protected elsif protect? and $data_states[state_id].protect? @skill_user.protected_allies -= 1 return true # Prevent casting protect if the protect limit is reached elsif @skill_user.protected_allies >= ProtectConfig::PROTECT_LIMIT return true end kal_old_state_resist?(state_id) end end class Game_Party alias :kal_old_remove_states_battle :remove_states_battle unless $@ def remove_states_battle kal_old_remove_states_battle members.each do |actor| actor.protected_allies = 0 end end end Thanks for reading and for considering my request! Others are interested in this script as well. This post has been edited by Sharpe: Apr 11 2012, 04:36 AM -------------------- My first tutorial: Moving a Player Through a Door Using a Move Route
"I give thee now a chance to share this world and to rule half of it if thou will now stand beside me. "What sayest thou? "Will the great warrior stand with me?" --The Dragonlord, Dragon Warrior, 1989. |
|
|
|
Aug 12 2011, 12:09 PM
Post
#2
|
|
![]() ![]() Type: Undisclosed |
I would like very much the same thing though in a slightly alternative format.
I would like to see: <protectATK> and <protectSPI> tags that cover attacks that are made using the respective attack stat. I would also like them to not function when the Protector is say... Sleeping and to protect the target from Status effects. Again like our friend Sharpe I would like to restrict the protect ability to attacks that target One Enemy. Although the option of a <cover> tag that functioned much the same way except only with All Enemies targets and did not protect against status effects would also be greatly appreciated. For a truly professional Cover/Protect Script it might be nice to be able to set the likelihood of the protect function activating. ie. <protectATK 30%> This would help a game designer better keep game balance because as we all know a "broken" or "overpowered" Protect function is a quick way to take away much of the challenge to a game. If every time your HP are low the Tank is there to take the damage instead there's little or no chance for a knockout--especially if you have two or more Protectors in your party. I hope that will help make things simpler for anyone involved. -------------------- |
|
|
|
Aug 16 2011, 07:52 AM
Post
#3
|
|
![]() ![]() Type: Writer Alignment: Lawful Good |
To the top, please.
-------------------- My first tutorial: Moving a Player Through a Door Using a Move Route
"I give thee now a chance to share this world and to rule half of it if thou will now stand beside me. "What sayest thou? "Will the great warrior stand with me?" --The Dragonlord, Dragon Warrior, 1989. |
|
|
|
Aug 19 2011, 10:39 AM
Post
#4
|
|
![]() ![]() Type: Undisclosed |
Bump. =]
-------------------- |
|
|
|
Aug 25 2011, 04:36 PM
Post
#5
|
|
![]() ![]() Type: Writer Alignment: Lawful Good |
To the top, please.
-------------------- My first tutorial: Moving a Player Through a Door Using a Move Route
"I give thee now a chance to share this world and to rule half of it if thou will now stand beside me. "What sayest thou? "Will the great warrior stand with me?" --The Dragonlord, Dragon Warrior, 1989. |
|
|
|
Aug 29 2011, 07:57 AM
Post
#6
|
|
![]() ![]() Type: Writer Alignment: Lawful Good |
To the top, please.
-------------------- My first tutorial: Moving a Player Through a Door Using a Move Route
"I give thee now a chance to share this world and to rule half of it if thou will now stand beside me. "What sayest thou? "Will the great warrior stand with me?" --The Dragonlord, Dragon Warrior, 1989. |
|
|
|
Sep 5 2011, 07:23 PM
Post
#7
|
|
![]() ![]() Type: Writer Alignment: Lawful Good |
To the top, please.
-------------------- My first tutorial: Moving a Player Through a Door Using a Move Route
"I give thee now a chance to share this world and to rule half of it if thou will now stand beside me. "What sayest thou? "Will the great warrior stand with me?" --The Dragonlord, Dragon Warrior, 1989. |
|
|
|
Sep 5 2011, 08:48 PM
Post
#8
|
|
![]() ![]() Type: Undisclosed |
Stick in there Sharp!
Its not exactly the same but I've been using this. Ive been using this: (Have not play tested it yet!!!) Click to download. The idea is to make an Interupting/Guardian counter attack with a damage and ATK_F of 0 so it won't actually hurt the enemy but will stop their attack. This will mean that no one takes the damage instead of halving it but its the best thing I could find that comes close. It will only allow you to indiscriminately protect your party from attack but you're still stopping attacks. -------------------- |
|
|
|
Sep 5 2011, 10:06 PM
Post
#9
|
|
![]() I'm on fire 24/7 >:3 ![]() Type: Coder Alignment: Lawful Good |
IAmHim, I think I already mentioned [ code ](without the spaces) tags to you before, please use them. When you just post normal text like that, its format screws up.
That is a hefty chunk of code, so a spoiler probably won't hold a [ code ] tag that size. So, either attach a txt document, or use Pastebin. |
|
|
|
Sep 5 2011, 11:12 PM
Post
#10
|
|
![]() ![]() Type: Undisclosed |
IAmHim, I think I already mentioned [ code ](without the spaces) tags to you before, please use them. When you just post normal text like that, its format screws up. That is a hefty chunk of code, so a spoiler probably won't hold a [ code ] tag that size. So, either attach a txt document, or use Pastebin. Okay, ill fix it up now. I didnt think it messed up the code so long as I disabled the emoticons. -------------------- |
|
|
|
Sep 10 2011, 04:19 AM
Post
#11
|
|
![]() ![]() Type: Writer Alignment: Lawful Good |
To the top, please.
-------------------- My first tutorial: Moving a Player Through a Door Using a Move Route
"I give thee now a chance to share this world and to rule half of it if thou will now stand beside me. "What sayest thou? "Will the great warrior stand with me?" --The Dragonlord, Dragon Warrior, 1989. |
|
|
|
Sep 21 2011, 09:28 AM
Post
#12
|
|
![]() ![]() Type: Writer Alignment: Lawful Good |
To the top, please.
-------------------- My first tutorial: Moving a Player Through a Door Using a Move Route
"I give thee now a chance to share this world and to rule half of it if thou will now stand beside me. "What sayest thou? "Will the great warrior stand with me?" --The Dragonlord, Dragon Warrior, 1989. |
|
|
|
Sep 26 2011, 08:49 PM
Post
#13
|
|
![]() ![]() Type: Undisclosed |
It appears no one is interested, stick with it!
-------------------- |
|
|
|
Jan 4 2012, 06:37 PM
Post
#14
|
|
![]() ![]() Type: Writer Alignment: Lawful Good |
It's been nearly five months. I've learned both Python (and PyGame) and C# well enough to probably make a simple RPG from "scratch" if I could invest the time to do so.
Still haven't taken the time to learn anything about this version of Ruby or how to edit the script in it. In fact, I've practically forgotten how to use the RMVX program. But, I noticed the RMVX icon on this computer and it brought back fond memories of the world I created with it. So, I thought I would work a little more on my RMVX game while it pleases me. Someone with "snake" in their name said they would fix this script, but the script workshop thread was deleted (I guess) so I don't know if they ever did. I seriously doubt it. Anyways. Long-time bump. -------------------- My first tutorial: Moving a Player Through a Door Using a Move Route
"I give thee now a chance to share this world and to rule half of it if thou will now stand beside me. "What sayest thou? "Will the great warrior stand with me?" --The Dragonlord, Dragon Warrior, 1989. |
|
|
|
Jan 6 2012, 12:29 PM
Post
#15
|
|
![]() Check Lucretia Fuel on Youtube. It's awesome. ![]() Type: Musician Alignment: Unaligned |
I'm quite interested in this, too.
-------------------- |
|
|
|
Jan 13 2012, 09:17 AM
Post
#16
|
|
![]() ![]() Type: Writer Alignment: Lawful Good |
To the top, please.
-------------------- My first tutorial: Moving a Player Through a Door Using a Move Route
"I give thee now a chance to share this world and to rule half of it if thou will now stand beside me. "What sayest thou? "Will the great warrior stand with me?" --The Dragonlord, Dragon Warrior, 1989. |
|
|
|
Jan 19 2012, 02:09 PM
Post
#17
|
|
![]() ![]() Type: Writer Alignment: Lawful Good |
To the top, please.
-------------------- My first tutorial: Moving a Player Through a Door Using a Move Route
"I give thee now a chance to share this world and to rule half of it if thou will now stand beside me. "What sayest thou? "Will the great warrior stand with me?" --The Dragonlord, Dragon Warrior, 1989. |
|
|
|
Jan 24 2012, 11:02 AM
Post
#18
|
|
![]() ![]() Type: Writer Alignment: Lawful Good |
To the top, please.
-------------------- My first tutorial: Moving a Player Through a Door Using a Move Route
"I give thee now a chance to share this world and to rule half of it if thou will now stand beside me. "What sayest thou? "Will the great warrior stand with me?" --The Dragonlord, Dragon Warrior, 1989. |
|
|
|
Jan 26 2012, 01:03 PM
Post
#19
|
|
![]() ![]() Type: Writer Alignment: Lawful Good |
To the top, please.
-------------------- My first tutorial: Moving a Player Through a Door Using a Move Route
"I give thee now a chance to share this world and to rule half of it if thou will now stand beside me. "What sayest thou? "Will the great warrior stand with me?" --The Dragonlord, Dragon Warrior, 1989. |
|
|
|
Jan 28 2012, 07:14 PM
Post
#20
|
|
![]() ![]() Type: Writer Alignment: Lawful Good |
To the top, please.
-------------------- My first tutorial: Moving a Player Through a Door Using a Move Route
"I give thee now a chance to share this world and to rule half of it if thou will now stand beside me. "What sayest thou? "Will the great warrior stand with me?" --The Dragonlord, Dragon Warrior, 1989. |
|
|
|
![]() ![]() |
| Lo-Fi Version | Time is now: 19th May 2013 - 12:09 AM |
|
|