MZ (Solved) How to update custom parameter value through code?

Hello,

I am currently working on a game about reviving a town and need to use a Custom Parameter for the Prosperity Level. I am using the VisuMZ_CoreEngine plugin. I have successfully displayed the Prosperity Level in the Status Menu, but I am unsure how to update this value.

I would like to increase the Prosperity value when the player completes a task, by adding a certain amount of prosperity in the quest event page. However, the custom parameter does not appear in the default "Change Parameter" page. Based on the core engine documentation, it mentions that this requires JavaScript knowledge, but I am not very familiar with coding.

Could someone please help me with this?

CoreEngine plugin documentation:
1726464967706.png


1726465047513.png
When I recall correctly, you need to do this:

In your window shown on the right, replace "return 1" with
Code:
return user.prl || 0;

Then, to initialize this parameter, you need a script and input this:
Code:
const actor = $gameActors.actor(1)
actor.prl = 0
Replace 1 with the ID of your actor from the database.

To update this value, input this:
Code:
const actor = $gameActors.actor(1)
actor.prl = actor.prl + 10
To increase by 10
When I recall correctly, you need to do this:

In your window shown on the right, replace "return 1" with
Code:
return user.prl || 0;

Then, to initialize this parameter, you need a script and input this:
Code:
const actor = $gameActors.actor(1)
actor.prl = 0
Replace 1 with the ID of your actor from the database.

To update this value, input this:
Code:
const actor = $gameActors.actor(1)
actor.prl = actor.prl + 10
To increase by 10
Thank you!!! It work perfectly.

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/solved-how-to-update-custom-parameter-value-through-code.171936/