Buff Charge based on TP

[solved]

The hero uses a CHARGE skill.

This skill consumes all his TP in order to add a buff state.

This Buff State power is based on how much TP he had.

Ex: Hero has 50 TP. He uses CHARGE. The buff will raises power +50%.

--------------------------------------------------------------------------------------------

Heres a walkthrough to how I simulated this effect:

1. Tskuhime's Skill Change Script - http://www.himeworks.com/2013/05/19/skill-change/

2. A CHARGE skill to add the CHARGE state.

3. Two variations of the same attack skill: Regular and Charged

4. On the regular skill notebox place

<skill change>
     id: 305
     condition: a.state?(x)
</skill change>


X = state ID

5. On the charged skill use the formulae

d="ATK formula here" + a.tp* 5; a.tp=0; a.remove_state(x);d

6. Done!

--------------------------------------------------------------------------------------------

It's a frankenstein's monster, but It works.

I rather have a script for it. A skill would consume and store the TP value in a variable and add a state. This state would multiple the skill power by the variable, then clear the variable.

I'm not good enough to handle such script though.
you can make 1 state per TP value... and use a conditional check via the damage formula for example to determine which to add...
you can make 1 state per TP value... and use a conditional check via the damage formula for example to determine which to add...
Hmm. This would take a really long time, but if I don't find any other way I think this is going to be the way.

Can you give me an example of conditional check on damage formula?
Well, I'm having a really hard time figuring this out.

I've created a skill called CHARGE. It just add a CHARGE state.

For the attack skill, I made a custom formulae that checks if the state is applied.

if a.state?(36);b.physical_attack(a, 😎 + a.tp * 50; else; b.physical_attack(a, 😎 ;end

The problem here is:

- If the CHARGE skill consume all TP, wont be possible calculate the formula.

- The attack skill can't consume all TP 'cause it can be usable without charge.

- If I add a a.tp=0 on the formulae, it will consume all TP before and wont be possible calculate the attack.

Little help here?!
Do something like this:

Set the CHARGE skill to require (whatever minimum TP)

Set the damage formula to:

v=a.tp;a.tp=0;v*50

This preserves the TP value in "v", clears the TP value and returns v*50 for the damage value...
Do something like this:

Set the CHARGE skill to require (whatever minimum TP)

Set the damage formula to:

v=a.tp;a.tp=0;v*50

This preserves the TP value in "v", clears the TP value and returns v*50 for the damage value...
Wow!

This was very helpful! Didn't know about this "preservation" command!

This works like a charm!

Thanks A LOT!

Edit:

For other people with the same problem, heres is the formula:

if a.state?(36);v=a.tp;a.tp=0;b.physical_attack(a, 😎 +v* 50; else; b.physical_attack(a, 😎 ;end
Glad to help, Nugem.

To avoid confusion:  there is no real "preservation" command.  

I'm relying on a nifty little trick in Ruby (the scripting language which runs inside RPG Maker):

The trick is:  The last expression is always the return value for the function.  And Ruby will create a variable on demand.  And Ruby considers a semicolon the end of a statement.  So, what I'm doing is saying "Create the variable named 'v' and assign it to a.tp"  Then, when the next statement clears a.tp, the value is preserved in the just-created variable 'v'

And, the last value after the last semicolon (v*50) becomes the return value for the damage formula.

So, if you used Java, the same code would look like this:

int v=a.tp;

a.tp=0;

return v*50;
Glad to help, Nugem.

To avoid confusion:  there is no real "preservation" command.  

I'm relying on a nifty little trick in Ruby (the scripting language which runs inside RPG Maker):

The trick is:  The last expression is always the return value for the function.  And Ruby will create a variable on demand.  And Ruby considers a semicolon the end of a statement.  So, what I'm doing is saying "Create the variable named 'v' and assign it to a.tp"  Then, when the next statement clears a.tp, the value is preserved in the just-created variable 'v'

And, the last value after the last semicolon (v*50) becomes the return value for the damage formula.

So, if you used Java, the same code would look like this:

int v=a.tp;

a.tp=0;

return v*50;
I see. I realised that after analysing the code a bit.

But I really appreciate your explanation.

I'm just in my first week of game dev. school, everything I know is self taught so I'm pretty clumsy.

Thanks for your time, pal.

Original thread: https://forums.rpgmakerweb.com/threads/buff-charge-based-on-tp.26370/