Adding quests[Concept]

kill4joy KJ

Member
Reputation
0
We had several quests on endacia, now this requires a menial understanding of the java programming language. If you do not know java, you should not be running a private server. I may post a detailed source example when I have the time, but at the moment it is just a concept, and most people should understand how to write a quest after this. If you are one of those people who just C+Ps tutorial source codes then F*k off.

Now basically we have one public integer which we will use as a counter. For example

Public Int Quest1;

In the player file, the default value of this will be 0.

0 means the player has not started the quest.

Each new "event" in the quest will increase the status by one.

For example

If the player talks to an NPC and accepts the quest
if(quest1 == 0 && TalkstoNPC)
Quest1 == 1

You can continue this until you have finished the quest, after that you can do a simple boolean.

if(Quest1 == *finished int* )
quest1_Finished = true;


now you can just use the boolean for whenever you want to restrict an individual to finishing the quest, such as killing specific monsters, going to certain areas, etc.
 
If I understood your post correctly, you and I have about the same idea of how a quest should work. This is my questhandler:

Code:
package server.model.players;


public class QuestHandler {

	private Client c;
	public QuestHandler(Client Client) {
		this.c = Client;
	}

	int maxPoints = 2;

	public void setState(int questID, int questStage) {
		switch (questID) {
		case 1: //Quest #1: Recovering the lost rules scroll.
			c.q1 = questStage;
			if (c.q1 > 0 && c.q1 < 6) {
				c.getPA().sendFrame126("@yel@Lost Rules", 7332);
			} else {
				c.getPA().sendFrame126("@gre@Lost Rules", 7332);
			}

			break; 
		}		
	}

	public void giveReward(int quest) {
		switch (quest) {
		case 1:
			c.getItems().addItem(995,100000);
			c.getItems().addItem(1731, 1);
			c.getItems().addItem(554,200);
			c.getItems().addItem(555,200);
			c.getItems().addItem(556,200);
			c.getItems().addItem(558,600);
			c.getItems().addItem(1381,1);
			c.getItems().addItem(1323,1);
			c.getItems().addItem(841,1);
			c.getItems().addItem(882,500);
			c.getItems().addItem(380,100);
			c.questPoints += 2;
			break;
		}
		c.getPA().sendFrame126("QP: "+c.questPoints, 3985); //<-- This actually sets quest points in the 317 skills interface.
		if (c.questPoints == maxPoints) {
			c.sendMessage("You can now wear the quest cape, please contact an administrator for the cape!");
		}
	}
}
 
Flow said:
If I understood your post correctly, you and I have about the same idea of how a quest should work. This is my questhandler:

Code:
package server.model.players;


public class QuestHandler {

	private Client c;
	public QuestHandler(Client Client) {
		this.c = Client;
	}

	int maxPoints = 2;

	public void setState(int questID, int questStage) {
		switch (questID) {
		case 1: //Quest #1: Recovering the lost rules scroll.
			c.q1 = questStage;
			if (c.q1 > 0 && c.q1 < 6) {
				c.getPA().sendFrame126("@yel@Lost Rules", 7332);
			} else {
				c.getPA().sendFrame126("@gre@Lost Rules", 7332);
			}

			break; 
		}		
	}

	public void giveReward(int quest) {
		switch (quest) {
		case 1:
			c.getItems().addItem(995,100000);
			c.getItems().addItem(1731, 1);
			c.getItems().addItem(554,200);
			c.getItems().addItem(555,200);
			c.getItems().addItem(556,200);
			c.getItems().addItem(558,600);
			c.getItems().addItem(1381,1);
			c.getItems().addItem(1323,1);
			c.getItems().addItem(841,1);
			c.getItems().addItem(882,500);
			c.getItems().addItem(380,100);
			c.questPoints += 2;
			break;
		}
		c.getPA().sendFrame126("QP: "+c.questPoints, 3985); //<-- This actually sets quest points in the 317 skills interface.
		if (c.questPoints == maxPoints) {
			c.sendMessage("You can now wear the quest cape, please contact an administrator for the cape!");
		}
	}
}

Yes, it seems to be quite similar, but you don't have code for the boolean, which is quite useful for "unlocking areas after completing a specific quest"
 
Unless you plan on doing quests like they should be done, not a rewrite of your own.

I don't see why not, or were you asking help with something?
 
Back
Top