Battle Reactions

Discussion in 'RGSS3 Scripts (RMVX Ace)' started by Tsukihime, Sep 18, 2013.

  1. Tsukihime

    Tsukihime Veteran Veteran

    Messages:
    8,230
    Likes Received:
    3,062
    Location:
    Toronto
    First Language:
    English
    This script provides functionality for setting up "battle reactions", which are actions that are automatically invoked in response to certain actions. A reaction is similar to a counter-attack, except instead of responding to any attack, it only responds to specific "reaction triggers" and responds with an appropriate "reaction response".


    For example, your actor might have a shield that casts "heal" on the wearer whenever the wearer is targeted by the "attack" skill. The reaction trigger is the "attack" skill, while the reaction response is to cast heal.


    You can have multiple reactions occur simultaneously and all of them will be executed.


    [​IMG]


    Download


    Get it at Hime Works!
     
    Last edited by a moderator: Feb 19, 2014
    #1
    RocketKnight, BCj, Darkanine and 4 others like this.
  2. ShinGamix

    ShinGamix DS Style 4Ever! Veteran

    Messages:
    3,906
    Likes Received:
    448
    Location:
    Alien Ship
    First Language:
    April Fools
    Primarily Uses:
    N/A
    This could have some cool uses to add to the enemy A.I.!
     
    #2
    Oriceles likes this.
  3. Engr. Adiktuzmiko

    Engr. Adiktuzmiko Chemical Engineer, Game Developer, Using BlinkBoy' Veteran

    Messages:
    14,548
    Likes Received:
    2,901
    Location:
    Philippines
    First Language:
    Tagalog
    can you add  the functionality to react to a certain skill type or react to all skills?
     
    #3
  4. Tsukihime

    Tsukihime Veteran Veteran

    Messages:
    8,230
    Likes Received:
    3,062
    Location:
    Toronto
    First Language:
    English
    Sort of backlogged on actual features because people have been saying that victor's battle system is not compatible and I haven't been able to figure out how to deal with it.


    Unfortunately it doesn't like the way I'm using "force action"
     
    Last edited by a moderator: Sep 21, 2013
    #4
  5. Lowell

    Lowell The Walking Atelier Veteran

    Messages:
    292
    Likes Received:
    68
    First Language:
    English
    Victors Scripts from what I understand rewrite a lot of things in his basic module, which breaks compatibility with other scripts.

    As far as I know it's like making compatibility patches for Takentai.
     
    #5
    Oriceles likes this.
  6. Tsukihime

    Tsukihime Veteran Veteran

    Messages:
    8,230
    Likes Received:
    3,062
    Location:
    Toronto
    First Language:
    English
    I've implemented two new types of reaction triggers:

    1. Skill Type Reaction Triggers

    2. Element Reaction Triggers

    Usage is similar to the skill reactions

    <stype reaction: stype_id react_id chance forced><element reaction: element_id react_id chance forced>Both reactions respond with skills, so the react_id is the ID of the skill to respond with.They are self-explanatory: when an attacker uses a skill with the specified skill type or element type, the reaction will respond.

    You don't want to react to "all skills" because that would mean even when you "guard" it will react.

    Currently, all of the reaction types are skills.

    I am looking into generalizing it to items, commands, events, and other things.

    Unfortunately, those reactions will use an extended note-tag that looks like this

    <battle reaction>trigger_type: stypetrigger_id: 2react_type: itemreact_id: 1</battle reaction>Where you literally set up every detail of the reaction.However there is much more flexibility when you do that, as opposed to using the pre-defined reaction triggers (skill, stype, element) which are hardcoded to use a skill in response.
     
    Last edited by a moderator: Sep 22, 2013
    #6
  7. Lowell

    Lowell The Walking Atelier Veteran

    Messages:
    292
    Likes Received:
    68
    First Language:
    English
    you can generally scratch out commands since commands are skills in ace, on another note, the only other thing I'd recommend is status effects, though you can also link those to skills as well.
     
    #7
  8. Tsukihime

    Tsukihime Veteran Veteran

    Messages:
    8,230
    Likes Received:
    3,062
    Location:
    Toronto
    First Language:
    English
    In that sense, events would also be done the same way by simply calling a skill that calls a common event, which would be easier than writing a reaction response that calls a troop event.
     
    #8
  9. Engr. Adiktuzmiko

    Engr. Adiktuzmiko Chemical Engineer, Game Developer, Using BlinkBoy' Veteran

    Messages:
    14,548
    Likes Received:
    2,901
    Location:
    Philippines
    First Language:
    Tagalog
    element reaction... that was nice Tsukihime... :)
     
    #9
  10. Ultima01

    Ultima01 Unhinged Veteran

    Messages:
    68
    Likes Received:
    9
    Location:
    Huntington, WV and Pittsburgh, PA
    First Language:
    English
    Primarily Uses:
    N/A
    Uh, if the actor/enemy affected by the tag is NOT tagged, the actor can't act if they've taken a hit that turn.  Is this intentional?
     
    #10
  11. Tsukihime

    Tsukihime Veteran Veteran

    Messages:
    8,230
    Likes Received:
    3,062
    Location:
    Toronto
    First Language:
    English
    I'm not sure what you mean, but if you mean an actor/enemy that reacts can't perform their own action, no that's not intentional. Someone had raised the issue and I updated the script to address it, but you probably found another bug.


    How to reproduce?
     
    Last edited by a moderator: Sep 25, 2013
    #11
  12. Yato

    Yato (aka Racheal) Veteran

    Messages:
    826
    Likes Received:
    344
    Location:
    Canada
    I was getting the bug CtelinAjira mentions as well, but I believe I fixed it quite easily. As far as I could tell, the issue was in this section of invoke_reactions:

    target.backup_actions target.clear_actions reactions = target.get_reactions(item) return if reactions.empty?If there were no reactions, the target's actions were cleared and never restored. Moving the clear_actions command under the reactions.empty? check fixed this for me.Also, A+. This works with my current mish-mash system with just some minor edits and allows me to get the effect I was looking for without having to code something myself.
     
    Last edited by a moderator: Sep 30, 2013
    #12
  13. Tsukihime

    Tsukihime Veteran Veteran

    Messages:
    8,230
    Likes Received:
    3,062
    Location:
    Toronto
    First Language:
    English
    Thanks, I added the "backup" and "restore" steps but didn't catch the return that I originally wrote.
     
    #13
  14. kerbonklin

    kerbonklin Hiatus King Veteran

    Messages:
    1,728
    Likes Received:
    281
    First Language:
    English
    Primarily Uses:
    RMMV
    Would there be a way where I can make the chance based on an actor's CNT or RFT parameters?  I'd like this to work as a replacement for the default counter/reflect mechanics because I can't use Victor's Retaliation Damage.

    Like maybe if the parameter is stored as a numeric integer variable in some fashion (maybe I can do that part) and then chance can be replaced with the variable.

    Basically a variable'd chance,
     
    Last edited by a moderator: Nov 13, 2013
    #14
  15. Tsukihime

    Tsukihime Veteran Veteran

    Messages:
    8,230
    Likes Received:
    3,062
    Location:
    Toronto
    First Language:
    English
    I've updated the script so that the chance can be specified as a formula.

    Note that the chance is between 0 and 100, and feature values are between 0 and 1.

    So suppose you gave your actor a CNT rate of 50%. That means the chance is 0.5, which is extremely small.

    You would need to scale it up as such

    a.cnt * 100So your skill reaction might look like

    Code:
    <skill reaction: 1 51 a.cnt*100>
    Which will react to skill 1 with skill 51 with a probability based on your counter.The formula supports the standard variables

    Code:
    a - battler that is reactingb - target of the reactionp - game partyt - game troops - game switchesv - game variables
     
    Last edited by a moderator: Nov 16, 2013
    #15
  16. Tsukihime

    Tsukihime Veteran Veteran

    Messages:
    8,230
    Likes Received:
    3,062
    Location:
    Toronto
    First Language:
    English
    I've made a fairly large update to the script.


    It introduces the concept of “Reaction Conditions”, which are conditions that must be met in order for the reaction to occur.


    For example, you may require a certain state to be applied, or your HP to be under a certain threshold, or that certain actors are in the party.


    The script originally provided a “chance” variable that allowed you to indicate the likelihood that the reaction will occur. This is considered to be deprecated and should not be used.


    All conditions should be done using reaction conditions, including random probabilities, because they are much more flexible and allow you to condition your reactions on anything that you can imagine.


    See the script usage and examples for more information!
     
    Last edited by a moderator: Feb 8, 2014
    #16

Share This Page