Hi Guys,
This may sound like a very strange request, but I need a plugin or a snippet of code that I can add to my game to allow my players gold to go into a minus figure. for example -$200. I've had a play around with the default JS files but had no luck. Can anyone tell me how I can do this?
Edit: Nevermind I figured it out. For those of you who want to know how this is done, here's how I did it:
1. Open "rpg_objects.js" in some form of javascript editor.
2. Search for "Game_Party.prototype.gainGold = function(amount) {" It's around line 4910
3. Change it to this code:
Game_Party.prototype.gainGold = function(amount) {
this._gold = (this._gold + amount).clamp(this.minGold(), this.maxGold());
};
4. Below that you will find this: (Don't edit this part)
Game_Party.prototype.maxGold = function() {
return 99999999;
};
5. Just below this bit of code add this line so it looks like this:
Game_Party.prototype.maxGold = function() {
return 99999999;
};
Game_Party.prototype.minGold = function() {
return -99999999;
};
And there you have it, your gold will now go into a Minus Integer / Negative Value... This is really good for anyone who has a game where you start off in debt with a loan shark or something like that and you have to pay off the debt 😉
Hope this helps.
This may sound like a very strange request, but I need a plugin or a snippet of code that I can add to my game to allow my players gold to go into a minus figure. for example -$200. I've had a play around with the default JS files but had no luck. Can anyone tell me how I can do this?
Edit: Nevermind I figured it out. For those of you who want to know how this is done, here's how I did it:
1. Open "rpg_objects.js" in some form of javascript editor.
2. Search for "Game_Party.prototype.gainGold = function(amount) {" It's around line 4910
3. Change it to this code:
Game_Party.prototype.gainGold = function(amount) {
this._gold = (this._gold + amount).clamp(this.minGold(), this.maxGold());
};
4. Below that you will find this: (Don't edit this part)
Game_Party.prototype.maxGold = function() {
return 99999999;
};
5. Just below this bit of code add this line so it looks like this:
Game_Party.prototype.maxGold = function() {
return 99999999;
};
Game_Party.prototype.minGold = function() {
return -99999999;
};
And there you have it, your gold will now go into a Minus Integer / Negative Value... This is really good for anyone who has a game where you start off in debt with a loan shark or something like that and you have to pay off the debt 😉
Hope this helps.