Dumango

Regular
Regular
Joined
Dec 28, 2022
Messages
100
Reaction score
16
First Language
Italian
Primarily Uses
RMMV
Hello,
I am writing regarding SRDude's plugin: StatDistribution.

I would like to have a command that adds "points" to a character and automatically spends them on a statistic.
For example, if a character eats an ingredient that increases the attack statistic by 2, two "points" are assigned to him and immediately spent on the attack.

This is related to another thing I need, which is an ingredient that when eaten resets all the character's statistics and "points", i need a command to that. In this way, even the spent "points" would become available again, and the player could choose how to invest them manually.

Someone can help me?
 

xabileug

Regular
Regular
Joined
Jul 1, 2014
Messages
635
Reaction score
241
Im looking for an extensive stat distribution plugin too.. hope some takes this
 

ATT_Turan

Forewarner of the Black Wind
Regular
Joined
Jul 2, 2014
Messages
11,214
Reaction score
9,177
First Language
English
Primarily Uses
RMMV
Hello,
I am writing regarding SRDude's plugin: StatDistribution.

I would like to have a command that adds "points" to a character and automatically spends them on a statistic.
It looks like this should be actor.addBaseDistribute(parameter ID, amount)
where the parameter ID is the order they're displayed on the Class tab in your database, starting with 0.

i need a command to that. In this way, even the spent "points" would become available again, and the player could choose how to invest them manually.
It looks like this should be done with actor.resetDistributeStats()

Both of these presume you know how to get a JavaScript reference to the actor in question. Let us know if you need help with that, too.
 

Dumango

Regular
Regular
Joined
Dec 28, 2022
Messages
100
Reaction score
16
First Language
Italian
Primarily Uses
RMMV
Both of these presume you know how to get a JavaScript reference to the actor in question. Let us know if you need help with that, too.
Yes, lol.
 

ATT_Turan

Forewarner of the Black Wind
Regular
Joined
Jul 2, 2014
Messages
11,214
Reaction score
9,177
First Language
English
Primarily Uses
RMMV
Looking back at your original post, it looks like you want this to happen by using an item on an actor. So you'd have to be calling a common event from the item, and it's not super easy to get a reference inside of that.

1 - In your item's Effects, apply a state (doesn't matter what it is, make a dummy state)

2 - Then call a common event

3 - In the common event, use conditional branches that reference each actor that could be in your party and check if they have your dummy state on

4 - Use the script calls I gave you above. Where it says "actor" you put:
Code:
$gameActors.actor(X)
where X is the ID of that actor (no leading zeros)

5 - Still in the conditional branch, remove the dummy state from the actor.
 

Dumango

Regular
Regular
Joined
Dec 28, 2022
Messages
100
Reaction score
16
First Language
Italian
Primarily Uses
RMMV
Looking back at your original post, it looks like you want this to happen by using an item on an actor. So you'd have to be calling a common event from the item, and it's not super easy to get a reference inside of that.

1 - In your item's Effects, apply a state (doesn't matter what it is, make a dummy state)

2 - Then call a common event

3 - In the common event, use conditional branches that reference each actor that could be in your party and check if they have your dummy state on

4 - Use the script calls I gave you above. Where it says "actor" you put:
Code:
$gameActors.actor(X)
where X is the ID of that actor (no leading zeros)

5 - Still in the conditional branch, remove the dummy state from the actor.
Sorry, perhaps I didn't understand what you meant, but my problem doesn't involve states. But rather SRDude's plugin: StatDistribution itself.

This plugin allows players to enhance their statistics using special "points," which can be allocated manually. However, I have a slightly different goal in mind.
Let me give you an example:

Player 1 uses the red item, and their attack increases by 2. In this case, the attack doesn't increase directly, but Player 1 receives 2 points that are automatically spent on the attack. This way, if the player ever wants to reset and redistribute their statistics, the earned points will be recorded, and the player can manually decide how to invest them.

To summarize, I plan to leverage SRDude's plugin functionality for an NPC character, granting players the ability to reorganize their statistics.
I would need two scripts (I believe) to achieve this: one that increases a statistic by a certain value and the actor receives that value, and another script that resets the statistics, similar to the base plugin command, for an item that automatically resets the statistics when used.
 

ATT_Turan

Forewarner of the Black Wind
Regular
Joined
Jul 2, 2014
Messages
11,214
Reaction score
9,177
First Language
English
Primarily Uses
RMMV
Sorry, perhaps I didn't understand what you meant, but my problem doesn't involve states.
I didn't say it did. I broke down the instructions as concisely as I could, even with numbers - please try to follow them.

If there is a specific part you're unable to understand, you can refer to that number in the instructions and which specific words you need help with.

I would need two scripts (I believe) to achieve this: one that increases a statistic by a certain value and the actor receives that value, and another script that resets the statistics
And I provided those script calls to you in my post above, but you said you didn't know how to use them. Thus, my instructions.
 

Dumango

Regular
Regular
Joined
Dec 28, 2022
Messages
100
Reaction score
16
First Language
Italian
Primarily Uses
RMMV
I didn't say it did. I broke down the instructions as concisely as I could, even with numbers - please try to follow them.

If there is a specific part you're unable to understand, you can refer to that number in the instructions and which specific words you need help with.


And I provided those script calls to you in my post above, but you said you didn't know how to use them. Thus, my instructions.
Sorry I hadn't understood anything!

I tried to do as you told me. I'm attaching an image of the common event, is it correct like this?

Schermata 2023-06-03 alle 16.42.07.png

I tried using the tool on actor number one, and for a moment, the frozen icon appeared and then disappeared. Is it working?
 

ATT_Turan

Forewarner of the Black Wind
Regular
Joined
Jul 2, 2014
Messages
11,214
Reaction score
9,177
First Language
English
Primarily Uses
RMMV
I tried to do as you told me. I'm attaching an image of the common event, is it correct like this?
No. All of your script calls have several syntax errors.

Please refer to my post above and copy them correctly. The only thing you should change is the letter X for the appropriate ID.

The event commands appear to be correct.
 

Dumango

Regular
Regular
Joined
Dec 28, 2022
Messages
100
Reaction score
16
First Language
Italian
Primarily Uses
RMMV
Thank you so much for your patience. Here's the updated common event:

Schermata 2023-06-05 alle 10.44.42.png

Did you mean to do it like this?

______________

I tried using the tool associated with this event again, and as soon as I use it on any actor (I tried with all of them), the "frozen" state icon appears, then the menu closes. When I reopen it, the icon is gone. Do you think it's working?
 

ATT_Turan

Forewarner of the Black Wind
Regular
Joined
Jul 2, 2014
Messages
11,214
Reaction score
9,177
First Language
English
Primarily Uses
RMMV
No, you're still missing huge chunks of code. I know English is not your native language, but holy cow man...I don't understand how you're coming up with these things from what I typed :guffaw:

From post #3:
It looks like this should be actor.addBaseDistribute(parameter ID, amount)
Then post #5:
4 - Use the script calls I gave you above. Where it says "actor" you put:
Code:
$gameActors.actor(X)

So, following those instructions, you get:
Code:
$gameActors.actor(1).addBaseDistribute(5, 2)
 

Dumango

Regular
Regular
Joined
Dec 28, 2022
Messages
100
Reaction score
16
First Language
Italian
Primarily Uses
RMMV
No, you're still missing huge chunks of code. I know English is not your native language, but holy cow man...I don't understand how you're coming up with these things from what I typed :guffaw:

From post #3:

Then post #5:


So, following those instructions, you get:
Code:
$gameActors.actor(1).addBaseDistribute(5, 2)

You're absolutely right, and I hope I haven't wasted your time with my issue, but the thing is, from the beginning, I didn't quite understand what your proposed solution was, so I'm a bit lost, to be honest.

I gave it one last try, hoping it was what you meant.

Schermata 2023-06-07 alle 16.46.12.png
 

Dumango

Regular
Regular
Joined
Dec 28, 2022
Messages
100
Reaction score
16
First Language
Italian
Primarily Uses
RMMV
@ATT_Turan
I tried a bit with all the advice you gave me, and I succeeded! It's working now.
Thank you for your patience!

EDIT:
I have one remaining issue. With the script to reset the statistics "$gameActors.actor(1).resetDistributeStats()", the statistics are reset (that's perfect), but the accumulated Points are not obtained (as in SMRDude's plugin).

So, I would need to check first how many invested statistics the actor in question has, then reset the statistics, and finally give back the reset statistics as Points.

For example: if my actor 1 has spent 8 Points on Attack and 2 Points on Defense, upon resetting the statistics, they should receive 10 Points.
 
Last edited:

ATT_Turan

Forewarner of the Black Wind
Regular
Joined
Jul 2, 2014
Messages
11,214
Reaction score
9,177
First Language
English
Primarily Uses
RMMV
I'm not sure what to say - it looks like it ought to. The default code for resetting points calls other functions to pay a cost and such, but doesn't call anything else to move points around.

And the first line in resetDistributeStats() is:
Code:
    this.addDistributePointsTemp(this._distributePointsSpent);
adding back the points that were already spent.

Maybe just as a check, change your script to:
Code:
console.log($gameActors.actor(1)._distributePointsSpent, " points spent"); $gameActors.actor(1).resetDistributeStats()

Then, in your playtest, press F12 and go to the Console tab. Verify it's showing there that the actor has spent points.
 

Dumango

Regular
Regular
Joined
Dec 28, 2022
Messages
100
Reaction score
16
First Language
Italian
Primarily Uses
RMMV
If I press F12, the Super Tools Engine by SMRDude opens. I tried with F8, and here's what the console tab says

Schermata 2023-06-12 alle 10.23.40.png


I'll show you more images. I'm currently focusing on actor number 1 (called "A")

Item give points&stats.png

This above is the item that, when used, increases the special attack (number 4 in the database) by 2. I also added a plugin command to give 2 points, and I need a script that removes these 2 points to make them "spent." -> (This should help for a check later maybe?)

item resetpoints and stats.png

While this is the item that, when used, resets the statistics (and your previous script works perfectly for that!), but it should also make the points available to the player again. So maybe here why need that "previous check".
 

ATT_Turan

Forewarner of the Black Wind
Regular
Joined
Jul 2, 2014
Messages
11,214
Reaction score
9,177
First Language
English
Primarily Uses
RMMV
I'm not sure what the point is of using both the plugin command and the script call - if you were doing this in an event to be able to use the plugin command, why did you request the script in your first post?

It seems weird to me that adding distributed points to an attribute would not also add them as spent points. But I guess try adding this after the command that adds to the parameter:
Code:
$gameActors.actor(1).addDistributePointsSpend(2)
 

Dumango

Regular
Regular
Joined
Dec 28, 2022
Messages
100
Reaction score
16
First Language
Italian
Primarily Uses
RMMV
I'm not sure what the point is of using both the plugin command and the script call - if you were doing this in an event to be able to use the plugin command, why did you request the script in your first post?

It seems weird to me that adding distributed points to an attribute would not also add them as spent points. But I guess try adding this after the command that adds to the parameter:
Code:
$gameActors.actor(1).addDistributePointsSpend(2)
No, unfortunately, it's not working... :(

I've come up with an idea, but I'm not sure if it's possible to implement:

When an actor uses the tool to increase their statistic, a variable called "Points" also increases.
Then, when the actor uses the tool to reset their statistics, I would need a script that does something like this:

actor1 receives points = "variable Points".

Is it possible to do something similar in a script? This means that the value of the points for that actor is equal to a game variable.
 

ATT_Turan

Forewarner of the Black Wind
Regular
Joined
Jul 2, 2014
Messages
11,214
Reaction score
9,177
First Language
English
Primarily Uses
RMMV
I had a typo above - it's Spent, not Spend.

When things don't work, you should try to get into the habit of opening your developer tools (F12) and checking the Console tab.

That should surely have produced an error that blahblahSpend is not a function.
 

Dumango

Regular
Regular
Joined
Dec 28, 2022
Messages
100
Reaction score
16
First Language
Italian
Primarily Uses
RMMV
I had a typo above - it's Spent, not Spend.

When things don't work, you should try to get into the habit of opening your developer tools (F12) and checking the Console tab.

That should surely have produced an error that blahblahSpend is not a function.
Oh my... it worked I love you, thank you for everything!


If I may, I wanted to ask you one last (for real) thing, I'm such a noob in this field...

Schermata 2023-06-16 alle 17.51.56.png

It's about a third tool that increases all statistics. As shown in the picture, the tool also works by increasing all statistics, but is there a more elegant way to combine everything into a single script or not?
 

Latest Threads

Latest Profile Posts

Man, the enemies in the new Sonic Frontiers update are totally roided up. I wanted a little more difficulty myself, but Sonic Team turned the dial a bit too far.

At least the new tracks for roaming Ouranos Island as Amy, Knuckles, and Tails slap hard.
mz_quest_victory_scene.gif


This battle victory screen has been pretty fun to work on. Not only can party members set new personal records for their contributions to the fight, but when they do, the party remarks on the accomplishment!
When you love all your children equally, but the world sees it differently.
popular.png
Found an old, unfinished project of mine, where you fight movie screenplays as an up-and-coming actress.
Turns out I used VX way back when. I may need to remake this in MZ, the premise was kinda hilarious.
1696205441250.png
1696205637522.png
Holy crow, logging in to 33 notifications! That was unexpected.

Forum statistics

Threads
134,981
Messages
1,252,573
Members
177,864
Latest member
Adubu
Top