Skill Description Depending on Actor?

WillS787

Villager
Member
Joined
Jan 23, 2022
Messages
9
Reaction score
2
First Language
English
Primarily Uses
RMMZ
Hello fellow RPG Makers!
I'm trying to find a way to have a skill's description be different depending on which actor we're looking at.
For example, when looking at Reid's skills, the description for Heal would contain '\V[101]', but when looking at Joe's skills, the description for Heal would contain '\V[201]'.

Objective:
I've made a skill point system where using a skill adds 1 to the skill point variable of the actor who used it, so after X many uses the actor learns the skill. Works fine, except I can't find a way to display this information to the player.

Example desired outcome:
Reid's Heal description:
'Heals one ally.
Skill Points: \V[101] / \V[1]'
Joe's Heal description:
'Heals one ally.
Skill Points: \V[201] / \V[1]'

Where V[101] is Reid's skill points for Heal, V[201] is Joe's skill points for Heal, and V[1] is the required skill points to learn Heal.

If there were a way to put a formula in a skill description, that would do it, but I haven't found a way to do so.

Thank you in advance for any help you can offer! Thanks!
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
4,969
Reaction score
4,553
First Language
English
Primarily Uses
RMMZ
You could use VisuStella Message Core, turn your skill point display into a text code macro and then put that macro in the skill description.
 

WillS787

Villager
Member
Joined
Jan 23, 2022
Messages
9
Reaction score
2
First Language
English
Primarily Uses
RMMZ
Thank you for the quick response!
This sounds great, I'm attempting to try this, but how do I get the skill id and actor id in the JS code? These would be the skill id and actor id that we're currently looking at in the menu. I need them to calculate the correct skill point variable id.
I'm thinking something like this, but I don't know the code to do it:

const x = (get actor id);
const y = (get skill id);
return $gameVariables.value((x*100)+y);

Sorry, scripting noob. Any advice is much appreciated.

Thanks!!
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
4,969
Reaction score
4,553
First Language
English
Primarily Uses
RMMZ
I think $gameParty has a property called _menuActorId or something like that.
 

WillS787

Villager
Member
Joined
Jan 23, 2022
Messages
9
Reaction score
2
First Language
English
Primarily Uses
RMMZ
Fantastic, $gameParty._menuActorId works great.
Now I just need to get the skill id that we're looking at.

Here's what I have attempted and does not work:

const x = $gameParty._menuActorId;
const y = $dataSkills[this._item].id; //this doesn't work
return $gameVariables.value((x*100)+y);

Is this doable?

Thank you for the help!
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
4,969
Reaction score
4,553
First Language
English
Primarily Uses
RMMZ
Fantastic, $gameParty._menuActorId works great.
Now I just need to get the skill id that we're looking at.

Here's what I have attempted and does not work:

const x = $gameParty._menuActorId;
const y = $dataSkills[this._item].id; //this doesn't work
return $gameVariables.value((x*100)+y);

Is this doable?

Thank you for the help!
$gameActors.actor($gameParty._menuActorId).lastMenuSkill().id

try that.
 

WillS787

Villager
Member
Joined
Jan 23, 2022
Messages
9
Reaction score
2
First Language
English
Primarily Uses
RMMZ
Hmm, that one crashed it:

rmmz_managers.js:2030 TypeError: Cannot read property 'id' of null

Here is the current script:

const x = $gameParty._menuActorId;
const y = $gameActors.actor($gameParty._menuActorId).lastMenuSkill().id;
return $gameVariables.value((x*100)+y);

Edit: After doing some experimenting, it seems the 2nd line in the above code returns the id of the last skill used from the menu, not the last skill viewed or current skill being viewed.
Any ideas how to get the id of the skill whose description is where this macro is being called from?

Thank you!
 
Last edited:

WillS787

Villager
Member
Joined
Jan 23, 2022
Messages
9
Reaction score
2
First Language
English
Primarily Uses
RMMZ
Update: I've got a workaround for this, if anyone else is trying to do the same thing.
Instead of a macro, I'm using a Text Code Replacement, so I can pass the skill id directly through the text code.
This means that when I paste the text code into each skill description, I need to manually update the skill id each time, but I can live with that.

Here's what the text code looks like in the description for skill #22:

\SkillPt[22]

And here is the code for the SkillPt text code replacement:

JavaScript:
const skillId = parseInt(arguments[1]);
const actorId = $gameParty._menuActorId;
const points = $gameVariables.value((actorId*100)+skillId);   //actor skill pt variable
const req = $gameVariables.value(skillId+40);   //required skill pt variable
let text = 'Skill points: ';
text += points + ' / ' + req;
return text;

The output looks like this if the actor has 2 skill points out of 5 required:
Skill points: 2 / 5

Note: to get this to work, the variables are assigned in a way that makes them easy to point to in a formula. For example actor #1's skill point variable id's are 101, 102, 103, etc., and actor #2's skill point variable id's are 201, 202, 203, etc. (actor_id*100 + skill_id). The required points variable id's are 41, 42, 43, etc. (skill_id + 40).
 

Latest Threads

Latest Posts

Latest Profile Posts

It has been brought to my attention that the name of my main robot protagonist in bio-Synthetica (R3-M1) is a Star Wars character LOL Woops. Always Google search names. The new name of my robot is now K0-R1. :kaophew:
I'm considering making my own battlers from scratch, it seems like a daunting task, but I like the look of it so much...A_Miriam3.png
I picked up running again after a long time and managed to get from 2.25km to 7km in two weeks :3 Time to get rid of those covid kilos!
Have you ever wondered what the lives of the NPC's are like in your hero's story? Come an find out with us as we play, "A Story Beside" by Wayward Prophet :LZSexcite:

Never in my life did I dream that I would be the proud owner of 5 jellyfish.

Forum statistics

Threads
122,092
Messages
1,146,459
Members
160,382
Latest member
Francis187
Top