MV Formula Box: Deal Damage and Add a State in a Boolean?

pkdarmstrong

Villager
Member
Joined
Feb 19, 2015
Messages
27
Reaction score
1
First Language
English
Good morning,

I am currently creating a "shield bash" skill, and I would like to have the condition where if the user has a larger % of HP than the target enemy, they are able to deal damage as AND add a "stun" state to the enemy. HOWEVER, if the user does not have a larger % of HP than the target enemy, the damage is dealt without adding the stun state. This is what I have so far:

(b.hp * 100 / b.mhp) <= (a.hp * 100 / a.mhp) ? b.addState(5) + a.def * 4 - b.def * 2 : a.def * 4 - b.def * 2

So my question is:
-How do I manipulate the first conditional section (b.addState(5) + a.def * 4 - b.def * 2) to deal damage as well as add the state? Am I just using the wrong operator?
-Is there any way to give the state a percentage chance of success through the formula/database settings?

Thank you for your time,
-pkdarmstrong
 
Last edited:

Windows i7

Veteran
Veteran
Joined
Nov 4, 2017
Messages
398
Reaction score
1,224
First Language
English
Primarily Uses
RMMV
don't add the value of b.addState(5), put that in the beginning.

b.addState(5); (b.hp * 100 / b.mhp) <= (a.hp * 100 / a.mhp) ? a.def * 4 - b.def * 2 : a.def * 4 - b.def * 2
 

pkdarmstrong

Villager
Member
Joined
Feb 19, 2015
Messages
27
Reaction score
1
First Language
English
b.addState(5); (b.hp * 100 / b.mhp) <= (a.hp * 100 / a.mhp) ? a.def * 4 - b.def * 2 : a.def * 4 - b.def * 2
I may not have been clear in my original post, let me rephrase what I am looking for. Sorry!

I want the condition of stunning an enemy to be after the boolean operator in the sense that it is conditional, not added on just for using the skill.

So in this case, if the user has more % HP than the enemy, then the state will be added along with the damage dealt. If the user has less % HP than the enemy, the conditions will just deal the damage, without including the added stun state.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
30,400
Reaction score
7,222
First Language
German
Primarily Uses
RMMV
Placing the addstate at the beginning will make it unconditional, so that is the wrong solution.

What you need to do is not use an operator, but use the command seperator ; between the two parts of the effects. And for that to be detected as part of the same conditional you need to put {} around both commands, but keep them at the same place.
 

pkdarmstrong

Villager
Member
Joined
Feb 19, 2015
Messages
27
Reaction score
1
First Language
English
I got the formula to work, however I did not use the simplified boolean formula, but used the "if-else" conditional formula instead. Made things a bit easier.

if (b.hp * 100 / b.mhp <= a.hp * 100 / a.mhp) {b.addState(5) ; a.def * 4 - b.def * 2} else {a.def * 4 - b.def * 2}

If I may ask some further questions, how would this formula translate into the more simplified boolean formula (x ? a : b)?
Again, thank you Windows i7 and Andar for you assistance.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
30,400
Reaction score
7,222
First Language
German
Primarily Uses
RMMV
Simplify the conditional formula, you don't need to multiple both sides with 100. Then place it in () just like you did with the if Variante - your mistake was to make that condition without brackets in your first post (the brackets were only around the parts, where they were not needed, instead of around the entire condition).
 

pkdarmstrong

Villager
Member
Joined
Feb 19, 2015
Messages
27
Reaction score
1
First Language
English
Simplify the conditional formula, you don't need to multiple both sides with 100. Then place it in () just like you did with the if Variante - your mistake was to make that condition without brackets in your first post (the brackets were only around the parts, where they were not needed, instead of around the entire condition).
Got it, thank you very much! This thread can be closed now, however that works. :)
 

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

Latest Threads

Latest Profile Posts

Finally did a test of sorts for the opening of my game... ... including this shot here.
My current status!?
It might be... QUAKE!!! :o
At least that was true several hours ago. :p
Quexp wrote on Shaz's profile.
I absolutely love your profile/pic! :kaoluv:
Stream will be live shortly with some Darkest Dungeon! Feel free to drop by!
I made a battle results screen for my minigame.. any feedback? :)

Forum statistics

Threads
100,686
Messages
978,412
Members
132,310
Latest member
hnhat
Top