Pastebin
API
tools
faq
paste
Login
Sign up
Please fix the following errors:
New Paste
Syntax Highlighting
//============================================================================= // RPG Maker MZ - Skill Buy System - Maliki Extension Version 3.1.3a //============================================================================= /*: * @target MZ * @plugindesc Provides extra functionality to Fomar's Skill Buy System. * @author Maliki79 * * @param Default Skill Group Cost Buildup * @type integer * @desc Default percentage Grouped Skills cost rise. * @default 0 * * @help MalMZ_FomarSkillSystem_Ex.js ver 3.1.3a * * Evals added for skills once learned. * Use Notetag <skillBuyEvals: code >>> * noting that the end of the tag MUST have 3 > signs as shown and the space after the : * When the skill is learned from the Skill Learn menu, the code will run. * You can use this to increase stats for the player, count skills learned, * and much more! * * Code has been added to allow grouping of skills for the purpose of increasing * AP costs within the group. First, you'll need to set groups via the Skill notetag * <skillLearnGroup: x> with x being an integer higher than 0. * Once done, every skill that is a part of that group will increase AP cost once any skill in that * group is bought. * This increase can be controlled in 2 ways. * first is by the Skill notetag <skillLearnGroupBdup: x> with x being an integer. * The other is by using the Default Skill Group Cost Buildup plugin param. * each will raise the total percentage rate of skill purchases in that group by the number given. * (Technically, you can use negative numbers to lower the percentage, if you like) * * There have been new script calls created to allow new skills to be added to the * buying list. These call are: * Game_Actors.actor(p).addBuyableSkills(x, y, z...); * and * $gameActors.addBuyableSkillsAll(x, y, z...); * The first one is usable for a single actor (p is their ID in the database) * while the second works on ALL actors in your database, whether in the party or not. * (x, y, z refers to the skill Ids of the skills you wish to add and you can add as many as you like.) * * Also added method to remove skills from list. * Use script call Game_Actors.actor(p).removeBuyableSkills(x, y, z...); * The skill will be removed from the list preventing the actor from being able to * learn it. It will NOT remove already learned skills from the actor. That is what * foregtSkill() is for. * * A quick tip: if you want to make a consumable that teaches the skills easily to one actor * or to the current party, you can use an item and the damage formulas. * Make the item/skill with a healing effect and put this in the damage formula: * b.addBuyableSkills(x, y, z); 0 * You should also make the item add a state with 0% success so the effect will always trigger. * * Item requirements have been added. * Use the following notetag in skill notes: * * <skillBuyItemCost: x, y> * * with x being the item ID and y being the quantity. * Insert multiple tags to add different items. * Don't include copies of the same item and do not use * weapon or armors. * * Skill buy Evals have been added! * Use the following notetag in skill notes: * *<buyReqEval: x>>> * * with x being an expression that evaluates to true or false. * s[x] and v[x] can be used for switches and variables respectively. * Example <buyReqEval: actor.level > v[1]>>> * Example 2 <buyReqEval: $gameParty.numItems($dataItems[1] == 1)>>> * * Created Skill learning Categories. * To use, when choosing the skill buy command name in the plugin parameters, separate * different categories with a comma. * Example: Weapon Skills,Magic,Stat Boosts * You can make as many categories as you want. * * Once made, you must put EACH learnable skill in a category. * Do this by adding <skillBuyCat:x> in Skill notes with x being * the exact spelling of your premade category. * You can only assign one category to each skill. * * Tip 2: you can use gainItem to regain an item used via item requirements, to * make a required tool for learning skills! */ var MalMZ = MalMZ || {}; MalMZ.SkillBuy = {}; MalMZ.SkillBuy.parameters = PluginManager.parameters('MalMZ_FomarSkillSystem_Ex'); MalMZ.SkillBuy.defaultGroupCostRate = parseInt(MalMZ.SkillBuy.parameters["Default Skill Group Cost Buildup"]); var MalDataMLSR = DataManager.loadSkillRequirements; DataManager.loadSkillRequirements = function() { MalDataMLSR.call(this); for (var i = 1; i < $dataSkills.length; i++) { $dataSkills[i].skillBuyItemCost = []; $dataSkills[i].buyReqEval = []; $dataSkills[i].skillBuyCat = []; $dataSkills[i].skillBuyEvals = []; var noteread = $dataSkills[i].note; while(noteread.indexOf("skillBuyEvals") > -1) { var notereg = noteread.split("<skillBuyEvals: "); var match = notereg[1].split(">>>"); $dataSkills[i].skillBuyEvals.push(match[0]); noteread = noteread.replace("<skillBuyEvals: ", " "); } while(noteread.indexOf("skillBuyItemCost") > -1) { var notereg = noteread.split("<skillBuyItemCost: "); var match = notereg[1].split(">"); var match2 = match[0].split(", "); var set = [parseInt(match2[0]), parseInt(match2[1])] $dataSkills[i].skillBuyItemCost.push(set), noteread = noteread.replace("<skillBuyItemCost: ", " "); } while(noteread.indexOf("buyReqEval") > -1) { var notereg = noteread.split("<buyReqEval: "); var match = notereg[1].split(">>>"); $dataSkills[i].buyReqEval.push(match[0]); noteread = noteread.replace("<buyReqEval: ", " "); } $dataSkills[i].skillLearnGroup = parseInt($dataSkills[i].meta.skillLearnGroup) || -1; $dataSkills[i].skillLearnGroupBdup = parseInt($dataSkills[i].meta.skillLearnGroupBdup || 0); if ($dataSkills[i].meta.skillBuyCat) $dataSkills[i].skillBuyCat = $dataSkills[i].meta.skillBuyCat; } }; var MalGActorInitMem = Game_Actor.prototype.initMembers Game_Actor.prototype.initMembers = function() { MalGActorInitMem.call(this); this._buyableSkills = []; this._skillLearnGroups = []; }; var MalSkillBuyGASetup = Game_Actor.prototype.setup Game_Actor.prototype.setup = function(actorId) { MalSkillBuyGASetup.call(this, actorId); this.setBuyableSkills(); }; Game_Actor.prototype.setBuyableSkills = function() { var skills = this.buyableSkills(); this._buyableSkills = skills; }; Game_Actor.prototype.addBuyableSkills = function (...args) { var list = args; var skills = this._buyableSkills; var skills2 = []; for (var i = 0; i < list.length; i++) { var newSkill = $dataSkills[list[i]]; skills.push(newSkill); }; for (var i = 0; i < skills.length; i++) { var newSkill = skills[i]; if (skills2.indexOf(skills[i]) == -1) skills2.push(skills[i]); }; this._buyableSkills = skills2; }; Game_Actor.prototype.removeBuyableSkills = function (...args) { var list = args; var skills = this._buyableSkills; for (var i = 0; i < list.length; i++) { var newSkill = $dataSkills[list[i]]; var index = skills.indexOf(newSkill); if (index > -1) { skills.splice(index, 1); }; } this._buyableSkills = skills; } Game_Actors.prototype.addBuyableSkillsAll = function(...args) { var actors = this._data; var list = args; var newList = ""; for (var i = 1; i < actors.length; i++) { for (var j = 0; j < list.length; j++) actors[i].addBuyableSkills(list[j]); }; }; Game_Actor.prototype.buyableSkillCheck = function(skill) { if (skill && skill.buyReq.length > 0) { for (var i = 0; i < skill.buyReq.length; i++) { if (!this.isLearnedSkill(skill.buyReq[i])) return false; } } if (!this.itemRequiredCheck(skill)) return false; if (!this.evalRequiredCheck(skill)) return false; return true; }; Game_Actor.prototype.itemRequiredCheck = function(skill) { if(skill.skillBuyItemCost == []) return true; for (var i = 0; i < skill.skillBuyItemCost.length; i++) { var req = skill.skillBuyItemCost[i]; var count = $gameParty.numItems($dataItems[req[0]]); if (req[1] > count) return false; }; return true; }; Game_Actor.prototype.evalRequiredCheck = function(skill) { if(skill.buyReqEval == []) return true; for (var i = 0; i < skill.buyReqEval.length; i++) { var buyEvals = skill.buyReqEval[i]; var actor = this; var s = $gameSwitches._data; var v = $gameVariables._data; if (!eval(buyEvals)) return false; }; return true; }; Window_SkillType.prototype.makeCommandList = function() { if (this._actor) { Fomar.SkillBuy.Window_SkillType_makeCommandList.call(this); var names = Fomar.SkillBuy.SkillBuyCommandName; var finalNames = []; if(names.indexOf(",") > -1) { var finalNamesSub = names.split(","); for (var i = 0; i < finalNamesSub.length; i++) { finalNames.push(finalNamesSub[i]); } } else { finalNames.push(names); } for (var i = 0; i < finalNames.length; i++) { this.addCommand(finalNames[i], "skill", true, finalNames.length == 1 ? Fomar.SkillBuy.stypeId : finalNames[i]); } }; }; var MalWSkillLstMIL = Window_SkillList.prototype.makeItemList; Window_SkillList.prototype.makeItemList = function() { if (this._actor && this._stypeId == Fomar.SkillBuy.stypeId) { this._data = this._actor._buyableSkills.filter((item => (Fomar.SkillBuy.showLearnt || !this._actor.isLearnedSkill(item.id)) && (Fomar.SkillBuy.showUnReq || this._actor.buyableSkillCheck(item)))); } else if(this._actor && Number.isNaN(Number.parseInt(this._stypeId))) { this._data = this._actor._buyableSkills.filter((item => (Fomar.SkillBuy.showLearnt || !this._actor.isLearnedSkill(item.id)) && (Fomar.SkillBuy.showUnReq || this._actor.buyableSkillCheck(item)) && item.skillBuyCat == this._stypeId)); } else { MalWSkillLstMIL.call(this); } }; var MalWSLisEn = Window_SkillList.prototype.isEnabled; Window_SkillList.prototype.isEnabled = function(item) { if (!item) { return false; } if (this._stypeId == Fomar.SkillBuy.stypeId || Number.isNaN(Number.parseInt(this._stypeId))) { var actor = this._actor; return (this._actor._ap >= this.skillAPCost(item, actor) && (!this._actor.isLearnedSkill(item.id) && this._actor.buyableSkillCheck(item))); } else { return MalWSLisEn.call(this, item); } }; Window_SkillList.prototype.skillAPCost = function(item, actor) { var actor = actor; var item = item; var cost = parseInt(item.meta["ap"]) || 1; if (item.skillLearnGroup > 0 && actor._skillLearnGroups[item.skillLearnGroup]) { cost = (cost * (1.0 + (actor._skillLearnGroups[item.skillLearnGroup] / 100))); } return parseInt(cost); }; var MalWinSklLstDrawSklCst = Window_SkillList.prototype.drawSkillCost; Window_SkillList.prototype.drawSkillCost = function(skill, x, y, width) { if (skill && (this._stypeId == Fomar.SkillBuy.stypeId || Number.isNaN(Number.parseInt(this._stypeId)))) { var actor = this._actor; if (this._actor.isLearnedSkill(skill.id)) { this.changeTextColor(ColorManager.textColor(Fomar.SkillBuy.apCostColor)); this.drawText("---", x, y, width, "right"); } else { if(skill.skillBuyItemCost != []){ var x2 = x*6; //x*2; for (var i = 0; i < skill.skillBuyItemCost.length; i++) { var req = skill.skillBuyItemCost[i]; var count = $gameParty.numItems($dataItems[req[0]]); if (req[1] > count) { this.changeTextColor(ColorManager.textColor(10)); } else { this.changeTextColor(ColorManager.textColor(3)); } this.drawIcon($dataItems[req[0]].iconIndex, width - this.costWidth() - x2, y + 2); this.drawText(req[1], x-(x2+8) , y, width - this.costWidth(), "right"); x2 += this.costWidth(); }; }; this.changeTextColor(ColorManager.textColor(Fomar.SkillBuy.apCostColor)); if (SceneManager._scene instanceof Scene_Skill) this.drawText(this.skillAPCost(skill, actor) + Fomar.APSystem.vocabAP, x, y, width, "right"); } } else { MalWinSklLstDrawSklCst.call(this, skill, x, y, width); } }; Window_SkillList.prototype.update = function() { Window_Selectable.prototype.update.call(this); if (this._stypeId != Fomar.SkillBuy.stypeId || !Number.isNaN(Number.parseInt(this._stypeId))) { this._req = []; this._oldIndex = -1; return; } if (this._oldIndex != this._index) { this._oldIndex = this._index; this._req = []; if (this.item() && this.item().buyReq.length > 0) { for (var i = 0; i < this.item().buyReq.length; i++) { this._req.push(this.item().buyReq[i]); } } this.refresh(); } }; var MalSSUseItem = Scene_Skill.prototype.useItem; Scene_Skill.prototype.useItem = function() { if (this.item() && (this._itemWindow._stypeId == Fomar.SkillBuy.stypeId || Number.isNaN(Number.parseInt(this._itemWindow._stypeId)))) { this.actor().learnSkill(this.item().id); this.actor()._ap -= this.skillAPCost(this.item(), this.actor()); this.processLearnEvals(this.actor(), this.item().id); this.processItemCosts(this.item()); if(this.item().skillLearnGroup > 0) { var sgNumb = this.item().skillLearnGroup; if(!this.actor()._skillLearnGroups[sgNumb]) this.actor()._skillLearnGroups[sgNumb] = 0; this.actor()._skillLearnGroups[sgNumb] += this.item().skillLearnGroupBdup || MalMZ.SkillBuy.defaultGroupCostRate || 1; } this._statusWindow.refresh(); this._itemWindow.refresh(); if (this._itemWindow._index >= this._itemWindow.maxItems()) { this._itemWindow.select(this._itemWindow._index - 1); } this.actor().refresh(); } else { MalSSUseItem.call(this); } }; Scene_Skill.prototype.processLearnEvals = function (actor, skillId){ var skillEvals = $dataSkills[skillId].skillBuyEvals; var actor = actor; var s = $gameSwitches._data; var v = $gameVariables._data; for (var i = 0; i < skillEvals.length; i++) { var SEval = skillEvals[i]; eval(SEval); }; }; Scene_Skill.prototype.processItemCosts = function (item){ if(item.skillBuyItemCost != []){ for (var i = 0; i < item.skillBuyItemCost.length; i++) { var req = item.skillBuyItemCost[i]; $gameParty.loseItem($dataItems[req[0]], req[1]); }; }; }; Scene_Skill.prototype.skillAPCost = function(item, actor) { var actor = actor; var item = item; var cost = parseInt(item.meta["ap"]) || 1; if (item.skillLearnGroup > 0 && actor._skillLearnGroups[item.skillLearnGroup]) { cost = (cost * (1.0 + (actor._skillLearnGroups[item.skillLearnGroup] / 100))); } return parseInt(cost); }; Scene_Skill.prototype.determineItem = function() { if (this._itemWindow._stypeId == -2 || Number.isNaN(Number.parseInt(this._itemWindow._stypeId))) { this.useItem(); this.activateItemWindow(); } else { Scene_ItemBase.prototype.determineItem.call(this); } };
Optional Paste Settings
Category:
None
Cryptocurrency
Cybersecurity
Fixit
Food
Gaming
Haiku
Help
History
Housing
Jokes
Legal
Money
Movies
Music
Pets
Photo
Science
Software
Source Code
Spirit
Sports
Travel
TV
Writing
Tags:
Syntax Highlighting:
None
Bash
C
C#
C++
CSS
HTML
JSON
Java
JavaScript
Lua
Markdown (PRO members only)
Objective C
PHP
Perl
Python
Ruby
Swift
4CS
6502 ACME Cross Assembler
6502 Kick Assembler
6502 TASM/64TASS
ABAP
AIMMS
ALGOL 68
APT Sources
ARM
ASM (NASM)
ASP
ActionScript
ActionScript 3
Ada
Apache Log
AppleScript
Arduino
Asymptote
AutoIt
Autohotkey
Avisynth
Awk
BASCOM AVR
BNF
BOO
Bash
Basic4GL
Batch
BibTeX
Blitz Basic
Blitz3D
BlitzMax
BrainFuck
C
C (WinAPI)
C Intermediate Language
C for Macs
C#
C++
C++ (WinAPI)
C++ (with Qt extensions)
C: Loadrunner
CAD DCL
CAD Lisp
CFDG
CMake
COBOL
CSS
Ceylon
ChaiScript
Chapel
Clojure
Clone C
Clone C++
CoffeeScript
ColdFusion
Cuesheet
D
DCL
DCPU-16
DCS
DIV
DOT
Dart
Delphi
Delphi Prism (Oxygene)
Diff
E
ECMAScript
EPC
Easytrieve
Eiffel
Email
Erlang
Euphoria
F#
FO Language
Falcon
Filemaker
Formula One
Fortran
FreeBasic
FreeSWITCH
GAMBAS
GDB
GDScript
Game Maker
Genero
Genie
GetText
Go
Godot GLSL
Groovy
GwBasic
HQ9 Plus
HTML
HTML 5
Haskell
Haxe
HicEst
IDL
INI file
INTERCAL
IO
ISPF Panel Definition
Icon
Inno Script
J
JCL
JSON
Java
Java 5
JavaScript
Julia
KSP (Kontakt Script)
KiXtart
Kotlin
LDIF
LLVM
LOL Code
LScript
Latex
Liberty BASIC
Linden Scripting
Lisp
Loco Basic
Logtalk
Lotus Formulas
Lotus Script
Lua
M68000 Assembler
MIX Assembler
MK-61/52
MPASM
MXML
MagikSF
Make
MapBasic
Markdown (PRO members only)
MatLab
Mercury
MetaPost
Modula 2
Modula 3
Motorola 68000 HiSoft Dev
MySQL
Nagios
NetRexx
Nginx
Nim
NullSoft Installer
OCaml
OCaml Brief
Oberon 2
Objeck Programming Langua
Objective C
Octave
Open Object Rexx
OpenBSD PACKET FILTER
OpenGL Shading
Openoffice BASIC
Oracle 11
Oracle 8
Oz
PARI/GP
PCRE
PHP
PHP Brief
PL/I
PL/SQL
POV-Ray
ParaSail
Pascal
Pawn
Per
Perl
Perl 6
Phix
Pic 16
Pike
Pixel Bender
PostScript
PostgreSQL
PowerBuilder
PowerShell
ProFTPd
Progress
Prolog
Properties
ProvideX
Puppet
PureBasic
PyCon
Python
Python for S60
QBasic
QML
R
RBScript
REBOL
REG
RPM Spec
Racket
Rails
Rexx
Robots
Roff Manpage
Ruby
Ruby Gnuplot
Rust
SAS
SCL
SPARK
SPARQL
SQF
SQL
SSH Config
Scala
Scheme
Scilab
SdlBasic
Smalltalk
Smarty
StandardML
StoneScript
SuperCollider
Swift
SystemVerilog
T-SQL
TCL
TeXgraph
Tera Term
TypeScript
TypoScript
UPC
Unicon
UnrealScript
Urbi
VB.NET
VBScript
VHDL
VIM
Vala
Vedit
VeriLog
Visual Pro Log
VisualBasic
VisualFoxPro
WHOIS
WhiteSpace
Winbatch
XBasic
XML
XPP
Xojo
Xorg Config
YAML
YARA
Z80 Assembler
ZXBasic
autoconf
jQuery
mIRC
newLISP
q/kdb+
thinBasic
Paste Expiration:
Never
Burn after read
10 Minutes
1 Hour
1 Day
1 Week
2 Weeks
1 Month
6 Months
1 Year
Paste Exposure:
Public
Unlisted
Private
Folder:
(members only)
Password
NEW
Enabled
Disabled
Burn after read
NEW
Paste Name / Title:
Create New Paste
Hello
Guest
Sign Up
or
Login
Sign in with Facebook
Sign in with Twitter
Sign in with Google
You are currently not logged in, this means you can not edit or delete anything you paste.
Sign Up
or
Login
Public Pastes
Die 7 wichtigsten Aktionen diese Woche
7 hours ago | 4.17 KB
Untitled
8 hours ago | 13.34 KB
Untitled
9 hours ago | 13.59 KB
VNC SCRIPT 2/2: autoinput.vbs
VBScript | 18 hours ago | 0.23 KB
VNC SCRIPT 1/2: vncauto.bat
Batch | 18 hours ago | 0.72 KB
videoscheomedia
XML | 21 hours ago | 1.00 KB
Untitled
1 day ago | 14.91 KB
autconnectVNC.bat
Batch | 1 day ago | 0.93 KB
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the
Cookies Policy
.
OK, I Understand
Not a member of Pastebin yet?
Sign Up
, it unlocks many cool features!