- Joined
- Aug 26, 2013
- Messages
- 46
- Reaction score
- 5
- First Language
- French
- Primarily Uses
Hello. I'm making a very simple ARPG plugin , and I can't get my code working correctly.
Here it is:
/*: * @plugindesc This plugin is an A-RPG test * @author Skymen * * @param Player ATK * @desc Defines the player's atk * @default 100 * * * @help Description goes here */var parameters = PluginManager.parameters('A-RPG tests');var playerATK = parameters['Player ATK'];var aliasPluginCommand = Game_Interpreter.prototype.pluginCommand;Game_Interpreter.prototype.pluginCommand = function(command, args){ aliasPluginCommand.call(this, command, args); var HP = [200,200]; var ATK = [200,200]; if (command == 'setupEnemy') { var event = $dataMap.events[this.eventId()]; var name = Number(event.name); var note = Number(event.note); if (HP.length<Number(this._eventId)) { HP.push(Number(name)); } else { HP[Number(this._eventId)]= Number(name); } if (ATK.length<Number(this._eventId)) { ATK.push(Number(note)); } else { ATK[Number(this._eventId)]= Number(note); } } if (command == 'agressive') { HP[this._eventId] = HP[this._eventId]- playerATK; } if (command == 'passive') { var event = $dataMap.events[this.eventId()]; $gameMessage.add('My new health value is ' + HP[this._eventId] + '\nand my max Health value is ' + event.name + '\nlet\'s do some math: ' +event.name + '-'+ playerATK +'=' + (event.name-playerATK)); HP[this._eventId] = HP[this._eventId]-playerATK; $gameMessage.add('My new health value is ' + HP[this._eventId] + '\nand my max Health value is ' + event.name + '\nlet\'s do some math: ' +event.name + '-'+ playerATK +'=' + (event.name-playerATK)); if(HP[this._eventId]<=0) { $gameSelfSwitches.setValue([this.mapId, this._eventId, 'D'], true); $gameMessage.add('I\'m dead'); } } if (command == 'normal') { }}What it's supposed to do is store the data contained in the name and the notes of each event that request the "setupEnemy" plugin command.
Then, when the plugin command "passive" is requested, the event's HP (stored in it's name, and then in an array) should lower. and when the value hits 0, the ennemy dies (activating the "D" self switch).
However, the life system does not seem to work properly
.
Someone to help me?
Here it is:
/*: * @plugindesc This plugin is an A-RPG test * @author Skymen * * @param Player ATK * @desc Defines the player's atk * @default 100 * * * @help Description goes here */var parameters = PluginManager.parameters('A-RPG tests');var playerATK = parameters['Player ATK'];var aliasPluginCommand = Game_Interpreter.prototype.pluginCommand;Game_Interpreter.prototype.pluginCommand = function(command, args){ aliasPluginCommand.call(this, command, args); var HP = [200,200]; var ATK = [200,200]; if (command == 'setupEnemy') { var event = $dataMap.events[this.eventId()]; var name = Number(event.name); var note = Number(event.note); if (HP.length<Number(this._eventId)) { HP.push(Number(name)); } else { HP[Number(this._eventId)]= Number(name); } if (ATK.length<Number(this._eventId)) { ATK.push(Number(note)); } else { ATK[Number(this._eventId)]= Number(note); } } if (command == 'agressive') { HP[this._eventId] = HP[this._eventId]- playerATK; } if (command == 'passive') { var event = $dataMap.events[this.eventId()]; $gameMessage.add('My new health value is ' + HP[this._eventId] + '\nand my max Health value is ' + event.name + '\nlet\'s do some math: ' +event.name + '-'+ playerATK +'=' + (event.name-playerATK)); HP[this._eventId] = HP[this._eventId]-playerATK; $gameMessage.add('My new health value is ' + HP[this._eventId] + '\nand my max Health value is ' + event.name + '\nlet\'s do some math: ' +event.name + '-'+ playerATK +'=' + (event.name-playerATK)); if(HP[this._eventId]<=0) { $gameSelfSwitches.setValue([this.mapId, this._eventId, 'D'], true); $gameMessage.add('I\'m dead'); } } if (command == 'normal') { }}What it's supposed to do is store the data contained in the name and the notes of each event that request the "setupEnemy" plugin command.
Then, when the plugin command "passive" is requested, the event's HP (stored in it's name, and then in an array) should lower. and when the value hits 0, the ennemy dies (activating the "D" self switch).
However, the life system does not seem to work properly
Someone to help me?