QuestsTweaker
QuestsTweaker
This modification creates a bridge between FTBQuests and CraftTweaker, allowing to expand the quest system capabilities with custom scripts.
Main Features
With this addon you get several unique functions for working with quests:
- Changing progress of existing tasks through CraftTweaker
- Special "Function" task type that checks progress through custom scripts
- "Function" type reward that executes a script upon quest completion
CraftTweaker API
mods.questtweaker.QuestManager
Managing task progress for any available task through CraftTweaker. If the task is unavailable (for example, due to unmet dependencies), the function won't work.
QuestManager.addTaskProgress(IPlayer player, string/int id, long progress);
QuestManager.setTaskProgress(IPlayer player, string/int id, long progress);
import mods.questtweaker.QuestManager;
// Adding progress
// IPlayer player, string/int id, long progress
QuestManager.addTaskProgress(event.player,"4c4bd563",1 as long);
// Or using hexadecimal number
QuestManager.addTaskProgress(event.player,0x4c4bd563,1 as long);
// Setting progress
// IPlayer player, string/int id, long progress
QuestManager.setTaskProgress(event.player,"4c4bd563",1 as long);
Example: when player picks up an item, set task progress equal to stack size:
import mods.questtweaker.QuestManager;
events.onPlayerPickupItem(function(event as crafttweaker.event.PlayerPickupItemEvent){
QuestManager.setTaskProgress(event.player,"52725826",event.item.item.amount as long);
});
mods.questtweaker.FunctionManager
Adding a new function for use with "Function" type tasks and rewards:
FunctionManager.addFunction(string functionID, function(IPlayer) -> long);
The function must return a long value.
Example 1: Player's current altitude
import mods.queststweaker.FunctionManager;
import crafttweaker.player.IPlayer;
// string functionID, function(IPlayer) -> long
FunctionManager.addFunction("height",function(player as IPlayer){
return player.y as long;
});
Example 2: On a Rail
FTBQuests Integration
Function Task
Periodically executes a function and uses the return value as progress.
Parameters:
- Function ID: function identifier registered in scripts
- Value: required value to complete the task
- Interval: function execution interval. Set to 0 for manual submission
Function Reward
Executes a function when the reward is collected.
Parameters:
- Function ID: function identifier registered in scripts
Dummy Task
Does nothing on its own. Intended for use with QuestManager.
Parameters:
- Value: required value to complete the task