Hi everyone,
I'd like to know if there is a plugin that manages party members' affection toward the player, and the discussions it unlock.
What I have in mind is adding a new command "Discuss" to the menu for the player to choose a single party member, which then will start a discussion between the main actor and the selected one based on the affection level they share.
I'm currently trying to find a way to make this happen in my project, however I'm stuck on two points at the moment :
Choosing the "Discuss" command from the menu - http://puu.sh/v4GKe/e740409453.jpg
Selecting the actor to discuss with - http://puu.sh/v4GN1/e338b8a24e.jpg
Thanks for your help,
Kohlskui
EDIT 01/04/2017 :
Hi again,
I managed to make this thing work, however it is a first attempt and hasn't been optimized at all, nor has it been made into a plugin because I suck at creating them.
With this, we get a "discuss" command in the menu, which allows the player to choose a party member to chat with. It'll then activate a specific switch, closes the menu, and play the global event that awaited the said specific switch to be turned on.
And that's it. You get a new property you can call anytime you want with the functions "affectionLevel()".
Screenshot :
http://puu.sh/v5tp6/bd0335dc87.png
You add a condition branch for each affectionLevel, and you're done.
____________________________________
I'll say it again, this was done quickly, currently works for what I expect it to do, but hasn't been optimized, nor has it been prepared as a plugin for exportation.
I don't know if others wanted an affection-system alike because I haven't found a thread on this subject, and I'm still looking for an actual plugin which manages this better than I did.
Thanks again for your help,
Kohlskui
I'd like to know if there is a plugin that manages party members' affection toward the player, and the discussions it unlock.
What I have in mind is adding a new command "Discuss" to the menu for the player to choose a single party member, which then will start a discussion between the main actor and the selected one based on the affection level they share.
I'm currently trying to find a way to make this happen in my project, however I'm stuck on two points at the moment :
- Affection level shared between two members :
I believe some kind of variables stored in the database could do the work, however I'm wondering if there isn't a more suitable way to store this data... - Starting a discussion between the two members :
I added the "Discuss" command in the menu, which shows a Window_MenuActor for the player to chooses the member he wishes to discuss with, and then... Nothing. I have no idea how to make the Window_Message works at this point. Using $gameMessage.add() makes the text appears only when the player closes the menu, which isn't what I expect from it.
Choosing the "Discuss" command from the menu - http://puu.sh/v4GKe/e740409453.jpg
Selecting the actor to discuss with - http://puu.sh/v4GN1/e338b8a24e.jpg
Thanks for your help,
Kohlskui
EDIT 01/04/2017 :
Hi again,
I managed to make this thing work, however it is a first attempt and hasn't been optimized at all, nor has it been made into a plugin because I suck at creating them.
- Adding the "Discuss" command :
Code:
Window_MenuCommand.prototype.addOriginalCommands = function() {
//kohl - Adding "Discuss" commmand
this.addCommand('Discuter', 'chat', true);
};
- Handling the "Discuss" command :
Code:
Scene_Menu.prototype.createCommandWindow = function() {
this._commandWindow = new Window_MenuCommand(0, 0);
this._commandWindow.setHandler('item', this.commandItem.bind(this));
this._commandWindow.setHandler('skill', this.commandPersonal.bind(this));
this._commandWindow.setHandler('equip', this.commandPersonal.bind(this));
this._commandWindow.setHandler('status', this.commandPersonal.bind(this));
this._commandWindow.setHandler('formation', this.commandFormation.bind(this));
this._commandWindow.setHandler('options', this.commandOptions.bind(this));
this._commandWindow.setHandler('save', this.commandSave.bind(this));
//kohl - Adding "discuss" command
this._commandWindow.setHandler('chat', this.commandChat.bind(this));
this._commandWindow.setHandler('gameEnd', this.commandGameEnd.bind(this));
this._commandWindow.setHandler('cancel', this.popScene.bind(this));
this.addWindow(this._commandWindow);
};
Code:
Scene_Menu.prototype.commandChat = function() {
this._statusWindow.setFormationMode(false);
this._statusWindow.selectLast();
this._statusWindow.activate();
this._statusWindow.setHandler('ok', this.onChatOk.bind(this));
this._statusWindow.setHandler('cancel', this.onChatCancel.bind(this));
};
Code:
//This code is added at the end of the Scene_Menu class for cohesion
//Those variables are used to locate the switches' position in the list
var chat_actor2_Index = 12;
var chat_actor3_Index = 13;
var chat_actor4_Index = 14;
var chat_actor5_Index = 15;
var chat_actor6_Index = 16;
var chat_actor7_Index = 17;
var chat_actor8_Index = 18;
Scene_Menu.prototype.onChatOk = function() {
//Here we retrieve the selected party member's actorId
var index = $gameParty.members()[this._statusWindow.index()].actorId();
//Then we use a "switch" to activate the switch corresponding to the selected actor
//Do note that we need the actorId, not the memberId, because actorId is a value that won't change in time and is the actual database-stored Id of the actor
switch(index){
case 2 :
$gameSwitches.setValue(chat_actor2_Index, true);
break;
case 3 :
$gameSwitches.setValue(chat_actor3_Index, true);
break;
case 4 :
$gameSwitches.setValue(chat_actor4_Index, true);
break;
case 5 :
$gameSwitches.setValue(chat_actor5_Index, true);
break;
case 6 :
$gameSwitches.setValue(chat_actor6_Index, true);
break;
case 7 :
$gameSwitches.setValue(chat_actor7_Index, true);
break;
case 8 :
$gameSwitches.setValue(chat_actor8_Index, true);
break;
};
//This is to prevent the player to talk to himself
if(index == 1){
SoundManager.playBuzzer();
//It is actually required to reactivate the window, otherwise the player will have a locked menu
this._statusWindow.activate();
} else {
//When the player has chosen a character to talk to, a switch is turned on at this point, and we don't need the menu anymore.
//The discussion will then be managed by a global event
this.popScene();
}
};
Scene_Menu.prototype.onChatCancel = function() {
if (this._statusWindow.pendingIndex() >= 0) {
this._statusWindow.setPendingIndex(-1);
this._statusWindow.activate();
} else {
this._statusWindow.deselect();
this._commandWindow.activate();
}
};
With this, we get a "discuss" command in the menu, which allows the player to choose a party member to chat with. It'll then activate a specific switch, closes the menu, and play the global event that awaited the said specific switch to be turned on.
- Affection level per member :
Code:
Game_Actor.prototype.initMembers = function() {
Game_Battler.prototype.initMembers.call(this);
this._actorId = 0;
this._name = '';
this._nickname = '';
this._classId = 0;
this._level = 0;
this._characterName = '';
this._characterIndex = 0;
this._faceName = '';
this._faceIndex = 0;
this._battlerName = '';
this._exp = {};
this._skills = [];
this._equips = [];
this._actionInputIndex = 0;
this._lastMenuSkill = new Game_Item();
this._lastBattleSkill = new Game_Item();
this._lastCommandSymbol = '';
//kohl - Adding affection level
this._affectionLevel = 0;
};
Game_Actor.prototype.affectionLevel = function() {
return this._affectionLevel;
};
Game_Actor.prototype.setAffectionLevel = function(value) {
this._affectionLevel = value;
};
And that's it. You get a new property you can call anytime you want with the functions "affectionLevel()".
- Managing the dialogs with each characters :
Screenshot :
http://puu.sh/v5tp6/bd0335dc87.png
You add a condition branch for each affectionLevel, and you're done.
____________________________________
I'll say it again, this was done quickly, currently works for what I expect it to do, but hasn't been optimized, nor has it been prepared as a plugin for exportation.
I don't know if others wanted an affection-system alike because I haven't found a thread on this subject, and I'm still looking for an actual plugin which manages this better than I did.
Thanks again for your help,
Kohlskui