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,556
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,556
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,556
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 Profile Posts

Empty Bottles and Health Extenders are now a thing.
Also the Sling-Shot does damage to enemies now, but not a lot and you won't get gold from killing them that way.
ScreenShot_5_26_2022_11_36_32.png
added a Panic gauge to battle. it fills up according to your actions. each character has a different passive that activates once the gauge is full. also once full, a countdown starts and after each action taken, the gauges decreases. with each character, the decrease is different.
Genuinely considering making a thread informing people how to Google.
It's time for Da Update...

Prototyping some overworld abilities. Some of the characters you'll meet on your journey can use special overworld skills to travel around. This can be something like digging holes in the ground or getting hints towards your next objective.

Forum statistics

Threads
122,163
Messages
1,146,955
Members
160,434
Latest member
SirBigSad
Top