Tsukihime 1,489 Posted May 17, 2012 (edited) FP: Conditional Effects Author: Tsukihime Overview Ever wanted to make sure that item/skill effects are only activated when certain conditions are met? Features Specify that critical hit must occur in order to activate effects Specify that a formula must be satisfied to activate effects Usage The critical condition is straightforward: if your attack was a critical hit, the effects will be activated. Otherwise, they won't. Just tag your skills/items with <fp:ce crit-hit> Now...the real functionality in this script comes with formulas. To specify a formula, use the tag <fp:ce f [formula]> For the formula, it is a little more challenging. You will need some knowledge of ruby syntax (mainly comparisons), and you will need to be able to do basic math. But it is straightforward if you know what they are. All formulas must be in the form of truth statements. That is, they must evaluate to true or false. The operators that you will be using are <= less than or equal to < less than >= greater or equal to > greater than == equal != not equal Of course, you are not limited to comparison. Any ruby statement that evaluates to true or false is valid, for example checking for substrings: <fp:ce a.name.include?("slime")> You will likely be using math operators + add - subtract * multiply / divide. Returns the quotient of a division operation % mod. Returns the remainder of a division operation The keywords are "a" and "b", where a is user, and b are the target(s). You can also specify variables using "v" and switches using "s" Let's look at some simple truth statements: <fp:ce f a.atk < b.def> This means that the effects will only activate when the user's attack is less than the target's defense. Might be useful if you want to implement some sort of "guard break" skill that is only effective when the enemy's guard is decently high. You can imagine the kinds of things you can do with formulas. How about a "level 5 death" spell? Only targets that have a level that is a multiple of 5 will be affected by this skill. <fp:ce f b.level % 5 == 0> We check whether the remainder of level / 5 is 0 (definition of multiple of 5), and then add "Death state" if it's true. Download script: http://db.tt/LJVjslBy Notes I am trying to find a good way to make it so that you can specify conditions for individual effects rather than all effects, but the only reasonable way is to specify an index of the effect (since it's stored in an array). Edited May 31, 2012 by Tsukihime 1 Share this post Link to post Share on other sites
Anema 3 Posted May 31, 2012 Additional examples for the syntax would be awesome. Great script, I'm working with it now to try to create a Skill that can only be used on one character. A Knight of Darkness serves the Vampire Queen, and when he has the Death State, she can use her ability "Loyal Beyond Death" to bring him back as a Death Knight. I'm going to mess around with it a while, but what is the syntax that should go in the skill's notebox? <fp: ce f b.name == Derevius> ? (Derevius is the name of the Knight). b.actor_id? Share this post Link to post Share on other sites
Tsukihime 1,489 Posted May 31, 2012 (edited) <fp:ce f b.name == "Derevius"> However, this doesn't say much about actual targeting. You might need to set the scope to "all allies" so that you don't rely on the engine to randomly pick the specific enemy. Edited May 31, 2012 by Tsukihime Share this post Link to post Share on other sites
Anema 3 Posted May 31, 2012 I've set the ability to only work on One Ally (Dead), of course. I'm using <fp:ce f b.actor_id == 006> to check whether the Knight is targeted, and it works, for the most part. When I'm using that tag, though, it removes the Death State properly, but it doesn't apply the Death Knight state. When I remove the tag, the Death Knight State is properly applied, and the Death State is properly removed. Any ideas what is preventing the Death Knight state from being applied while I'm using the <fp:ce f b.actor_id == 006> note tag? Share this post Link to post Share on other sites
Tsukihime 1,489 Posted May 31, 2012 (edited) Turns out the issue was actor_id isn't exposed to the public. If the code fails I just catch the exception and return false (eg: doesn't work), but that probably makes it difficult to debug. class Game_Actor < Game_Battler def actor_id @actor_id end end You will need to add this if you want to access actor_id Edited May 31, 2012 by Tsukihime Share this post Link to post Share on other sites
Anema 3 Posted May 31, 2012 Perfect, thank you! I can think of a million ways to utilize this script! Share this post Link to post Share on other sites
Ryluin 0 Posted March 9, 2014 Hi Tsukihime, Thanks for the script, it works great. I know it's an old script but I wondered what you thought about updating it, and adding something similar to Jet's Self Effects script where you can specify which effect is used by the script. Right now your script applies all effects when conditions are met, but it would be extremely useful to be able to target specific effects. For example: I can't have an attack that deals damage, heals the user AND does something else on a critical hit. For quick reference here's Jet's script: http://blog.rpgmakerweb.com/wp-content/uploads/2012/05/SkillSelfEffects.txt Cheers Share this post Link to post Share on other sites
Tsukihime 1,489 Posted March 10, 2014 I am not planning to add anything to this script because I don't like it and discourage any use of it. Share this post Link to post Share on other sites
Ryluin 0 Posted March 10, 2014 Fair enough, thanks for your reply. I'm glad you said what you did actually because as a result I've now got Lunatic Damage running and have achieved exactly what I wanted. Cheers Share this post Link to post Share on other sites
Tsukihime 1,489 Posted March 10, 2014 (edited) Lunatic Damage is definitely much more flexible than this script. Going to have this topic locked to indicate that it is no longer supported. Edited March 10, 2014 by Tsukihime Share this post Link to post Share on other sites
Galv 1,387 Posted March 10, 2014 Locked at OP's request - no longer supported Share this post Link to post Share on other sites