Skill Buy System (Skill Trees possible)

Fomar0153

Arkz
Restaff
Joined
Mar 13, 2012
Messages
1,327
Reaction score
473
First Language
English
Primarily Uses
RMMZ
Skill Buy System
Version 1.1
by Fomar0153

Description
Implements a skill buy system. You can set requirements and implement skill trees if you wish.
Requires at least one AP System.

Features
Compatible with both my previous AP systems.
Set skill requirements.

Screenshots


How to Use
Place the plugin in your project's js/plugins/ folder.
Inside RPG Maker MZ's editor, open the Plugin Manager.
Create a new entry and select this plugin from the list.
Customise the options to your liking and then click ok.

Notetag skills with:
<ap: n>
Where n is the cost of the skill.
To make a skill require others skills to be learned before it can be learned:
<buyreq:x,y,z>
Seperate the skill ids with commas.

Notetag actors and/or classes with:
<skillbuy: x,y,z>
Seperate the skill ids with commas.

Download
Click here.

AP Systems:
If you want to earn AP by killing enemies, click here.
If you want to earn AP when you level, click here.

FAQ
Q: Nothing seems to happen when I use your plugin or I get an error.
A: Make sure the plugin has its original name and that you haven't accidentally renamed it.

Q: I double checked the name and I still have an error.
A: Please be really specfic about what you did when the error occurred, hit F8 and it'll give you some more details that might be useful to me. Does it happen in a blank project?

Credits
Fomar0153

Terms of Use
As long as I am credited, you may use this plugin in your projects both commercial and non-commercial.

Version History
1.0 -> 1.1 - 18/09/20
Fixed a bug where skills for allies would open up the actor select window.
Optimisation improvements.
 
Last edited:

Maliki79

Veteran
Veteran
Joined
Mar 13, 2012
Messages
794
Reaction score
347
First Language
English
Primarily Uses
N/A
Awesome! Gonna see if I can squeeze an on buy eval in there so I can get my stat buying system back on track!
 

Knightmare

Knight of the Night
Veteran
Joined
Mar 14, 2012
Messages
1,226
Reaction score
292
First Language
English
Primarily Uses
RMMV
Awesome! Gonna see if I can squeeze an on buy eval in there so I can get my stat buying system back on track!
You read my mind! Same thing I thought when I saw the thread title. I'm going to try to get it to work today, if I get it working right I'll share how to here and vice-versa if you get it before I do please share how you did it here.
 

Fomar0153

Arkz
Restaff
Joined
Mar 13, 2012
Messages
1,327
Reaction score
473
First Language
English
Primarily Uses
RMMZ
Awesome! Gonna see if I can squeeze an on buy eval in there so I can get my stat buying system back on track!
If you don't care/need an increasing AP cost you can probably just edit Scene_Skill.prototype.useItem and check the skill id and do it via paramPlus.
 

Maliki79

Veteran
Veteran
Joined
Mar 13, 2012
Messages
794
Reaction score
347
First Language
English
Primarily Uses
N/A
@Fomar0153 I will need increasing costs. Also, I won't only be raising base params.
Finally, as a bit of an aside, I'll need to make it so you can add skills to the learnable list after game start.
 

Kupotepo

Fantasy realist/Advocatus Diaboli
Veteran
Joined
Jul 5, 2017
Messages
1,939
Reaction score
2,064
First Language
Thai
Primarily Uses
RMMV
@Fomar0153, this silly thing I will ask you. Can rename AP to JP? Thank you for your amazing plugins.
 

skelhat

Warper
Member
Joined
Jun 4, 2020
Messages
3
Reaction score
1
First Language
Portuguese
Primarily Uses
RMMV
Is it possible to add an item as a requirement in addition to the AP?
Or if not, do you have plans for that?
The plugin is excellent, but it would be even better if it is possible to add requirements to learn the skill, I say this because the player could obtain an advanced skill at the beginning of the game without a requirement.
 

Maliki79

Veteran
Veteran
Joined
Mar 13, 2012
Messages
794
Reaction score
347
First Language
English
Primarily Uses
N/A
Ran into a little bit of a snag.
Apparently, if you try to learn a skill that can target an actor, the character select menu opens ups and I cannot confirm the skill to be learned.
 

Knightmare

Knight of the Night
Veteran
Joined
Mar 14, 2012
Messages
1,226
Reaction score
292
First Language
English
Primarily Uses
RMMV
I only got to play around with it about 20 minutes before I had to go to work and am currently working so I will not be able to do much more till later. I tried using some of the old tips and tricks script calls from the way it was done in MV but realized I needs special "lunatic" codes for a plugin that doesn't exist in MZ yet so that shot my idea down real quick.

Personally I won't need anything fancy so I'll try as @Fomar0153 suggested and just edit Scene_Skill.prototype.useItem and check the skill id via paramPlus. The new code is throwing me off a bit, I was just getting halfway decent with editing (not writing from scratch) MV code and now I have to re-learn the exact way to do it here for MZ so it might take me a bit to get it right.

@Fomar0153 I will need increasing costs. Also, I won't only be raising base params.
Finally, as a bit of an aside, I'll need to make it so you can add skills to the learnable list after game start.
Sorry I won't be able to help with all that, that is beyond my skill level.
 

Maliki79

Veteran
Veteran
Joined
Mar 13, 2012
Messages
794
Reaction score
347
First Language
English
Primarily Uses
N/A
No worries. I'm making progress on my end. (Besides the snag mentioned above...)
My issue is that everything I'm doing is basically hardcoded for my game.
After I get it working 100%, I'll see if I can break it down into something shareable.
 

Fomar0153

Arkz
Restaff
Joined
Mar 13, 2012
Messages
1,327
Reaction score
473
First Language
English
Primarily Uses
RMMZ
New version available, I fixed the bug mentioned below:

Ran into a little bit of a snag.
Apparently, if you try to learn a skill that can target an actor, the character select menu opens ups and I cannot confirm the skill to be learned.
Ok fixed it, thanks for the report.

Personally I won't need anything fancy so I'll try as @Fomar0153 suggested and just edit Scene_Skill.prototype.useItem and check the skill id via paramPlus. The new code is throwing me off a bit, I was just getting halfway decent with editing (not writing from scratch) MV code and now I have to re-learn the exact way to do it here for MZ so it might take me a bit to get it right.
You've misunderstood I meant something like:

JavaScript:
  Scene_Skill.prototype.useItem = function() {
    if (this.item() && this._itemWindow._stypeId == Fomar.SkillBuy.stypeId) {
      if (this.item().id == 12){
        // do the param plus stuff here
      } else {
        this.actor().learnSkill(this.item().id);
      }
      this.actor()._ap -= parseInt(this.item().meta["ap"]);
      this._statusWindow.refresh();
      this._itemWindow.refresh();
      if (this._itemWindow._index >= this._itemWindow.maxItems()) {
        this._itemWindow.select(this._itemWindow._index - 1);
      }
      this.actor().refresh();
    } else {
      Fomar.SkillBuy.Scene_Skill_useItem.call(this);
    }
  };
 

masterkof

Veteran
Veteran
Joined
Nov 12, 2013
Messages
58
Reaction score
24
First Language
english
Primarily Uses
Fomar0153 is it possible to do something like a skill shop. I mean by going to a npc and opening the learning skill tab and disabling the learning skill tab on the player.
 

Knightmare

Knight of the Night
Veteran
Joined
Mar 14, 2012
Messages
1,226
Reaction score
292
First Language
English
Primarily Uses
RMMV
New version available, I fixed the bug mentioned below:



Ok fixed it, thanks for the report.



You've misunderstood I meant something like:

JavaScript:
  Scene_Skill.prototype.useItem = function() {
    if (this.item() && this._itemWindow._stypeId == Fomar.SkillBuy.stypeId) {
      if (this.item().id == 12){
        // do the param plus stuff here
      } else {
        this.actor().learnSkill(this.item().id);
      }
      this.actor()._ap -= parseInt(this.item().meta["ap"]);
      this._statusWindow.refresh();
      this._itemWindow.refresh();
      if (this._itemWindow._index >= this._itemWindow.maxItems()) {
        this._itemWindow.select(this._itemWindow._index - 1);
      }
      this.actor().refresh();
    } else {
      Fomar.SkillBuy.Scene_Skill_useItem.call(this);
    }
  };
Thank you, you just saved me a bunch of time. I'm going to experiment with it now. Thanks for fixing the bug @Maliki79 pointed out also.

EDIT - I have a working version of a jerry-rigged stat distribution system with this sort of like how the old Yanfly Tips and Tricks 'Stat Upgrade' with using this plugin and AP to buy stat increases. It's ugly as h*** but it works. Replace the area that @Fomar0153 mentioned in my quote (start line 238) with this...


Fomar.SkillBuy.Scene_Skill_useItem = Scene_Skill.prototype.useItem;
Scene_Skill.prototype.useItem = function() {
if (this.item() && this._itemWindow._stypeId == Fomar.SkillBuy.stypeId) {
if (this.item().id == 361){
this.user()._paramPlus[0] += 5;
this.user().forgetSkill(361);
this.user().refresh();
}
else if (this.item().id == 362){
this.user()._paramPlus[1] += 3;
this.user().forgetSkill(362);
this.user().refresh();
}
else if (this.item().id == 363){
this.user()._paramPlus[2] += 1;
this.user().forgetSkill(363);
this.user().refresh();
}
else if (this.item().id == 364){
this.user()._paramPlus[3] += 1;
this.user().forgetSkill(364);
this.user().refresh();
}
else if (this.item().id == 365){
this.user()._paramPlus[4] += 1;
this.user().forgetSkill(365);
this.user().refresh();
}
else if (this.item().id == 366){
this.user()._paramPlus[5] += 1;
this.user().forgetSkill(366);
this.user().refresh();
}
else if (this.item().id == 367){
this.user()._paramPlus[6] += 1;
this.user().forgetSkill(367);
this.user().refresh();
}
else if (this.item().id == 368){
this.user()._paramPlus[7] += 1;
this.user().forgetSkill(368);
this.user().refresh();
} else {
this.actor().learnSkill(this.item().id);
}
this.actor()._ap -= parseInt(this.item().meta["ap"]);
this._statusWindow.refresh();
this._itemWindow.refresh();
if (this._itemWindow._index >= this._itemWindow.maxItems()) {
this._itemWindow.select(this._itemWindow._index - 1);
}
this.actor().refresh();
} else {
Fomar.SkillBuy.Scene_Skill_useItem.call(this);
}
};


obviously you'll need to replace the id numbers to the ones in your own database (361, 362, etc)

Don't credit me at all for this...credit only @Fomar0153 (for the plugin) and give a mention to @Yanfly (for the tips and tricks.)
 
Last edited:

Fomar0153

Arkz
Restaff
Joined
Mar 13, 2012
Messages
1,327
Reaction score
473
First Language
English
Primarily Uses
RMMZ
Fomar0153 is it possible to do something like a skill shop. I mean by going to a npc and opening the learning skill tab and disabling the learning skill tab on the player.
Err it's a bit clunky but if you literally copy and pasted Window_SkillType, Scene_Skill and rename them both you could probably get the job done. Then just make all my code also refer to the new versions, except for the following:

JavaScript:
  Fomar.SkillBuy.Window_SkillType_makeCommandList = Window_SkillType.prototype.makeCommandList;
  Window_SkillType.prototype.makeCommandList = function() {
    if (this._actor) {
      Fomar.SkillBuy.Window_SkillType_makeCommandList.call(this);
      this.addCommand(Fomar.SkillBuy.SkillBuyCommandName, "skill", true, Fomar.SkillBuy.stypeId);
    }
  };
Which you should change to:

JavaScript:
  Window_SkillTypeNewName.prototype.makeCommandList = function() {
    if (this._actor) {
    
      this.addCommand(Fomar.SkillBuy.SkillBuyCommandName, "skill", true, Fomar.SkillBuy.stypeId);
    }
  };
And then just call your new Scene_SkillNewName

Thank you, you just saved me a bunch of time. I'm going to experiment with it now. Thanks for fixing the bug @Maliki79 pointed out also.

EDIT - I have a working version of a jerry-rigged stat distribution system with this sort of like how the old Yanfly Tips and Tricks 'Stat Upgrade' with using this plugin and AP to buy stat increases. It's ugly as h*** but it works. Replace the area that @Fomar0153 mentioned in my quote (start line 238) with this...


JavaScript:
Fomar.SkillBuy.Scene_Skill_useItem = Scene_Skill.prototype.useItem;
  Scene_Skill.prototype.useItem = function() {
    if (this.item() && this._itemWindow._stypeId == Fomar.SkillBuy.stypeId) {
      if (this.item().id == 361){
          this.user()._paramPlus[0] += 5;
          this.user().forgetSkill(361);
          this.user().refresh();
          }
      else if (this.item().id == 362){
          this.user()._paramPlus[1] += 3;
          this.user().forgetSkill(362);
          this.user().refresh();
          }
      else if (this.item().id == 363){
          this.user()._paramPlus[2] += 1;
          this.user().forgetSkill(363);
          this.user().refresh();
          }
      else if (this.item().id == 364){
          this.user()._paramPlus[3] += 1;
          this.user().forgetSkill(364);
          this.user().refresh();
          }
      else if (this.item().id == 365){
          this.user()._paramPlus[4] += 1;
          this.user().forgetSkill(365);
          this.user().refresh();
          }
      else if (this.item().id == 366){
          this.user()._paramPlus[5] += 1;
          this.user().forgetSkill(366);
          this.user().refresh();
          }
      else if (this.item().id == 367){
          this.user()._paramPlus[6] += 1;
          this.user().forgetSkill(367);
          this.user().refresh();
          }
       else if (this.item().id == 368){
          this.user()._paramPlus[7] += 1;
          this.user().forgetSkill(368);
          this.user().refresh();
      } else {
          this.actor().learnSkill(this.item().id);
      }
      this.actor()._ap -= parseInt(this.item().meta["ap"]);
      this._statusWindow.refresh();
      this._itemWindow.refresh();
      if (this._itemWindow._index >= this._itemWindow.maxItems()) {
        this._itemWindow.select(this._itemWindow._index - 1);
      }
      this.actor().refresh();
    } else {
      Fomar.SkillBuy.Scene_Skill_useItem.call(this);
    }

  };

obviously you'll need to replace the id numbers to the ones in your own database (361, 362, etc)

Don't credit me at all for this...credit only @Fomar0153 (for the plugin) and give a mention to @Yanfly (for the tips and tricks.)
A couple of points;
Fomar.SkillBuy.Scene_Skill_useItem = Scene_Skill.prototype.useItem;
If someone reading this wants to use this, you can either copy and paste over the existing section or paste it at the bottom, if you paste it at the bottom ommit the above line.

With that many if else if else... you could consider using a switch statement.

If you want to have a go at making the AP cost increase look for:
JavaScript:
this.drawText(parseInt(skill.meta["ap"]) + "AP", x, y, width, "right");
And maybe change it to:
Code:
var cost = parseInt(skill.meta["ap"]);
// your code to increase the cost
this.drawText(cost + "AP", x, y, width, "right");
And then look for:
JavaScript:
this.actor()._ap -= parseInt(this.item().meta["ap"]);
And change it to match.
 

Maliki79

Veteran
Veteran
Joined
Mar 13, 2012
Messages
794
Reaction score
347
First Language
English
Primarily Uses
N/A
Ok.
I think I finished the edits. It's basically a rewrite of the whole thing with a few touches I hope are appreciated.

removed

Feel free to check it out and see if it's helpful.

Additions:
Applied evals on skill learning
Grouped skills with rising AP costs in that group
Individual and group skill additions outside of starting set.

If I'm missing anything fun, I can try to add it.


~Mal
 
Last edited:

Luckysince97

Veteran
Veteran
Joined
Feb 6, 2018
Messages
102
Reaction score
27
First Language
French
Primarily Uses
RMMZ
:XP1:Ty guy i was turning in round trying to build a skill tree with double teleport , but you @Knightmare @Maliki79 and @Fomar0153 just made what i got in mind happen, so to resume i use maliki, eval with some line of knigthmare and now not only i got an stat system working , but i can decide the paste to which each of my character learn their skill, i had to drop weapon skill learn but

if it could be implanted that would be awesome, so that skill are not only learnable by item or skill but by weapon also...
except for that you made a great job , ty Knight i figure out that in some way luna custom eval still work in some way, i gonna have to go back to vx ace to see what are the one i use to have thougth...lol!

oh and if you can would be great to explain the x placement code for new user , i had to change the x=180 to x=0 inside the js and i didnt find the y line but figure out that if i made it *1.6 it come down just under lv but above ppap.pngso after testing out i was asking myself if it could be possible to create a skill to call other skill so that few skill could be categorized
or should i just create a new skill id and dump the skill in it!

this is just for sorting purpuse...
 
Last edited:

Luckysince97

Veteran
Veteran
Joined
Feb 6, 2018
Messages
102
Reaction score
27
First Language
French
Primarily Uses
RMMZ
i was wondering if i could use swicth with that @Maliki79 , you see i use param [0] method from knigthmare and as leveling by 5 hp only i create 160 variable of 8 basic param for 5 dif character, but i would like to give my character a point of no return...

if he is level 10 he is learning hp+ 75 if levl 40 hp+ 500 ect...
or like in my previous message something to categorise much more than just a list name learn skill, would be great if it took stype in consideration
so that way i could create stype as level swich if 10 learn this skill if 20 learn these but forget level 10 stype and so on..
in other word


<skillBuyEvals: if $gameSwitches.setValue(X, true); && (this.item().id == 301){
this.user()._paramPlus[0] += 50;
this.user().forgetSkill(301);
this.user().refresh(); else this.user() refresh(false)
} >>>
let say i use this formula how do i tell, if swicht [] is on forget skill[301] but do not refresh
while somebody check that out ill go search in old luna engine

So i try that and annnnnnnnnn not working! could someone help me out ...
 
Last edited:

Maliki79

Veteran
Veteran
Joined
Mar 13, 2012
Messages
794
Reaction score
347
First Language
English
Primarily Uses
N/A
@Luckysince97 I'm not quite sure what you are trying to do, but if you are looking to have different levels of parameter change per level, you can do that fairly easily.
Try adding this to skill notes:

<skillBuyEvals: if(actor.level <= 10) actor._paramPlus[0] += 50;
if(actor.level > 10) actor._paramPlus[0] += 450;
if(!actor.hpLevel)actor.hpLevel=0;
actor.hpLevel++;
if(actor.hpLevel!=100) actor.forgetSkill(301)>>>

Using this will raise hp by 50 for each level up to 10.
Then it will raise hp by 450 past level 10.
Also, it creates an hpcounter which counts each time that specific actor learns the skill.
As long as the counter is below 100, the actor forgets the skill which allows it to be relearned.
This limits the number of times the param can be raised.
I know you said you wanted to use multiple skills, but I think doing it this way will be a lot simpler.
You can also change the amount of the param to raise via the actor's ID (which is what I do in my project) Experiment a bit and see what you can figure out. If you still need help, let me know and I'll see what I can do.

@skelhat I actually missed your comment earlier.
I totally forgot that I wanted item requirements in my game as well as am working to add it in.
I pretty much got the logic done. I'm trying to see about making it display pretty-like in the menu, which is my weak point admittedly. I should have something to show in a few hours.
Better or worse...

(BTW, in case anyone was hoping for it, I'm not planning to add the gold or switch/variable/eval requirements.
If there is a desire for it, I'll consider adding it.

And of course, if @Fomar0153 decides to do it, icing on the cake! :)
(Sorry if I kinda kidnapped your plugin...)


~Mal
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts


My only regret is the portal mirror effect is too subtle to show up in these GIFs. It probably just needs more sparkles. :LZSwink:
Microsoft: Hey, let's waste money advertising the Xbox Series X when nobody has any in stock, we don't seem to be making more, we aren't taking preorders and you can't get on a waiting list. BEST. IDEA. EVER.
So I'm practicing ITC with a spirit box, and decide to try to contact my deceased soulmate. It actually gave me multiple identifiers. Me, still a bit skeptical, asked aloud "Fine but does he still love me?" and the box spoke and printed the word "Forever" at the same time. Been a mess of tears since. :kaocry:
Been scratching away at my game and making progress, but just had a revelation. I'm working in full screen and adjusting all my pictures accordingly, but will they resize if someone's screen is smaller?? I hope this doesn't turn out to be a problem later.

Forum statistics

Threads
105,634
Messages
1,015,148
Members
137,300
Latest member
acehero8
Top