- Joined
- Apr 21, 2014
- Messages
- 6
- Reaction score
- 3
- First Language
- English
- Primarily Uses
- RMMV
Hi, first post on the forum, I'm sorry it comes off as one of those whiny help me threads, but I'm a little bit stumped.
I 'borrowed' a script from @mrcopra last night, to get some skills costing gold (thanks!) but I've run into a little issue with it and I don't know enough about javascript to fix it. The gold is displaying next to the skill and is deducting from the total amount just fine, but it's also subtracting from the TP value which I don't want it to do.
Could a coding wizard have a quick look through and tell me what needs to change? I will forever adore you, honest.
I 'borrowed' a script from @mrcopra last night, to get some skills costing gold (thanks!) but I've run into a little issue with it and I don't know enough about javascript to fix it. The gold is displaying next to the skill and is deducting from the total amount just fine, but it's also subtracting from the TP value which I don't want it to do.
Could a coding wizard have a quick look through and tell me what needs to change? I will forever adore you, honest.
Code:
/*:
* @plugindesc Make skill cost gold. V 1.2
* Read Help
* @author mrcopra
*
*
* @param CostGoldColour
* @desc Change The cost colour
* @default 17
*
* @help Write this in skill's note
* <costGold:x> // x is the amount of gold
*/
var parameters = PluginManager.parameters('SkillCostGold');
var CostGoldColour = Number(parameters['CostGoldColour'] || 17);
Game_BattlerBase.prototype.canPaySkillCost = function(skill) {
//console.log(Number(skill.meta.costGold))
if (skill.meta.costGold){
return $gameParty.gold() >= this.skillGdCost(skill)}else{
return this._tp >= this.skillTpCost(skill) && this._mp >= this.skillMpCost(skill)};
};
Window_Base.prototype.gdCostColor = function() {
return this.textColor(CostGoldColour);
};
Window_SkillList.prototype.drawSkillCost = function(skill, x, y, width) {
if (this._actor.skillGdCost(skill) > 0) {
this.changeTextColor(this.gdCostColor());
this.drawText(this._actor.skillGdCost(skill), x, y, width, 'right');
} else if (this._actor.skillTpCost(skill) > 0) {
this.changeTextColor(this.tpCostColor());
this.drawText(this._actor.skillTpCost(skill), x, y, width, 'right');
} else if (this._actor.skillMpCost(skill) > 0) {
this.changeTextColor(this.mpCostColor());
this.drawText(this._actor.skillMpCost(skill), x, y, width, 'right');
}
};
Game_BattlerBase.prototype.skillMpCost = function(skill) {
if (skill.meta.costGold){
return Number(skill.meta.costGold);
}
return Math.floor(skill.mpCost * this.mcr);
};
Game_BattlerBase.prototype.skillTpCost = function(skill) {
if (skill.meta.costGold){
return Number(skill.meta.costGold);
}else{
return skill.tpCost};
};
Game_BattlerBase.prototype.skillGdCost = function(skill) {
return Number(skill.meta.costGold);
};
Game_BattlerBase.prototype.paySkillCost = function(skill) {
this._mp -= this.skillMpCost(skill);
this._tp -= this.skillTpCost(skill);
if (skill.meta.costGold){
console.log(this.skillGdCost(skill));
$gameParty.loseGold(this.skillGdCost(skill))} ;
};
Game_BattlerBase.prototype.meetsSkillConditions = function(skill) {
return (this.meetsUsableItemConditions(skill) &&
this.isSkillWtypeOk(skill) && this.canPaySkillCost(skill) &&
!this.isSkillSealed(skill.id) && !this.isSkillTypeSealed(skill.stypeId));
};


