Hi guys, I want to change the element of the Current Actor Dynamically via Plugins (Javascript)
I change the Class via
$gameActors.actor(1).changeClass(X);
but how can I change the element trait of the said actor?
that depends on how you apply the trait in the first case.
by default actors have no element trait - it is supposed to come from equipment like a fire sword or ice spear or whatever.
if you apply it directly then there is no way to remove or change a fixed trait to class or actor in default, but there are plugins that give dynamic trait functions.
but even with dynamic traits it is usually better to handle element rates by equipment, unless you make them completely dynamic and apply even the first one only after the game is initialised (not in the database itself)
To be fair you can change it but...
I mean, it's a simple thing to do a script call
$dataActors[1].traits[0].dataId = 1
Pretending the first trait was an Attack Element, I just set it to "Physical"
This might work for you depending on how temporary the change is.
But this is the $dataActors not the $gameActors. The change won't be saved when you leave the game. And a bigger concern might be that the trait change would be present when starting a new game or loading a different save file.
Then again, if this trait is something you're regularly checking or changing then maybe it won't be a big deal.
I don't know. Attack Elements don't make a difference if the Enemy doesn't have an Elemental Rating in the first place. I think the only way you could exploit this is if there was a very gimmicky boss that was immune to everything but a rare element you're meant to jump through hoops to get. And even then, the player would need to already have that element prepared on a different save. Like a speedrun strategy.
Hardly game breaking. In fact, you could make it a feature of a "rare element only" challenge run. If maintaining the element from the very beginning of the game was easier said than done.
$gameActors don't have a ._trait property to store changes to.
If we were to give it one, you'd have to change a number of things to make it work.
Classes, like equipment, have their own set of traits that the actor will inherit. So if Swordsman has a Fire Attack element, the Actor with that Class will too. They'll lose that trait on a class change, and assume the traits of another class. The only reason it wouldn't is if you didn't give the class an element trait. Or because the element you're seeing is attributed by something else carrying that trait; equipment or a state.
Am I reading "Change Element" too literal? Actually remove or replace the trait itself? Without removing or replacing the State, Equipment, Class ect...
You could have duplicate Swordsman classes, but with a different element for each. Behind the scenes, changing an element means changing the class.
Like this? [img]https://i.imgur.com/1dywB7T.png[/img]
Otherwise, changing the $dataClasses is like changing the $dataActors.
Maybe if you set up your classes in a particular order like
1 Swordsman (no element)
2 Swordsman (fire)
3 Swordsman (water)
.
.
8 Archer (no element)
9 Archer (fire)
10 Archer (water)
.
.
.
So when you use a class change script call, the ID for the fire class will be the base class ID+1.
Where "+1" is a variable.
Of course this setup assumes the elements are mutually exclusive. Creating classes for every elemental combo would be a pain.
It's tricky, you can have multiple Elemental Rates Traits that change the damage multiplier.
like 1000% followed by 2%
So that's (Damage * 10 * .02) which would be the same as (Damage * .2) or 20%.
But that across 2 traits, and you can have element traits on Actors, Classes, Equipment, and States.
So "How" to do this, with a script call, is a great question. Because you might change individual traits, or push a new trait.
A more pertinent question is "why" is it changing? Perhaps the class' element rate goes up by with the character level?