Mod
FTB Quests
Mod version
ftb-quests-forge:2001.4.7
Forge / Fabric version
1.20.1 Forge 47.2.32
Modpack & version
No response
What issue are you having?
I am attempting to write a KubeJS server script where quest/task completion is monitored by listening to FTBQuestsEvents.completed() event.
The effects I expect:
- When a quest is completed, the event is triggered and the game writes some texts in the chat column.
- Track the status of one or more specific tasks or quests. The task/quest I expect to use as a trigger has a specific tag.
- I use the method
QuestObject.hasTag("def_boost_1") to determine whether the quest/task that triggered the event has the specific tag. If the trigger has the tag, said method should return true.
- When a task of a quest is completed, the event should be triggered once. When all the tasks of a quest are completed, the quest is completed and the event should be triggered once more. I don't expect the process to involve number of the tags of the task/quest.
- Hence, if a quest with x tasks is completed, the event should be triggered x+1 times (x for the tasks and once for the quest), no matter how many tags the task/quest have.
What is happening:
- When I complete a quest (no tag) with one task (no tag), the event is triggered twice, as expected.
- When I complete a quest (1 tag) with one task (no tag), the event is triggered three times. (Twice expected)
- When I complete a quest (no tag) with one task (1 tag), the event is triggered three times. (Twice expected)
-
- When I complete a quest (2 tags, one is the trigger tag and the other one isn't) with one task (no tag), the event is triggered three times, where the first output is
false (for the task) and the last two are true (for the quest). (Twice expected, a false for the task and a true for the quest.)
)
- When I complete a quest (1 tag, not the trigger tag) with one task (1 tag, the trigger tag), the event is triggered four times, where the first two outputs are
true (for the task) and the last two are false (for the quest). (Twice expected, a true for the task and a false for the quest.)
Other mods involved: KubeJS
This is the code I use in a server script: (trigger tag is def_boost_1)
FTBQuestsEvents.completed(event => {
const questObj = event.getObject();
const player = event.player;
player.tell(Text.of(`Has tag? ${questObj.hasTag("def_boost_1")}`))
})
This is an image of the output for case 5 of "What is happening":

Crashlogs
No response
Steps to reproduce
- Create a quest with one task.
- Create a KubeJS script listening for completion event, reference code provided above. Trigger tag name is
def_boost_1.
- Add several tags to the quest and its task arbitrarily. Make sure no trigger tag is added.
- Complete the task (in normal way, instead of simply setting the status to "completed"). If the script is loaded normally, there should be outputs.
- You should see x+2 lines of output, where x indicates the total number of tags of the task and the quest.
- Add the target tag to the task. Reset the status and complete the quest again.
- You should see x+1 lines of
true output and y+1 lines of false output, where x indicates the number of tags of the task and y indicated the number of tags of the quest.
- Adding more tasks with tags should be effective.
Anything else to note?
KubeJS version: kubejs-forge-2001.6.5-build.7
Mod
FTB Quests
Mod version
ftb-quests-forge:2001.4.7
Forge / Fabric version
1.20.1 Forge 47.2.32
Modpack & version
No response
What issue are you having?
I am attempting to write a KubeJS server script where quest/task completion is monitored by listening to
FTBQuestsEvents.completed()event.The effects I expect:
QuestObject.hasTag("def_boost_1")to determine whether the quest/task that triggered the event has the specific tag. If the trigger has the tag, said method should returntrue.What is happening:
false(for the task) and the last two aretrue(for the quest). (Twice expected, afalsefor the task and atruefor the quest.))
true(for the task) and the last two arefalse(for the quest). (Twice expected, atruefor the task and afalsefor the quest.)Other mods involved: KubeJS
This is the code I use in a server script: (trigger tag is
def_boost_1)This is an image of the output for case 5 of "What is happening":
Crashlogs
No response
Steps to reproduce
def_boost_1.trueoutput and y+1 lines offalseoutput, where x indicates the number of tags of the task and y indicated the number of tags of the quest.Anything else to note?
KubeJS version:
kubejs-forge-2001.6.5-build.7