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

Ahh... so you'd like the user to lose hp equal to the heal to the target?

then it would be... IDK if this works though...

b.state?(ID)? a.hp -= damage ; -damage : damage
It gives me the error because in that formula the ; cannot be used (I also tried a , to se if I could do multiple things that way..... hold on, just thought of something else....... oh well, trying a () around both effects and using a , within those (), didn't work. Hmmmmmm......

Let's go to basics... How do we have an ? evaluation allow us to do multiple effects to the left of the : or even to the right of the :
Could anyone please help me with creating skills like these? Even just one or two is fine.

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.
Anyone, please correct me if I'm wrong on this, but you can use the b.state?(ID)? EFFECTA : EFFECTB where b is the target (or a if you want to see if the attacker is afflicted by the state, such as FFXII's blind sight attack (only hits if you are blind)), ID is the Id of the state you want to see if they have, and EFFECTA and B are the effects you want to occur (A if in the state, B if not afflicted).
You need a semi-colon between lines of script in the formula box.

a.add_state(27); 2 + a.atk - b.def
Brilliant!!!! I just tried it out myself. I was using the bonus script for SkillSelfEffects from the RPGMaker Tutorials for VX Ace (the one with the Lunge Tutorial), but couldn't get the script to work (kept getting nil errors). Adding the add_state command into the formula bar works exactly as I want it to.
Is it possible to make a skill which only hits if the opponent is already afflicted with a specific state?

Like for my idea, you would have a skill called Knockdown, which would... knock the enemy down.

Then you would have an attack called Execute which would instantly kill the foe, but would only work if they were afflicted with Knockdown state.
I responded to the first time you asked. Sorry, I just started on this forum (and using RPG MAker VX Ace).
The Problem is

Formulae are only calculated if the skill hits. It would be easier to deal no dmg if the state isn't applied.

b.state?(<id>)? 9999 : 0;

<id> must be switched with the id of the state and remove the zeros at the beginning (009 => 9)

It is possible 2 make something with aren't hitting at all with a workaround but i think this isn't necessary in that case.

regards Bot
With Taka's stated Execute skill you could do b.add_state(1) to add the death state if the formula evaluates as true.
Is it possible to make a skill which only hits if the opponent is already afflicted with a specific state?

Like for my idea, you would have a skill called Knockdown, which would... knock the enemy down.

Then you would have an attack called Execute which would instantly kill the foe, but would only work if they were afflicted with Knockdown state.
Personally I think Bot's workaround for the Execute skill you mentioned is a bit longwinded. Try the following

b.state?(ID)? b.add_state(1) : 0

where ID is the number of you Knockdown state. This will add state 1 to your target (1 being the death state) if they are in the knockdown state. Else it will deal 0 damage (i.e. miss)

For this to work I think you will need to add a feature to the death state which reduces the targets hp to 0. OR you could make a state called something like Kill, which reduces the target's hp to 0, and just use the Kill state id in the add_state part of the formula.

A final way you could do it is

'b.state?(ID)? b.hp = 0 : 0'

this I think will be the most effective way because it will reduce the target's hp to 0 if they are in the knockdown state.

I just tested it both with the add_state and the b.hp=0 formula and both result in the display of "takes no damage" followed by the slain message. They formula works. If they are actually in the state that doesn't allow them to be executed then it just says takes no damage, which I think is what you're looking for.
I am trying to make a spell that sacrifices the user, killing them and heals/revives the target for the caster's current health. Kinda like an explosion spell that heals rather than used for damage.

How would I do this?

I tried using a formula I seen for explosion spell and changed to healing but didn't work.

c = a.hp; a.add_state(1); c^^ above formula works great to damage, but doesn't to squat to heal.

Edit: I had the Scope set to One Ally (Dead), works fine on One Ally. 😛

However, the spell doesn't work on dead allies.

How do I get it to remove death from a dead ally, and not let it affect the user if he is targeted with his own spell?
Try 'c=a.hp; a.add_state(1); b.state?(1)? b.remove_state(1): c'

and set you damage type to HP Recover in the box that has HP/MP Damage/Drain/Recover.

Also, I'm waiting on an answer to my question about multiple effects when using the b.state?(ID)? et al evaluations. Until then try a modification of the formula as follows

c=a.hp; a.add_state(1); if b.state==1 then b.remove_state(1); c; else c; end

I am not sure if remove_state is the proper key term for removing a state.
@ Ministry There's no way to add those kind of value in the status effect box by default. But thanks for your reply. @ adiktuzmiko When I put like -2 in the box though, it gets automatically back to the +1 value.
Hmmmmm..... interesting problem. While using a state to set a parameter such as atk and def to effective buffs and debuffs, I can only do it via percentages rather than +/- values, i.e. I could raise/lower/ atk/def each by whatever amount I want via states and set the duration. But, as far as the skill itself doing a buff/debuff like that, you are right, I can't get the grow option to allow a negative value (it becomes +1)
voymasa, please avoid double posting, as it is against the forum rules. You can review our forum rules here. Thank you.


You can reply to multiple posts at once by clicking the multiquote button, or edit your last post if you have something to add in quick succession.
voymasa, please avoid double posting, as it is against the forum rules. You can review our forum rules here. Thank you.

You can reply to multiple posts at once by clicking the multiquote button, or edit your last post if you have something to add in quick succession.
Sorry.

Can you explain how to multiquote, to me (its mechanic). I'll experiment with it.
There is a multiquote button on all posts.  Click it on each post you want to answer.
voymasa, please avoid double posting, as it is against the forum rules. You can review our forum rules here. Thank you.

You can reply to multiple posts at once by clicking the multiquote button, or edit your last post if you have something to add in quick succession.

There is a multiquote button on all posts.  Click it on each post you want to answer.
Okay, I see now. Does this work if I scroll between pages before making the reply? Will it let me move to another page of this same topic to quote someone else in the multiquote? I'm new to this forum so I was catching up on 9 pages of the topic and trying to help out or get help during the discussion.
So what happens if a skill using a formula with a.level in it is used by an enemy?

For example, if my formula is a.atk * 4 + a.level * 3 - b.def * 2, what happens?

Does it ignore the level calculation?

Does the game crash?

If not, how does it factor it?
you could just try it yourself...

it'll return 0
So what happens if a skill using a formula with a.level in it is used by an enemy?

For example, if my formula is a.atk * 4 + a.level * 3 - b.def * 2, what happens?

Does it ignore the level calculation?

Does the game crash?

If not, how does it factor it?
I use a variable to store the damage formula I want to use, and I also use a conditional to check if the damage will be <1. If it is I have it deal 1 damage (still using 20% variance, so it will sometimes do 0, but I like that), otherwise it returns the variable+whatever factor you want to add based upon the a.level. If you multiply it will return 0 for the enemy because the enemy's level is a nil value (they don't have one).

My damage formula for regular attack is thus:

v[3]=((a.atk/b.def)*a.atk*0.6);v[3]<1? 1: v[3]+(a.level*0.75)

That stores the initial formula in my third variable (I named it Random Number), and then checks if that variable (v[3] in my database) is less than 1, so that allies and enemies will still have a chance to deal damage to a high defense opponent. Otherwise it executes what is to the right of the : which is the damage formula result stored in the variable, to which I add 3/4 of the attacker's level (obviously adding 0 for the enemies). VX Ace "doesn't handle low stats well" according to some, but that's with the standard formula (atk*4-def*2) which multiplies the attack value a lot higher than defense. Have fun with the formula bar.

you could just try it yourself...

it'll return 0
Yep. I decided to add a little extra if it is the player though (+ a weighted level multiplier) to emulate increase in weapon skill (still don't have a good enough grasp of scripting with Ruby to do a weapon skill system, etc).
I think I'm getting it little by little, I mean I don't play enough with complex formulas, and I should definitely mess around with that more especially for these really cool effects. Here is one I am thinking about:

There is an enemy called Sisyphus. He has the habit of instantly restoring his health once he gets below 12% of max HP. But this spell also has the effect  of inflicting the party with attack and defense debuff.

So I'm looking for an attack that hits all enemies and heals user at the same time.
I think I'm getting it little by little, I mean I don't play enough with complex formulas, and I should definitely mess around with that more especially for these really cool effects. Here is one I am thinking about:

There is an enemy called Sisyphus. He has the habit of instantly restoring his health once he gets below 12% of max HP. But this spell also has the effect  of inflicting the party with attack and defense debuff.

So I'm looking for an attack that hits all enemies and heals user at the same time.
I would recommend set it as an HP Damage vs All Enemies (I assume you know which two options those are). In the formula bar use:

a.hp=a.mhp; b.add_state(ID); b.add_state(ID)

Where ID is the number of the state of the debuff. I like using states to debuff (you will have to set up each state and duration) because it allows you to control the duration and specific amount of the debuff (normal debuffs are 25% in VX Ace).

After setting up the states and the skill, go to the Enemy tab and under that enemy add the skill in their attack routine with a high priority and under the circumstance that their HP is below 12%.

Another way is to add both states via the features section (at a rate of 100%) while leaving the hp gain in the above bar. I believe that will remove the 0 damage message.

Now, I hope you have a way that the player can actually beat Sisyphus (because as you described it, every time they drop below 12% they will be prioritizing instant healing.) Now, you can play around with the states so that you add a state to Sisyphus with a 1 round duration that heals 100% hp, because that will allow you to use a message to tell the player that he healed up. Otherwise he will be fully healed without telling the player.
Oh yeah, basically Sisyphus will have generally low defenses and by the time you do meet it, you'll be able to blast him. But it's all on your timing. Don't worry I'm not going to make it too crazy. This fight will be tested many times.

I have a message in my troop event where Sisyphus says something then heals. Then the one controlling Sisyphus says something. So it is pretty clear when he heals up.

And the fight is looking great. Everything is falling within range just wonderfully. Fight isn't as tough as one might think...

I now have a skill similar to what Sisyphus does called Ice fortress. I might just turn it into a simple shield all spell but what if I wanted it to do what the Sisyphus spell does, except since its a damage all spell, I have to have the add state part apply to my entire party?

Basically:

Damage all enemies and add fortress state to all allies.
I just want to point everyone here to this topic:

http://forums.rpgmakerweb.com/index.php?/topic/18034-random-and-unwanted-mp-gain-while-in-auto-battle/

The problem described there will probably apply to most effects added here as well, and Mithran provides the reason and a tip how to prevent that in the other topic.
Hey there, I am new to RGSS and have not done any scripting in quite some time. Anyway, for my RPG I am trying to create a set of Alchemy Skills that are enabled when characters equip a certain accessories.

Based on skimming through this, I wound up with this formula:

rand(10); when 1..7; $game.party.item[1]+=1; end; else 0;

However, when I use this in battle, it generates 99 of my first 7 items.

My understanding here is that I am generating a number between 1 and 10, and then when that number equals anywhere 1-7, it will generate the item, otherwise it will do nothing.

Can anyone tell me where I'm going wrong, here?

As well, since space is limited in the actions box, how can I output success/failure messages, to notify the player whether the attempt was successful or not?

Am I over-reaching here? Or over-thinking?

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