Status
Not open for further replies.

Korimax

Architect of Procrastination
Veteran
Joined
Apr 3, 2013
Messages
941
Reaction score
41
First Language
English
Primarily Uses
N/A
Okay basically I am asking how exactly I set up a battle formula when I want a skill to deal 50% of the target's current HP, I know how to do total HP by using a Negative Heal, but I don't know how to use Current HP.

Also if it is at all possible, I was wondering if it were possible for skills to have a sort of conditional damage, like if the target's HP falls below a specific % then it deals a specific amount of damage rather than 50% (That or just additional damage alongside the 50% when it gets that low).

EDIT: ALSO, I apologize if somehow I am posting this in the wrong place. (I do believe I am right, but I could somehow be mistaken.)
 
Last edited by a moderator:

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
33,371
Reaction score
8,395
First Language
German
Primarily Uses
RMMV
the damage formula can process any ruby operation, that includes checking conditions and more.

But for your half.damage, the formula is very simple - you just have to remember that a is the placeholder for the user and b the placeholder for the target. So your formula is simply:

Code:
b.hp/2
Place that in the skills damage formula and it will always deal half of the current HP of the target as damage (rounded down in case of uneven numbers)
 

Korimax

Architect of Procrastination
Veteran
Joined
Apr 3, 2013
Messages
941
Reaction score
41
First Language
English
Primarily Uses
N/A
*Sigh* I should have realized it was divided by 2, I was being a bit ignorant. (I was trying to write it out as b.hp-50%)  :guffaw:

Anyway, thank you for answering my question, any chance you might be able to answer the 2nd part. (I kinda just need to know if I need scripts or something of that nature for that really.)
 

Zevia

Veteran
Veteran
Joined
Aug 4, 2012
Messages
661
Reaction score
374
First Language
English
Primarily Uses
RMMV
For the conditional, you can do an if statement in the damage formula, too. So, let's say if the target is under 30% health, then you want the ability to deal 100 damage, and otherwise, it does 50% of their current HP. For the damage formula box, do:

if (b.hp*1.0)/(b.mhp*1.0)<0.3;x=100;else;x=b.hp/2;end;xThe reason you're multiplying b.hp and b.mhp by 1.0 is because, by default, the engine will ignore any decimals and just return the integer, but if you tell it to multiply by 1.0 first, then it will read decimals properly (so without the 1.0, b.hp/b.mhp will always return 0). So it will divide the target's HP by the target's max HP, and give you a decimal (your percentage of health remaining). If it's less than 0.3 (or less than 30%, for this example), then it sets a variable x equal to 100. Otherwise, x will equal half the target's current HP (b.hp/2). It will then do X damage.
 
Last edited by a moderator:
  • Like
Reactions: BCj

Korimax

Architect of Procrastination
Veteran
Joined
Apr 3, 2013
Messages
941
Reaction score
41
First Language
English
Primarily Uses
N/A
THANK You so much. (That was actually quite easy to understand.)

Anyway I dunno if these threads get closed but my question has been answered.  :p
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
42,894
Reaction score
14,994
First Language
English
Primarily Uses
RMMV
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

I work late on the game so I sleep in then I wake up late so I have to work hard to make up for sleeping in meaning I work late again and sleep in again... what a nasty cycle.
I just had my first real fire. Dad made burgers for lunch and the grill caught fire. He tried to get water but I told him you should never put water on a grease fire. So I got him the fire extinguisher under the sink and we managed to put it out. I can still smell a little of the smoke coming from the patio, but at least it's clearing. It sure was scary though.
was rendering a video and window decided to bsod on me :D fun
Could not for the life of me figure out how to implement the dual/triple techs in Touch the Stars in a player-friendly way. Was describing all the problems to my wife and just rubber-ducked a solution that should work brilliantly.
I think I'm going to make each equippable item in my fantasy RPG grant a skill while its worn (in addition to the character's learned skills). Equipped gear that might be weaker in stats can still be useful in certain situations if the skill they grant exploits a weakness or resists a strength in the monsters being fought. This could potentially open up lots of build strategies to play with for fun.

Forum statistics

Threads
113,838
Messages
1,077,859
Members
147,905
Latest member
Arcansel
Top