Steal Skill Skill Without Plugin - Can you help improve & complete this?

Hello, everyone. Someone over on the Steam MZ discussions forum was asking about an MZ plugin for a Steal Skill (skill). Not a Steal Item or Equipment Skill. I was pretty sure you could do that without a plugin so I gave it a try just to see. A user by the name of "coyote_craft" responded a couple of times, which actually helped me get to where I am right now, but most of what they offered was beyond my understanding.

I was able to make the Skill and a Common Event that allows the Actor to use the Skill in combat and gives a 50% chance (just to test the concept) to steal an applicable skill from the enemy. I am sure there is a better, more efficient way to do what I have so far, but I just have the CE determine the last enemy targeted (so this will work no matter how combat is triggered and no matter what enemies are in the troop) and then using conditional branches, I manually put in the skill(s) for the enemy from the database. I didn't know how to simplify getting the enemy skill(s) with like a script or something so I just looked in the database myself and then put them manually in the conditional branches.

Of course, doing it this way would require that the CE include every enemy that is included in a troop and used in the game. That could get quite long. I only used 5 enemies for testing this concept.

For testing purposes, I made the skill hit all the time. And I made it so the actor can choose which skill to try to steal if the enemy has more than one skill available. All of that seems to work just fine.

However, I am now a little stuck on three parts.

One is where I want to make it so if the actor already knows the skill, the CE will tell them that. So I was thinking that there must be a way to compare the enemy skill(s) with the list of skills that the actor knows. But it would have to be generalized so any actor in the party could know and use the Steal Skill against any enemy.

But I can't figure out how to have the CE compare what skill(s) the targeted enemy knows with what the actor knows.

Two is where I would want to check to see if the actor using the Steal Skill (skill) can even use that skill. I figured out I needed that in testing when the stolen skill didn't show up as available because the actor didn't have the ability to use that type of skill (magic). It worked fine after I gave the actor that ability.

Three is only applicable if there is an easier way to do this without manually putting a conditional branch for each enemy in the CE. Doing it manually lets me pick and choose which skills I will let any actor steal. If there was a different way to do it, I would want to also be able to exclude skills from being stolen.

I think that you can still do all of this without a plugin, but I just don't have enough knowledge and experience to do it.

Any help that someone can offer is greatly appreciated! Including how to actually do this better and more efficiently than the way I currently have it. Also, if I am missing something important that I just haven't discovered yet, please feel free to point that out too.

Here are the screen shots of what I have right now.

Steal Skill.jpgSteal Skill CE 1.jpgSteal Skill CE 2.jpgSteal Skill CE 3.jpgSteal Skill CE 4.jpg

Thanks!
One is where I want to make it so if the actor already knows the skill, the CE will tell them that. So I was thinking that there must be a way to compare the enemy skill(s) with the list of skills that the actor knows. But it would have to be generalized so any actor in the party could know and use the Steal Skill against any enemy.

But I can't figure out how to have the CE compare what skill(s) the targeted enemy knows with what the actor knows.
You could do the old trick of making the skill apply a state to the actor who uses it. You can then check in the common event for which actor has that state, and that's the one you compare skills with. But this makes it even more hugely convoluted.
Two is where I would want to check to see if the actor using the Steal Skill (skill) can even use that skill.
Conditional Branch -> Tab 2 -> Actor is Class. You'd have to check for every class that gets the appropriate skill type to use each skill you could possibly steal.
Any help that someone can offer is greatly appreciated! Including how to actually do this better and more efficiently than the way I currently have it.
I mean...I'm sure you know this, but just code it. It would take up a fraction of the space to do this in a JavaScript function compared to this monster common event 😛 But I understand you're trying to accomplish it via eventing as an intellectual exercise.
@ATT_Turan Thanks for your input above. It jogged my mental thought processes a bit and helped me update what I have.

Now, any party member can use the Steal Skill if they have it assigned to them and the CE will recognize who they are. I also made the main CE call other CEs, one for each actor in the party. That way I could manually input and test the concept of the actor can't learn that type of skill (special or magic) or the actor already knows that skill.

I had to create a new skill type (Learning) so the actors in combat could use the Steal Skill, since I didn't want it to be either Special or Magic. This seems to work, it is just a lot of manual comparison of the database.

Here are updated screen shots. This would still be a lot of manual input, I think it is now generic for whoever is part of the party and no matter what their names are. I would just have to create a CE for each actor and update those CEs will all the enemies.

I still think there must be an easier way to do this with scripting, but still without a plugin. I just don't know how to use JS.

Steal Skill Updated.jpgSteal Skill Actor Updated.jpgSteal Skill CE Updated.jpgSteal Skill CE Actor 1-1.jpgSteal Skill CE Actor 1-2.jpgSteal Skill Actor 6-1.jpgSteal Skill CE Actor 6-2.jpgSteal Skill CE Actor 6-3.jpg

Thanks for any more input or thoughts anyone has. I am going to point the Steam MZ discussion poster over here. I already suggested posting here, but I will post this thread since Steam is being a pain in my butt about posting screenshots.
I still think there must be an easier way to do this with scripting, but still without a plugin.
I'm not really sure what you mean by this - "with scripting" is using the same JavaScript that you'd use in a plugin, you'd just be condensing the entirety of the common event into a JS function that's stored in a plugin file instead of a common event slot. There's no real reason to avoid using a plugin for advanced functionality just for the sake of avoiding a plugin. 😉

There are certainly a few places that could make some of the checks a bit simpler with individual script calls, but I think if you were going to start mixing those in, it would be just as straightforward to simply convert the whole thing to code.

If you wanted to make a plugin request of this, it wouldn't be that hard to knock out.
I'm not really sure what you mean by this - "with scripting" is using the same JavaScript that you'd use in a plugin, you'd just be condensing the entirety of the common event into a JS function that's stored in a plugin file instead of a common event slot. There's no real reason to avoid using a plugin for advanced functionality just for the sake of avoiding a plugin. 😉

There are certainly a few places that could make some of the checks a bit simpler with individual script calls, but I think if you were going to start mixing those in, it would be just as straightforward to simply convert the whole thing to code.

If you wanted to make a plugin request of this, it wouldn't be that hard to knock out.
Thanks for clarifying. I don't know much about plugins and I haven't experimented with them yet. The only reason I was trying to make this myself was because the original poster couldn't find a plugin to do this in MZ and I couldn't find one either from a quick search.

I figured if I couldn't help find a plugin, I might as well try doing it without one. :LZScheeze:

I am not against plugins. But I would like to understand them better. I also know from experience with modding other games that there can be challenges with making sure that mods (plugins) stay up to date with game updates and that mods (plugins) don't conflict with each other.

I just figured the more I can do without them, even with scripting, the better. Unless I can learn to make my own and then be responsible for keeping them up to date. But I don't see that happening any time soon! :LZSlol:

Thanks again for your responses!
So here's a quick function to do it. Save the attached js file and include it as a plugin. Then you can call the StealSkill function in the game.

It will steal a random skill from the enemy's list of actions that 1 - the actor doesn't already know, and 2 - the actor has the skill type to use.


The function returns 0 if the steal fails for any of those reasons, or the name of the stolen skill. So to reproduce the skill as it appears in the sample gif, I did:
1 - Make a skill with the damage formula:

Code:
$gameVariables.setValue(1, StealSkill(a, b)); 10
Replace the 1 with any unused game variable ID, and replace 10 with whatever damage formula you like.

2 - Make a common event that gets called by that skill. Inside of the event code:
Conditional -> Variable X (the same ID as above) != 0
-- Show Message "Learned \V[X]!" (same ID as above

I might consider making a full plugin out of this. Some options would be:
- Set a steal success rate. Right now it's just the success rate of the skill, but it could be a separate number if you want to hit for damage consistently but not steal every time.

- Set options to always steal a new skill if possible. Right now, if an enemy has, say, three skills, you could randomly end up stealing the same one twice, resulting in no effect the second time.
So here's a quick function to do it.
Thank you so much for taking that time to do this! This is awesome! I will play around with it myself and I will make sure to let the original poster on Steam know that they should check here for a solution.

I really appreciate that you did this. It was fun working up to the point I was able to. Maybe someday I will be able to do something like this all by myself.

Thanks again!

Original thread: https://forums.rpgmakerweb.com/threads/steal-skill-skill-without-plugin-can-you-help-improve-complete-this.145975/