MV Problem trying to get HP of any event

I tried to use : $gameMap.event(3)._user.battler._hp inside some event just to check if it get any info, but i'm receiving
cannot read property of '_hp' null.
Anyone can help me? i search for solution, but none worked it for me 🙁
if there is any tutorial i would appreciate .

Edit: I'm using Chrono engine ABS plugin.
Events have no HP, so of course that is undefined.

I'm assuming that you use a plugin for some type of action battle system where some events pretend to be enemies, but that is something entirely else - and depends on the plugin you're using.

So you should check the help section of that plugin to learn how to check HP, and if you have problems there you need to link us to whatever plugin you're using before we can even start to answer.
Events have no HP, so of course that is undefined.

I'm assuming that you use a plugin for some type of action battle system where some events pretend to be enemies, but that is something entirely else - and depends on the plugin you're using.

So you should check the help section of that plugin to learn how to check HP, and if you have problems there you need to link us to whatever plugin you're using before we can even start to answer.
ok, i added the info, but the problema was happening because i wasn't using the event ID, i was using the event name 🙁 But still don't know the best way to check HP , i'll try to get ID and set variable, but i think there is a better way .
You should be able to use the battler() function and its hp property for the event during battle (which for the abs is usually active):
JavaScript:
$gameMap.event(3).battler().hp
You should be able to use the battler() function and its hp property for the event during battle (which for the abs is usually active):
JavaScript:
$gameMap.event(3).battler().hp
I'm wondering the best way to check HP of the monsters in the map, do you have any idea?
I got the HP info, but i need to control what is going to happen if hp change and how it will trigger the events. Right now i'm using in the routes calling the common events.
Don't mind me, I'm just moving this because it's a plugin question~

I've moved this thread to Plugin Support (from MV Support). Thank you.

I'm wondering the best way to check HP of the monsters in the map, do you have any idea?
I got the HP info, but i need to control what is going to happen if hp change and how it will trigger the events. Right now i'm using in the routes calling the common events.
Unless I am misunderstanding your specific need, I think that script call is the quickest way to get the hp of the enemy event on the map.

Hopefully the stuff below doesn't confuse you - you are welcome to ignore it completely since it deals with a bit of coding and you still have to come up with your own ways to manage and use it.

To get a list of all enemies present on the map, use this script call:
JavaScript:
$gameMap.allEnemiesOnMap();
You can assign it to a variable or whatever you need in the script call and go from there.

If you are comfortable with JS, you should be able to add functions, calculations, logs, etc. using this function to check for when battlers (actors or events) receive any kind of damage.

Something like this will store the damage of the character in a game temp and also give you a console log of the character and the damage they received (save this text code as a .js file and load it like a plugin):
JavaScript:
Game_Battler.prototype.onDamage = function(value) {
    this.removeStatesByDamage();
    this.chargeTpByDamage(value / this.mhp);
    $gameTemp._charDamage = $gameTemp._charDamage || {};
    const enemies = $gameMap.allEnemiesOnMap().map(event => event.battler());
    const index = this.isActor() ? this.index() : enemies.indexOf(this);
    $gameTemp._charDamage[`${this.name()}_${index}`] = {hp: this.hp, damage: value};
    console.log($gameTemp._charDamage);
};

Any time anyone gets attacked, it will temporarily store who received the attack, their index during the battle, their hp, and their actual damage received in that moment. Every time they get attacked, the damage value gets updated (not added to previous value). So say Ash who is the party leader gets attacked, you will see this in the console:
Code:
{Ash_0: {hp: 330, damage: 9}}

Another way would be where you run event commands/script calls during the damage process to constantly check on every change and that is dependent upon every time an enemy gets damaged (you'll have to store and compare changes of enemy HP and constantly check it as well). That would have to depend on your workflow and I won't be able to help much.

Chrono Engine is not user-friendly and certainly if you want specific things, you really have to dig into what MOG has setup and learn all the references.

Edit:

I would also clear it out after each map with $gameTemp._charDamage = {}
@bass2yang Didn't know you were a fellow Chrono Engine aficionado. Maybe you could help me with the "Chrono/Cross Engine on steroids" plugin I'm making.

It's not clear what the OP wants to do, but if bass2yang's functions weren't enough, I just released a HP bars for Chrono Engine plugin.

I think you're saying you want the enemy to do something else if its HP hits a threshold?
Then you would put in its autonomous move route, for example
Code:
if(this.battler().hp<=.50*(this.battler().mhp)){//do something}
"If this battler's hp is less than or equal to half its maximum hp do something."
@bass2yang Didn't know you were a fellow Chrono Engine aficionado. Maybe you could help me with the "Chrono/Cross Engine on steroids" plugin I'm making.

It's not clear what the OP wants to do, but if bass2yang's functions weren't enough, I just released a HP bars for Chrono Engine plugin.

I think you're saying you want the enemy to do something else if its HP hits a threshold?
Then you would put in its autonomous move route, for example
Code:
if(this.battler().hp<=.50*(this.battler().mhp)){//do something}
"If this battler's hp is less than or equal to half its maximum hp do something."
You just answered what i need Tks 😀.
You give me some ideas.. i dont think i'll need to use to many switchs or something like it. I'm going to control events using scripts
Unless I am misunderstanding your specific need, I think that script call is the quickest way to get the hp of the enemy event on the map.

Hopefully the stuff below doesn't confuse you - you are welcome to ignore it completely since it deals with a bit of coding and you still have to come up with your own ways to manage and use it.

To get a list of all enemies present on the map, use this script call:
JavaScript:
$gameMap.allEnemiesOnMap();
You can assign it to a variable or whatever you need in the script call and go from there.

If you are comfortable with JS, you should be able to add functions, calculations, logs, etc. using this function to check for when battlers (actors or events) receive any kind of damage.

Something like this will store the damage of the character in a game temp and also give you a console log of the character and the damage they received (save this text code as a .js file and load it like a plugin):
JavaScript:
Game_Battler.prototype.onDamage = function(value) {
    this.removeStatesByDamage();
    this.chargeTpByDamage(value / this.mhp);
    $gameTemp._charDamage = $gameTemp._charDamage || {};
    const enemies = $gameMap.allEnemiesOnMap().map(event => event.battler());
    const index = this.isActor() ? this.index() : enemies.indexOf(this);
    $gameTemp._charDamage[`${this.name()}_${index}`] = {hp: this.hp, damage: value};
    console.log($gameTemp._charDamage);
};

Any time anyone gets attacked, it will temporarily store who received the attack, their index during the battle, their hp, and their actual damage received in that moment. Every time they get attacked, the damage value gets updated (not added to previous value). So say Ash who is the party leader gets attacked, you will see this in the console:
Code:
{Ash_0: {hp: 330, damage: 9}}

Another way would be where you run event commands/script calls during the damage process to constantly check on every change and that is dependent upon every time an enemy gets damaged (you'll have to store and compare changes of enemy HP and constantly check it as well). That would have to depend on your workflow and I won't be able to help much.

Chrono Engine is not user-friendly and certainly if you want specific things, you really have to dig into what MOG has setup and learn all the references.

Edit:

I would also clear it out after each map with $gameTemp._charDamage = {}
I aprecciate your effort explaining to me, it helped me, but i'm going to be studying to do something better.
Do you know where can i find any documentation about mog abs?
I have a beginner guide here:

There's also DriftwoodGaming's videos
I have a beginner guide here:

There's also DriftwoodGaming's videos

I'll check this out, how do you debug or events or scripts?
sometimes i don't know the events names or variable, that's something i'm getting confuse,
do you know where can i find the methods and variables ?
i'll not ask anything else for a day haha you helped me a lot thanks.
how do you debug or events or scripts?
You use the console. Press F8 or F12 during playtest. From there you can test functions directly or look at an event's data.

For example, if you type in $gameMap.event(8)._user
1739299844600.png
You use the console. Press F8 or F12 during playtest. From there you can test functions directly or look at an event's data.

For example, if you type in $gameMap.event(8)._user
View attachment 331257
ok, now i can make the game happen

Original thread: https://forums.rpgmakerweb.com/threads/problem-trying-to-get-hp-of-any-event.175347/