Lyseth

Potato Mage
Veteran
Joined
May 26, 2015
Messages
723
Reaction score
44
First Language
English
Primarily Uses
RMMV
So I wanted to create abilities that will execute targets at a certain HP percentage remaining, ex: “Will instantly kill enemies at 20% or less HP, does not effect bosses”
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,006
First Language
Tagalog
Primarily Uses
RMVXA
For the HP part, that's easy to do

you can use a formula like this in the damage formula.box

Code:
if (b.hp<(b.mhp*0.2)){b.hp=0;}else{actual damage formula}

so like if your normal damage formula is a.atk*4 - b.def*2

Code:
if (b.hp<(b.mhp*0.2)){b.hp=0;}else{a.atk*4-b.def*2}

These arent tested though so it might have syntax errors or others

I think there is also a function called hpRate in which case you can just do
Code:
if (b.hpRate <= 0.2)

but for the does not affect bosses, you need a way first to determine if the target is a boss.
 

Silva

Scoobityboo
Veteran
Joined
Nov 5, 2018
Messages
402
Reaction score
224
First Language
English
Primarily Uses
RMMV
Just a thought as to how you could stop this affecting bosses. At the start of your game have an event set a variable to an array holding all the ids of your bosses. Eg.

upload_2019-2-25_18-35-56.png

You can add more values to this, so long as they're separated by commas. After this have your execute damage formula check the enemyId against this array. Something like this should work:

Code:
(!$gameVariables.value(1).includes(b._enemyId) && b.hpRate() <= 0.2) ? b._hp = 0 : a.atk*4-b.def*2
 
Last edited:

TWings

The Dragon Whisperer
Veteran
Joined
Jul 26, 2017
Messages
528
Reaction score
867
First Language
French
Primarily Uses
RMMV
To separate bosses from the rest, I use a boss state that I put on every boss,
then in the skills that need to behave differently with bosses and standard enemies I use that condition :
Code:
if (!b.isStateAffected( state id)) { enemy case } else { boss case }
It also allows me to easily add specific parameters to all bosses at once (like poison resistance or whatever).
 

Lyseth

Potato Mage
Veteran
Joined
May 26, 2015
Messages
723
Reaction score
44
First Language
English
Primarily Uses
RMMV
@Engr. Adiktuzmiko @TWings

Is it possible to let it still deal damage even if it won’t execute? Cause if possible, I don’t want it to be completely useless within boss fights
 

TWings

The Dragon Whisperer
Veteran
Joined
Jul 26, 2017
Messages
528
Reaction score
867
First Language
French
Primarily Uses
RMMV
Yeah, you can just mix it up to do the same to bosses and enemies who have more than 20% HP
Code:
if ((b.hp<(b.mhp*0.2))&&(!b.isStateAffected( your boss state id )){b.hp=0;}else{ damage formula }
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,006
First Language
Tagalog
Primarily Uses
RMVXA
If you look at the first line of code I posted there is this part

else {actual damage formula}

What that part does is that it deals damage based on the formula you write there in case it doesnt execute
 

Latest Threads

Latest Posts

Latest Profile Posts

Celebrating a milestone over at Twitter
Sneak peak of my upcoming update! Who's holding her, you may ask? Find out tonight!
10.PNG
BCj
Finished another GUI! Turn indicator wasn't made by me.

ff981f8dc50b03cf58038c644334b454.jpg


3cb092fdc00087acfa0a190fd891f0ed.jpg
Added a small refining scene to my game.

Forum statistics

Threads
115,260
Messages
1,088,417
Members
149,859
Latest member
yhiriend
Top