skills: Script Call Question

Is there an easy way to make a character learn every skill in a sill type; other than individually selecting each skill for an actor. I'm trying to make the traditional "Item" command obsolete by making it so that only characters who equip the corresponding utility slot, have access to skills that use items. that is accomplished by yanflys plugin skillscostitems; with no problem. thats not the issue.... so far.

So, since Actor 1 has a utility belt, so he can throw grenades as long as you have them in inventory. However, individually adding each skill for each actor... is tedious.

is there a script call for this? or do i have to find a plugin for it?
You could do it with a script call that loops through all skills, checks to see what the skill type is, and adds the skill to the actor if it's the right type. You would need to repeat this for each actor, or use a combination of notes on the actor and checking the note in the script call to see if they match.

I am running short of time, but I'm sure someone else will be able to give you the details.
You could do it with a script call that loops through all skills, checks to see what the skill type is, and adds the skill to the actor if it's the right type. You would need to repeat this for each actor, or use a combination of notes on the actor and checking the note in the script call to see if they match.

I am running short of time, but I'm sure someone else will be able to give you the details.

Thank you. details are indeed what I need. As it stands, i'm not even sure how to define or recognize what a script call is; or where to put it... I just tried a script call in a parallel event and it crashed my game :/ 😛 but what you say about looping through all skills sounds about like what i was thinking of.
What plugins are you using? Can you please provide a screenshot of the Types tab in the database, where all your skill types are defined?
What plugins are you using? Can you please provide a screenshot of the Types tab in the database, where all your skill types are defined?

I am using a WHOLE LOT of yanfly's plugins. they are all in order. and here's the screenshot 🙂 mind you, a lot of the weapon types are still... unknown. i was just messing around with them. The skill type in question is "Devices".

upload_2017-11-26_22-8-47.png
So it's just one skill type? How will you determine which actors get all those skills? Do they ALL get them, or just one, or just specific ones?
So it's just one skill type? How will you determine which actors get all those skills? Do they ALL get them, or just one, or just specific ones?
OH! basically, i want every actor to "know" the skills, but the option to use them will only be added when the appropriate armor is equipped in the utility slot. i just add that "trait" to the armor piece itself.
This reply is intended to answer your original question --> Have an actor learn every skill for a given Skill Type.

Copy the code below and paste into a new JavaScript file within your project/js/plugins folder.
You mentioned you are using a lot of plugins already, so I included a check at the beginning for compatibility issues because I'm not familiar with the plugins out there already for skills/items (I haven't gotten to that part yet in my own game 🙂 ). If you get an alert, let me know which method was the issue and what plugin you're using that it is already defined (ctrl-F through your plugin files).

Spoiler: Mass Learn/Forget Skills Plugin
Code:
//
// Mass learn/forget skills based on Skill Type
//
/*:
* @plugindesc Mass learn or forget skills based on Skill Type
* @author Aloe Guvner
*
* @help
* Two new functions give the ability to learn and forget all
* skills of a given Skill Type.
* The functions are for Game_Actor.
*
* Call the functions using a Script command with this syntax:
* $gameActors.actor(actorId).massLearnSkills(stypeId)
* $gameActors.actor(actorId).massForgetSkills(stypeId)
*
* -actorId: The ID of the actor in the database
* --i.e. Harold --> 1
*
* stypeId: The ID of the Skill Type in the database
* --i.e. Special --> 2
*
* For example, in the standard database to teach Harold all
* "Special" skills:
*
* $gameActors.actor(1).massLearnSkills(2);
*/

(function() {
if (Game_Actor.prototype.massLearnSkills) {
    alert("Compatibility Issue: massLearnSkills method already defined");
    }

if (Game_Actor.prototype.massForgetSkills) {
        alert("Compatibility Issue: massForgetSkills method already defined");
    }

Game_Actor.prototype.massLearnSkills = function(stypeId) {
    for (var i = 1; i < Object.keys($dataSkills).length; i++) {
        if ($dataSkills[i].stypeId === stypeId) {
            this.learnSkill(i);
        }
    }
};

Game_Actor.prototype.massForgetSkills = function(stypeId) {
    var count = this._skills.length;
    var forgetThese = [];
    for (var i = 0; i < count; i++) {
        if ($dataSkills[this._skills[i]].stypeId === stypeId) {
            forgetThese.push(this._skills[i]);
        }
    }
    for (var i = 0; i < forgetThese.length; i++) {
        this.forgetSkill(forgetThese[i]);
    }
}

})();

The key for you will be to figure out when/how to call these methods. Again, not too familiar with the plugins out there but hopefully there is something which allows you to call a script/event when a certain armor is equipped. You'll also need to know how to grab the Actor Id and the Skill Type Id to use this.

Disclaimer: Beginner programmer here so there may be a more elegant/efficient way to do this. Will welcome any feedback or tips from the more experienced programmers on here.
This reply is intended to answer your original question --> Have an actor learn every skill for a given Skill Type.

Copy the code below and paste into a new JavaScript file within your project/js/plugins folder.
You mentioned you are using a lot of plugins already, so I included a check at the beginning for compatibility issues because I'm not familiar with the plugins out there already for skills/items (I haven't gotten to that part yet in my own game 🙂 ). If you get an alert, let me know which method was the issue and what plugin you're using that it is already defined (ctrl-F through your plugin files).

Spoiler: Mass Learn/Forget Skills Plugin
Code:
//
// Mass learn/forget skills based on Skill Type
//
/*:
* @plugindesc Mass learn or forget skills based on Skill Type
* @author Aloe Guvner
*
* @help
* Two new functions give the ability to learn and forget all
* skills of a given Skill Type.
* The functions are for Game_Actor.
*
* Call the functions using a Script command with this syntax:
* $gameActors.actor(actorId).massLearnSkills(stypeId)
* $gameActors.actor(actorId).massForgetSkills(stypeId)
*
* -actorId: The ID of the actor in the database
* --i.e. Harold --> 1
*
* stypeId: The ID of the Skill Type in the database
* --i.e. Special --> 2
*
* For example, in the standard database to teach Harold all
* "Special" skills:
*
* $gameActors.actor(1).massLearnSkills(2);
*/

(function() {
if (Game_Actor.prototype.massLearnSkills) {
    alert("Compatibility Issue: massLearnSkills method already defined");
    }

if (Game_Actor.prototype.massForgetSkills) {
        alert("Compatibility Issue: massForgetSkills method already defined");
    }

Game_Actor.prototype.massLearnSkills = function(stypeId) {
    for (var i = 1; i < Object.keys($dataSkills).length; i++) {
        if ($dataSkills[i].stypeId === stypeId) {
            this.learnSkill(i);
        }
    }
};

Game_Actor.prototype.massForgetSkills = function(stypeId) {
    var count = this._skills.length;
    var forgetThese = [];
    for (var i = 0; i < count; i++) {
        if ($dataSkills[this._skills[i]].stypeId === stypeId) {
            forgetThese.push(this._skills[i]);
        }
    }
    for (var i = 0; i < forgetThese.length; i++) {
        this.forgetSkill(forgetThese[i]);
    }
}

})();

The key for you will be to figure out when/how to call these methods. Again, not too familiar with the plugins out there but hopefully there is something which allows you to call a script/event when a certain armor is equipped. You'll also need to know how to grab the Actor Id and the Skill Type Id to use this.

Disclaimer: Beginner programmer here so there may be a more elegant/efficient way to do this. Will welcome any feedback or tips from the more experienced programmers on here.

WHOA! i had no idea it would require its own plugin. I thought that i would simply have to enter a script call under the actor notes to make the actor learn every skill ID listed. i will give this a shot and reply after testing. THANKS!

One thing that i did, for the sake of plugin organisation was change the name from
"Mass learn/forget skills based on Skill Type" to "AloeGuvner_Masslearnskills". I believe that the filename has to match the headline of the script or something like that; at least it was a hangup i encountered on a couple of yanflys plugins. i dont know if it's right or not, but it makes sure your name is first view at least.

tested: IT WORKS! Thanks a lot! you will definitely get some credit thrown your way; thanks for your time! out of curiosity? how long did it take you to work on this?
You could have done it with a script call, but a plugin is more elegant - especially one that lets you "turn it on and off" during the game.
WHOA! i had no idea it would require its own plugin. I thought that i would simply have to enter a script call under the actor notes to make the actor learn every skill ID listed. i will give this a shot and reply after testing. THANKS!

well, this certainly saves sooo much time and possibly a broken mouse or two. I cannot thank Aloe enough; and you as well for your part in clearing up what i need Shaz. this is awesome. I can think of many areas where a plugin like this would be a benefit to many people. great work!
WHOA! i had no idea it would require its own plugin. I thought that i would simply have to enter a script call under the actor notes to make the actor learn every skill ID listed. i will give this a shot and reply after testing. THANKS!

Shaz is right, it doesn't actually require a plugin but I was looking for some practice and trying to get familiar with the Skills portion of the database so I figured it could be worth it to make a plugin.

Be careful with your wording, when Shaz mentions a "script call" he's referring to the event command "Script Call" on the 3rd page in events. This allows you to type in text that gets executed as JavaScript.
When you are referring to the Notes section for any part of the database, that's merely text which is meant for you to keep notes. It's only when plugins specifically check the Notes section (like many of Yanfly's plugins) that allow the Notes to actually have an impact on the game. Hopefully that makes sense.

One thing that i did, for the sake of plugin organisation was change the name from
"Mass learn/forget skills based on Skill Type" to "AloeGuvner_Masslearnskills". I believe that the filename has to match the headline of the script or something like that; at least it was a hangup i encountered on a couple of yanflys plugins. i dont know if it's right or not, but it makes sure your name is first view at least.

tested: IT WORKS! Thanks a lot! you will definitely get some credit thrown your way; thanks for your time! out of curiosity? how long did it take you to work on this?

While this plugin is a standalone so the name doesn't technically matter, you are right that it's good to keep a consistent naming structure to keep the project as clean as possible. It is especially important when there is a huge library (like Yanfly's) to ensure that all the pieces are in the right order.
I guess it took me a little more than an hour? It was my first time looking into the Game_Actor methods so I took a bit just getting to know that section. Like Shaz said it's really just a couple of loops.

Just for formalities sake:
Terms of Use: Free for use in any RMMV game (commercial or non-commercial)
Credit: Credits not required but if you would like to, just credit "Aloe Guvner"
Shaz is right, it doesn't actually require a plugin but I was looking for some practice and trying to get familiar with the Skills portion of the database so I figured it could be worth it to make a plugin.

Be careful with your wording, when Shaz mentions a "script call" he's referring to the event command "Script Call" on the 3rd page in events. This allows you to type in text that gets executed as JavaScript.
When you are referring to the Notes section for any part of the database, that's merely text which is meant for you to keep notes. It's only when plugins specifically check the Notes section (like many of Yanfly's plugins) that allow the Notes to actually have an impact on the game. Hopefully that makes sense.



While this plugin is a standalone so the name doesn't technically matter, you are right that it's good to keep a consistent naming structure to keep the project as clean as possible. It is especially important when there is a huge library (like Yanfly's) to ensure that all the pieces are in the right order.
I guess it took me a little more than an hour? It was my first time looking into the Game_Actor methods so I took a bit just getting to know that section. Like Shaz said it's really just a couple of loops.

Just for formalities sake:
Terms of Use: Free for use in any RMMV game (commercial or non-commercial)
Credit: Credits not required but if you would like to, just credit "Aloe Guvner"

You sir, are a saint. TY.
when Shaz mentions a "script call" he's referring to the event command "Script Call" on the 3rd page in events.

she's referring ... 😉
she's referring ... 😉

I want to make a bad joke about squirrels holding their nuts, but I'm not sure it's appropriate for the forums XD ... still, that's a chuckle.

Edit: crap, i wanted to quote shaz's last message and what aloe_guvner posted. at the same time, but clicking the quote button only took shaz's words... do i have to add in some extra html line to re-quote what someone else quoted and their response? i cant forum for my life -_-
You can use the +Quote on several posts at once, and then reply to them all. Or you can select the first part to quote & hit Reply, then go find the next thing you want to quote, select it and hit Reply, and so on.

Original thread: https://forums.rpgmakerweb.com/threads/skills-script-call-question.87769/