Game Data Variables HP

Hi i'm using RPG MAekr MV and i wanted to make a skill that automatically activates if the actor is at 50 HP or lower. The wat i wanted to activate it is a force action. I did some fiddling and i found out about Actor Game Data Variables for HP but i really don't understand how to use it. The picture below is a common event that i set up for the skill.

Screenshot (100).png
You're making two mistakes here


1) control variable is a command, not an assignment.


It will load the current HP of the ifrit (which is maximum since it was only just added) into the variable.


And that value will never change until another control variable command is given - even if the ifrit is harmed, the value in the variable will stay the same until the moment the command is given again.


2) everything in the common event will be executed when the summon ifrit skill is used - and not at any other time.


Which means that neither the conditional branch nor the control variable command will ever be executed at any other time, and at this time the ifrit has full health.


You need another event, regularly repeating those commands, for them to work. And most probably you'll need two events - one troop event for the cases where the ifrit is harmed on battlescreen and one common event or map event for cases when the ifrit is harmed on map screen.


I suggest you follow the link to the starting point in my signature and work through the tutorials on eventing.
You're making two mistakes here


1) control variable is a command, not an assignment.


It will load the current HP of the ifrit (which is maximum since it was only just added) into the variable.


And that value will never change until another control variable command is given - even if the ifrit is harmed, the value in the variable will stay the same until the moment the command is given again.


2) everything in the common event will be executed when the summon ifrit skill is used - and not at any other time.


Which means that neither the conditional branch nor the control variable command will ever be executed at any other time, and at this time the ifrit has full health.


You need another event, regularly repeating those commands, for them to work. And most probably you'll need two events - one troop event for the cases where the ifrit is harmed on battlescreen and one common event or map event for cases when the ifrit is harmed on map screen.


I suggest you follow the link to the starting point in my signature and work through the tutorials on eventing.

So how would i change this to make Ifrit use the skill if he is at  50 HP or lower. Would i add a value to the variable Ifrits HP or subtract it?

Screenshot (103).png
So how would i change this to make Ifrit use the skill if he is at  50 HP or lower. Would i add a value to the variable Ifrits HP or subtract it?

Your question proves that you still don't understand what variables are - you cannot change that in your screenshot, and to read the value you'll never add or substract something from it. As I said above, this needs to be split into several different types of events.


Please follow the link in my signature to the starting point and take a month or so to work through the tutorials there, especially the variable guide and the eventing tutorials.
What you can do is activate the common event using a passive blank state on the actors you want this to work on.


you need yanfly buffstate core plugin


on the state:


<Custom React Effect>


if (target.hp/target.mhp <= 0.5) {


$gameTemp.reserveCommonEvent(n); }


</Custom React Effect>
What you can do is activate the common event using a passive blank state on the actors you want this to work on.


you need yanfly buffstate core plugin


on the state:


<Custom React Effect>


if (target.hp/target.mhp <= 0.5) {


$gameTemp.reserveCommonEvent(n); }


</Custom React Effect>

How's this. I tried it but i din't work. Am i writing it wrong 

Screenshot (104).png
@CielRpg Did you read the comment that that specific solution in the notebox requires a specific plugin? have you checked if those plugins are configured correctly? Because it will not work if the plugin does not work or is configured in a wrong way (which is one reason why I try to give solutions that work without plugins)
@CielRpg Did you read the comment that that specific solution in the notebox requires a specific plugin? have you checked if those plugins are configured correctly? Because it will not work if the plugin does not work or is configured in a wrong way (which is one reason why I try to give solutions that work without plugins)

Yep i have the plugin and i put it under thee correct plugin for best compatability. Thats why i think that i might have a spelling error or something.

Screenshot (105).png
Lol, Andar you could have seen that in a few secs checking the screenshot. Why are you helping in MV if you're not using it?


target is target not Ifrit, the state must be a passive blank state using yanfly on ifrit(guessing the actor name)


You'll probably don't want the CE to activate everytime you take a hit when you're below 50% so turn a switch on in the force action while putting a condition 


<Custom React Effect>


if (target.hp/target.mhp <= 0.5 && $gameSwitches._data[x]) {


$gameTemp.reserveCommonEvent(n); }


</Custom React Effect>


You'll need someway to turn it off somewhere if you want the ce to activate again
For the reserve common event script call i reserved the summon common event. Is this right or should i reserve the return common event. I made a switch and put the switch ID under x in the script call. I haven't tested it yet but can you see if this is all goood.&& $gameSwitches._data[x]) {

Screenshot (106).png

Screenshot (107).png

Screenshot (108).png

Screenshot (109).png

Screenshot (110).png

Original thread: https://forums.rpgmakerweb.com/threads/game-data-variables-hp.72198/