Have you, as a modder, ever wanted to create Quests for your mods? Well, with this API, you can! This Work in progress has many features that are constantly growing in order to provide you with an extensive API that will work with others who use this API!
I have taken over this mod from Flammantis, you can see the old thread here.
Now Forge Compatible! Since from now on the Source is going to be released, then forge references are included. If you are not using forge, simply remove these references (all base classes that this mod edits anyway).
Features:
-Functional QuestTracker that stores quests in the HUD!
-Functional Type System that lets you choose between mining items, killing mobs, and getting items.
-Auto Notifications for Obtaining, Failing, or Completing Quests!
-Saving and Loading done in the player class!
-Gui Helper so you can make your own quest logs and NPC Dialogue!
-Repeatable Quests!
-Ability to grant multiple rewards!
-Ability to grant XP as a reward!
-Add multiple types for quests!
-6 Examples that uses Villager so you can see how to create Quests using this mod!
-QuestGive that allows us to give entities special effects when they have quests or quests to turn in!
Video:
Tutorials:
Tutorial one: Creating a Quest:
Since our system automatically finds quests added to the system, we start out by creating a new class and extending Quest.
This will cause us to have to implement quite a few methods for our new class, as they are abstract in Quest.
You should make something similar to this:
package net.flammantis.QuestAPI.examples;
import net.flammantis.QuestAPI.Quest;
import net.flammantis.QuestAPI.types.TypeDig;
import net.minecraft.src.Block;
public class OurQuest extends Quest
{
public OurQuest ()
{
// We CAN give our quest types, but do not have to.
// TypeDig is used for breaking blocks
// TypeGetItem is used for obtaining items.
// TypeHunt is used for killing mobs.
// type is an array which we can create to have multiple types.
// lets do all three currently in the system:
this.type = new Type[3];
this.type[0] = new TypeDig (Block.blockClay, 16, this);
// first argument is the block to break, the second is the amount, and
// the third is this quest, which signifies which object owns the type.
this.type[1] = new TypeHunt (EntityPig.class, 4, this, "Pig");
// first argument is the class of the entity to kill, the second is the
// amount, the third is this quest, and the fourth in the display name
// of the entity.
this.type[2] = new TypeGetItem (new ItemStack(Item.bone), this);
// first argument is the itemStack (this includes items and amounts) to
// get, the second argument in this quest.
}
public String getName ()
{
// This is the display name of our Quest
return "Our Quest";
}
public String getDescription ()
{
// This is the description that shows up in Guis
return "In the middle of the Street";
}
public boolean isRepeatable ()
{
// Return true if the quest is repeatable, or false if it is not.
return true;
}
public void sendGainMessage ()
{
// This is the action that takes place when the quest is first accepted.
}
}
Once you have done this, the quest is complete, but you cannot yet test it. If you are using the examples, then we can
test this example by adding it to the questGive of the Villager. This is easy, as we just go into VillagerQuestGive
class and add this bit of code to onTick():
// this is previous line for reference
quests.add(new GetCoal());
//Our quest goes here, add in the next line:
quests.add(new OurQuest());
now our quest should be testable! Now, you should be able to mess around with name, description, and repeatable, but there
will be more tutorials teaching you how to add rewards and create npcs that give quests.
Tutorial Two: Rewards
Now we have made our quest, but what about rewards? Rewards are simple, and we can just add them to the constructor of our class:
reward.add(new ItemStack(Item.bed));
// This will add an ItemStack made up of a single bed to the rewards.
We can even add multiple rewards to quests, as in multiple different ItemStacks!
reward.add(new ItemStack(Item.goldNugget, 2));
// This will add 2 gold nuggets to the rewards
reward.add(new ItemStack(Block.blockSnow, 4));
// This will add four blocks of snow to the rewards as well!
Now what about enchanted items? Well, first we create the itemstack and then enchant it how we want, and then add it, like so:
ItemStack enchantedBow = new ItemStack(Item.bow);
// First we create the bow
enchantedBow.addEnchantment(Enchantment.power, 2);
// Then we enchant the ItemStack with power II like so
reward.add(enchantedBow);
// And this is how we add the bow to the rewards
We can add the experience reward as well, which grants experience upon quest completion:
xpGained = 10;
// This will grant the play 10 xp (not too much, maybe 1 level at level 0)
And that is rewarding at its basics!
Tutorial Three: Adding quests to entities with QuestGive:
This tutorial will teach you how to add a basic entity (just with the pigman skin, nothing fancy) and a QuestGive in order to add our quest to entities!
So first, lets make a new Entity, most likely an EntityLiving, and pretty much base most of it off of the villager (except rendering, of course). So our basic setup should look like this:
package net.flammantis.QuestAPI.examples;
import net.minecraft.src.EntityAIOpenDoor;
import net.minecraft.src.EntityAISwimming;
import net.minecraft.src.EntityAIWander;
import net.minecraft.src.EntityAIWatchClosest;
import net.minecraft.src.EntityAIWatchClosest2;
import net.minecraft.src.EntityCreature;
import net.minecraft.src.EntityList;
import net.minecraft.src.EntityLiving;
import net.minecraft.src.EntityPlayer;
import net.minecraft.src.EntityVillager;
import net.minecraft.src.World;
public class EntityPigDude extends EntityCreature
{
public EntityPigDude(World par1World)
{
super(par1World);
this.texture = "/mob/pigman.png";
this.moveSpeed = 0.5F;
this.getNavigator().setBreakDoors(true);
this.getNavigator().setAvoidsWater(true);
this.tasks.addTask(0, new EntityAISwimming(this));
this.tasks.addTask(4, new EntityAIOpenDoor(this, true));
this.tasks.addTask(9, new EntityAIWatchClosest2(this, EntityPlayer.class, 3.0F, 1.0F));
this.tasks.addTask(10, new EntityAIWatchClosest(this, EntityLiving.class, 8.0F));
this.tasks.addTask(15, new EntityAIWander(this, 0.3F));
}
public int getMaxHealth()
{
return 20;
}
}
This will create an Entity similar to the Villager. However, our new mob doesn't exist in game! If you are using ModLoader, look up examples on how to add a new Entity to the list with it, otherwise, you can do this for testing:
EntityList.java, line 205, in the static section at the bottom:
// This is only if you aren't using modLoader!
addMapping(EntityPigDude.class, "PigMan", 300, 0xffffff, 12422002);
now we can use a spawn egg to test our new Entity!
Next we need to create a QuestGive for our new entity, so lets go ahead and create one:
package net.flammantis.QuestAPI.examples;
import java.util.ArrayList;
import quests.OurQuest;
import net.flammantis.QuestAPI.Quest;
import net.flammantis.QuestAPI.QuestAPI;
import net.flammantis.QuestAPI.QuestGive;
import net.minecraft.src.Entity;
import net.minecraft.src.EntityPlayer;
public class PigManQuestGive extends QuestGive
{
public PigManQuestGive(Entity e)
{
super(e);
this.quests = new ArrayList<Quest>();
}
public void onTick()
{
quests.clear();
// add our quest here, just like before
quests.add(new OurQuest());
super.onTick();
}
public void onInteractWithParent(EntityPlayer thePlayer)
{
// This will display our quest gui on screen! If you have your own,
// display that instead.
QuestAPI.questAPIInstance.mc.displayGuiScreen(new QuestDialogue(null,
quests, thePlayer));
}
}
Now that we have created this and added our quest to it, we must add this quest give to our entity! For this we must:
1) Add a new variable of type PigManQuestGive to EntityPigDude
2) Initialize that variable in the constructor
3) Add the method onLivingUpdate that calls the super class's onLivingUpdate and our QuestGive's onTick.
4) Add the interact method that calls the super class's interact and our QuestGive's onInteractWithParent
This is pretty simple to do, so I will just display the end product of our EntityPigDude:
package net.flammantis.QuestAPI.examples;
import net.minecraft.src.EntityAIOpenDoor;
import net.minecraft.src.EntityAISwimming;
import net.minecraft.src.EntityAIWander;
import net.minecraft.src.EntityAIWatchClosest;
import net.minecraft.src.EntityAIWatchClosest2;
import net.minecraft.src.EntityCreature;
import net.minecraft.src.EntityList;
import net.minecraft.src.EntityLiving;
import net.minecraft.src.EntityPlayer;
import net.minecraft.src.EntityVillager;
import net.minecraft.src.World;
public class EntityPigDude extends EntityCreature
{
// Add the QuestGive
PigManQuestGive quests;
public EntityPigDude(World par1World)
{
super(par1World);
// initialize the questGive
quests = new PigManQuestGive(this);
this.texture = "/mob/pigman.png";
this.moveSpeed = 0.5F;
this.getNavigator().setBreakDoors(true);
this.getNavigator().setAvoidsWater(true);
this.tasks.addTask(0, new EntityAISwimming(this));
this.tasks.addTask(4, new EntityAIOpenDoor(this, true));
this.tasks.addTask(9, new EntityAIWatchClosest2(this, EntityPlayer.class, 3.0F, 1.0F));
this.tasks.addTask(10, new EntityAIWatchClosest(this, EntityLiving.class, 8.0F));
this.tasks.addTask(15, new EntityAIWander(this, 0.3F));
}
public int getMaxHealth()
{
return 20;
}
// Add onLivingUpdate
public void onLivingUpdate()
{
quests.onTick();
super.onLivingUpdate();
}
// Add interact
public boolean interact(EntityPlayer par1EntityPlayer)
{
quests.onInteractWithParent(par1EntityPlayer);
return super.interact(par1EntityPlayer);
}
}
And thats it! We now have a new Entity that has a quest for the player!
Download:
The newest Downloads are of the source, so decompile as usual (make sure to update mcp first!) and then open eclipse and drag the folders inside of the zip into the src folder of the eclipse project. This will overwrite files (and may cause errors you will need to fix if you aren't using the latest version of forge!) that are edited and add in the new files and packages.
NOTE: I messed up when packaging this one up, so when you open up the rar, make sure to go into the "questapiforgeexamples" folder before moving everything over to eclipse!
v0.7: Fixed non loading of quests bug. Added multiple types system. Added type display system to guihelper. Forge Compatibility. Release as source.
v0.65: Added particle effects to quest give. Reduced base class edits by 1.
v0.6: Changed Guis so that there is a QuestGuiHelper class to help display information about quests in your own guis! Fixed Item info displaying behind items bug. Default log and dialogue are in the examples version, but not the normal. The log must now be viewed through an unnamed item with id 300 (after fire charge). This item is also only in the examples. This allows you to create your own dialogs and access them from whatever you like. Lets say a book that grants a quest has a different Dialog then a person who grants one!
v0.5: Fixed up how items appear in GUIs and added GetItem Type! Lowered Base Class edits to 6 (not including Villager!)
v0.3: First upload from me taking over!
To-do:
Quest Talk type (probably just going to show how to do this without typing)
Make some Tutorials!
Make SMP
BugList:
-sendGainMessage was never called. Fixed in next update
-May cause StringIndexOutofBounds error. Looking into this.
-Wierd ingamegui text shadowing while running outside of eclipse.
Flammantis messaged me and said he was just very unmotivated to mod right now. I invited him the the repository so he can check out and edit code when he feels like it, but he asked me to take over since I was showing great interest and he didn't want to mod this anymore.
Flammantis messaged me and said he was just very unmotivated to mod right now. I invited him the the repository so he can check out and edit code when he feels like it, but he asked me to take over since I was showing great interest and he didn't want to mod this anymore.
Oh, okay. Well, maybe one day he'll join back in with you.
I also wish you luck with this API.
Oh, okay. Well, maybe one day he'll join back in with you.
I also wish you luck with this API.
Thanks! Also, what do you think about losing quests when you die? Currently that happens, but I'm not sure if I should keep it as a feature or just fix it (wouldn't be hard to do).
Also, added the ability to scroll over rewards in order to see their names and enchants (just like scrolling over in inventory)
Now, this is truely becoming the World of Minecraft! This mod looks really good but there is only one thing, please attempt to make a user friendly interface. Alot of mods that create NPCs or quests and such are very difficult to navigate.
Keep up the good work! To you!
Rollback Post to RevisionRollBack
Im not addicted, I just spend alot of time doing that. Hey, I can quite whenever I want... just... not right now.
Now, this is truely becoming the World of Minecraft! This mod looks really good but there is only one thing, please attempt to make a user friendly interface. Alot of mods that create NPCs or quests and such are very difficult to navigate.
Keep up the good work! To you!
Actually doing a lot of work on the interface for NPC dialogue and quests! And thanks!
Thanks! Also, what do you think about losing quests when you die? Currently that happens, but I'm not sure if I should keep it as a feature or just fix it (wouldn't be hard to do).
Also, added the ability to scroll over rewards in order to see their names and enchants (just like scrolling over in inventory)
I think it makes sense, but taking it out would be better for the users. Especially if it's a difficult quest.
Also, please try to get rid of at least some of the base class edits.
I think it makes sense, but taking it out would be better for the users. Especially if it's a difficult quest.
Also, please try to get rid of at least some of the base class edits.
yea, base class edits are pretty brutal, but most of the time I just don't see another way. I have to edit base classes to detect things like blocks being picked and creatures being killed, and changes in the inventory. Player must (obviously) be edited so that quests can be stored there. Idk, I've been thinking about this issue for a while now, so I'm working on it.
Yea, tomorrow (for me) I will make some tutorials as well as an enhanced video (one that shows all the features accurately).
If noone else has any suggestions, though, I will just continue work on SMP and have v0.7 with SMP!
Then I need to test that throughout and then I should be able to make an official release!
I may also make some different looking GUIs for dialogue and questlog if people find this interesting, as well as maybe fix up how the Quest Tracker works.
Also, v0.5 is out with less Base class edits and better looking items in guis (aka scrolling over items tells you their name and all but the achievement looking thing will have the magic part of items fixed to look normal).
EDIT: I think I'm going to change quest log and quest dialogue so that these are resources used by GUIs to print information about quests. AKA: Instead of actually including my own GUIs, you can make your own and use the resources for quest printing to print information about them to the screen!
If you like this, go ahead and let me know!
Sorry about the quick update, but now you should be able to create your own GUIs to be customized for whatever look or gui type you are looking for! I will create some videos for tutorials in a while, so be patient for just a bit on that (this is a WIP API after all).
Also, Quest Log must now be accessed by using a new book looking item with no name, id 300 (creative only, no recipe), behind fire charge. Quest Log is in the example version only! You get to make your own for your mod!
Sorry about the quick update, but now you should be able to create your own GUIs to be customized for whatever look or gui type you are looking for! I will create some videos for tutorials in a while, so be patient for just a bit on that (this is a WIP API after all).
Also, Quest Log must now be accessed by using a new book looking item with no name, id 300 (creative only, no recipe), behind fire charge. Quest Log is in the example version only! You get to make your own for your mod!
Yea, sorry, I've been trying to make videos, but my computer keeps hassling me. I will probably just make some written tutorials for the newest update once I release that.
My friends and I are going to use the Quest API in a BIG mod we're working on, as big as Equivalent Exchange or the Aether or like that. (But doesn't take as long as Aether developement. We're taking about 1 month?)
Rollback Post to RevisionRollBack
Alchemist's RPG, the Dynalith Team's awesome WIP mod. Support us by clicking it! (I know you wanna!)
My friends and I are going to use the Quest API in a BIG mod we're working on, as big as Equivalent Exchange or the Aether or like that. (But doesn't take as long as Aether developement. We're taking about 1 month?)
Sounds awesome! Also, uploading a cool new version and at least one tutorial. Now that I actually have time, I will try to make most, if not all, of the tutorials today.
Have you, as a modder, ever wanted to create Quests for your mods? Well, with this API, you can! This Work in progress has many features that are constantly growing in order to provide you with an extensive API that will work with others who use this API!
I have taken over this mod from Flammantis, you can see the old thread here.
Now Forge Compatible! Since from now on the Source is going to be released, then forge references are included. If you are not using forge, simply remove these references (all base classes that this mod edits anyway).
Features:
-Functional QuestTracker that stores quests in the HUD!
-Functional Type System that lets you choose between mining items, killing mobs, and getting items.
-Auto Notifications for Obtaining, Failing, or Completing Quests!
-Saving and Loading done in the player class!
-Gui Helper so you can make your own quest logs and NPC Dialogue!
-Repeatable Quests!
-Ability to grant multiple rewards!
-Ability to grant XP as a reward!
-Add multiple types for quests!
-6 Examples that uses Villager so you can see how to create Quests using this mod!
-QuestGive that allows us to give entities special effects when they have quests or quests to turn in!
Video:
Tutorials:
Tutorial one: Creating a Quest:
Since our system automatically finds quests added to the system, we start out by creating a new class and extending Quest.
This will cause us to have to implement quite a few methods for our new class, as they are abstract in Quest.
You should make something similar to this:
Once you have done this, the quest is complete, but you cannot yet test it. If you are using the examples, then we can
test this example by adding it to the questGive of the Villager. This is easy, as we just go into VillagerQuestGive
class and add this bit of code to onTick():
now our quest should be testable! Now, you should be able to mess around with name, description, and repeatable, but there
will be more tutorials teaching you how to add rewards and create npcs that give quests.
Tutorial Two: Rewards
Now we have made our quest, but what about rewards? Rewards are simple, and we can just add them to the constructor of our class:
We can even add multiple rewards to quests, as in multiple different ItemStacks!
Now what about enchanted items? Well, first we create the itemstack and then enchant it how we want, and then add it, like so:
We can add the experience reward as well, which grants experience upon quest completion:
And that is rewarding at its basics!
Tutorial Three: Adding quests to entities with QuestGive:
This tutorial will teach you how to add a basic entity (just with the pigman skin, nothing fancy) and a QuestGive in order to add our quest to entities!
So first, lets make a new Entity, most likely an EntityLiving, and pretty much base most of it off of the villager (except rendering, of course). So our basic setup should look like this:
This will create an Entity similar to the Villager. However, our new mob doesn't exist in game! If you are using ModLoader, look up examples on how to add a new Entity to the list with it, otherwise, you can do this for testing:
EntityList.java, line 205, in the static section at the bottom:
now we can use a spawn egg to test our new Entity!
Next we need to create a QuestGive for our new entity, so lets go ahead and create one:
Now that we have created this and added our quest to it, we must add this quest give to our entity! For this we must:
1) Add a new variable of type PigManQuestGive to EntityPigDude
2) Initialize that variable in the constructor
3) Add the method onLivingUpdate that calls the super class's onLivingUpdate and our QuestGive's onTick.
4) Add the interact method that calls the super class's interact and our QuestGive's onInteractWithParent
This is pretty simple to do, so I will just display the end product of our EntityPigDude:
And thats it! We now have a new Entity that has a quest for the player!
Download:
The newest Downloads are of the source, so decompile as usual (make sure to update mcp first!) and then open eclipse and drag the folders inside of the zip into the src folder of the eclipse project. This will overwrite files (and may cause errors you will need to fix if you aren't using the latest version of forge!) that are edited and add in the new files and packages.
NOTE: I messed up when packaging this one up, so when you open up the rar, make sure to go into the "questapiforgeexamples" folder before moving everything over to eclipse!
Newest Forge Compatible With Examples v0.7
Older Versions:
Without Examples v0.65
With Examples v0.65
Without Examples v0.6
With Examples v0.6
Without Examples v0.5
With Examples v0.5
Without Examples v0.3
With Examples v0.3
Changelog:
v0.7: Fixed non loading of quests bug. Added multiple types system. Added type display system to guihelper. Forge Compatibility. Release as source.
v0.65: Added particle effects to quest give. Reduced base class edits by 1.
v0.6: Changed Guis so that there is a QuestGuiHelper class to help display information about quests in your own guis! Fixed Item info displaying behind items bug. Default log and dialogue are in the examples version, but not the normal. The log must now be viewed through an unnamed item with id 300 (after fire charge). This item is also only in the examples. This allows you to create your own dialogs and access them from whatever you like. Lets say a book that grants a quest has a different Dialog then a person who grants one!
v0.5: Fixed up how items appear in GUIs and added GetItem Type! Lowered Base Class edits to 6 (not including Villager!)
v0.3: First upload from me taking over!
To-do:
Quest Talk type (probably just going to show how to do this without typing)
Make some Tutorials!
Make SMP
BugList:
-sendGainMessage was never called. Fixed in next update
-May cause StringIndexOutofBounds error. Looking into this.
-Wierd ingamegui text shadowing while running outside of eclipse.
Support:
[center]This document is Copyright ©2012 Flammantis and is the intellectual property of the author. It may not be claimed as your own, and cannot be placed on any other website without his permission.
[center]
Flammantis messaged me and said he was just very unmotivated to mod right now. I invited him the the repository so he can check out and edit code when he feels like it, but he asked me to take over since I was showing great interest and he didn't want to mod this anymore.
Oh, okay. Well, maybe one day he'll join back in with you.
I also wish you luck with this API.
Thanks! Also, what do you think about losing quests when you die? Currently that happens, but I'm not sure if I should keep it as a feature or just fix it (wouldn't be hard to do).
Also, added the ability to scroll over rewards in order to see their names and enchants (just like scrolling over in inventory)
Keep up the good work! To you!
Hey, I can quite whenever I want... just... not right now.
Actually doing a lot of work on the interface for NPC dialogue and quests! And thanks!
I think it makes sense, but taking it out would be better for the users. Especially if it's a difficult quest.
Also, please try to get rid of at least some of the base class edits.
yea, base class edits are pretty brutal, but most of the time I just don't see another way. I have to edit base classes to detect things like blocks being picked and creatures being killed, and changes in the inventory. Player must (obviously) be edited so that quests can be stored there. Idk, I've been thinking about this issue for a while now, so I'm working on it.
Thanks! I'm going to update to v0.5 soon, then going to work on smp, unless I get any more suggestions.
Yea, tomorrow (for me) I will make some tutorials as well as an enhanced video (one that shows all the features accurately).
If noone else has any suggestions, though, I will just continue work on SMP and have v0.7 with SMP!
Then I need to test that throughout and then I should be able to make an official release!
I may also make some different looking GUIs for dialogue and questlog if people find this interesting, as well as maybe fix up how the Quest Tracker works.
Also, v0.5 is out with less Base class edits and better looking items in guis (aka scrolling over items tells you their name and all but the achievement looking thing will have the magic part of items fixed to look normal).
EDIT: I think I'm going to change quest log and quest dialogue so that these are resources used by GUIs to print information about quests. AKA: Instead of actually including my own GUIs, you can make your own and use the resources for quest printing to print information about them to the screen!
If you like this, go ahead and let me know!
Also, Quest Log must now be accessed by using a new book looking item with no name, id 300 (creative only, no recipe), behind fire charge. Quest Log is in the example version only! You get to make your own for your mod!
Nice! Waiting on the tutorials.
Yea, sorry, I've been trying to make videos, but my computer keeps hassling me. I will probably just make some written tutorials for the newest update once I release that.
Alchemist's RPG, the Dynalith Team's awesome WIP mod. Support us by clicking it! (I know you wanna!)
Sounds awesome! Also, uploading a cool new version and at least one tutorial. Now that I actually have time, I will try to make most, if not all, of the tutorials today.