Enemy Action Conditions

enemyActionConditions1

This script allows you to define multiple custom action conditions on top of the conditions provided by the database.

The database does not allow you to set multiple conditions for a single action. This script addresses this issue by allowing you to create multiple conditions.

In order to provide flexible conditions for game developers, custom action conditions are provided as formulas, allowing you to condition your actions on anything you can imagine.

Download

Script: download here

Installation

In the script editor, place this script below Materials and above Main

Usage

When setting up the enemy in the database, you can set up the actions that the
enemy can use. Each action has an ID: the first action on the list is ID 1,
the second action on the list is ID 2.

enemyActionConditions2

To add an action condition to a particular action, use the note-tag

<action condition: ID>
  FORMULA
</action condition>

Where the ID is the action ID, and the FORMULA is any valid formula that
returns true or false. All conditions must be met in order for the action to
be usable.

The following formula variables are available:

a - the enemy
p - game party
t - game troop
s - game switches
v - game variables

You may also like...

99 Responses

  1. Stevee says:

    Since the admin of this web page is working, no doubt very soon it will be
    famous, due to its feature contents.

  2. Tiela says:

    Very rapidly this website will be famous among all blog users, due to
    it’s pleasant posts

  3. Rony says:

    Excellent blog here! Also your site loads up
    very fast! What web host are you using? Can I get your affiliate link
    to your host? I wish my site loaded up as fast as yours lol

  4. Porshe says:

    Hi there, You have done an excellent job. I will certainly digg
    it and personally recommend to my friends. I am confident they’ll be benefited from this web site.

  5. Reneka says:

    Wow, that’s what I was searching for, what a material! existing here at
    this weblog, thanks admin of this web site.

  6. Willam says:

    Hi there! I just wanted to ask if you ever have any trouble with hackers?
    My last blog (wordpress) was hacked and I ended up losing several weeks of hard work due to no data
    backup. Do you have any solutions to protect
    against hackers?

  7. Rivka says:

    Hi, yes this post is in fact fastidious and I have learned
    lot of things from it regarding blogging. thanks.

  8. Sheterica says:

    I do not know if it’s just me or if everyone else encountering issues with your site.

    It appears like some of the text in your posts are running off the screen. Can somebody else please
    provide feedback and let me know if this is happening to them as well?

    This could be a problem with my web browser because I’ve had this happen before.
    Cheers

  9. Ranae says:

    Its like you read my mind! You appear to know a lot about this, like you wrote the book in it or something.
    I think that you could do with some pics to drive the message home a bit, but other than that, this is great blog.
    A great read. I’ll definitely be back.

  10. Cristinia says:

    If some one wishes to be updated with most up-to-date technologies after that he must be pay a visit this website and be up to
    date every day.

  11. Karena says:

    Thanks for one’s marvelous posting! I quite
    enjoyed reading it, you could be a great author.I will make sure to bookmark your blog and will often come back later in life.
    I want to encourage you continue your great job, have a nice
    afternoon!

  12. Elisebeth says:

    Write more, thats all I have to say. Literally, it seems as though you relied on the video to make your point.
    You definitely know what youre talking about, why
    waste your intelligence on just posting videos to your
    blog when you could be giving us something informative to read?

  13. It’s very interesting! If you need help, look here: ARA Agency

  14. Riana says:

    Do you have a spam problem on this blog; I
    also am a blogger, and I was wondering your situation; we have developed some nice practices and
    we are looking to swap techniques with others, please shoot me an e-mail if interested.

  15. Roshunda says:

    Fantastic items from you, man. I have understand your stuff prior to and you’re just extremely great.
    I actually like what you’ve received here, really like what
    you’re saying and the way in which wherein you say it. You
    make it entertaining and you continue to care for to keep it sensible.
    I can’t wait to learn much more from you. This is actually a great site.

  16. Janssen says:

    I have been browsing online more than 3 hours today, yet I never found any interesting article like yours.
    It is pretty worth enough for me. In my view, if all site owners and bloggers made good
    content as you did, the internet will be a lot more useful than ever before.

  17. Joathan says:

    We are a gaggle of volunteers and starting a new scheme in our community.

    Your website offered us with useful info to work on. You have performed a formidable activity and our entire neighborhood can be thankful to you.

  18. Bradlee says:

    I was recommended this website by my cousin. I am not sure whether this post is written by him as no
    one else know such detailed about my trouble. You’re
    amazing! Thanks!

  19. Vallerie says:

    Currently it looks like Expression Engine is the best blogging platform out
    there right now. (from what I’ve read) Is that what you’re using on your blog?

  20. Kieu says:

    Thanks a bunch for sharing this with all folks you actually
    realize what you are speaking about! Bookmarked. Kindly also
    consult with my site =). We will have a link exchange agreement
    between us

  21. Rollie says:

    Awesome article.

  22. Icholas says:

    Hi there, You have done a fantastic job. I will certainly digg
    it and personally recommend to my friends. I’m confident
    they will be benefited from this web site.

  23. Shaconda says:

    Greate article. Keep posting such kind of info on your site.
    Im really impressed by it.
    Hi there, You’ve done an excellent job. I will
    certainly digg it and in my opinion recommend to my friends.
    I’m sure they’ll be benefited from this website.

  24. Ean says:

    I read this article completely concerning the comparison of most up-to-date and earlier
    technologies, it’s remarkable article.

  25. Karan says:

    great publish, very informative. I ponder why the opposite specialists of this sector do not understand this.
    You should continue your writing. I’m confident, you’ve a great readers’ base already!

  26. Tavares says:

    Amazing! Its genuinely awesome post, I have got much clear
    idea about from this piece of writing.

  27. Tanicia says:

    When someone writes an paragraph he/she retains the plan of a user
    in his/her mind that how a user can know it. Thus that’s why this piece of writing is amazing.
    Thanks!

  28. Deshawna says:

    Hey! I know this is kinda off topic but I’d figured I’d ask.
    Would you be interested in trading links or maybe guest authoring
    a blog article or vice-versa? My blog covers a lot of the same topics as yours and I think
    we could greatly benefit from each other. If you’re interested feel free to send me an email.
    I look forward to hearing from you! Great blog by the way!

  29. Rusty says:

    Hi there, this weekend is good in support
    of me, as this point in time i am reading this wonderful informative post here at my
    home.

  30. Monalisa says:

    I pay a quick visit everyday some web sites and information sites to
    read content, except this website presents quality based articles.

  31. Reyn says:

    My family always say that I am killing my time here at web,
    however I know I am getting know-how everyday by reading such
    pleasant articles.

  32. Aleksandar says:

    Hi i am kavin, its my first time to commenting anyplace, when i read this
    paragraph i thought i could also create comment due to this brilliant article.

  33. Jehna says:

    My partner and I absolutely love your blog and find nearly all of your post’s
    to be exactly what I’m looking for. Would you offer guest writers to write content for you personally?

    I wouldn’t mind creating a post or elaborating on many of the subjects you write regarding here.
    Again, awesome web site!

  34. Idania says:

    Greetings! Very helpful advice within this article!
    It’s the little changes that will make the most significant changes.
    Many thanks for sharing!

  35. Thelbert says:

    I’m not that much of a online reader to be honest but your sites really nice, keep
    it up! I’ll go ahead and bookmark your site to come back later on. All the best

  36. Marqus says:

    I couldn’t resist commenting. Exceptionally well written!

  37. Jayden says:

    Hey! Would you mind if I share your blog with my
    facebook group? There’s a lot of folks that I think would really appreciate your content.

    Please let me know. Many thanks

  38. Shatrice says:

    Amazing blog! Do you have any hints for aspiring writers?
    I’m planning to start my own site soon but I’m a little lost on everything.
    Would you suggest starting with a free platform like WordPress or go for a paid option? There are so many
    options out there that I’m completely overwhelmed ..
    Any suggestions? Cheers!

  39. Latrece says:

    Hey! This post couldn’t be written any better! Reading through this post reminds
    me of my previous room mate! He always kept talking about this.
    I will forward this article to him. Fairly certain he will have a good read.
    Many thanks for sharing!

  40. Jerral says:

    Everything is very open with a precise clarification of the issues.
    It was really informative. Your website is very helpful.

    Thanks for sharing!

  41. Demond says:

    This site was… how do you say it? Relevant!!
    Finally I’ve found something which helped me.
    Thank you!

  42. Makila says:

    My brother suggested I might like this web site. He was once
    entirely right. This submit truly made my day. You cann’t imagine
    just how much time I had spent for this information! Thank you!

  43. Basma says:

    Hello just wanted to give you a quick heads
    up. The words in your post seem to be running off the screen in Internet explorer.
    I’m not sure if this is a format issue or something to do with web browser compatibility but I thought I’d post to let you know.
    The design and style look great though! Hope you get the problem fixed soon.
    Many thanks

  44. Normand says:

    I visited multiple web pages however the audio feature for audio songs current at this
    web page is genuinely marvelous.

  45. Jeaninne says:

    I like the helpful info you provide on your articles.
    I will bookmark your blog and check again right here
    frequently. I am quite certain I’ll learn many new stuff proper here!

    Good luck for the next!

  46. Breyon says:

    This article gives clear idea designed for the new users of blogging, that really how to do running a blog.

  47. Eliott says:

    We stumbled over here coming from a different website and
    thought I might check things out. I like what I see
    so now i am following you. Look forward to looking over your web page
    again.

  48. Dorie says:

    I am in fact happy to read this blog posts which includes
    tons of useful data, thanks for providing these information.

  49. Wilburn says:

    What’s Taking place i am new to this, I stumbled upon this I have found It positively useful and it has helped me out loads.
    I’m hoping to give a contribution & aid other users like its aided me.
    Good job.

  50. Tyler says:

    Excellent web site. Lots of helpful info here. I’m sending it to a few pals ans additionally
    sharing in delicious. And naturally, thanks on your effort!

  51. Venesha says:

    you are actually a excellent webmaster. The website loading speed
    is amazing. It kind of feels that you are doing any
    distinctive trick. Moreover, The contents are masterpiece.
    you have done a fantastic activity in this matter!

  52. Thinh says:

    I am actually grateful to the holder of this website who
    has shared this impressive piece of writing at here.

  53. Quince says:

    I’m really loving the theme/design of your site.
    Do you ever run into any browser compatibility issues?
    A few of my blog visitors have complained about my website not operating
    correctly in Explorer but looks great in Safari. Do you have any tips to
    help fix this issue?

  54. Rand says:

    magnificent issues altogether, you simply won a brand new reader.

    What might you suggest in regards to your submit that you simply made some days ago?
    Any sure?

  55. Lynsey says:

    Amazing! Its truly awesome article, I have got much clear idea concerning
    from this post.

  56. Steffanie says:

    I’m gone to say to my little brother, that he should also
    pay a visit this website on regular basis to obtain updated from most up-to-date news update.

  57. Timi says:

    I loved as much as you will receive carried out
    right here. The sketch is attractive, your authored material
    stylish. nonetheless, you command get bought an shakiness over that you wish be delivering the following.
    unwell unquestionably come further formerly
    again as exactly the same nearly a lot often inside case you shield this hike.

  58. Magnus says:

    You’re so interesting! I don’t think I’ve truly read a single thing like this
    before. So wonderful to discover someone with genuine thoughts on this issue.
    Seriously.. many thanks for starting this up.
    This site is something that’s needed on the web, someone with a little originality!

  59. Lisbeth says:

    Great blog you’ve got here.. It’s difficult to find quality writing
    like yours nowadays. I seriously appreciate individuals like you!
    Take care!!

  60. Tonesha says:

    Hi there Dear, are you in fact visiting this site daily, if
    so afterward you will absolutely take fastidious experience.

  61. Halee says:

    Hello, this weekend is nice for me, as this occasion i am reading this great educational paragraph here at
    my home.

  62. Allen says:

    Do you have a spam issue on this blog; I also am a blogger, and I was wanting to know your situation; we
    have developed some nice procedures and we are
    looking to trade strategies with other folks, please shoot me an e-mail if interested.

  63. Jejuan says:

    I’m really enjoying the theme/design of your weblog. Do you ever run into any web browser compatibility issues?
    A small number of my blog readers have complained about
    my site not operating correctly in Explorer but looks great in Chrome.
    Do you have any suggestions to help fix this problem?

  64. Aydin says:

    Hi there! I know this is somewhat off-topic but I had to
    ask. Does running a well-established blog like yours require a massive amount work?
    I’m brand new to writing a blog but I do write in my journal every day.
    I’d like to start a blog so I will be able to share my personal experience and feelings
    online. Please let me know if you have any kind of
    recommendations or tips for brand new aspiring blog owners.
    Thankyou!

  65. bloodyliao says:

    Excuse me, how to make a skill usable by enemy only when any one of them is hurt?
    I tried this one, but fail.

    !(t.hp_rate * 100) == 100
    </action condition>

    • Hime says:

      That’s because t is the troop itself, not an enemy.

      Assuming there are two enemies, and you want a skill to be usable when one of them is hurt, you can say
      t.members.any?{|mem| mem.hp_rate < 1}

      However if they restore their HP, then the condition is false again.

  66. Emily says:

    Would this work on party members as well? Or at least a way to edit it to make it work? I’d like some party members to have skills that are only usable if a variable is at a certain value or a switch is on. Is that possible?

  67. Anonymous says:

    I know this is late but I was wondering if it’s possible to make the enemy use a skill on an ally enemy when a certain state is applied to their ally. I’m basically trying to get my enemies to have a chance to revive each other.

    • Hime says:

      It would be possible to check if “any” allies have a particular state, but it wouldn’t be possible to check if a specific ally had that state. The script only specifies whether the action can be used, and not whether the action can be used on a specific target (as the script does not handle any target related properties).

      I’m not sure if you would be able to accomplish what you want with this script on its own.

  68. Anonymous says:

    Heya.

    I’m having some trouble with this script and I’d like some advice. If my actor is using attack A, then they’re in state A. When this happens, I want my enemy to attack them over all else. However, if my other actor uses attack B, then they’re in state B. Is there a way to have my enemy attack the actor in state B over the actor in state A?

    • Hime says:

      This script is mainly focused on whether an enemy is able to use a skill.
      Have you considered having state B simply increase the TGR parameter that makes it a more likely target?

  69. Anonymous says:

    Skill chain?

  70. Alex says:

    Hello.

    This is a minor question/comment.

    I’m trying to put cumulative conditions on the same skill.

    In concrete… my acrobat have two skills raising either evade or magic evade.
    I use the conditions so it wont use any of these skills if either state is up.

    I first tried to have both in one condition…

    !a.state? (242)
    !a.state? (243)

    But then the acrobat was using the skills if any of the two wasn’t up.

    Now i use two conditions for the same skill :

    !a.state? (242)

    !a.state? (243)

    And it works as intended, so it’s not a blocking issue.

    Yet i Wonder if there isn’t a simpler/smouther way to write it down.

    If not I hope it’ll help people trying to do the same.

  71. velicue says:

    Hi I’m using the game variable but it seems to be not correct.

    v[2] == 1

    It tells that if variable no.2 is 1 then use action 1. Is this correct?

    • velicue says:

      Oh it’s ok now. The problem is I forgot to save the game file after I inserted the script. The script is great and thanks a lot!

  72. Joey Desud says:

    Do you know of any way to get an enemy to use a skill only on characters without a specific state?

    For example I’m using

    !p.members.any? {|mem| mem.state?(5) }

    to get an enemy to confuse party members that don’t have the status effect. But the enemy still just seems to target randomly anyway.

    • Hime says:

      Unfortunately due to the way actions are processed by default, it chooses which skill to use before it chooses which battler to target.

      The check only occurs during the skill selection step. This is why there is no variable for the target.

  73. Alex says:

    Hello.

    I have some questions for i have no knowledge of formula.

    I’d like to have an enemy using a skill when one member of the party have a specific state.
    I tried with “p.state? (3)” but it doesn’t works, perhaps because “p” means the party and not one character.

    I also Wonder how to reverse this condition.
    For exemple, i’d like the enemy to cast a skill when it doesn’t have a specific state.
    In the same way, is there a way to have an enemy use a skill when no one in the party have a specific state?

    Alternatively, if you know a good place to learn about formula… i could learn to fish.
    I had a look at “How to make the most of custom formulae. Part #1” but it seems focused on damage formula.

    Thanks in advance.

    • Hime says:

      Yes, p refers to the party object. If you want to make it so that a skill is used when any member of the party has state 3, you can say

      p.members.any? {|mem| mem..state?(3) }
      

      Which simply asks whether any member has state 3.

      For the reverse, you just need to stick a ! in front to negate it

      !p.members.any?{|mem| mem.state?(3)}
      

      Which means if someone has the state, then it won’t be used.

      If you can do damage formulas then you could do any other formula. The principles are the same. For learning, I’m not sure what would be the best approach because you can basically do anything. That topic is likely a good place to start since it focuses on specific applications.

      • Anonymous says:

        Can I make enemies use magic and special attacks in a specific order with this script?

        • Hime says:

          Not directly, but if you can enforce some sort of order by using conditions (such as variable value) and then having each skill change the variable value, you can then force the enemy to use certain skills in that order based on the variable. Or you can use states. It’s up to you to think about the logic.

    • Alex says:

      Ok i just tested and it works fine. Thanks!
      I’ll have a closer look at the guide.

      • Alex says:

        I am terribly sorry.
        Another question or two.

        if i write “!a.state? (X)” it will use the skill only if it doesn’t have the state? (for self casting buffs)

        Also, i couldn’t find how to use a switch as a condition. “$game_switches[x] ?” doesn’t seems to work.

        Hopefully it should be the last time i bug you (with this script).

        • Hime says:
          1. Yes. Does it do that?

          2. Example

          if s[1]
             # switch one ON
          else
             # switch one OFF
          end
          
          • Alex says:

            1 – it works all right.
            2 – I don’t manage to make it work.
            Actually i don’t know how to make sure the condition is registered. I tried two things :

            if s[1]
            1
            else
            0
            end

            or

            if s[1]
            true
            else
            false
            end

            None worked.

            At worst i can replace the switch with a state marker inflicted on the whole troup.

            Out of curiosity i also tried …

            !t.members.all? {|mem| mem.state?(177)}

            Hoping the skill wont be used if the whole troup have a specific state, but it doesn’t work…

            Guess it’s not that simple ;p

          • Hime says:

            Try just writing

            s[1]
            
          • Alex says:

            I can’t reply to the last message so i reply here.
            s[1] works and !s[1] works too.
            Thanks a lot.

  74. WCouillard says:

    I had all four battle members inflicted with a state, and had set the enemy to not select the action unless at least one member wasn't inflicted with the state, and the enemy still randomly selects to use that action.

    "condition eval 2"
    p.any? { |a| !a.state?(33) }
    "/condition eval"

    Replaced the code in quotes so it wouldn't parse weird here.

    Do I have the note tag wrong? Should it be b.state?(33)?

  75. RogueDeus says:

    Just to clarify. Is the use 'rating' selection in the tool set still the primary factor in chances of one ability used over another? Assuming they are available.

Leave a Reply to Hime Cancel reply

Your email address will not be published. Required fields are marked *