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
105
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
105
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,921
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,921
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,921
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,921
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 Profile Posts

Wanted to look through job ads and now I spent about an hour laughing about the website of a spiritual healer looking for a Marketing and IT guy. Call me oldfashioned, but I think that "healing of deceaseds" comes a little late.
Workin' hard! Wish I was hardly workin'...
One of these days, I will have no more errors.
The tutorial streak is going on, learn something about cave edits today!
(And possibly in a few days even more, stay tuned ;) )
Something is working in my game, and I have no idea how or why. It wasn't working yesterday. But it is now.
So we're just gonna...move on, and never, EVER, touch that passive again, lest it break.

Forum statistics

Threads
129,915
Messages
1,206,233
Members
171,111
Latest member
choupie
Top