How to make the most of custom formulae. Part #1

This stuff is genius. I'd have never realized the potential of the formula bar so soon without seeing this!

I do have a question - Could you show me, by chance, the format you might use to have status-effect exploiting skills? I'm still a little bit fuzzy on the use of variables and if statements in the formula bar. To give a more direct example, I mean like this:

Gut Punch: If target has Nausea status effect, then damage = a.atk *2, else damage = a.atk *2 - b.def.

Shatter: If target has Reflect/Wall/Protect/Shell, then damage = a.mat *2 and removes Reflect/Wall/Protect/Shell, else, the skill does nothing.

If I know how to do those, then I think that I could do any status effect I could think of within the system. 🙂

EDIT: I guess, what I mean, is to ask if there is a command, or a default variable to check whether or not an actor has a status effect, or if it must be done through a wider-spread variable web.
state?(id) will determine if the battler has the state based on id inflicted on them. So try if b.state?(id).
In my game I have added the status "Undead" and would like to have the option to cause healing 'damage' to enemies and actors with that status.

I know how to set healing skills to be used on both enemies and actors...that's a standart function in the database, but how do I set the difference of wether it does damage or recover?
Ooh, I would be interested in the answer to Kilravok's question as well. Another question: can you consult an enemy's element rates within a formula? (e.g. if enemy's element rate for Earth is less than 100% then inflict so much damage, otherwise inflict such much damage)
Silly question, does anyone know how the formula box processes skills that target more than one enemy. Does it process each one individually or all at once?
Individually.
Thanks, I haven't had a chance to check how it works.
[deleted post to make a new thread about it instead]
it can make the damage depend on actor id, right?

so, is it possible depends on actor class id???

and how?
replace b with a if the actor is attacking

case b.id; when 1;200;when 2; 4000; else; 0;end;
This tutorial is amazing. It's helping a lot. But I'm curious about the limits of a. and b.


Basically, here's my situation:


I've created some extra stats, and I want them to be affected by the spells and actions taken in battle. So, if you cast X spell, it raises Y stat and lowers Z stat. I can make a common event that increases the stat of one particular person, but I really need it to be universalized so that it calls up whomever the caster of the spell is as well as the target of the spell. The damage box seems to be a potential workaround. How might I code this? I thought about doing it as a state that was applied to the actors, but I just end up in the same scenario all over again: I don't know how to tell the state to change these stats for whomever the target and enemy are.


So could it be something like:


b.stat.atk += 1; if b.stat.atk >= 1; 1; b.add_state(1); else 1; end


With the idea being that the skill adds to the enemy's attack (randomly chosen stat-I've given them custom stats in the enemy note box for this), and if their new stat is at or above a certain level it kills them, and otherwise it just does one damage?


Last question: when it comes to healing spells and buffs, is b. still the recipient of the effect?


Thanks for your hard work- this tutorial really is amazing.
b is always the target.


And maybe:


b.add_param(2) += 1; if b.atk >= 1; 1; b.add_state(1); else; 1; end
@Formar Thanks for the info. Unfortunately, I'm trying to call an xstat variable, and I need the change to be permanent. I know how to do it as a temporary, one time thing:


if b.xstat.pcf + 1 >= 1; 1; b.add_state(1); else; 1; end


But two things are going wrong;


1) It isn't actually increasing the b.stat.pcf permanently- so this doesn't provide me with a cumulative total. How could I modify the code you just gave me to do so?


I tried b.xstat.pcf +=1; if b.xstat.pcf >= 1; 1; b.add_stat(1); else; 1; end But it was just failing. Any idea why?


2) I tried to create a custom state (29) that created death but with different messaging. For some reason:


b.xstat.pcf +1 >=1; 1; b.add_stat(1); else 1; end works, but


b.xstat.pcf +1 >=1; 1; b.add_sate(29); else; 1; end for some reason suddenly didn't work. Any idea why?


If I can't get this to work, is it possible to create a common event that increases the xstat of the user and target permanently as a side-effect of the casting?


I know that $game_actors[1].xstat.pcf += 1 works, when I use it as a common event and call it as part of the spell effect, but unfortunately I don't know how to write it so that it changes [1] to whomever cast the spell and to whichever target the spell had. Is there a variable I can use that will do it? I gather A and B don't work outside of the custom battle formula.


Alternately, is there a way for me to turn the xstats into parameters? that act like normal stats?


Sorry for all of the complicated questions, but this is sort of the heart of my entire game, and after days (and many, many hours) of scouring the web, I can't seem to find an answer to my dilemma. Hoping your code ninja skills can do it!
xstat is from a script. I have no idea what I can or can't do with it.
Well let me rephrase this in a different way.


More generally:


When I do this:


D = <target's stat value>; if D + 5 >= 1; 1; b.add_state(1); else; 1; end


It works just fine.


But when I do this:


d = <target's stat value>; if d + 5 >= 6; 1; b.add_state(1); else; 1; end


It fails entirely.


And when I do:


d = <target's stat vaue>; if d + 5 >= 1; b.add_state(1); else; 1; d = d + 5; end


It also fails.


1) So any idea why the first statement works, but the second statement just fails?


2) Any idea how I can make the last statement work? Basically, it's supposed to create a counter system that builds up D until it finally hits a certain number after a certain number of casts. But...battle script hates me for it.
Could anyone please help me with creating skills like these? Even just one or two is fine.

1. A skill to Throw items akin to how it is in most Final Fantasy games - where you select the Throw command, select an item (such as a weapon) and have it deal damage to an enemy based on  specific damage values, then remove the thrown item from your inventory.

2. A skill to throw money at the opponent similar to the above skill, but instead it will deal damage based on how much money is thrown. (I know of a script that does this, but it always deals damage equal to the amount of money thrown instead of having any variance or being x amount of gold be worth x amount of damage.)

3. A skill that increases in power based on how many steps you've taken.

4. A skill that increases in power based on your total game playtime.

5. A skill that grows in power every time that you use it within a given battle, but resets back to default damage after the battle ends.

6. A skill like the one above, but have it grow in power based on how many turns have elapsed in battle.

7. A skill that deals damage based on the difference between the user's current and max HP (like the skill Minus Strike in FF9, if you're familiar with it).

8. A skill that performs a follow-up attack in the event that the attack misses the first hit (the idea is to make a skill which will perform another attack that is much stronger than the normal version in the event that the enemy evades that first attack)

9. An attack which increases in power if the enemy is already afflicted with a specific state, or will only connect with enemies who are already afflicted with a specific state.

10. An attack that deals random damage within a certain damage range, but has a certain chance of dealing damage in certain ranges (for example, an attack that has a 1% chance of hitting for 9999, a 70% chance of hitting for 100-1000 and a 29% chance of hitting for 1001-5000)

11. This one is a bit complicated... And I honestly doubt it can be done... Is there a way to make a skill that changes attributes based on the user's attack element (if it makes it easier, the element change is invoked through a state)? Specifically, I have a Spellsword and he has skills like Fire Invoke and Ice Invoke which grant him a state that transforms his attack attribute to that element. I want to make another skill that, depending on which Invoke he has enabled at the moment, will be of that element and also have the potential to inflict a specific state (for example, using this skill after using Fire Invoke will turn it into Fire Element and have a chance to afflict Burn status).
1. A skill to Throw items akin to how it is in most Final Fantasy games - where you select the Throw command, select an item (such as a weapon) and have it deal damage to an enemy based on  specific damage values, then remove the thrown item from your inventory.
You could have a throw skill for each item. If you had an event that each term worked out which throw skills to give the player then this could work.
$game_party.lose_item($data_items[x], 1);400-b.def

2. A skill to throw money at the opponent similar to the above skill, but instead it will deal damage based on how much money is thrown. (I know of a script that does this, but it always deals damage equal to the amount of money thrown instead of having any variance or being x amount of gold be worth x amount of damage.)
You could do this if you had set amounts e.g. "Throw 500G"
$game_party.gain_gold(-500);500 * x

3. A skill that increases in power based on how many steps you've taken.
$game_party.steps
4. A skill that increases in power based on your total game playtime.
$game_system.playtime
5. A skill that grows in power every time that you use it within a given battle, but resets back to default damage after the battle ends.
Use a variable to track the uses then reset it every battle.
$game_variables[x] += 1;($game_variables[x] * 50) - 2 * b.def

6. A skill like the one above, but have it grow in power based on how many turns have elapsed in battle.
You could have an event that adds 1 to a variable every turn and resets at the beginning of every battle.
($game_variables[x] * 50) - 2 * b.def

7. A skill that deals damage based on the difference between the user's current and max HP (like the skill Minus Strike in FF9, if you're familiar with it).
a.mhp - a.hp
I'll pass 8

9. An attack which increases in power if the enemy is already afflicted with a specific state, or will only connect with enemies who are already afflicted with a specific state.
This has been asked before read through the thread.
10. An attack that deals random damage within a certain damage range, but has a certain chance of dealing damage in certain ranges (for example, an attack that has a 1% chance of hitting for 9999, a 70% chance of hitting for 100-1000 and a 29% chance of hitting for 1001-5000)
case rand(100);when 0;9999;when 1..29;rand(4000) + 1001;else;rand(901) + 100;end;
11. This one is a bit complicated... And I honestly doubt it can be done... Is there a way to make a skill that changes attributes based on the user's attack element (if it makes it easier, the element change is invoked through a state)? Specifically, I have a Spellsword and he has skills like Fire Invoke and Ice Invoke which grant him a state that transforms his attack attribute to that element. I want to make another skill that, depending on which Invoke he has enabled at the moment, will be of that element and also have the potential to inflict a specific state (for example, using this skill after using Fire Invoke will turn it into Fire Element and have a chance to afflict Burn status).
This could be done but you're going about it wrong. Rather than changing the attribute you should just do something like:
dmg=500;d,g*=element_rate(element_id)


But why not just have separate skills that the state adds?
You could have a throw skill for each item. If you had an event that each term worked out which throw skills to give the player then this could work.

$game_party.lose_item($data_items[x], 1);400-b.defYou could do this if you had set amounts e.g. "Throw 500G"

$game_party.gain_gold(-500);500 * x$game_party.steps$game_system.playtimeUse a variable to track the uses then reset it every battle.

$game_variables[x] += 1;($game_variables[x] * 50) - 2 * b.defYou could have an event that adds 1 to a variable every turn and resets at the beginning of every battle.

($game_variables[x] * 50) - 2 * b.defa.mhp - a.hp

I'll pass 8

This has been asked before read through the thread.case rand(100);when 0;9999;when 1..29;rand(4000) + 1001;else;rand(901) + 100;end;This could be done but you're going about it wrong. Rather than changing the attribute you should just do something like:

dmg=500;d,g*=element_rate(element_id)

But why not just have separate skills that the state adds?
Oh wow, thanks for all those!

But I have a couple more questions related to your answers...

In regards to #4... How exactly is the game time factored in? Seconds?

And in the case of #10... could you explain that step by step? So in the event I need to change some of the values, I can.
Seconds I believe.


And 10 just checks a random number in the intervals you defined 1% and 29% then everything else.
Great thread so far.
I can't go to the other websites, so it's kinda odd to see random text commands appear as answers.
(Such as seeing someones question being answered with critical=true, when I've never seen that text command.)

After reading it all, I found a few shortcuts to plans I orginally made, which involved making 16+ copies of most of my abilities (unique to each person).

But in a new shortcut I came up with, it involves using TP to change a persons state.
(aka, if they are at 25% 50% 75% and a 100%, they change to a state that corresponds to the %.)

But in eventing, I cant find a conditional branch that checks TP, nor setting variables to = TP.

Is it possible to use a work around within battle formulas, which cause a state change, if they have TP and then change state? (literally added into almost every spell this character has.)

Original thread: https://forums.rpgmakerweb.com/threads/how-to-make-the-most-of-custom-formulae-part-1.1143/