Rhudra

Veteran
Veteran
Joined
Feb 2, 2013
Messages
30
Reaction score
3
First Language
French
Primarily Uses
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.
 

SoulPour777

Crownless King
Veteran
Joined
Aug 15, 2012
Messages
1,093
Reaction score
104
First Language
English
Primarily Uses
N/A
I have hard coded this one, can you try if its working? I haven't tested this script yet:

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    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 
 

Rhudra

Veteran
Veteran
Joined
Feb 2, 2013
Messages
30
Reaction score
3
First Language
French
Primarily Uses
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.
 

SoulPour777

Crownless King
Veteran
Joined
Aug 15, 2012
Messages
1,093
Reaction score
104
First Language
English
Primarily Uses
N/A
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
 

Rhudra

Veteran
Veteran
Joined
Feb 2, 2013
Messages
30
Reaction score
3
First Language
French
Primarily Uses
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?
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,889
First Language
English
"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)
 
Last edited by a moderator:

Rhudra

Veteran
Veteran
Joined
Feb 2, 2013
Messages
30
Reaction score
3
First Language
French
Primarily Uses
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.
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,889
First Language
English
You'd check the results of the action

Code:
a.result.evaded
If that doesn't work, try `b` instead of `a`.
 

Rhudra

Veteran
Veteran
Joined
Feb 2, 2013
Messages
30
Reaction score
3
First Language
French
Primarily Uses
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?
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,889
First Language
English
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.
 

Rhudra

Veteran
Veteran
Joined
Feb 2, 2013
Messages
30
Reaction score
3
First Language
French
Primarily Uses
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!
 
Last edited by a moderator:

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,889
First Language
English
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
 

Rhudra

Veteran
Veteran
Joined
Feb 2, 2013
Messages
30
Reaction score
3
First Language
French
Primarily Uses
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!
 

Latest Threads

Latest Posts

Latest Profile Posts

Got sick and had to take a few days off work in order to get tested and make sure it wasn't the big one. Felt a lot better today and thought to myself, "Hey now, I can't get tested until tomorrow anyway, I can get so much character art done today!"
....I watched Youtube and browsed this site for hours instead.
>.>
But at least I'm doing the art now! Yaaaaay.......
1638314262144.png
Didn't wanna spam the feed by posting Denzel's spritelayer separae, but I'm real happy with how this concept is coming along so wanted to share it, innit :D
EVXA wrote on Avery's profile.
Not sure how often you take time to play the games sent to you, but if you could give my game a shout & review on steam maybe that would be amazing, only if you like the game of course, I'd love to know which games have been your favorites over the years too.
I'm seeing my god daughter's school play next week. Being the mild agoraphobe I am this makes me nervous. Thus I had a dream that it was actually a plot by my best friend to take me clubbing at an establishment where it is customary to throw a harpoon at staff members to reward good service.
Praise be to the game make!

Forum statistics

Threads
117,090
Messages
1,104,485
Members
153,087
Latest member
Luphelia
Top