MV Add variable Skill Type from state (YEP_AutoPassiveStates)

Hello,

I am looking to add a specific Skill Type through a state using notetags rather than the default Add Skill Type trait. I am attempting this so that if statements based on equipment determine which Skill Type is added.

What would the correct code be to add a Skill Type through a notetag? I am using YEP_AutoPassiveStates, but I am not sure this is the correct plugin for this, as I have had trouble running code from the notebox with this plugin before.

Below is a rough draft, which simply activates the state based on what equipment is being held. While this could work, it would require a few hundred states to do so, one for each Skill Type. Naturally, I would much prefer running the eval in a single state and providing the skill type per if statement.


Code:
<Custom Passive Condition>
  if (
user.equips()[0] && user.equips()[0].wtypeId === 141)
{
    condition = true;
  } else {
    condition = false;
  }
  </Custom Passive Condition>
You can't just do that with code in a state.

You need to use a dynamic traits plugin (I believe Shaz and Galv have some) - you'll need to read up on the syntax of that, then you should see how it gets the reference to the trait.

I think you're going to have to end up using waynee95's On Equip Eval, which will execute code upon adding and removing equipment - that code can place the dynamic trait on the actor, then remove it again.

(erm...omg, you have a few hundred skill types? O__O )
Thanks, I will look into the dynamic traits plugins and see if these can address what I am hoping to do.

If I understand this correctly however, there isn't a way to do this via code? Take for instance this snippet here that I use to automatically unequip an item when a 2-handed weapon is equipped.


Code:
<Custom On Equip Eval>
a.changeEquip(1, $dataArmors[0]);
user.refresh();
$gamePlayer.refresh();
</Custom On Equip Eval>

I would think substituting a.changeEquip(1, $dataArmors[0]); with a.addSkillType(1); (or whatever the correct syntax is) would work, but perhaps not.


-

About the skill types, yes it does seem like a lot, but I actually only have maybe 60 unique jobs, and 20 unique weapon types, however I am working on a tactical RPG style game (think FFT/Tactics Ogre), and setting up unique skill types for each weapon (and for which hand it is wielded in) allows me to calculate the damage and animation based on which weapon is used for the attack.

Example: Hero#1 has a dagger in right hand and a crossbow in left hand. Dagger + Right Hand provides skilltype 1 (Right Hand Dagger skills), while Crossbow + Left Hand provides skilltype 250 (Left Hand Crossbow skills). In this manner, all attacks from skilltype 1 will use dagger animation + only pull attack data from the right hand dagger, while attacks from skilltype 250 perform the attacks from the crossbow held in the left hand instead. The standard Attack skill is removed and replaced with an attack specific for each weapon type, and present on the associated skill type.
I would think substituting a.changeEquip(1, $dataArmors[0]); with a.addSkillType(1); (or whatever the correct syntax is) would work
There's no such thing. Skill types (amongst other things) are only provided by traits. You can see this in your basic database setup.

About the skill types...setting up unique skill types for each weapon...allows me to calculate the damage and animation based on which weapon is used for the attack.
I have no idea what your skill/knowledge level is, so you do what works best for you.

But I think it would be way easier, less database clutter, and incidentally eliminate the entire question you're asking here, just to program your skills using Yanfly's Action Sequences and use conditionals (which you could probably copy and paste a bunch) to see what's being wielded and change the animations and motions appropriately.

And then all of your stuff can be in one place, Skills, or Weapon Skills, or whatever. And if you really want to separate them out by Melee Skills and Ranged Skills, that's two skill types, not hundreds, and you can easily show/hide them using Victor Engine's Command Replace. (and you can show/hide individual skills within easily with Yanfly's Skill Core notetags, so you don't always see dagger skills in Melee Skills unless you're wielding one)
Unfortunately custom sequences are a no-go from what I understand as I am using LeTBS tactical battle system. I can run some custom sequences through the LeTBS code, but these are quite limited.
I will double check, but it is looking like I am going to have to settle with unique states being responsible for each skill type. Which isn't even that big of a deal really, as long as it doesn't produce any slowdown.

Original thread: https://forums.rpgmakerweb.com/threads/add-variable-skill-type-from-state-yep_autopassivestates.165427/