JavaScript questions that don't deserve their own thread

Okay, so in the above example it would be
Sorry, I don't see an example of how you're using it in your project, but no. An object can never be two types; it's either an event or an interpreter (or, obviously, something entirely else 😛 ).

The only way that could ever be relevant is if you were referring to some inherited properties. For example, a Game_Actor object can also refer to things it inherited from Game_BattlerBase.
No: an event and an interpreter are two different things.
The intent is to use it in a normal script call, not in a move route.

Sorry this bit has me confused… in the original example “this” works to reference the event. If I wanted to add an interpreter reference, this will only work if I refer to the current event with 0 like in your suggestions above?

Sorry, I don't see an example of how you're using it in your project, but no.
So I was trying to convey that animateTwelve(this, 0, 12, 20) works. So “this” here is actually the interpreter, and not the event as I had assumed?
in the original example “this” works to reference the event.
Oh...I should've noticed that sooner. 😊
So “this” here is actually the interpreter, and not the event as I had assumed?
In that case target is already an interpreter reference. _eventId is an interpreter property that stores the ID of This Event, and that's what you're using to reference it.
@werzaque It occurs to me that pretty much all of your "questions that don't deserve a thread" actually do 😉

Sorry this bit has me confused… in the original example “this” works to reference the event.
Again, I don't see any example aside from the pure code of your function, but; again, if you're running it from a Script command, it doesn't.

As your function is written as a free-standing function (not a member of any data type), this will refer to the global object (or be undefined, in strict mode).
1715087551907.png

1715087568645.png

1715087602744.png



If you are running it from a Script command and you pass in a this, it will be an interpreter.
1715087633464.png

1715087652264.png



You may find this useful.
Yep, in that case target is already an interpreter reference. _eventId is an interpreter property that stores the ID of This Event, and that's what you're using to reference it.
Wonderful! Thanks!
If you are running it from a Script command and you pass in a this, it will be an
Pennies dropping!

Phew… so grateful for your perseverance! Many many thanks.
Hello again, long time no see.

I was looking around but no luck.

is there a dmg formula to cap the DOT that use % of max hp?

something like: [Poison] deals 10% of max hp at the end of the round, up to 1000 HP



Thanks for your time
is there a dmg formula to cap the DOT that use % of max hp?
something like: [Poison] deals 10% of max hp at the end of the round, up to 1000 HP
This is most easily done with an existing plugin, using my Eval Tags or VisuStella's Skills and States Core to do the damage as a formula.

You could also make a little plugin to universally modify all slip damage:
Code:
Game_Battler.prototype.maxSlipDamage = function() {
    return $dataSystem.optSlipDeath ? Math.min(1000, this.hp) : Math.min(1000, Math.max(this.hp - 1, 0));
};
but obviously that's less versatile.
This is most easily done with an existing plugin, using my Eval Tags or VisuStella's Skills and States Core to do the damage as a formula.

You could also make a little plugin to universally modify all slip damage:
Code:
Game_Battler.prototype.maxSlipDamage = function() {
    return $dataSystem.optSlipDeath ? Math.min(1000, this.hp) : Math.min(1000, Math.max(this.hp - 1, 0));
};
but obviously that's less versatile.
Manage to make it work with <Custom Regenerate Effect> using a negative value:
Code:
<Custom Regenerate Effect>
var value = Math.floor(Math.min(user.mhp * 0.1 , 1000) * -1);
user.gainHp(value);
</Custom Regenerate Effect>

thanks for the help
Is there a code I could use to get the name of the currently equipped weapon and actor is using?

I want to save that to a variable.
you can use
Code:
$gameActors.actor(x).weapons()[0].name
just replace the x with the actor's id
Hello again, this time im looking for an specific JS command that gives the amount of healing the target recived.

im trying to make state that reduce the healing recived by 50% and ill use the same negative Custom Regen to do it, but i canr find the js command to store that amount of healing into my variable X to do the formula

Code:
<Custom Regenerate Effect>
var X = ?????;
user.gainHp((X * 0.5) * -1);
</Custom Regenerate Effect>


Thanks for your time
for an specific JS command that gives the amount of healing the target recived.
im trying to make state that reduce the healing recived by 50%
are these separate? is the state supposed to reduce healing by 50% and then heal the one who applied it for that amount? just reducing incoming heals can be done by using the REC trait, but it doesnt affect heals from notetags without making them factor REC, and i dont think REC impacts hp regen traits.

If youre trying to reduce healing on one battler and heal another for the same amount, regenerate effects have no notion of incoming heals and cannot impact them. you use can a <Custom React Effect> (or the equivalent tag for what plugin youre using. your profile says mz but youve provided yanfly ones in the thread so far?) to reduce incoming healing by half and heal the origin for that amount, or edit the Game_Battler.gainHp function to reduce the value by half if its positive and the state is on the battler, and then call another one on the other battler for that same value.
are these separate? is the state supposed to reduce healing by 50% and then heal the one who applied it for that amount? just reducing incoming heals can be done by using the REC trait, but it doesnt affect heals from notetags without making them factor REC, and i dont think REC impacts hp regen traits.

If youre trying to reduce healing on one battler and heal another for the same amount, regenerate effects have no notion of incoming heals and cannot impact them. you use can a <Custom React Effect> (or the equivalent tag for what plugin youre using. your profile says mz but youve provided yanfly ones in the thread so far?) to reduce incoming healing by half and heal the origin for that amount, or edit the Game_Battler.gainHp function to reduce the value by half if its positive and the state is on the battler, and then call another one on the other battler for that same value.
yeah is the same thing and i think i found what i was looking for

Code:
target.result().hpDamage < 0

and yes, regenerate effects didnt work 😅

To be specific with this state = if the user of this state is been healed by 1000 HP, the user will only recover half of that (500 HP),
so im not sure if Recovery Effect is what im looking for since that only affects the caster and not the target (i think thats how it works)


ill try to do something using this as a base tomorrow
Code:
<Custom Respond Effect>
if (target.result().hpDamage < 0) {
     // code to reduce [target.result().hpDamage]
}
</Custom Respond Effect>
@SnakeBD If you double check the instructions for Yanfly's Buffs & States Core, it tells you that the Custom Respond Effect includes a value variable that represents the incoming damage/healing.
you can use
Code:
$gameActors.actor(x).weapons()[0].name
just replace the x with the actor's id
Thank you.

I’m assuming this works with “a” or “user” when being used in combat
it depends on how youre running it. if its from a skill's formula box or notetag then you can use those. if its from a troop event or a common event, you cant use them.
it depends on how youre running it. if its from a skill's formula box or notetag then you can use those. if its from a troop event or a common event, you cant use them.
Just wanted to confirm, as I've ran into some instances where code didn't work like that in the past.
This is for MZ. Would anyone know of a script call to force the Skill window in battle to refresh?

I have a feature in my game where the player can toggle on a common event in battle using a key, which then swaps their skill set and enables a state. The effect works just fine, but if the player triggers the common event with the skill list open, it does not refresh to show their new skill set. Backing out of the skill window and going back in redraws it just fine though.
try
Code:
SceneManager._scene._skillWindow.refresh()
Works like a charm!

I greatly appreciate the help
try
Code:
SceneManager._scene._skillWindow.refresh()

Original thread: https://forums.rpgmakerweb.com/threads/javascript-questions-that-dont-deserve-their-own-thread.46341/