formulas not dealing damage

Manofdusk

Veteran
Veteran
Joined
Apr 26, 2014
Messages
211
Reaction score
39
First Language
English
Primarily Uses
 I'm having a little trouble with my overdrive formulas (overdrive damage scales with tp then sets tp to 0)

these three formula don't deal any damage for some reason:

c = a.tp; ((a.atk * a.mdf) - b.def) * (1+(c/25));  a.tp = 0

c = a.tp; (a.mat * (1+rand(6))) * (1+(c/25)); a.tp = 0

c = a.tp; b.result.critical=true; ((a.atk * a.mdf) - b.def) * (1+(c/25)); a.tp = 0

this one works just fine though
c = a.tp; d = ((a.atk * a.mdf) - b.def) * (1+(c/25)); a.tp = 0; b.state?(47) ? d * 2.5  : d

I'm not sure what I'm missing.
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
5,592
Reaction score
6,522
First Language
Indonesian
Primarily Uses
RMVXA
Try to put the formula in the end of line.

For example :

Code:
c = a.tp;  a.tp = 0;  ((a.atk * a.mdf) - b.def) * (1+(c/25))
 

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
damage is always the last part (or in explicit return cases, the return value that you set) so on your code the last part will be a.tp = 0 meaning it will be the one used as the damage value, which will then be 0. The last formula worked because the last part will return either d*2.5 or d which has non-zero values
 
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
c = a.tp; ((a.atk * a.mdf) - b.def) * (1+(c/25));  a.tp = 0


c = a.tp; (a.mat * (1+rand(6))) * (1+(c/25)); a.tp = 0


c = a.tp; b.result.critical=true; ((a.atk * a.mdf) - b.def) * (1+(c/25)); a.tp = 0
Yep, you can do all sorts of weird and wonderful stuff in the damage formula, but the last part MUST be the damage itself. In your first 3 statements, you end with


a.tp = 0


That's just going to return true (probably - because you're doing an assignment which succeeds). It does NOT provide a value to pass back to the script.


If you want to make the middle bit the actual damage and leave the user with no tp, do it like this:


c = ((a.atk * a.mdf) - b.def) * (1 + (a.tp / 25)); a.tp = 0; c


c = (a.mat * (1 + rand(6))) * (1 + (a.tp / 25)); a.tp = 0; c


b.result.critical = true; c = ((a.atk * a.mdf) - b.def) * (1 + (a.tp / 25)); a.tp = 0; c


Some of those brackets are superfluous, too. Remember the mathematical order of operations.


This:


((a.atk * a.mdf) - b.def) * (1 + (c / 25))


is the same as this:


(a.atk * a.mdf - b.def) * (1 + c / 25)
 
  • Like
Reactions: BCj

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

Latest Threads

Latest Posts

Latest Profile Posts

Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
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

Forum statistics

Threads
105,857
Messages
1,017,018
Members
137,563
Latest member
MinyakaAeon
Top