Hello
I'm searching for a way to have an enemy use a skill when it evade an attack (physical, magical or both).
I'd like a thief-like enemy boss using a laughter skill when evading an attack from an enemy, making it confused.
I thought to use Tsukihime's Battle reactions script but i didn't found a way to make it work with evasion.
Reaction when evading an attack
● ARCHIVED · READ-ONLY
-
-
I have hard coded this one, can you try if its working? I haven't tested this script yet:
SpoilerCode:SKILL_CAST = 10 # number of the skill id to be used when the enemy evadesclass Game_System attr_accessor :evade_react alias :soul_game_system_initialize :initialize #-------------------------------------------------------------------------- # * Display Evasion #-------------------------------------------------------------------------- def initialize soul_game_system_initialize @evade_react = false end end class Window_BattleLog < Window_Selectable alias :soul_display_evasion_evade_reaction :display_evasion #-------------------------------------------------------------------------- # * Display Evasion #-------------------------------------------------------------------------- def display_evasion(target, item) soul_display_evasion_evade_reaction if target.is_a?(Game_Enemy) @evade_react = true end endendclass Scene_Battle < Scene_Base #-------------------------------------------------------------------------- # * Alias Listings #-------------------------------------------------------------------------- alias :soul_end_state_auto_cast :turn_end #-------------------------------------------------------------------------- # * End Turn #-------------------------------------------------------------------------- def turn_end soul_end_state_auto_cast if @evade_react soul_state_auto_cast_skill(battler) @evade_react = false end end #-------------------------------------------------------------------------- # * State Auto Skill Force Action #-------------------------------------------------------------------------- def soul_state_auto_cast_skill(battler) last_subject = @subject @subject = battler action = Game_Action.new(battler) action.set_skill(SKILL_CAST) battler.actions.unshift(action) use_item battler.actions.shift @subject = last_subject end end -
Hello and thanks for the fast answer.
I made a quick test with a blank new project, adding your work as an independant script with a +100 evade slime.
When an enemy dodge, it raises an error :
"Script dodge script line 25 : ArgumentError occured
wrong number of arguments (0 for 2)"
i also noted that it work whenever an enemy, any enemy, dodges.
I think i can solve this using a skill replacement script and a blank skill thought. -
Can you try this? I seem to have left out the alias.
Code:SKILL_CAST = 10 # number of the skill id to be used when the enemy evadesclass Game_System attr_accessor :evade_react alias :soul_game_system_initialize :initialize #-------------------------------------------------------------------------- # * Display Evasion #-------------------------------------------------------------------------- def initialize soul_game_system_initialize @evade_react = false end end class Window_BattleLog < Window_Selectable alias :soul_display_evasion_evade_reaction :display_evasion #-------------------------------------------------------------------------- # * Display Evasion #-------------------------------------------------------------------------- def display_evasion(target, item) soul_display_evasion_evade_reaction(target, item) if target.is_a?(Game_Enemy) @evade_react = true end endendclass Scene_Battle < Scene_Base #-------------------------------------------------------------------------- # * Alias Listings #-------------------------------------------------------------------------- alias :soul_end_state_auto_cast :turn_end #-------------------------------------------------------------------------- # * End Turn #-------------------------------------------------------------------------- def turn_end soul_end_state_auto_cast if @evade_react soul_state_auto_cast_skill(battler) @evade_react = false end end #-------------------------------------------------------------------------- # * State Auto Skill Force Action #-------------------------------------------------------------------------- def soul_state_auto_cast_skill(battler) last_subject = @subject @subject = battler action = Game_Action.new(battler) action.set_skill(SKILL_CAST) battler.actions.unshift(action) use_item battler.actions.shift @subject = last_subject end end -
Hi.
This time no reaction at all.
I used the same setting as before.
The game doesn't crash but there is no use of skill nb 10 (or any skill at all)
Perhaps i didn't placed it at the right place?
I put it Under "materials" at the place of "insert here".
Since you said it was hard coded, do i need to replace a part of the core script? -
"An attack" --> any attack? or specifically the "attack" skill?
You can use Reaction Conditions to condition on whether the skill was evaded or not, however currently the script does not support reactions on "anything" (you'd have to specify either a skill, skill type, or element, which indeed is a limited selection) -
Hello.
If there is a way to make evading a condition for the reaction to trigger then i can try something.
For now i have only two skill groups for physical actions. So if i can set the same reaction three times (one for simple attack use, one for special skill group, one for stealth group).
Any idea about the formula to use as a condition though? (or where i could search for clues?)
I'd be grateful. -
You'd check the results of the action
Code:If that doesn't work, try `b` instead of `a`.a.result.evaded -
Hello.
I am sorry it didn't worked.
I wrote this down in the enemy box :
<skill reaction: 1 276>
<stype reaction : 1 276>
<stype reaction : 3 276>
<reaction condition : 1,2,3>
b.result.evaded
</reaction condition>
The enemy didn't reacted. I tried with "a" or "b" (event "t" and "p"), neither worked.
I tried the reaction without the condition and it worked all fine. So i guess it's part of the formula? -
Does this work in a new project?
I've had reports of some scripts actually clearing out all of the results before the reaction checks occur. -
Yes just did. And as you suspected it was a script incompatibility.
I guess the check for an evasion doesn't works with Victor's damage popup.
Without it the script works fine.
I'll try to find a way to replace victor's.
Thanks a lot! -
If the results are put somewhere else, you could see where it's being stored.
For example yanfly's battle system had this thing where the "hp_damage" is moved into "stored_hp_damage", and so devs just had to remember to point to the correct variable.s -
For now I replaced victor's script with one from atelier RGSS, since i already uses their battlehud.
It seems to work fine with your script. So with a few correction I think it'll be all right.
Thanks for your help!