MV Delayed Effects using JavaScript

I'm creating a skill to do delayed fire damage to a target and I'm looking for a JavaScript template for other delayed skills later down the line. I know virtually no JavaScript, so a breakdown of how it works would be extremely appreciated.
This can't be done without knowing how the engine itself works - javascript isn't a miracle worker.

Basically no skill has any form of timing involved in that form - and such a timing cannot be created by javascript either, not without rewriting the engine itself.

what you need to do is to use states.
states do have timing involved and that timing (like counting the number of turns until the state is removed) is handled by the engine automatically.

If I understand you correctly you want to include an effect at the moment when the state is removed automatically.
That is also not in the default engine, but such a function is easier to add by plugin than your original description.
There are a few plugins that already do this, you can look for them either as an inspiration on learning how to program this or to use them directly.
I understand I need to use states and I have most of the Yanfly plugins ready, I just need to know how to use JavaScript to expand my flexibility of these things.
This article might help:
Notably, this state notetag to force use of a skill when the state elapses:

// Buffs & States Core <Custom Leave Effect> // Get the landing skill. var skill = 200; // Get the last targeted index. var target = -2; // Queue the forced action. BattleManager.queueForceAction(user, skill, target); </Custom Leave Effect>
(Note: queueForceAction is a shortcut defined by YEP_BattleEngineCore.)

Yanfly has a lot of similar articles here, in case you're interested:
I read the Jump article but I don't really understand what it means ie. the actual source code
I read the Jump article but I don't really understand what it means ie. the actual source code
For future reference: it can be more helpful to mention, if possible, exactly what it is that you don't understand, e.g.
  • "What does BattleManager.queueForceAction do?"
    • It's basically a Force Action command.
  • "How does the game know when to run this code?"
    • When a state expires, the plugin processes its <Custom Leave Effect> notetag.
  • "Where do I put these 'notetags'?"
    • Database objects have a Note box (bottom-right); notetags go there.
  • "What does var mean?"
The video might clarify things, if you haven't already watched it. 👋

The notetag of interest for your situation, which I included in my post, contains 3 lines of code, each one commented with its purpose (lines starting with // are comments). It requires Yanfly's Buffs & States Core plugin:
Regarding the other notetags: action sequences are not JavaScript, they're kind of like a list of plugin commands. The plugin interprets each line of the sequence and performs the appropriate script calls in response.

Rather than trying to cultivate a deep understanding of (object-oriented) programming, the JavaScript language, and RMMV's core scripts from the start, many people simply find/request relevant snippets of code from others who are more informed on the topic. For example:
For future reference: it can be more helpful to mention, if possible, exactly what it is that you don't understand, e.g.
  • "What does BattleManager.queueForceAction do?"
    • It's basically a Force Action command.
  • "How does the game know when to run this code?"
    • When a state expires, the plugin processes its <Custom Leave Effect> notetag.
  • "Where do I put these 'notetags'?"
    • Database objects have a Note box (bottom-right); notetags go there.
  • "What does var mean?"
The video might clarify things, if you haven't already watched it. 👋

The notetag of interest for your situation, which I included in my post, contains 3 lines of code, each one commented with its purpose (lines starting with // are comments). It requires Yanfly's Buffs & States Core plugin:
Regarding the other notetags: action sequences are not JavaScript, they're kind of like a list of plugin commands. The plugin interprets each line of the sequence and performs the appropriate script calls in response.

Rather than trying to cultivate a deep understanding of (object-oriented) programming, the JavaScript language, and RMMV's core scripts from the start, many people simply find/request relevant snippets of code from others who are more informed on the topic. For example:
Thanks! This was very helpful.

Original thread: https://forums.rpgmakerweb.com/threads/delayed-effects-using-javascript.144975/