Puppet Knight - Element Impact && Element Icons

This plugin introduces dynamic elemental mechanics, allowing you to inflict states, modify damage based on target conditions, and scale power with consecutive uses or hits of elements.

Key Features:
  1. Custom Element Cycles:
    • Define relationships between elements, including strengths and weaknesses.
    • Support for single-element cycles (where elements are strong against themselves) and two-element cycles (where elements are strong against each other).
    • Multi-element cycles for traditional rock-paper-scissors-style interactions.
  2. Dynamic Element Rules:
    • Choose how battlers' current elements are determined with three flexible options:
      • Last Used Element: Based on the last skill's element.
      • Last Hit Element: Based on the last element the battler was hit by.
      • Higher Stack: Prioritizes the element with the higher consecutive usage or hit count.
  3. Stack-Based Adjustments:
    • Track consecutive uses (Use Stacks) and hits (Hit Stacks) of elements.
    • Apply scaling damage modifiers based on stack counts, allowing for dynamic damage interactions.
  4. State Impact Effects:
    • Inflict or remove states based on elements, with configurable chances.
    • Add damage modifiers for specific state and element combinations.
  5. Reflect Damage Mechanic:
    • Option to reflect damage back to the user if specific element based conditions are met by the target
  6. Debug Mode:
    • Easily toggle detailed console logging to debug and fine-tune your configurations.
  7. Script Calls:
    • assign icons to element ids, also more easily search element ids and names based on skill id
  8. Highly Configurable:
    • Define multipliers (percentage-based) for strengths, weaknesses, and stack effects.
    • Flexible parameter settings to adjust maximum stacks, element relationships, and more.
  9. Use Cases:
    • Create engaging rock-paper-scissors-style elemental battles.
    • Add layers of strategy with dynamic stack-based damage scaling.
    • Reward players for mastering elemental mechanics in your game.


The plugin can be found on itch!


Any feature requests you can let me know there or here


Terms: You're free to use this plugin in projects commercial or non commercial.
Must Credit Puppet Knight as the author. While a copy of the game is not required, it
would be appreciated ^_^.

And yes, this was created with the help of AI.
Big Big update!

Absorbed some amazing feedback from casper to update how a lot of the multipliers work, but mainly to remove IIFE from the plugin. This allows me to allow fellow devs more flexibility in utilizing the parts of the plugin they want in more modular ways.

Full Version 1.1 update details below:

1. Introduction of Element Cycles​

  • Brand New Feature:
    • Define relationships between elements in Element Cycles, supporting:
      • Single-Element Cycles: An element can be strong against itself, applying the Strength Multiplier.
      • Two-Element Cycles: Both elements are strong against each other, consistently applying the Strength Multiplier.
      • Multi-Element Cycles: Cyclical strength and weakness relationships (e.g., rock-paper-scissors mechanics).
    • Fully customizable via plugin parameters, including configurable Strength Multiplier and Weakness Multiplier.

2. Complete Code Overhaul​

  • Refactored to enable reusability of functions outside the plugin's default flow:
    • PK_ElementImpact.getCurrentElement: Dynamically determines a battler's current element based on the Element Rule.
    • PK_ElementImpact.getElementMultiplier: Provides a flexible, standalone method to calculate the damage multiplier based on element relationships.
  • Simplified and modularized logic for better extensibility and compatibility with other plugins or custom systems.

3. New Element Rule Parameter​

  • Added the Element Ruleparameter to control how a battler's element is determined:
    • Last Used Element: Uses the last element applied by the battler.
    • Last Hit Element: Uses the last element that hit the battler.
    • Higher Stack: Selects the element associated with the higher stack between consecutive uses and hits.

4. Improved Damage Calculation Workflow​

  • Reorganized the damage calculation process to ensure accuracy:
    • Elements for the user and target are captured before updates to lastUsedElem and lastHitElem.
    • Stacks (lastUsedStack and lastHitStack) now contribute consistently to damage scaling.
    • The Element Cycle Multiplier applies after all other calculations, ensuring it reflects the correct relationships and rules.

5. Debugging Enhancements​

  • Introduced a Debug Mode plugin parameter:
    • Enables detailed logging for easy debugging of elements, stacks, and multipliers.
    • Optional and configurable via plugin parameters.

Summary​

This version introduces a major leap in functionality with the Element Cycles system, offering powerful new mechanics for elemental interactions. The code has been overhauled to improve modularity and enable reusability, making it easier to integrate and extend the plugin. These updates provide developers with more flexibility, precision, and control over elemental mechanics in their projects.


updated plugin can be found on itch!
Version 1.2 Update!

Added in a Reflect Mechanic option. This will allow targets to reflect skill damage back to the user of an action when specific element and stack conditions are met. This relies on the `Element Rule` established in 1.1.

New Notetags:

<noReflect> This notetag is used to prevent a skill from being reflected no matter what the targets element is

<noStacks> This notetag is used to avoid damage changes or reductions based on stacks. Element cycle changes still Apply

<noCycle> This notetag is used to avoid damage changes due to Element Cycles

<ignoreAll> This notetag is used for all three effects above

None of these notetags mitigate damage related to state Impact multipliers. Stack increases and element changes still update as needed.


On deck feature:

I am planning to create an additional notetag that will allow skills to reverse the element cycle they fall under (think the "Reaver" weapons like https://fireemblem.fandom.com/wiki/Lancereaver in Fire Emblem), but purely for elements. I just want to be sure it respects the multiplier correctly as well as test how it would interact with reflections if at all.


Any suggestions/asks for new features on this plugin? Don't hesitate to give me a shout. I'm trying to hit as many things that don't seem possible out of the box for MZ when it comes to Elements.
And yes, this was created with the help of AI.
I don't think this should just be mentioned as casually as you do here, since the consequence is that whoever uses this plugin will need to flag their project as using AI.
I don't think this should just be mentioned as casually as you do here, since the consequence is that whoever uses this plugin will need to flag their project as using AI.

Its mentioned because the forum rules state I need to mention it. I understand that this is something that impacts users of my plugin when releasing their own projects, because its something that is going to ultimately impact my own.

I am not going out of my way beyond the casual mention to bring up that I am using AI. Especially when it doesn't matter how the AI was used to necessitate me providing the disclaimer. If you take issue with how I disclosed it, you are welcome to report the initial post to forum mods.
Version 1.3 Update


Feature Update:
Added in the aforementioned notetag to reverse element cycle damage

<reverseCycle>

Any skill utilizing this notetag will reverse the cycle of the element its utilizing, if that element belongs to a cycle.

For Example, if the cycle is set up as Fire > Air > Water > Fire (Strength Multiplier x150%, Weakness Multiplier 50%)

Normally, a Fire skill hitting an enemy whose current element is Water would have its damage reduced by 50%

However if a fire skill with the notetag <reverseCycle> hits a water target, the strength multiplier would apply instead.


Bug Fix:

While testing reverseCycle I noticed the timing of when elementCurrent and the lastHit/Used properties was a bit funky. I cleaned up the order a bit to make sure anytime a battlers elementCurrent is being checked using the function `PK_ElementImpact.getCurrentElement`, it will be accurate.



Next Steps:


Though I'm likely going to take a step away from plugin building to focus on my project, I do have some things in mind I want to do here still.


Namely working on some Item Notetags to allow specific element effects, as well as some extra skill notetags to do things like maximize the users stacks.

There is also a bit of tweaking I want to do still to how stacks and elementCurrent are reset, and ways to avoid the stack being disrupted. This could look like a plugin parameter where it looks at the type of damage a skill does (like only HP or MP damage types affect elementCurrent and stacks), or something more tedious for the dev like a notetag. But we'll see. A lot of the answers generally come from the direction my game's going and then I code the solution in.



As always let me know if there's anything you like to see. Next to EquipSlotsChange, this has been a fun plugin for me to work on and want to do a lot more with it as a Elements and States solution.
Version 1.4 Update

NEW SCRIPT CALLS + Standalone "Lite" plugin

I've added in a new parameter structure that allows devs/users to associate Icons with element ids. This will make drawing specific elements in your project a little easier. Gone are the days of tracking down everywhere you tried to draw "Fire" as icon 47, when really you wanna use 200!!


also added two more functions to easily search element ids and names based on skill id


ElementImpact contains all the functionality of the standalone plugin "ElementIcon". So no need to have both if you're using the core plugin already. I will be updating ElementImpact further to integrate the new script calls soon, but for now, they act fairly independently.
Version 1.4 Update

NEW SCRIPT CALLS + Standalone "Lite" plugin

I've added in a new parameter structure that allows devs/users to associate Icons with element ids. This will make drawing specific elements in your project a little easier. Gone are the days of tracking down everywhere you tried to draw "Fire" as icon 47, when really you wanna use 200!!


also added two more functions to easily search element ids and names based on skill id


ElementImpact contains all the functionality of the standalone plugin "ElementIcon". So no need to have both if you're using the core plugin already. I will be updating ElementImpact further to integrate the new script calls soon, but for now, they act fairly independently.
Hello! I've been using this plugin for a while, and its been great! but i have run in to a bit of a problem...

The Plugin itself works absolutely fine, there's no errors or anything, but something ive been struggling with is Displaying Which Element An Actor Is Afflicted With. At first i thought i could make every skill apply a state to self that does nothing but has an elemental icon, but since you can't have more than one element at a time, it gets weird with the states priority and the state with the highest priority will stay there forever no matter what other elemental state is supposed to show.


I was going to ask if there was any better way to display this with SRD's Hudmaker, but after scrolling through this thread you keep mentioning something about element icons? in the quoted post you said that it's possible to attach an icon to the element, which sounds like it might be the displayable icon for the element but i cant find a mention in the help section.


If this is something built in to the plugin, please let me know and if it's not, please give me your input on another way of doing it.
in the quoted post you said that it's possible to attach an icon to the element, which sounds like it might be the displayable icon for the element but i cant find a mention in the help section.


If this is something built in to the plugin, please let me know and if it's not, please give me your input on another way of doing it.

Hey! So this should be a fairly straightforward check using a combination of two functions in the plugin:

PK_ElementImpact.getCurrentElement

and

PK_ElementImpact.elementIcon


try this:

Spoiler: Check Actor Current Element Icon
const actorElement = PK_ElementImpact.getCurrentElement(battler);
const actorElemIcon = PK_ElementImpact.elementIcon(actorElement);

then just reference actorElemIcon wherever you want to draw the actors current element.

Element Icons were added in with version 1.4, make sure you're using that latest version from itch. Info in the help section is under #7.

Next update I'll see about either adding in a function that can produce the icon directly or add in extra instructions in case someone else has interest in the same set up.


Let me know if you run into any issues!
Hey! So this should be a fairly straightforward check using a combination of two functions in the plugin:

PK_ElementImpact.getCurrentElement

and

PK_ElementImpact.elementIcon


try this:

Spoiler: Check Actor Current Element Icon
const actorElement = PK_ElementImpact.getCurrentElement(battler);
const actorElemIcon = PK_ElementImpact.elementIcon(actorElement);

then just reference actorElemIcon wherever you want to draw the actors current element.

Element Icons were added in with version 1.4, make sure you're using that latest version from itch. Info in the help section is under #7.

Next update I'll see about either adding in a function that can produce the icon directly or add in extra instructions in case someone else has interest in the same set up.


Let me know if you run into any issues!
Hey! thanks for replying so swiftly, but i do have a couple questions...

from what i understand, those two lines of code are

the variable "actorElement" is set to the battler's current element
the variable "actorElemIcon" is set to the corresponding icon for their element.

but how do we get from there to the icons showing up on the battler?
I know there's a show icon script call, but you choose the X and Y for that, rather than it showing on the actor.


if all else fails, i do have SRD's hudmaker, like i said before so i suppose i could make all of the icons for each character and only have them appear when "actorElemIcon" is set to something...?

I feel like you had a very easy way to do it and me, being the RPG maker user with the coding knowledge of a baked potato, am missing.
Sorry for the late reply, busy day

but how do we get from there to the icons showing up on the battler?
I know there's a show icon script call, but you choose the X and Y for that, rather than it showing on the actor.


if all else fails, i do have SRD's hudmaker, like i said before so i suppose i could make all of the icons for each character and only have them appear when "actorElemIcon" is set to something...?


Set up the icons for each element in the plugin parameters

1740795757644.png


HUDMaker is probably the easiest lift to do this if you're already using that. You would only need to create an Icon HUD Component

1740795611348.png


For each actor in battle. Then in IconIndex -> Code
Use:

Spoiler: HUDMaker > Icon Component > IconIndex > Code
const battler = $gameParty.members()[0];
if (battler){
const actorElement = PK_ElementImpact.getCurrentElement(battler);
const actorElemIcon = PK_ElementImpact.elementIcon(actorElement);
return actorElemIcon;
}
return 0;

Update the party index for each actor

`PK_ElementImpact.getCurrentElement` returns "0" by default if no element is found/no icon associated. So it should work without that if check, but HUDMaker is wonky sometimes when changing from Map to Battle so throwing in there just in case.
Sorry for the late reply, busy day




Set up the icons for each element in the plugin parameters

View attachment 332894

HUDMaker is probably the easiest lift to do this if you're already using that. You would only need to create an Icon HUD Component

View attachment 332893

For each actor in battle. Then in IconIndex -> Code
Use:

Spoiler: HUDMaker > Icon Component > IconIndex > Code
const battler = $gameParty.members()[0];
if (battler){
const actorElement = PK_ElementImpact.getCurrentElement(battler);
const actorElemIcon = PK_ElementImpact.elementIcon(actorElement);
return actorElemIcon;
}
return 0;

Update the party index for each actor

`PK_ElementImpact.getCurrentElement` returns "0" by default if no element is found/no icon associated. So it should work without that if check, but HUDMaker is wonky sometimes when changing from Map to Battle so throwing in there just in case.
Sorry, I'm away from my computer right now so I can't check but does this require the premium paid version of hudmaker? I only have the free one.

Thanks so much for helping me out with this!
Sorry, I'm away from my computer right now so I can't check but does this require the premium paid version of hudmaker? I only have the free one.

I dont remember whats locked behind the paid version sorry!
Sorry for the late reply, busy day




Set up the icons for each element in the plugin parameters

View attachment 332894

HUDMaker is probably the easiest lift to do this if you're already using that. You would only need to create an Icon HUD Component

View attachment 332893

For each actor in battle. Then in IconIndex -> Code
Use:

Spoiler: HUDMaker > Icon Component > IconIndex > Code
const battler = $gameParty.members()[0];
if (battler){
const actorElement = PK_ElementImpact.getCurrentElement(battler);
const actorElemIcon = PK_ElementImpact.elementIcon(actorElement);
return actorElemIcon;
}
return 0;

Update the party index for each actor

`PK_ElementImpact.getCurrentElement` returns "0" by default if no element is found/no icon associated. So it should work without that if check, but HUDMaker is wonky sometimes when changing from Map to Battle so throwing in there just in case.
even though i put "return 0;" at the end, it still says "cannot read property 0 of undefined". i know its this because when i deleted the icon it ran just fine.


it may be that it's because i cannot do the "addon" function as its locked behind the p[aid version, but i dont think thats the right error if it was.
even though i put "return 0;" at the end, it still says "cannot read property 0 of undefined". i know its this because when i deleted the icon it ran just fine.


it may be that it's because i cannot do the "addon" function as its locked behind the p[aid version, but i dont think thats the right error if it was.


Can youu screenshot/copy and paste what you're puuttingg and where? As well as screenshot the console to see the fuull error
Screenshot 2025-03-01 151416.png

Screenshot 2025-03-01 150113.png

Screenshot 2025-03-01 151449.png

Screenshot 2025-03-01 151610.png

this one? (sorry, im not experienced with the console)
also DANGIT i thought i included those in my original reply 🙁
So in HUDMaker i need you to open uup the icons component and the code area inside so i can see what you're workingg with
So in HUDMaker i need you to open uup the icons component and the code area inside so i can see what you're workingg with
Screenshot 2025-03-01 151927.png

;_;sorry for the incompetence
suddenly i realize its all my fault haha hehe IAUYGBDP:>UIWSYKDG
got it working. thanks puppet knight and once again i apologize for my brain not braining
uh oh... there's no error but the icon does not appear. ive used multiple attacks and have the icons completely set up, but it does not show 🙁

update because my old post is getting cluttered:

I found out why its not working (EXTREMELY embarrasing oversight on my part)
i put in the ID of the actor rather than leaving it at 0, and now the error no longer shows.

the problem is that the icons never show up. i've used many skills on the actor and it still does not display the icon.

anything else I'm missing?
I found out why its not working (EXTREMELY embarrasing oversight on my part)
i put in the ID of the actor rather than leaving it at 0, and now the error no longer shows.

the problem is that the icons never show up. i've used many skills on the actor and it still does not display the icon.

anything else I'm missing?
Can you add a console.log(actorElemIcon) before it returns
Can you add a console.log(actorElemIcon) before it returns
Screenshot 2025-03-02 120708.png

says it's not defined unfortunately

Original thread: https://forums.rpgmakerweb.com/threads/puppet-knight-element-impact-element-icons.173533/