Heliolater

Villager
Member
Joined
Oct 15, 2021
Messages
18
Reaction score
7
First Language
English
Primarily Uses
RMMV
Looking for a way to determine what skill type an action is while running a script.

I'm using Yanfly's plugins and specifically following his tips & tricks guide for Dualcasting. It seems to be able to act on only 'magical' skills. I see this is a method of the Game_Action class:

if (action && action.isSkill() && action.isMagical()) {
...
}

However, looking through the library, I haven't been able to find a method that can fetch the skill type. Essentially, I want to change the action.isMagical() to check if the action is a skill of type X. Any ideas?
 

TSR

The Northern Frog
Veteran
Joined
Nov 14, 2019
Messages
451
Reaction score
535
First Language
French
Primarily Uses
RMMZ
Hello.
this.item().stypeId will return the skill type id of the action.
if (action.item().stypeId === 1) //check if the skill is magic (assuming magic is the first skill type in the database)
 

Heliolater

Villager
Member
Joined
Oct 15, 2021
Messages
18
Reaction score
7
First Language
English
Primarily Uses
RMMV
Hello.
this.item().stypeId will return the skill type id of the action.
if (action.item().stypeId === 1) //check if the skill is magic (assuming magic is the first skill type in the database)
Yes, that worked exactly. I'm not sure why though. I see Game_Item in the library, but it has no member stypeId. I think I'm fundamentally missing something about the hierarchy.

Also, thank you!
 
  • Like
Reactions: TSR

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
4,969
Reaction score
4,552
First Language
English
Primarily Uses
RMMZ
Yes, that worked exactly. I'm not sure why though. I see Game_Item in the library, but it has no member stypeId. I think I'm fundamentally missing something about the hierarchy.

Also, thank you!
Game_Item is the class that holds the skills and items that actors/enemies use, but they are not the *data* of those skills and items. The item() function returns an element from the $dataSkills array, which is what contains the actual information of the skill, and is loaded from Skills.json. If you look up my primer post on data class mapping, it explains exactly what internal variables map to the different aspects of the database.

stypeId is the variable that maps to the "skill type" dropdown in the skills tab.
 
  • Like
Reactions: TSR

Heliolater

Villager
Member
Joined
Oct 15, 2021
Messages
18
Reaction score
7
First Language
English
Primarily Uses
RMMV
Game_Item is the class that holds the skills and items that actors/enemies use, but they are not the *data* of those skills and items. The item() function returns an element from the $dataSkills array, which is what contains the actual information of the skill, and is loaded from Skills.json. If you look up my primer post on data class mapping, it explains exactly what internal variables map to the different aspects of the database.

stypeId is the variable that maps to the "skill type" dropdown in the skills tab.
Thanks for going the extra mile and explaining. I think I'll be able to extrapolate this to solve a lot of other issues in future.
 

Latest Threads

Latest Profile Posts

Historically, "honor" isn't what has won fights. Being as brutally dishonorable and malicious as possible has done that. This is a tactic that works for any fight. Honor doesn't matter when you're the loser.
Mcniner wrote on Umbriel's profile.
Hello! It seems the Zelda sprites you sent me were removed by a moderator. Could you gmail them to me here: steinjaltman@gmail.com? Thanks!
Remember to do your 0,01% progress on your game today!
Went to see Jujutsu Kaisen 0 yesterday, it was cool. The movie wasnt really a masterpiece, it had some pacing and characterization problems, but overall I enjoyed it, maybe because it was the first anime film I have ever been to in the cinema lol. The battle animation & music were top-notch. I havent seen much of the anime so people who watched the entire season would probably like it more.

Forum statistics

Threads
121,996
Messages
1,145,770
Members
160,264
Latest member
diexue
Top