How do I use a damage formula for damage on the overworld?

Status
Not open for further replies.

Binder28

Veteran
Veteran
Joined
Sep 15, 2020
Messages
111
Reaction score
31
First Language
Portuguese
Primarily Uses
RMVXA
I want my character to take damage on the overworld based on a damage formula...it goes like this

damage: 2 - AGI +1

Basically there is a fixed damage that is decreased by the characters agility stat, but the minimum damage is 1...I got the agility as a variable if that helps, but I don't know how to deal damage based on the damage formula...the "decrease HP" only let's me deal damage based on a flat number or a variable...
 

DawoleQ

Villager
Member
Joined
Sep 24, 2021
Messages
13
Reaction score
9
First Language
Polish
Primarily Uses
RMVXA
You could put the equasion in a variable and the do "decrease HP" with that variable like so:
In a script call event:
$game_variables[ID] = 2 - $game_variables[AGI_variable_ID] + 1

And after that the "decrease HP" event with the first variable as the value.


Hope I helped :thumbsup-right:
 

Binder28

Veteran
Veteran
Joined
Sep 15, 2020
Messages
111
Reaction score
31
First Language
Portuguese
Primarily Uses
RMVXA
You could put the equasion in a variable and the do "decrease HP" with that variable like so:
In a script call event:
$game_variables[ID] = 2 - $game_variables[AGI_variable_ID] + 1

And after that the "decrease HP" event with the first variable as the value.


Hope I helped :thumbsup-right:

I think there is a problem...I've tested it with 50 agility and it healed me lol...probably because the variable went to the negatives...I need it to deal 1 damage if the stats is greater than necessary...
 

DawoleQ

Villager
Member
Joined
Sep 24, 2021
Messages
13
Reaction score
9
First Language
Polish
Primarily Uses
RMVXA
I think there is a problem...I've tested it with 50 agility and it healed me lol...probably because the variable went to the negatives...I need it to deal 1 damage if the stats is greater than necessary...
Ok, then do it like this:
In the script call:
$game_variables[ID] = 2 - $game_variables[AGI_ID]

$game_variables[ID] = 1 if $game_variables[ID] < 1

And then the decrease HP event.


That should work perfectly even with 50 AGI
 

Aoi Ninami

Veteran
Veteran
Joined
Sep 22, 2015
Messages
520
Reaction score
694
First Language
English
Primarily Uses
RMVXA
I suspect that what you originally wrote for your formula is not what you intended.

"2 - AGI + 1" would output 2 at AGI 1, 1 at AGI 2, 0 or negative if AGI is 3 or above.

Even if you correct it by imposing a minimum of 1, the output can only ever be 1 or 2.

Maybe write a short list in the form "at AGI __, I want the output (damage amount) to be __" and then it will be easier for us to tell you what the correct formula would be?
 

gundambison

Veteran
Veteran
Joined
Jun 11, 2014
Messages
123
Reaction score
22
First Language
English
Primarily Uses
Making formula is not easy. But you are already have the basic formula, then is good for you.
but sometime calculated damage based AGI, STR, VIT etc is not simple as

Code:
DamageReceive = DamagePure + (something increase damage) - (something decrease damage)
* something increase/decrease like elemen stuff

Sometime we need to make process like this
rawCalculate = bla-bla (you can use above suggestion or yours)

//condition for agi to evade (%)
if( you can avoid) result =0;
//calculate str
if( result > 0) result = result - strDecreaseDamage;

if(result< 0) result = 0;

damage = rounded( damage );

since the problem is.. there is formula that's make heal instead damage.. then you need to add condition
Code:
if(damage <= 0) damage =0;
hope this help you..
 

Binder28

Veteran
Veteran
Joined
Sep 15, 2020
Messages
111
Reaction score
31
First Language
Portuguese
Primarily Uses
RMVXA
I've done it....I just used the first formula and put it in a conditional branch that checked if the agility was high enough to make the damage zero, in that case you just take 0 damage =) thanks, it's working now
 

hiddenone

Lurker Extraordinaire
Global Mod
Joined
Feb 19, 2014
Messages
2,895
Reaction score
6,001
First Language
english
Primarily Uses
RMMZ

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.

Latest Threads

Latest Posts

Latest Profile Posts

Learn how to do custom face parts with my latest tutorial!
Generatorpartsfromscratch.png
The Legion
T7T0hR2.gif
Made a title screen, and by ''made'' I ofc mean I slapped a simple title on some cool art I bought xD This side project might be fun.

sIMPLE.png
CDF.png

Trying for a Classical RPG with Pokemon Elements. Capture monsters like Zombies and Harpys and use them on your team.
ow28O4A.png

Astarte in her usual demeanor: mocking people.

Forum statistics

Threads
129,872
Messages
1,205,837
Members
171,049
Latest member
Azkaelika
Top