Yanfly quest journal issue

Callangoso

Warper
Member
Joined
Dec 29, 2018
Messages
3
Reaction score
0
First Language
Portuguese
Primarily Uses
RMMV
Hello everyone! I have been tinkering with some plugins for my test project on RPG Maker MV. Having a quest log is very useful, and I was planning on using Yanfly's, but I have found a small issue with it, and I am not sure if it's a bug or me doing something incorrectly.

The plugin gives you the option to hide quest types (so Main quests, side quests, characters quests, etc), but it should still show quests (they should simply be all together, without being categorized), yet no quest shows in the log, despite the correct number of quests being listed in the category window (completed, failed, etc).

I was wondering if anyone could help me with this, either if they can tell me it's a known issue, or if I am doing something wrong and if it's fixable.upload_2018-12-28_16-32-50.png
 

Fornoreason1000

Black Sheep
Veteran
Joined
Mar 1, 2014
Messages
206
Reaction score
95
First Language
English
Primarily Uses
RMMV
what exactly are you trying to achieve?
it sound like you are trying to hide quest types and then wondering why they don't show up?

is this the setting you are talking about?
YEpQuestJournalTypes.png

basically if you set Show Types to false for some reason all the quest do not appear, despite Yanfly saying it should.
Show Types
- If this is enabled, it will allow for the Quest List Window to display the
various quest types. If this is disabled, then those quest types will not
appear and all quests will be displayed without their quest type as their
individual header.
Default: true
Interesting, not sure if its a bug yet or if I'm over looking something.

Edit: after investigating it does appear to be a bug with the plugin, the good news I know where it is and why it happens.

Basically when you select "False" on the variable and then open the Quest Menu in game, Yanfly's script will check it and if it returns false it will call addQuestCommands(category, type) but with no type parameter.

Code:
Window_QuestList.prototype.makeQuestList = function() {
  if (this.showType()) {
    var list = JSON.parse(this.settings('Type Order'));
    var length = list.length;
    for (var i = 0; i < length; ++i) {
      var listItem = list[i];
      var fmt = this.settings('Type Text Format');
      var type = listItem.replace(/\\I\[(\d+)\]/gi, '').trim();
      var type = listItem.replace(/\\C\[(\d+)\]/gi, '').trim();
      if (this._closedQuestTypes.contains(type)) {
        var closed = this.settings('List Closed Symbol');
      } else {
        var closed = this.settings('List Open Symbol');
      }
      var number = $gameSystem.getTypeQuests(this._currentCategory,
        type).length;
      if (!this.showEmptyTypes() && number <= 0) continue;
      number = Yanfly.Util.toGroup(number);
      var text = fmt.format(closed, listItem, number);
      this.addCommand(text, 'type', true, type);
      if (!this._closedQuestTypes.contains(type)) {
        this.addQuestCommands(this._currentCategory, type);
      }
    }
  } else {
    this.addQuestCommands(this._currentCategory) //when Show type is false!
  }
};

.in this function the type parameter will 'Default' to a Empty string as seen below

Code:
Window_QuestList.prototype.addQuestCommands = function(category, type) {
  category = category || this._currentCategory;
  type = type || ''; //since we provided 'undefined', we default to an empty string.
  var list = $gameSystem.getTypeQuests(category, type); //empty string is used here
  var length = list.length;
  for (var i = 0; i < length; ++i) {
    var questId = list[i];
    var questData = $dataQuests[questId];
    if (!questData) continue;
    var text = questData.name;
    this.addCommand(text, 'quest', true, questId);
  }
};
addQuestCommands will then call $gameSystem.getTypeQuest(category, type). type will again Default to an empty string.
Based on the category provided, $gameSystem.getTypeQuest will call various Functions such as getAvalaibleQuest() to retrieve quest Data.
after which is where the bug happens.

Code:
Game_System.prototype.getTypeQuests = function(category, type) {
  this.initQuestSettings();
  category = category || 'all';
  type = type || ''; //its already an empty string, but since thats a falsey value it will default again!
  var result = []; //this is the array of quest we want from this function
  if (category === 'available') {
    var quests = this.getQuestsAvailable();
  } else if (category === 'completed') {
    var quests = this.getQuestsCompleted();
  } else if (category === 'failed') {
    var quests = this.getQuestsFailed();
  } else {
    var quests = this.getAllQuests();
  }
  var length = quests.length;

  for (var i = 0; i < length; ++i) {
    var questId = quests[i];
    var questData = $dataQuests[questId];
    if (!questData) continue;
    //this is what causes the bug, Yanfly will only add the quest if the Quest Type matches, but since a
    //Empty string has been passed as the Quest Type, no quest will ever match
    if (questData.type === type) result.push(questId);
  }
  return result;
};

before returning the array of quest, yanfly will run a loop , only adding quest that matches the Quest Type, since he function already defaulted to an Empty string thanks to Show Types being false, none of the quest match and thus no Quest will be added to the array.

Here is what's supposed to happen
DS Engine 001 31-Dec-18 10_19_04 PM.png

it should be noted that specifying an empty type in a Quest will default it to 'Main Quest" somehow. this mean you can't circumvent this bug be adding no quest types to Quest.
 
Last edited:

SunAero

Warper
Member
Joined
Feb 3, 2018
Messages
2
Reaction score
3
First Language
English
Primarily Uses
RMMV
I know this post is super old, but since I found it I thought maybe I could chip in. This is just a small edit I made after Fornoreason1000 correctly identified and provided detailed documentation for this bug. I edited the code in the following way to resolve this, and I believe it should work as intended whether or not Show Types is true or false.

Just change this:

Game_System.prototype.getTypeQuests = function(category, type) {
this.initQuestSettings();
category = category || 'all';
type = type || ''; //its already an empty string, but since thats a falsey value it will default again!
var result = []; //this is the array of quest we want from this function
if (category === 'available') {
var quests = this.getQuestsAvailable();
} else if (category === 'completed') {
var quests = this.getQuestsCompleted();
} else if (category === 'failed') {
var quests = this.getQuestsFailed();
} else {
var quests = this.getAllQuests();
}
var length = quests.length;

for (var i = 0; i < length; ++i) {
var questId = quests;
var questData = $dataQuests[questId];
if (!questData) continue;
if (questData.type === type) result.push(questId);
}
return result;
};


To this:

Game_System.prototype.getTypeQuests = function(category, type) {
this.initQuestSettings();
category = category || 'all';
type = type || '';
var result = [];
if (category === 'available') {
var quests = this.getQuestsAvailable();
} else if (category === 'completed') {
var quests = this.getQuestsCompleted();
} else if (category === 'failed') {
var quests = this.getQuestsFailed();
} else {
var quests = this.getAllQuests();
}
var length = quests.length;
for (var i = 0; i < length; ++i) {
var questId = quests;
var questData = $dataQuests[questId];
if (!questData) continue;
//added if statement to check if display quest types is true, if so, act as normal, if not, push all quests
if (Window_QuestList.prototype.showType()) {
if (questData.type === type) result.push(questId);
} else {
result.push(questId);
}
}
return result;
};


Obviously, it would be better coming directly from Yanfly, but I believe my edit is functional and might save a bit of work for those who run through the same motions I did. (Identify the bug, verify I was running the latest version, search to see if anyone else was having similar issues, run across this post.)
 

dwiseman57

Merchant Prince Digital
Veteran
Joined
Jun 29, 2014
Messages
40
Reaction score
1
First Language
English
Primarily Uses
N/A
I'm confused by this too and do not understand the solution. I have the same error (no quests showing but a 1 in the "current" category). I am using all default settings...
 

InklingRain

Villager
Member
Joined
Sep 8, 2020
Messages
13
Reaction score
1
First Language
English
Primarily Uses
RMMV
I had the same issue, because I changed the name of 'main quest' under 'types', which meant that any quest labelled as 'main quest' appeared as blank. If you change the name of the labels, you need to manually type the new name into the 'type' box under each quest to make it appear.
 

Fornoreason1000

Black Sheep
Veteran
Joined
Mar 1, 2014
Messages
206
Reaction score
95
First Language
English
Primarily Uses
RMMV
I'm confused by this too and do not understand the solution. I have the same error (no quests showing but a 1 in the "current" category). I am using all default settings...
It's a Bug hands down. Yanfly's script omit's a value when show type is false, but in java script that is the same as providing a "false" value (called undefined). that next function will take any "false" value and turn it into a empty name (it usually looks like "" , think of it as a empty text file) (it actually does it again in another function, it seems Yanfly does it out of habit) when the script checks the name no quest will match the empty name type. since no Quest will match a empty name , no quest will show up.

The Solution is to replace "Game_System.prototype.getTypeQuests" inside Yanfly's script with SunAero's edited code.
If you can't do this on your own i can send you an edited version. there's a good chance Yanfly has updated his script too, so do that if you can.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Oh no. That moment when you try to fix something you modified in your game, like, a year ago but didn't want to fix then, and you now have no idea what you even did. Me right now, trying to figure out why my gold window is over stretched?
LittlePIGGY wrote on atreyoray's profile.
Where are you TT^TT
We need ARP_InGameManual for MZ
Oh my gosh. Thank you, Macy's! Thank you so much! You have made me very happy!
Happy Thanksgiving everyone! What are you thankful for? I'm thankful that I no longer have PTSD, and that I get to enjoy a good meal with my mom and stepdad! It might not be the same as before COVID, but at least I still get to enjoy the holiday!

Forum statistics

Threads
105,550
Messages
1,014,568
Members
137,225
Latest member
Eryndor
Top