| 
 
| 赞 | 659 |  
| VIP | 62 |  
| 好人卡 | 144 |  
| 积分 | 337 |  
| 经验 | 110435 |  
| 最后登录 | 2024-7-10 |  
| 在线时间 | 5096 小时 |  
 Lv5.捕梦者 
	梦石0 星屑33738 在线时间5096 小时注册时间2012-11-19帖子4877 
 | 
| 正好自己有类似的功能,整理一下就行了。 
 
 复制代码//==================================================================================================================
// XdRs_KillRecord.js
//==================================================================================================================
/*:
* @plugindesc 杀敌数量记录。
* 
* @author 芯☆淡茹水
* 
* @help
* 插件命令:  SbtKilledNum enemyId valId
* 将某个敌人的当前杀死数量代入一个变量。
* enemyId :敌人ID。
* valId  :变量ID。
*
*/
//==================================================================================================================
;(function(){
var XdRsData = XdRsData  || {};
XdRsData.killRecord = XdRsData.killRecord || {};
//==================================================================================================================
XdRsData.killRecord.GSinitialize = Game_System.prototype.initialize;
Game_System.prototype.initialize = function() {
    XdRsData.killRecord.GSinitialize.call(this);
    this.clearKilledData();
};
Game_System.prototype.clearKilledData = function() {
    this._killedData = [];
};
Game_System.prototype.killedNum = function(enemyId) {
    return this._killedData[enemyId] || 0;
};
Game_System.prototype.recordEnemyKills = function(enemyId) {
    this._killedData[enemyId] = this._killedData[enemyId] || 0;
    this._killedData[enemyId]++;
};
//==================================================================================================================
XdRsData.killRecord.GIpluginCommand = Game_Interpreter.prototype.pluginCommand;
Game_Interpreter.prototype.pluginCommand = function(command, args) {
    XdRsData.killRecord.GIpluginCommand.call(this, command, args);
    command === 'SbtKilledNum' && $gameVariables.setValue(+args[1], $gameSystem.killedNum(+args[0]));
};
//==================================================================================================================
XdRsData.killRecord.BMdisplayRewards = BattleManager.displayRewards;
BattleManager.displayRewards = function() {
    XdRsData.killRecord.BMdisplayRewards.call(this);
    this.recordEnemyKills();
};
BattleManager.recordEnemyKills = function() {
    $gameTroop.deadMembers().forEach(function(e){e && $gameSystem.recordEnemyKills(e.enemyId());});
};
//==================================================================================================================
}());
//==================================================================================================================
//==================================================================================================================
 | 
 评分
查看全部评分
 |