赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 1 |
经验 | 0 |
最后登录 | 2024-3-8 |
在线时间 | 32 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 98
- 在线时间
- 32 小时
- 注册时间
- 2023-9-30
- 帖子
- 33
|
我定制过一个插件,就是那种变量值商店
像米家游戏,都是把抽卡道具做到商店里嘛,所以变量值商店也差不多
至于抽卡嘛...https://rpg.blue/forum.php?mod=viewthread&tid=478478&extra=page%3D1%26filter%3Dtypeid%26typeid%3D1306
你试试这个
下面是那个变量值商店的js:
//=============================================================================
// AnotherCurrencyShop.js
//-----------------------------------------------------------------------------
// Version
// 1.0.0 プラグイン公開
// 1.0.1 修正参数错误并指定购买窗口命令项名称
//=============================================================================
/*:
* @plugindesc 变量值交易商店
* @author rinne_grid 汉化:硕明云书
*
* @param Currency Name
* @desc 货币的名称。(指定MP、PT等)
* @default 灵石
*
* @param Variable Number
* @desc 用作货币的变量的值。(默认情况下指定第一个变量)
* @default 1
*
* @param Buy Command Name
* @desc 购买项目时显示的命令字符串。根据需要指定“交换”等
* @default 购买
*
* @param Sell Command Name
* @desc 出售项目时显示的命令字符串
* @default 出售
*
*
*
*
* @help
*
* 插件命令
* AnotherCurrencyShop on varId nName buy sell # 启用不使用金钱的商店,最后varId需要替换为指定的变量ID值,nName为添加新的名字,如果未填写则使用原版变量值,buy购买,sell出售,如果未填写,则使用默认名称
* AnotherCurrencyShop off # 禁用不使用金钱的商店
*
*
*
*
*
*
* 魔改作者: 流逝的岁月
* 魔改版本: v1.02
*
*
* 魔改内容v1.02: 添加新的插件参数
* 魔改内容v1.01: 添加新的插件参数
* 魔改内容v1.00: 修改原版指令 AnotherCurrencyShop on,支持多变量,如果未使用这个功能则为默认变量
*
*
* 此插件已进行付费魔改
*
*
*
------------------------------------------------------
* 无范围限制使用、商用需署名作者
*/
(function(){
var parameters = PluginManager.parameters('AnotherCurrencyShop');
var currencyName = String(parameters['Currency Name'] || 'PT');
var variableNumber = String(parameters['Variable Number'] || '1');
var buyCommandName = String(parameters['Buy Command Name'] || '購入する');
var sellCommandName = String(parameters['Sell Command Name'] || '売却する');
var Zzy = Zzy || {};
Zzy.MACS = Zzy.MACS || {};
Zzy.MACS.SetVarId = 0;
Zzy.MACS.SetNName = '';
Zzy.MACS.SetBuy = '';
Zzy.MACS.SetSell = '';
//-------------------------------------------------------------------------
// 関数退避
//-------------------------------------------------------------------------
var _Game_Interpreter_pluginCommand =
Game_Interpreter.prototype.pluginCommand;
var _Scene_Shop_doBuy = Scene_Shop.prototype.doBuy;
var _Scene_Shop_doSell = Scene_Shop.prototype.doSell;
var _Window_Gold_value = Window_Gold.prototype.value;
var _Window_Gold_currencyUnit = Window_Gold.prototype.currencyUnit;
var _Window_ShopCommand_makeCommandList = Window_ShopCommand.prototype.makeCommandList;
Game_Interpreter.prototype.pluginCommand = function(command, args) {
_Game_Interpreter_pluginCommand.call(this, command, args);
if(command === 'AnotherCurrencyShop')
{
switch(args[0]) {
case 'on':
var varId = args[1] === undefined ? 0 : parseInt(args[1]);
var nName = args[2] === undefined ? '' : String(args[2]);
var buy = args[3] === undefined ? '' : String(args[3]);
var sell = args[4] === undefined ? '' : String(args[4]);
Zzy.MACS.SetVarId = varId;
Zzy.MACS.SetNName = nName;
Zzy.MACS.SetBuy = buy;
Zzy.MACS.SetSell = sell;
$gameSystem.rngd_hook_on_AnotherCurrencyShop();
break;
case 'off':
$gameSystem.rngd_hook_off_AnotherCurrecyShop();
break;
}
}
};
//-------------------------------------------------------------------------
// ゴールド以外のショップON
//-------------------------------------------------------------------------
Game_System.prototype.rngd_hook_on_AnotherCurrencyShop = function()
{
Scene_Shop.prototype.doBuy = function(number)
{
var vNumber = Zzy.MACS.SetVarId ? Zzy.MACS.SetVarId : variableNumber;
var _current = $gameVariables.value(vNumber);
_current -= number * this.buyingPrice();
$gameVariables.setValue(vNumber, _current);
$gameParty.gainItem(this._item, number);
};
Scene_Shop.prototype.doSell = function(number)
{
var vNumber = Zzy.MACS.SetVarId ? Zzy.MACS.SetVarId : variableNumber;
var _current = $gameVariables.value(vNumber);
_current += number * this.sellingPrice();
$gameVariables.setValue(vNumber, _current);
$gameParty.loseItem(this._item, number);
};
Window_Gold.prototype.value = function() {
// プラグインで指定した変数の値を金額として返す
var vNumber = Zzy.MACS.SetVarId ? Zzy.MACS.SetVarId : variableNumber;
return $gameVariables.value(vNumber);
};
Window_Gold.prototype.currencyUnit = function()
{
var cName = '';
cName = Zzy.MACS.SetNName ? Zzy.MACS.SetNName : currencyName;
return cName;
};
Window_ShopCommand.prototype.makeCommandList = function() {
this.clearCommandList();
var buy = Zzy.MACS.SetBuy ? Zzy.MACS.SetBuy : buyCommandName;
var sell = Zzy.MACS.SetSell ? Zzy.MACS.SetSell : sellCommandName;
this.addCommand(buy, 'buy');
this.addCommand(sell, 'sell', !this._purchaseOnly);
this.addCommand(TextManager.cancel, 'cancel');
};
};
//-------------------------------------------------------------------------
// ゴールド以外のショップOFF
//-------------------------------------------------------------------------
Game_System.prototype.rngd_hook_off_AnotherCurrecyShop = function() {
Scene_Shop.prototype.doBuy = function(number) {
_Scene_Shop_doBuy.call(this, number);
};
Scene_Shop.prototype.doSell = function(number) {
_Scene_Shop_doSell.call(this, number);
};
Window_Gold.prototype.value = function() {
return _Window_Gold_value.call(this);
};
Window_Gold.prototype.currencyUnit = function() {
return _Window_Gold_currencyUnit.call(this);
};
Window_ShopCommand.prototype.makeCommandList = function() {
_Window_ShopCommand_makeCommandList.call(this);
};
};
//-------------------------------------------------------------------------
// ゴールド以外のショップOFF
//-------------------------------------------------------------------------
Zzy.MACS.Scene_Shop_terminate = Scene_Shop.prototype.terminate;
Scene_Shop.prototype.terminate = function() //退出恢复正常
{
Zzy.MACS.Scene_Shop_terminate.call(this);
Zzy.MACS.SetVarId = 0;
Zzy.MACS.SetNName = '';
Zzy.MACS.SetBuy = '';
Zzy.MACS.SetSell = '';
};
})(); |
|