Characterspecific Parameters (Javascript?)

Hey,
I guess I need some help, I created some custom parameters that work fine via the visustella core engine.
Yet I wanted to have a 2nd Character that has the same parameters but different values.
(Green circle = different values, Red circle = same values)
For example:
Character ID 1 has 5 points in Fire, while Character ID 10 has 1 Point in fire while having 4 in water.

At the moment the Problem is, that they share the same parameter values in the red circle and obviously I am not proficient enough in coding to solve this. So I wanted to ask for some help.

So
1721311044919.png
1721311309058.png
It's because you've set the parameter equal to a game variable - so yes, the value of that variable has nothing to do with which actor you're looking at.

For example:
Character ID 1 has 5 points in Fire, while Character ID 10 has 1 Point in fire while having 4 in water.
How are you actually tracking that? Because that's not all in variable 5.
ah yes, because i use variables to increase those parameters
so variable 5 = the parameter value for fire.

I guess that making different variables for characters would be a way for it to work.
So I could make for example variable 6 the param value for fire on another character

Yet how do I let it check if Character ID 1 or Character ID 2... is being looked at?
I assumed you already had a working system and you just needed help displaying it.

There are easier ways to do this, there are plugins that provide custom parameters and you'd just paste the script call for getting the value into the VisuStella field.

But to answer your question - the way you check is this.actorId()

So if actor ID 1 has fire in game variable 5, and actor ID 7 has fire in game variable 6, you would do:
Code:
if (this.actorId() == 1)
    return $gameVariables.value(5);
if (this.actorId() == 7)
    return $gameVariables.value(6);

Of course, if you arrange your variables in sequence according to actor ID, you could just use one line with some basic math. So, like, your variables for fire are all in order by actor ID starting with variable 5:
Code:
return $gameVariables.value(4 + this.actorId());
I think VS wants to be used like this:

In the Plugin Parameter, type this:
Code:
// Declare Constants
const user = this;

// calculations
return user.fire || 0;

Now you can do this to change an actor's attribute value:

Code:
$gameActors.actor(1).fire = ($gameActors.actor(1).fire || 0) + 5
Increases the fire attr from Actor with ID 1 by 5
I think VS wants to be used like this:
VS doesn't care, it explicitly states that section is not for creating custom variables 😉

Your solution also works - I just figured since the OP is clearly new and not comfortable with code, sticking to the included event commands as much as possible would be easier to use.
I assumed you already had a working system and you just needed help displaying it.

There are easier ways to do this, there are plugins that provide custom parameters and you'd just paste the script call for getting the value into the VisuStella field.

But to answer your question - the way you check is this.actorId()

So if actor ID 1 has fire in game variable 5, and actor ID 7 has fire in game variable 6, you would do:
Code:
if (this.actorId() == 1)
    return $gameVariables.value(5);
if (this.actorId() == 7)
    return $gameVariables.value(6);

Of course, if you arrange your variables in sequence according to actor ID, you could just use one line with some basic math. So, like, your variables for fire are all in order by actor ID starting with variable 5:
Code:
return $gameVariables.value(4 + this.actorId());
Thank you, this works!
(Edit: I just deleted the AI Code)
I tried using an AI and it came up with this
That's never a particularly good idea. AI generators, by definition, generate material - they make things up.

Most of the code we see from AI is nonsensical and unusable - since it can't consistently solve grade-level math, I'm not sure why it seems like a good idea to ask it to produce code for you.

It's also against the rules to ask for help fixing any AI code.

I'm glad you got it working, good luck with your project.
That's never a particularly good idea. AI generators, by definition, generate material - they make things up.

Most of the code we see from AI is nonsensical and unusable - since it can't consistently solve grade-level math, I'm not sure why it seems like a good idea to ask it to produce code for you.

It's also against the rules to ask for help fixing any AI code.

I'm glad you got it working, good luck with your project.
the code i had in the beginning wasnt ai, I was just trying to find a solution for my problem, thats why I also asked one^^
Being desperate enought to make it work, but I am using what you told me.
the code i had in the beginning wasnt ai
I'm aware. I'm pointing out that this:
I also asked one
doesn't make sense to me.

If AI is often wrong...and you don't know how to code, so you can see whether what it tells you is wrong...how could you trust anything it says? And if you can't trust anything it says, isn't it logically a waste of time to interact with it?

Anyway, have fun with your game.

Original thread: https://forums.rpgmakerweb.com/threads/characterspecific-parameters-javascript.170411/