Scope Conditions

This script allows you to specify a scope condition for your items and skills.

A scope condition is a formula that is used to determine whether a skill
or item has an effect on a target or not. If it has no effect on a target then
the action does not do anything to that target.

scopeConditions1

Download

Script: download here

Installation

Place this script below Materials and above Main

Usage

Note-tag skills/items with

<scope condition: formula />

Where the formula is some valid ruby statement.
The following variables are available for your formula

a - current attacker
b - target
f - friends unit
o - opponents unit
v - game variables
s - game switches

The target is all of the targets that the skill/item can affect. For example,
if a skill affects all enemies, then b will be replaced with each enemy
during action execution.

The f and o variables depend on who the current attacker is.
If the attacker is an actor, then the friends unit is the game party.

Examples

Some example scope conditions

<scope condition: b.level % 5 == 0 />
   -targets with levels that are multiples of 5

<scope condition: b.state.include?(23) />
   -targets with state 23 applied

<scope condition: b.name =~ /slime/i />
   -targets with the word "e" in their name (case-insensitive)

<scope condition: b.hp > (b.mhp / 2) />
   -targets with more than 50% of their max HP

You may also like...

100 Responses

  1. Everything is very open with a precise explanation of the issues.

    It was really informative. Your website is useful.
    Thank you for sharing!

  2. Hello There. I discovered your blog using msn. That
    is a very neatly written article. I will make sure to bookmark it and return to learn more of your helpful info.
    Thanks for the post. I’ll definitely return.

  3. Bestel xeloda 500 mg online zonder recept nodig te hebben
    aankoop xeloda 500 mg mylan in Nederland
    waar xeloda 500 mg zonder voorschrift te kopen
    Beste plek om xeloda online te kopen in Nederland Hoe xeloda zonder recept te bestellen
    aankoop van merknaam xeloda 500 mg Mylan
    xeloda 500 mg zonder medische goedkeuring te verkrijgen bestellen xeloda België
    Waar kan ik xeloda 500 mg kopen in België?
    je kunt xeloda 500 mg zonder voorschrift kopen in Bogota
    xeloda 500 mg prijs in Zwitserland xeloda 500 mg bestellen in Monaco
    xeloda 500 mg kopen in Europa
    xeloda 500 mg beschikbaar zonder voorschrift in Mexico aankoop van merknaam xeloda 500 mg Mylan
    xeloda kopen zonder recept: makkelijk en snel xeloda zonder recept in Nederland
    Online aankoop van xeloda 500 mg met discrete verzending
    xeloda 500 mg zonder voorschrift in België
    xeloda 500 mg vrij verkrijgbaar in Amsterdam
    xeloda 500 mg te koop in Hoorn – snelle verzending gegarandeerd!

    Vind xeloda 500 mg zonder recept nodig in Groningen, Nederland xeloda zonder voorschrift
    in Rotterdam
    prijs van xeloda 500 mg zonder recept xeloda 500 mg
    kopen in Nederlandse apotheek
    Waar xeloda 500 mg zonder voorschrift te bestellen Informeer naar de prijs van xeloda 500 mg in Eindhoven, Nederland
    xeloda 500 mg online kopen: een slimme keuze voor uw gezondheid Vind xeloda 500 mg online tegen betaalbare prijzen in Nederland.

    xeloda 500 mg online aankoop in Nijmegen online aankoop
    van xeloda 500 mg in Frankrijk

  4. Joeann says:

    I have been browsing on-line more than 3 hours today, yet I by no means found any attention-grabbing article like yours.
    It is lovely price enough for me. In my view, if all webmasters and bloggers made excellent content material as you probably did, the internet will likely be much more useful
    than ever before.

  5. Aisling says:

    Hey there just wanted to give you a quick heads up. The text in your post seem to be running off the screen in Ie.
    I’m not sure if this is a format issue or something to do with internet browser compatibility but
    I thought I’d post to let you know. The design and style look great though!
    Hope you get the issue resolved soon. Kudos

  6. Sheyla says:

    Thank you a bunch for sharing this with all folks you
    actually recognize what you’re speaking about!
    Bookmarked. Kindly also consult with my website =). We could
    have a link trade contract between us

  7. Annalicia says:

    Hi are using WordPress for your blog platform? I’m
    new to the blog world but I’m trying to get started and set up my own. Do you
    require any html coding expertise to make your own blog?

    Any help would be really appreciated!

  8. Tahisha says:

    I think that is among the most vital info for me.
    And i’m glad studying your article. But wanna observation on few basic things, The web site style is ideal, the articles is truly great : D.
    Good task, cheers

  9. Tadeusz says:

    Your style is really unique in comparison to other
    people I have read stuff from. Thanks for posting when you’ve got the opportunity, Guess
    I’ll just book mark this blog.

  10. Lamekia says:

    Hi there just wanted to give you a quick heads up and let you know a few of
    the pictures aren’t loading correctly. I’m not sure why but I think
    its a linking issue. I’ve tried it in two different internet browsers and both show the same results.

  11. Hamilton says:

    Please let me know if you’re looking for a author for your
    site. You have some really good articles and I believe I would be a good asset.
    If you ever want to take some of the load off, I’d love to write some content for your
    blog in exchange for a link back to mine. Please shoot me an email if interested.

    Thanks!

  12. Jashan says:

    I’m gone to tell my little brother, that he should
    also pay a visit this web site on regular basis
    to get updated from latest gossip.

  13. Yehudah says:

    Hi, I do think this is a great blog. I stumbledupon it 😉 I am going to return once again since i
    have bookmarked it. Money and freedom is the
    best way to change, may you be rich and continue to help others.

  14. Jonni says:

    I read this article completely on the topic of the
    difference of most up-to-date and preceding technologies, it’s amazing article.

  15. Charvis says:

    Fantastic site you have here but I was curious about if you knew
    of any community forums that cover the same topics discussed here?
    I’d really like to be a part of community where I can get
    suggestions from other knowledgeable individuals
    that share the same interest. If you have any recommendations, please let me know.
    Cheers!

  16. Edy says:

    Terrific work! That is the type of info that
    should be shared across the internet. Shame on the search engines for now
    not positioning this submit higher! Come on over and seek advice
    from my site . Thank you =)

  17. Elijio says:

    I know this web page offers quality based content and other information, is there any other site which
    provides such stuff in quality?

  18. Dawnyel says:

    I needed to thank you for this good read!!
    I absolutely loved every little bit of it. I have you book-marked
    to look at new stuff you post…

  19. Lancelot says:

    When someone writes an paragraph he/she keeps the thought
    of a user in his/her brain that how a user can understand it.
    So that’s why this article is great. Thanks!

  20. Dezeray says:

    Hey! I realize this is sort of off-topic but I had to ask.
    Does managing a well-established website such as yours require a massive amount work?
    I’m brand new to operating a blog however I do write in my diary everyday.
    I’d like to start a blog so I will be able to share my personal experience and thoughts online.
    Please let me know if you have any kind of recommendations or
    tips for new aspiring bloggers. Thankyou!

  21. Larysa says:

    This is my first time pay a visit at here and i am
    actually impressed to read everthing at single place.

  22. Vernell says:

    Hi friends, its wonderful piece of writing regarding teachingand fully explained, keep it up all the time.

  23. Deanthony says:

    Greetings from Florida! I’m bored to tears at work so I decided to check out your site on my iphone during lunch break.
    I love the info you present here and can’t wait to take a look when I get
    home. I’m amazed at how quick your blog loaded on my mobile ..

    I’m not even using WIFI, just 3G .. Anyways,
    excellent site!

  24. Justino 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 site when you could be giving us something enlightening
    to read?

  25. Kewan says:

    Thanks for sharing your thoughts on website. Regards

  26. Carlota says:

    Very energetic post, I loved that a lot. Will there be a part
    2?

  27. Larren says:

    I’m impressed, I have to admit. Seldom do I encounter a blog that’s equally educative and
    interesting, and without a doubt, you’ve hit the nail on the head.

    The issue is something that too few men and women are speaking intelligently about.
    I’m very happy I stumbled across this during my hunt for
    something relating to this.

  28. Corinne says:

    I think that is one of the so much significant information for me.
    And i am glad reading your article. But wanna observation on few
    general issues, The web site style is wonderful, the articles is truly nice
    : D. Good activity, cheers

  29. Bobbijo says:

    Hi colleagues, how is everything, and what you wish for to say concerning this post, in my view its in fact awesome in favor of me.

  30. Torie says:

    Hey there, You have done a fantastic job. I will definitely
    digg it and personally suggest to my friends. I’m confident
    they’ll be benefited from this website.

  31. Geana says:

    I’m really impressed together with your writing skills as smartly as
    with the format for your weblog. Is this a paid theme
    or did you customize it yourself? Anyway keep up the
    nice high quality writing, it’s uncommon to see a great blog like this one today..

  32. Kimberlie says:

    Thanks very nice blog!

  33. Angeline says:

    Hi there to all, as I am actually keen of reading this webpage’s post to be updated on a regular basis.

    It carries fastidious information.

  34. Shaketa says:

    Spot on with this write-up, I seriously think this site needs
    a great deal more attention. I’ll probably be returning to read more, thanks for the information!

  35. Alistair says:

    Excellent blog here! Additionally your site a lot up very
    fast! What web host are you the usage of? Can I am getting your affiliate
    hyperlink in your host? I want my site loaded
    up as fast as yours lol

  36. Wilhelm says:

    Hey this is kind of of off topic but I was wondering if blogs use WYSIWYG editors or if you have to manually code with
    HTML. I’m starting a blog soon but have no coding knowledge so I wanted to get guidance from someone with experience.
    Any help would be enormously appreciated!

  37. Nichel says:

    I was suggested this web site by my cousin. I am not sure whether this post is written by him as no one else
    know such detailed about my problem. You’re wonderful! Thanks!

  38. Dyson says:

    Hi! Do you know if they make any plugins to assist with SEO?

    I’m trying to get my blog to rank for some targeted keywords but
    I’m not seeing very good success. If you know of any please share.
    Thank you!

  39. Rheanne says:

    Good day! Would you mind if I share your blog with my zynga group?
    There’s a lot of people that I think would really appreciate your content.
    Please let me know. Many thanks

  40. Taneshia says:

    With havin so much content and articles do you ever run into any problems of
    plagorism or copyright violation? My website has
    a lot of completely unique content I’ve either
    created myself or outsourced but it seems a lot of it is popping
    it up all over the web without my permission. Do you know any methods to help prevent content
    from being stolen? I’d certainly appreciate it.

  41. Taylar says:

    Thanks for your marvelous posting! I certainly enjoyed reading it, you will
    be a great author.I will make sure to bookmark your
    blog and will often come back at some point. I want to encourage yourself to continue your great work, have a nice weekend!

  42. Melea says:

    It’s a pity you don’t have a donate button! I’d definitely
    donate to this outstanding blog! I suppose for now i’ll settle for bookmarking
    and adding your RSS feed to my Google account.

    I look forward to fresh updates and will share this website with my Facebook
    group. Talk soon!

  43. Kaleena says:

    Great post. I was checking constantly this blog and I am impressed!

    Very useful info particularly the ultimate section 🙂 I handle such information much.

    I was seeking this certain info for a very long time.

    Thank you and good luck.

  44. Johnice says:

    I blog quite often and I seriously appreciate your content.
    This great article has really peaked my interest. I am going to take a
    note of your blog and keep checking for new details about once a week.
    I opted in for your Feed too.

  45. Anis says:

    I am regular visitor, how are you everybody? This
    paragraph posted at this web page is actually good.

  46. Kathreen says:

    Hi, I think your website might be having browser compatibility issues.
    When I look at your blog in Firefox, it looks fine but when opening in Internet Explorer, it
    has some overlapping. I just wanted to give you a quick heads up!
    Other then that, superb blog!

  47. Jonnathan says:

    Hello, i read your blog occasionally and i own a similar one and i was
    just curious if you get a lot of spam comments?
    If so how do you protect against it, any plugin or anything you can recommend?
    I get so much lately it’s driving me mad so any assistance is very much appreciated.

  48. Enoch says:

    When someone writes an paragraph he/she retains the plan of a user
    in his/her brain that how a user can be aware of it. Therefore that’s why this
    post is amazing. Thanks!

  49. Diadra says:

    I have been surfing online more than three hours today, yet I never found any interesting article like yours.
    It’s pretty worth enough for me. In my opinion, if all web owners and bloggers made good content as you did, the internet will be much more useful than ever before.

  50. Llesenia says:

    I’m really enjoying the design and layout of your blog.
    It’s a very easy on the eyes which makes it much more
    enjoyable for me to come here and visit more often. Did you hire out
    a developer to create your theme? Fantastic work!

  51. Betzaida says:

    Hmm is anyone else experiencing problems with the pictures on this blog loading?
    I’m trying to figure out if its a problem on my end or if it’s the
    blog. Any suggestions would be greatly appreciated.

  52. Treg says:

    Hurrah! After all I got a web site from where I know how to actually obtain helpful information concerning my study and knowledge.

  53. Loriana says:

    Greate article. Keep posting such kind of information on your
    page. Im really impressed by your blog.
    Hello there, You’ve performed an incredible job.

    I’ll certainly digg it and individually
    recommend to my friends. I am sure they will be benefited from this website.

  54. Elric says:

    Thanks for ones marvelous posting! I seriously enjoyed reading it, you are a great author.I will ensure that I bookmark your blog and may come back down the road.

    I want to encourage continue your great work,
    have a nice weekend!

  55. Deanglo says:

    Thank you for the good writeup. It actually was once a leisure account it.
    Glance advanced to far brought agreeable from you! However, how
    could we keep up a correspondence?

  56. Vincente says:

    What’s up friends, its fantastic article regarding teachingand completely defined, keep it up all the
    time.

  57. Lakyn says:

    Excellent site you have got here.. It’s hard to find quality writing like yours these days.
    I really appreciate individuals like you! Take care!!

  58. Britteny says:

    Hey! I’m at work surfing around your blog from my new iphone 4!
    Just wanted to say I love reading through your blog and look forward to all your posts!
    Carry on the outstanding work!

  59. anon says:

    Is it possible to make a skill that targets both dead and alive allies? I want to heal a selected ally, reviving beforehand if necessary.

  60. Aggron says:

    Say I have a skill that normally hits only one target. I would like to set it up so that the same skill will instead hit all enemies if the user has a specific state (let’s say Poison, or State ID 2 by default). Is such a thing possible with this script? If so, what would the scope condition look like?

    • Hime says:

      Unfortunately, the conditions only apply to the targets based on the scope of the skill. It doesn’t allow you to change the actual scope of the skill.

  61. Wavelength says:

    Hi Hime – wanted to report a bug in this script.

    Using the right-carat character ” > ” in a condition seems to end the tag early, often resulting in a TRUE evaluation where it’s not intended. For instance, your “greater than half HP” example above ( [scope condition: b.hp > (b.mhp / 2)] ) does not work and will always evaluate to TRUE in my tests.

    This can be worked around by using < and ! in its place; for example [scope condition: !(b.hp <= (b.mhp / 2))] so it’s not a critical issue – but I think this should at least be documented in the instructions.

    Thanks for the great script!

    (Replaced all > < carats with ] [ brackets so the post doesn’t become faulty.)

    • Hime says:

      I’ve updated the script so that you close the note-tag with /> instead of just >

      • Wavelength says:

        Just did a simple test with the new version and it’s working well – thank you for the fix!

        • Hime says:

          It is still not foolproof in the sense that if you had the string /> anywhere in your formula, it would still cut it off prematurely. This could appear in regular expressions for example if you wanted to match on something that starts with > symbol.

          Alternatively, I could provide a note-tag that looks like this
          <scope condition>
          FORMULA HERE
          </scope condition>

          Which would then reduce the possiblity that it will be cut off prematurely.

  62. Juan says:

    How would I have it affect all enemies with the same name as the target?
    Target a slime only slimes affected, but if I target a goblin, only goblins affected? Any ideas if thats possible?

  63. Juan says:

    I read (mostly) the comments left and didnt see what I was looking for. How would I use this to target any enemy and all enemies that are named the same as that enemy. So, I target a slime and all other slimes are targeted as well. I would be willing to give each creature type a state so that the are labeled, if that helps. I need a skill that only chains to the target and other creatures of the same name… thoughts?

    • Hime says:

      b.name gives the target’s name. b.original_name gives the name without the extra letter appended. The problem here is that the scope condition checks whether the target is valid or not, so you will need to store the name somewhere before the condition check occurs as you don’t have reference to the first target after the skill is executed.

      You may be able to use pre-skill effects which allows you to execute an effect before the skill itself is executed along with formula effects which allows you to execute a formula as the effect.

      The effect you might execute may be something like

      $game_variables[10] = b.original_name

      And then your scope condition will check the variable

      b.name.include?($game_variables[10])

  64. Matthew says:

    In terms of 'passive states' applied to enemies to identify a certain monster type, this would allow a skill to function like 'Dia' spells from Final Fantasy I, right?

  65. rubydragon44 says:

    But enemies don't consider this effect, is what I mean.
    I'm okay with the fact that it's about affecting someone and not about targeting or not targeting.
    I know that you can still target anyone using this script. But only the player knows not to use a move against someone who's conditions they don't meet.
    Even when I set them to autobattle, normally enemies use moves that are going to be the most useful, yet they don't see a false in a scope condition to be a consideration of how useful a move is.

  66. rubydragon44 says:

    I'm confuzzled.
    I was trying a Triple Battle System where the members on the left can't hit the enemies on the right and the members on the right can't hit the enemies on the left with most skills
    So my condition was
    scope condition: if a.state?(187); !b.state?(189); end; if a.state?(189); !b.state?(187); end; and nothing happened and I also tried
    a.state?(187) ? !b.state?(189) : a.state?(189) ? !b.state?(187) which that gave me an error

    • Hime says:

      You need to explain what your condition is supposed to mean.

      • rubydragon44 says:

        Oops. I'm sorry. facepalm If user has Left state (187) then target can't have Right state (189). If user has Right state (189), then target can't have Left state (187).

      • rubydragon44 says:

        Okay, I got it.
        scope condition: (a.state?(187) && !b.state?(189)) or (a.state?(189) && !b.state?(187)) or (a.state?(188)) or (!a.state?(187) && !a.state?(188) && !a.state?(189))
        So user has Left and target does not have Right, or Target has Right and target does not have Left, or user has Middle, or user does not have a position.
        :3
        And such works.

        • Hime says:

          Glad to see you've got it sorted out. Presumably when you were asked to explain yourself, you had to think about how you were going to phrase it in a coherent way, which typically means it has to be somewhat logical.

          • rubydragon44 says:

            🙂 Yup.
            There's a problem though. I'm not sure if I should put it on Bithub instead.
            Enemies don't consider the Scope Conditions in their actions.
            That means that an enemy on the right side will try to attack an actor on the left side and fail.

            I also know that there is http://www.himeworks.com/2014/02/23/enemy-action-conditions/
            but I would also wonder if there's a way to have enemies automatically take Scope Conditions into consideration.

          • Hime says:

            This script is not intended to determine whether you can select someone as a target or not, it simply determines whether it has any effect on the target or not.

            Your actors should still be able to pick one of the enemies that it shouldn't be targeting, as a target.

            Another script will be required to actually change who you can target.

    • rubydragon44 says:

      I also tried
      scope condition: (!a.state?(187) && !b.state?(189)) && (!a.state?(189) && !b.state?(187)) which lead to nothing happening

  67. KaizoVorna says:

    You mean Scope Condition? There wasn’t one. It started working properly only when I DID give it a Scope Condition.

    • Hime says:

      I’ll have to see a demo I am not sure how you have it set up.

      • KaizoVorna says:

        Well… It just so happens that I just got a Beta of sorts finished just yesterday if you want to see for yourself. The important thing is that I got it to work, but it’s still weird. I can give you a download link once it finishes uploading.

  68. KaizoVorna says:

    Some sort of very bizarre error is popping up on line 100 of the script. I was fighting an enemy that just happens to have a skill that utilizes this script, everything goes without a hitch UNTIL the enemy uses its last attack before dying. (No other scripts involved in the process, just good ol’ Immortal until at 0% HP then use Skill that Does Not Utilize Target Scopes and remove Immortal afterwards so it dies.) The script causes the game to inexplicably crash at that particular enemy. (And no other enemy that also has final attacks as far as I know.) All I have is the fact that the enemy was paralyzed when it died, so could inability to act or something else cause a bug with it?

    • KaizoVorna says:

      Addendum: Nope, it’s not about the paralysis. Same thing happens normally too.
      It says “Script ‘Tsukihime_Scope_Conditions line 101 NoMethodError occured. undefined method ‘scope_condition_met?’ for nil:NilClass”

      • KaizoVorna says:

        And it magically started working after I made the skill target enemies whose levels are divisible by 1. (In other words, any level.) I have no idea what happened but… At least my project works…?

  69. Cristian says:

    I want to make some enemies (mostly bosses) to certain attack, to make this I want to make if certain switch is OFF the enemy could be target of this attack, how do I make this?

  70. Maliki79 says:

    UPDATE: I kinda figured it out. The reason it wasn’t working was because I was looking for a state which was listed as a Permastate (Thank you for that script as well). So, what would be the syntax for looking for a Permastate? (Looking for a “normal” state does work ok.)

  71. Maliki79 says:

    Hello TH.
    I’m trying to get this script to work via current states, but it’s not working.
    The formula I use is

    b.state?(n)

    where n is the state I’m checking for.
    Is this correct?
    Also, I don’t know if this matters, but I’m trying to use items from the menu outside of battle.

    Thanks for the assistance.

Leave a Reply

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