Skill which removes all of users TP

Status
Not open for further replies.

Gamewolf

Villager
Member
Joined
Feb 20, 2013
Messages
24
Reaction score
0
First Language
Swedish
Primarily Uses
So i basically want to make a skill which does more damage the more tp you got ( which i have succeded in ^^) but i also want the move to set your tp to 0 so you can't just spam it, anyone know how i can do this? With common events the only thing i could wind was changing HP and MP, but not TP.

Grateful for all help.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
In the formula box, you should be able to calculate your damage into a variable, then reduce your tp, then output the variable. Something like this:

Code:
dmg = <damage calculation here>; a.tp = 0; dmg
 
Last edited by a moderator:

Gamewolf

Villager
Member
Joined
Feb 20, 2013
Messages
24
Reaction score
0
First Language
Swedish
Primarily Uses
In the formula box, you should be able to calculate your damage into a variable, then reduce your tp, then output the variable. Something like this:

dmg = <damage calculation here>; a.tp = 0; dmg
Your way is the one i was thinking about, but i must have done something wrong as when the skill is used the game crashes with the error message

Script 'Game_Battler' line 352: SyntaxError occured

unexpected sSTAR, expecting $end

a.tp * a.atk * 0.1 - b.def *1.5; a.tp = 0;

any idea what i did wrong?
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
Yes, you didn't do what I said to do :)


You MUST put the damage calculation into a variable, then change your tp, then return the damage variable.


Using your formula, this, exactly would be what you'd enter:

dmg = a.tp * a.atk * 0.1 - b.def * 1.5; a.tp = 0; dmgThe method expects the formula to return the damage amount, and if you put a.tp = 0 last, it will not.
Try that, and if it doesn't work, post back with the new error message and copy/paste the formula from your skill.
 

Gamewolf

Villager
Member
Joined
Feb 20, 2013
Messages
24
Reaction score
0
First Language
Swedish
Primarily Uses
Yes, you didn't do what I said to do :)

You MUST put the damage calculation into a variable, then change your tp, then return the damage variable.

Using your formula, this, exactly would be what you'd enter:

dmg = a.tp * a.atk * 0.1 - b.def * 1.5; a.tp = 0; dmgThe method expects the formula to return the damage amount, and if you put a.tp = 0 last, it will not.Try that, and if it doesn't work, post back with the new error message and copy/paste the formula from your skill.
Thanks, it works now, and just as i wanted it to, very grateful. Another question since you seem alot better than me when it comes to using custom formulas.

a.atk * 5*(101.to_f-(a.mhp.to_f/a.hp.to_f)*100.to_f) - b.def * 2.5

it's an attack which is supposed to do more damage the less life you got, i made a skill like this but backwards ( more damage the greater ones hp) in the past but i can't remember exactly on which terms i am to use  .to_f since right now the skill only does null damage anytime i use the skill.
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
I think it should be a.hp/a.mhp

because a.mhp/a.hp would always return greater than 1 when you don't have full hp... so 101 - that value*100 will most probably be less than 0 unless you have full HP... so you will have a negative total damage, leading to the null attack...

btw, you don't really need to put all those .to_f there
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
I'm not sure if it's really what you want, but try something like this.

a.atk * 5 * (101 - a.hp_rate * 100) - b.def * 2.5a.hp_rate is the same as saying (a.hp.to_f/a.mhp). So that calculation is already done for you in Game_BattlerBase.
As a note, to convert a constant to a float, you just need to put .0 at the end, rather than adding .to_f (so 10.0 instead of 10.to_f)


And in a calculation, you don't have to convert EVERY operand to a float - as long as you have one at the appropriate time, the whole thing will stay as a float.


In this case, a.hp_rate is already a float, so you don't actually have to do ANY conversions.
 

Gamewolf

Villager
Member
Joined
Feb 20, 2013
Messages
24
Reaction score
0
First Language
Swedish
Primarily Uses
I think it should be a.hp/a.mhp

because a.mhp/a.hp would always return greater than 1 when you don't have full hp... so 101 - that value*100 will most probably be less than 0 unless you have full HP... so you will have a negative total damage, leading to the null attack...

btw, you don't really need to put all those .to_f there
I'm not sure if it's really what you want, but try something like this.

a.atk * 5 * (101 - a.hp_rate * 100) - b.def * 2.5a.hp_rate is the same as saying (a.hp.to_f/a.mhp). So that calculation is already done for you in Game_BattlerBase.As a note, to convert a constant to a float, you just need to put .0 at the end, rather than adding .to_f (so 10.0 instead of 10.to_f)

And in a calculation, you don't have to convert EVERY operand to a float - as long as you have one at the appropriate time, the whole thing will stay as a float.

In this case, a.hp_rate is already a float, so you don't actually have to do ANY conversions.
Well, seems like i shouldn't try to do math this late when i am already tired...

thanks for the help both of you, i am off to bed i think ^^. Just one final thing for Shaz, i didn't know that there existed such fancy things as hp_rate, know any place with a list of things like that? could come in handy in the future :)
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
You've just got to look through the scripts. It's daunting, especially if you're new to it. I learned to program over 20 years ago, and I still struggle with some of the Ace scripts. And I only know about hp_rate because I saw someone else mention it in response to a forum post ;)


In battle, you will be interested in the Game_Battler class and the Game_BattlerBase class. hp_rate is a method in Game_BattlerBase, which means you can call it by doing a.hp_rate or b.hp_rate - you can do the same with all of the other methods there, though not all of them will be useful to you in creating a formula.


I won't close this yet, because you didn't actually indicate whether you tried it and whether it worked.
 
Last edited by a moderator:

Gamewolf

Villager
Member
Joined
Feb 20, 2013
Messages
24
Reaction score
0
First Language
Swedish
Primarily Uses
You've just got to look through the scripts. It's daunting, especially if you're new to it. I learned to program over 20 years ago, and I still struggle with some of the Ace scripts. And I only know about hp_rate because I saw someone else mention it in response to a forum post ;)

In battle, you will be interested in the Game_Battler class and the Game_BattlerBase class. hp_rate is a method in Game_BattlerBase, which means you can call it by doing a.hp_rate or b.hp_rate - you can do the same with all of the other methods there, though not all of them will be useful to you in creating a formula.

I won't close this yet, because you didn't actually indicate whether you tried it and whether it worked.
if you mean the formula you gave me for the second attack, then it worked like a charm, thanks for all the help :)
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
Awesome :)


This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.
 
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:
To whom ever person or persons who re-did the DS/DS+ asset packs for MV (as in, they are all 48x48, and not just x2 the pixel scale) .... THANK-YOU!!!!!!!!! XwwwwX

Forum statistics

Threads
105,853
Messages
1,016,986
Members
137,561
Latest member
visploo100
Top