Script - Get element of active skill

I'm updating the substitute function in rpg_manager and I only want the substitute to activate if a skill does damage (i.e if the element is not 0. Not for status skills like sleep and silence). How do I the active skills element?

BattleManager.checkSubstitute = function(target) {
return target.isStateAffected(29) && !this._action.isCertainHit() && !this._action.isForAll();
//return target.isDying() && !this._action.isCertainHit();
};
JavaScript:
this._action.damage.elementId
JavaScript:
this._action.damage.elementId
Thanks for the reply.
Unfortunately this._action.damage.elementId and this._action.damage are undefined in BattleManager in rpg_manager.js.
Below is the output of Battlemanager._action.
1666974717696.png
Thanks for the reply.
Unfortunately this._action.damage.elementId and this._action.damage are undefined in BattleManager in rpg_manager.js.
Below is the output of Battlemanager._action.
View attachment 243833
Sorry, I missed a bit.

this._action.item().damage.elementId
That was it, thanks so much.
How were you able to figure the pathing for the elements?
That was it, thanks so much.
How were you able to figure the pathing for the elements?
Trial and error, really. When a new RM comes out the first thing I do is delve into the code and look at how everything fits together. It's fairly intuitive though: the element is part of the damage setting in the database, so it stands to reason that the element ID belongs to the damage property of the data item.
You can also reverse engineer it - if you know that the element rate on a battler must be compared to the element of the damage at some point, just go to the damage execution and follow any other functions it calls until you find how that comparison is done.

Original thread: https://forums.rpgmakerweb.com/threads/script-get-element-of-active-skill.152294/