Archeia's Advanced AI Conditions

Discussion in 'RGSS3 Scripts (RMVX Ace)' started by Archeia, Feb 13, 2015.

  1. Archeia

    Archeia Level 99 Demi-fiend Staff Member Developer

    Messages:
    14,636
    Likes Received:
    14,384
    Location:
    Game Dev Salt Mines
    First Language:
    Filipino
    Primarily Uses:
    VNM
    Advanced AI Conditions
    Version 1.0c
     ​
    What is this?
    This script allows the developper to exert better control on how the AI handles the enemies' action patterns.
    Script configuration is almost entirely made via noteboxes and no RGSS3 knowledge is required to use it.
     
    Features and Instructions

    [​IMG]
    PART 1: DEFAULT AI CONFIGURATION
     
    - TGR settings
    TGR determine the frequency a target will be chosen during random targeting rolls. The configuration module below allows you to set how damage and healing affects TGR to make a character more threatening to the eyes of the AI.
     
    - Skill settings
    Every skill can be given default AI *targeting* conditions all enemies will use. To do it, you have to create an "AI block" in the skill's notebox.
     
    Notetags explanation:

    <ai_conditions>Explanation: You always start the block with this one. target_hpgt: nExplanation: The target HP must be greater or equal to n%. target_hplt: nExplanation: The target HP must be lesser or equal to n%. target_states: n, n...Explanation: The target must have the specified states already inflicted. target_states_not: n, n...Explanation: The target must NOT have the specified states already inflicted. only_if_targetExplanation: If no suitable target is found, the skill won't be used AT ALL. </ai_conditions>Explanation: You always end the block with this one.PART 2: ENEMY AI CONFIGURATION
     
    On top on a default AI, you can setup individual AI conditions for every different enemy. In case of conflict with the default targeting AI, these settings will take precedence.
    All these settings make use of the enemy's notebox.
     
    NOTE: the term "action index" refers to the order of the action pattern you enter for enemies in the database. For instance, if your list is like this:
     
    Attack
    Fire II
    Poison
     
    Attack will be index 1, Fire II will be index 2 and Poison index 3. And so on.
     
    Notetags explanation:

    <ai_conditions: n, n...>Explanation: One way of starting an AI block. n must be an action index and if you put more than one (separated by comma), the conditions will be applied to each of them. <ai_conditions: n, n...> use_idExplanation: Same as above, but instead of the action index, the skill ID will be used. n must be a valid skill ID in this case. switches: n, n...Condition: designated switches are ON. variables: x, y, x, y...Condition: the variables x have the value y. states: n, n...Condition: acting enemy is under the every of the designated states. hpgt: nCondition: acting enemy has hp greater or equal than n%. hplt: nCondition: acting enemy has hp lesser or equal than n%. mpgt: nCondition: acting enemy has mp greater or equal than n%. mplt: nCondition: acting enemy has mp lesser or equal than n%. party_level: nCondition: party level is greater than n. turns_order: a+bxCondition: it's exactly like in the database condition for turns. target_hpgt: nCondition: The target HP must be greater or equal to n%. target_hplt: nCondition: The target HP must be lesser or equal to n%. target_states: n, n...Condition: The target must have the specified states already inflicted. target_states_not: n, n...Condition: The target must NOT have the specified states already inflicted. only_if_targetCondition: If no suitable target is found, the skill won't be used AT ALL. </ai_conditions> Explanation: You must end the block with this one. 
    - Creating Turn Patterns
     
    Turn patterns is a special AI setting which completely replace an action pattern with another one at the designated turns. During a turn pattern, the "normal" actions (the ones you entered into the database) won't be taken into consideration, ever. You need to create another block to make a Turn Pattern.

    <turn_pattern: a+bx>Used to define the pattern. a is the first turn and b the number of turns after the first. skill: a, ba is the skill id and b the rating. </turn_pattern>End the pattern.  
    NOTE 1: You can put as many skill tags as you want.
    NOTE 2: In order to assign conditions to a skill inside a turn pattern, you have to create a new AI block with that skill's ID.
     
    - Absolute Rating
     
    The absolute rating is a special rating you assign to an action during databasing your enemy. An action with this rating will take absolute priority, ignoring all others (even higher ones) provided it can be used.
    If you have several actions with an absolute rating, one will be chosen randomly.
     
    Download and Terms of Use

    • Contact me for commercial usage.
    • I will not be giving support or fixing bugs for you. I don't have time for that.
    • Please do not distribute them in one huge zip/rar/.7z/whatever compression without my permission.
    • You may use or edit the code as you please as long as it has proper attribution. However, you cannot change the license for the script e.g. removing the permission to use for commercial projects.
    • Please add me in your credits either as Archeia Nessiah/Division Heaven. It can be in the ReadMe/Game Credits/etc.
    • I am not liable for any destructive behavior that the materials could have caused you, such as, but not limited to, computer damage, incontinence, explosion of user’s head, coma, death, and/or halitosis. So edit or use at your own risk.
     
    Last edited by a moderator: Apr 1, 2015
    #1
    Ebanyle, Idril, BCj and 21 others like this.
  2. The Stranger

    The Stranger The Faceless Friend Veteran

    Messages:
    2,795
    Likes Received:
    17,004
    Location:
    Birmingham, England
    First Language:
    English
    Primarily Uses:
    RMMV
    This looks fantastic! I'm looking forward to designing complex encounters, now.
     
    #2
  3. Engr. Adiktuzmiko

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

    Messages:
    14,640
    Likes Received:
    2,967
    Location:
    Philippines
    First Language:
    Tagalog
    This is nice... not as extensive as a full RGSS3 powered AI setting as you're limited to what to use, but nonetheless good and easier to use. :3

    One thing I notice though is that this kind of script somehow would work better if we add an accompanying target selection script...
     
    Last edited by a moderator: Feb 13, 2015
    #3
    Archeia likes this.
  4. Jaymonius

    Jaymonius Veteran Veteran

    Messages:
    232
    Likes Received:
    74
    Location:
    Calgary Alberta
    First Language:
    English
    Ooooooooooooooooooh!!! Now this looks like this will be a lot of fun to mess around with. I've always wanted to have smarter AI enemies and bosses without having to rely on events to get things done. Excellent! Good show. :D
     
    #4
  5. Zero0018

    Zero0018 Apprentice Member

    Messages:
    133
    Likes Received:
    1
    First Language:
    English
    Thank you for this awesomeness.
     
    #5
  6. Kenen

    Kenen Veteran Veteran

    Messages:
    256
    Likes Received:
    153
    First Language:
    English
    Primarily Uses:
    RMMV
    The target states function here is very convenient. The same can be done with Yanfly's scripts, but that requires adjusting individual skills. This way, everything can be done in the enemy pane. Awesome!
     
    #6
  7. Oddball

    Oddball Veteran Veteran

    Messages:
    1,663
    Likes Received:
    437
    First Language:
    English
    Primarily Uses:
    N/A
    How do you make a group of enemies (Like wolves) target the actor with the lowest HP or the most negative states?
     
    #7
  8. Ksi

    Ksi ~RTP Princess~ Moderator

    Messages:
    2,002
    Likes Received:
    1,533
    Location:
    Australia
    First Language:
    English
     
    Last edited by a moderator: Feb 15, 2015
    #8
  9. Engr. Adiktuzmiko

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

    Messages:
    14,640
    Likes Received:
    2,967
    Location:
    Philippines
    First Language:
    Tagalog
    @Oddball - This is a script to determine what Action an enemy will do, not for choosing who to target... Those are different things

    which is also why on my first post, I said

     
    Last edited by a moderator: Feb 15, 2015
    #9
  10. Archeia

    Archeia Level 99 Demi-fiend Staff Member Developer

    Messages:
    14,636
    Likes Received:
    14,384
    Location:
    Game Dev Salt Mines
    First Language:
    Filipino
    Primarily Uses:
    VNM
    It has target controls to some extent but you would want to combine it with TGR.

    not very straightforward though but only does it through conditions.

     
    Last edited by a moderator: Feb 15, 2015
    #10
  11. Oddball

    Oddball Veteran Veteran

    Messages:
    1,663
    Likes Received:
    437
    First Language:
    English
    Primarily Uses:
    N/A
    But none of those are what i wanted. I'm not going to use this anyway, but i was talking about it comparing the HP of ALL the actors and targeting the one with the lowest, so that predatory animals like wolves seem to behave like real wolves. Eating the one's that are most likely to catch and spread a disease to the rest

    your script only checks if a certain actors HP is below/above a certain point
     
    #11
  12. Archeia

    Archeia Level 99 Demi-fiend Staff Member Developer

    Messages:
    14,636
    Likes Received:
    14,384
    Location:
    Game Dev Salt Mines
    First Language:
    Filipino
    Primarily Uses:
    VNM
    Um no it doesn't? It checks EVERYONE's HP (the targets they can attack) IF you use this tag:

    target_hpgt: nCondition: The target HP must be greater or equal to n%. target_hplt: nCondition: The target HP must be lesser or equal to n%.to find who has the lowest and who has it at a certain amount. I'm not sure what you're talking about. You can't even set actor IDs.

    If you're talking about MAX HP then that's an entirely different thing and you might want to work around that by giving the lowest MAX HP character a state, so they would target it. It's not that complicated.

    If you're not going to use it then I'm not sure what's the issue here. I'm only replying to Engr. Adiktuzmiko's comment about lack of target options (which is true to some extent but I don't know how much target control you'd want more).
     
    Last edited by a moderator: Feb 16, 2015
    #12
  13. Engr. Adiktuzmiko

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

    Messages:
    14,640
    Likes Received:
    2,967
    Location:
    Philippines
    First Language:
    Tagalog
    Doesn't this just checks if the target HP is on a certain level? I think what he's asking is how to find the target with the LOWEST hp of them all
     
    #13
  14. Archeia

    Archeia Level 99 Demi-fiend Staff Member Developer

    Messages:
    14,636
    Likes Received:
    14,384
    Location:
    Game Dev Salt Mines
    First Language:
    Filipino
    Primarily Uses:
    VNM
    Thus why I proposed a workaround using either states or TGR based on their conditions.

    Actually I do have a TGR script that does increase or decrease the target's TGR based on the condition of their HP or if they have a state, I can release that one too hm.
     
    Last edited by a moderator: Feb 16, 2015
    #14
    Kes and Engr. Adiktuzmiko like this.
  15. Zero0018

    Zero0018 Apprentice Member

    Messages:
    133
    Likes Received:
    1
    First Language:
    English
    When I add:

    <ai_conditions>

    target_states_not: 49 <---- haste state id

    </ai_conditions>

     

    To a skill, I get the error message in the screenshot.

     

    When I add the tag:

     

    <ai_conditions 2>        action index 2, Skills: 1 = attack, 2 = haste

    target_states_not: 49  <---- haste state id

    </ai_conditions>

     

    To an enemy, it still casts the buff on a target who has the state. What am I doing wrong?


    1.png
     
    #15
  16. Archeia

    Archeia Level 99 Demi-fiend Staff Member Developer

    Messages:
    14,636
    Likes Received:
    14,384
    Location:
    Game Dev Salt Mines
    First Language:
    Filipino
    Primarily Uses:
    VNM
    Check the instructions and/or screenshots. You got the syntax wrong.
     
    #16
  17. Zero0018

    Zero0018 Apprentice Member

    Messages:
    133
    Likes Received:
    1
    First Language:
    English
    I don't see what I am doing wrong. I realize your busy, but according to the screenshot and your instructions, it says you have to create an AI block in the skill's notebox. The ai block has to start with <ai_conditions> and end with </ai_conditions>. There is no screenshot showing this in action. I am assuming you can do multiple commands inbetween.

    So:

    <ai_conditions>

    target_hpgt: 5

    only_if_target

    </ai_conditions>

     

    This should work, however it gives the error like before, saying num isn't a method or w/e. What syntax do I have wrong? I copied exactly from this thread from the instructions.


    Can you show me an example of how it's working on a skill in your project please? I really want to use this script!
     
    #17
  18. Archeia

    Archeia Level 99 Demi-fiend Staff Member Developer

    Messages:
    14,636
    Likes Received:
    14,384
    Location:
    Game Dev Salt Mines
    First Language:
    Filipino
    Primarily Uses:
    VNM
    You create the AI on the enemy notebox. Not skill.
     
    #18
  19. Zero0018

    Zero0018 Apprentice Member

    Messages:
    133
    Likes Received:
    1
    First Language:
    English
    Oh..... Sorry, as posted above:

    I read this and saw that it said skill's notebox. Thanks for the clarification!

    So then, in the enemy notebox:
     

    <ai_conditions 1>

    target_states_not: 49

    </ai_conditions>

     

    This should only cast the skill when the target doesn't have the state, as you can see in the video, it just repeats haste on the same target.

     
     
    #19
  20. Archeia

    Archeia Level 99 Demi-fiend Staff Member Developer

    Messages:
    14,636
    Likes Received:
    14,384
    Location:
    Game Dev Salt Mines
    First Language:
    Filipino
    Primarily Uses:
    VNM
    SIIIIIIIIIIGHHHHHHHHHHHHHHHHHHHHHH.......................
     
    Look at the instructions again and see what I have? The screenshot. I can't believe that you keep missing the  symbol. Here's an example use.

    <ai_conditions: 4>target_hplt: 80target_states: 37only_if_target</ai_conditions>Are you using any other scripts? If you are test this first in a test project.
    Like I said, I have to ask so many questions that I don't have time for support. Debug it first in an empty project and see if it still errors.
    If it does then report, if it doesn't then check which script of yours is doing it.

    But check the syntax like I said.
     
    Last edited by a moderator: Mar 1, 2015
    #20

Share This Page