I'm having difficult with parameters and whatnot, but I have a one-turn use item that I want to work like Detect or Protect in Pokemon games. But I'm not sure how to do that. Any help?
A state that protects from any damage at all?
RPG Maker VXAce Supportthe damage done depends on your damage formulas.
If you use only default damage formulas, you can prevent any damage by making the DEF parameter higher than the highest possible attack rating. Do that with a state that is removed by any damage, and have the item apply that state.
However every skill that ignores defence when calculating damage will also ignore that DEF-increase state.
So it all depends on how your skills work - there are several ways to make such a state depending on what you place in your skill's damage formulas.
If you use only default damage formulas, you can prevent any damage by making the DEF parameter higher than the highest possible attack rating. Do that with a state that is removed by any damage, and have the item apply that state.
However every skill that ignores defence when calculating damage will also ignore that DEF-increase state.
So it all depends on how your skills work - there are several ways to make such a state depending on what you place in your skill's damage formulas.
Use 100% PDR and MDR in your state. These two cut the respective damage type taken by a flat percentage. 25% PDR of 100 physical damage taken would become 75 damage only, etc. 100% will nullify it completely, even if attacks that ignore defense in formulas are involved.. If you want protection from states, then you'll have to add state-resist stuff as well.
It isn't that simple though. I learned this when using certain hit skills. Certain hit skills ignore MDR and PDR just as they ignore reflect. If the attacks have some sort of element, it's better to manually create the resist to all of the elements as well. MDR and PDR wont cover everything.
The following code should allow any state with the given notetag to completely ignore what is written in a skill's damage formula box. Or you can just do what CWells suggested and manually add every single defensive measure known to your game.
Edit: Threw in bypassing of state additions, should I go one step farther and do buffs?
Code:
#===============================================================================# Script: Null Damage State# Author: Selchar# Requestor: Koi#================================================================================beginThis script allows for bypassing the damage step completely(anything found in askill's damage formula box).#-------------------------------------------------------------------------------# State Notetag#-------------------------------------------------------------------------------The following notetag will nullify any and all damage(physical, magical,elemental, and certain hit) when added to a state.<null all damage state>=endmodule Selchar module State Null_State_Damage = 0 endend#===============================================================================# The script itself#===============================================================================class Game_Battler < Game_BattlerBase alias :sel_null_ads_mdv :make_damage_value def make_damage_value(user, item) null_all_damage_state ? @result.make_damage(Selchar::State::Null_State_Damage, item) : sel_null_ads_mdv(user, item) end alias :sel_null_ads_as :add_state def add_state(state_id) null_all_damage_state ? return : sel_null_ads_as(state_id) end def null_all_damage_state states.each do |i| return true if i.null_all_damage_state end return false endendclass RPG::State def null_all_damage_state @note =~ /<null[-_ ]?all[-_ ]?damage[-_ ]?state>/i ? @null_all_damage_state = true : @null_all_damage_state = false if @null_all_damage_state.nil? @null_all_damage_state endend
No no, it's working fine! Thank you so much!
This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.
Moderator note: This thread is being re-opened at the request of the OP.
Original thread: https://forums.rpgmakerweb.com/threads/a-state-that-protects-from-any-damage-at-all.21515/