se7enet purgatorio

Page 1 of 4 1234>
Topic Options
Rate This Topic
#18084 - 09/03/08 09:09 PM Quest System
HolyKnight
Malt-o-Meal


Registered: 03/03/07
Posts: 5

Offline
I know I have not posted here for more than a year, but that was due to not ever rlly being able to get on due to personal problems, so for the moment being, I am back from the dead (not that I was rlly ever active here much in the first place).

Anyway, on with the topic. I developed a very simple quest system on the DK game I run. (not that it rlly has any members....yet)
I'm not going to go into too much detail, other than I also had the Fights/Kills/Deaths mod installed. It was sort of required for some of the quests I made. Also, any Database things that were not there in the original, but are in my code, I have also added. If you are interested enough in the party system, then I hope you will be able to read this below code yourself.

All below code was put into the bottom of my towns.php
I also added a link to this function in templates/town.php

 Code:
#
function towncenter() { //This area will have NPCs for quests.
 
//Setting up Variables
global $userrow;
 
$latitude = $userrow["latitude"];
$longitude = $userrow["longitude"];
$Q1 = $userrow["Q1"];
$kills = $userrow["kills"];
$Q2 = $userrow["Q2"];
$deaths = $userrow["deaths"];
$Q3 = $userrow["Q3"];
$Q4 = $userrow["Q4"];
$Q5 = $userrow["Q5"];
$Q6 = $userrow["Q6"];
$Q7 = $userrow["Q7"];
$gold = $userrow["gold"];
 
//Different NPCs dependent on location
 
if ($latitude == 0 AND $longitude == 0) {
if ($Q1 == 0) {$page = "An elderly man walks up to you with hopeful eyes. He mentions monsters have recently been attacking the farms around Midworld.<br> <br>";
$page .= "Hello there. You seem to be new around here! I'm sorry to ask this of you so suddenly, but could you kill ten of those monsters outside town? If you return to me, I will give you something in return for your hard efforts!<br> <br> ";
$page .= "You accept the request without hesitation, and rush out of the town hall, to prepare for your battle.";
$page .= "<br>You may return to <a href=\"index.php\">town</a>";
$Q1 = $userrow["Q1"] + 1;
$updatequery = doquery("UPDATE {{table}} SET Q1='$Q1' WHERE id='".$userrow["id"]."' LIMIT 1", "users");}
elseif ($Q1 == 1 AND $kills >= 10) {$page = "You have returned? Have you slayed the monsters as I have asked? You did! Great! Here take my life savings, it may not be much but it is all I can do to repay you for your services!";
$page .= "<br><br> You have gained 50 gold and 10 EXP!";
$page .= "<br>You may return to <a href=\"index.php\">town</a>";
$newgold = $userrow["gold"] + 50;
$newexp = $userrow["experience"] + 10;
$Q1 = $userrow["Q1"] + 1;
$updatequery = doquery("UPDATE {{table}} SET Q1='$Q1',gold='$newgold',experience='$newexp' WHERE id='".$userrow["id"]."' LIMIT 1", "users");}
elseif ($Q4 == 1) {$page = "You see a stone of the purest white. You also see a few faded footsteps in the nearby soil. They must have been made by Billy and this must be the Life Stone.<br> <br>";
$Q4 = $userrow["Q4"] + 1;
$updatequery = doquery("UPDATE {{table}} SET Q4='$Q4' WHERE id='".$userrow["id"]."' LIMIT 1", "users");}
elseif ($Q5 == 1) { $page = "You walk into the Town Center, and notice everyone laughing. You yourself cannot help but laugh as you enter the room. As you inquire a nearby woman about it, she states she found a Laughing Stone, and used it to brighten up the atmosphere here. You tell her of your current quest, and she agrees to let you have to stone.";
$Q5 = $userrow["Q5"] + 1;
$updatequery = doquery("UPDATE {{table}} SET Q5='$Q5' WHERE id='".$userrow["id"]."' LIMIT 1", "users");
}
else {$page = "You walk into the town center. It seems everything is running smoothly, as no one here seems troubled.";
$page .= "<br>You may return to <a href=\"index.php\">town</a>";}
}
elseif ($latitude == 30 AND $longitude == 30) {
if ($Q2 == 0) { $page = "A philosopher, probably around the young age of 20, approaches you with a curious gleam in his eye.<br> <br>";
$page .= "Greetings adventurer. You seem to be a knowledgeable chap! I am a firm believer that reincarnation exists. Would you be able to die and return to me alive once again?<br> <br> ";
$page .= "You give him an odd glance, sigh, and nod, agreeing to the request. This could be a dangerous one";
$page .= "<br>You may return to <a href=\"index.php\">town</a>";
$Q2 = $userrow["Q2"] + 1;
$updatequery = doquery("UPDATE {{table}} SET Q2='$Q2' WHERE id='".$userrow["id"]."' LIMIT 1", "users");}
elseif ($Q2 == 1 AND $deaths >= 1) {$page = "I heard the news of your death but here you are in front of me now! Great, now if you please follow me...";
$page .= "<br><br> You follow the philosopher into a meeting, where he explains your death and rebirth. By the end, no one believes his story.";
$page .= "<br><br> Oh bother. None of them believe me! No matter, now I know myself for certain reincarnation exists. Here is a reward for your troubles.";
$page .= "<br><br> You receive 100 gold and 50 EXP!";
$page .= "<br>You may return to <a href=\"index.php\">town</a>";
$newgold = $userrow["gold"] + 100;
$newexp = $userrow["experience"] + 50;
$Q2 = $userrow["Q2"] + 1;
$updatequery = doquery("UPDATE {{table}} SET Q2='$Q2',gold='$newgold',experience='$newexp' WHERE id='".$userrow["id"]."' LIMIT 1", "users");}
else {$page = "You walk into the town center. It seems everything is running smoothly, as no one here seems troubled.";
$page .= "<br>You may return to <a href=\"index.php\">town</a>";}
}
elseif ($latitude == 70 AND $longitude == -70) {
if ($Q3 == 0) {$page = "A seasoned warrior approaches you with a hardened resolve and a deep voice. He begins to boast.<br> <br>";
$page .= "Ha! You puny explorer. I am the great Jern, only warrior who ever lived to slay 1000 monsters! Anyone who can beat that record I will allow acquisition of my prized possession!<br> <br> ";
$page .= "You glare at him with an annoyed look. Who does he think he is!? You decide to show him who's boss, you are going to break his record...";
$page .= "<br>You may return to <a href=\"index.php\">town</a>";
$Q3 = $userrow["Q3"] + 1;
$updatequery = doquery("UPDATE {{table}} SET Q3='$Q3' WHERE id='".$userrow["id"]."' LIMIT 1", "users");}
elseif ($Q3 == 1 AND $kills >= 1001) {$page = "You walk up to the egotistic warrior, as he is boasting of his past battles with not-so-fearsome creatures of the wilderness. You interrupt him to show your papers, proving you have over 1,000 kills, in his face. He blushes, let's out a mighty sorrowful roar. After he calms he states. I see, well then I guess I owe you this. His expression changes to a smile as he hands you a book called \"Adventures of the Battler Legend\" written by Jern. You stomp away, only slightly annoyed that this is your prize. You soon decide to take a break near a tree, and out of lack of any other books in your possession, begin reading it.";
$page .= "<br><br> What a surprise! Jern may have been exaggerating his kills, but he sure knows his stuff! You feel you have better fighting skills just reading the book! You gain 1000 exp!";
$page .= "<br><br>You may return to <a href=\"index.php\">town</a>";
$newexp = $userrow["experience"] + 1000;
$Q3 = $userrow["Q3"] + 1;
$updatequery = doquery("UPDATE {{table}} SET Q3='$Q3',experience='$newexp' WHERE id='".$userrow["id"]."' LIMIT 1", "users");}
else {$page = "You walk into the town center. It seems everything is running smoothly, as no one here seems troubled.";
$page .= "<br>You may return to <a href=\"index.php\">town</a>";}
}
 
elseif ($latitude == -100 AND $longitude == 100) {
if ($Q4 == 0) {$page = "An ancient woman sneaks up on you from behind.<br> <br>";
$page .= "Excuse
me, I seem to have lost my stone of life. I think that little Billy
stole it again, he usually hangs out around Midworld, could
you retrieve it for me?<br> <br> ";
$page .= "You
look at the old lady with a sense that she may very well be insane, but
you inevitably agree to the quest she has given you. Midworld she
said...";
$page .= "<br>You may return to <a href=\"index.php\">town</a>";
$Q4 = $userrow["Q4"] + 1;
$updatequery = doquery("UPDATE {{table}} SET Q4='$Q4' WHERE id='".$userrow["id"]."' LIMIT 1", "users");}
elseif ($Q4 == 2) {$page = "You have returned? Do you have my stone? You do! Can I have it please? Oh thank you young man, your kindness will never be forgotten!";
$page .= "<br>The old lady disappears in a ghostly fashion. Did she just look transparent for a moment there? And how come she vanished in thin air....?";
$page .= "<br><br> You find 250 gold on the ground where the old woman had stood, moments before.";
$page .= "<br>You may return to <a href=\"index.php\">town</a>";
$newgold = $userrow["gold"] + 250;
$Q4 = $userrow["Q4"] + 1;
$updatequery = doquery("UPDATE {{table}} SET Q4='$Q4',gold='$newgold' WHERE id='".$userrow["id"]."' LIMIT 1", "users");}
else {$page = "You walk into the town center. It seems everything is running smoothly, as no one here seems troubled.";
$page .= "<br>You may return to <a href=\"index.php\">town</a>";}
}
 
 
 
elseif ($latitude == -130 AND $longitude == -130) {
if ($Q5 == 0) {$page = "A fool wanders up to you and glumly requests of your service.<br> <br>";
$page .= "Hello there, I am supposed to be entertaining the Lord of Smarksere this evening, but I am discouraged, could you possibly find me something to once again encourage me to entertain well?<br> <br> ";
$page .= "You accept the request and begin to ponder. How could you encourage him? You are tired, perhaps you should go to the Dragonspear Inn.";
$page .= "<br>You may return to <a href=\"index.php\">town</a>";
$Q5 = $userrow["Q5"] + 1;
$updatequery = doquery("UPDATE {{table}} SET Q5='$Q5' WHERE id='".$userrow["id"]."' LIMIT 1", "users");}
elseif ($Q5 == 2) {$page = "He sees you return and runs over. You show him the laughing stone and he bursts out in chuckles. He looks at you, thanks you whole heartedly and states that your pay was on the bench he was sitting on.";
$page .= "<br><br> You walk over to the bench and find 100g! Under the bench you find something else. A stone that contains swirling darkness within. You wonder what you could possibly find that it would be useful for.";
#
$page .= "<br>You may return to <a href=\"index.php\">town</a>";
$newgold = $userrow["gold"] + 100;
$Q5 = $userrow["Q5"] + 1;
$updatequery = doquery("UPDATE {{table}} SET Q5='$Q5',gold='$newgold' WHERE id='".$userrow["id"]."' LIMIT 1", "users");}
else{ $page = "You walk into the town center. It seems everything is running smoothly, as no one here seems troubled.";
$page .= "<br>You may return to <a href=\"index.php\">town</a>";}
 
}
 
elseif ($latitude == 170 AND $longitude == 170) {
if ($Q5 == 2) {$page = "A woman who claims to be a mystic is advertising the fact that she is buying a darkness stone. She seems to be paying well, too bad you don't have one.<br> <br>";
$page .= "<br>You may return to <a href=\"index.php\">town</a>";}
elseif ($Q5 == 3) {$page = "An woman who claims to be a mystic strides over to you and states that she senses you have a Dark Stone on you. She says she will pay 2,500 gold for it. You agree, figuring it would have no other use, and walk off with a pocket freshly full of coins.";
$page .= "<br><br> You have gained 2500 gold";
$page .= "<br>You may return to <a href=\"index.php\">town</a>";
$newgold = $userrow["gold"] + 2500;
$Q5 = $userrow["Q5"] + 1;
$updatequery = doquery("UPDATE {{table}} SET Q5='$Q5',gold='$newgold' WHERE id='".$userrow["id"]."' LIMIT 1", "users");}
elseif ($Q5 == 4) {$page = "You walk into the town center. You spot the mystic you sold your stone to. She thanks you again and you walk off, wondering exactly what use she did make of that stone.";
$page .= "<br>You may return to <a href=\"index.php\">town</a>";}
else{$page = "You walk into the town center. It seems everything is running smoothly, as no one here seems troubled.";
$page .= "<br>You may return to <a href=\"index.php\">town</a>";}
}
elseif ($latitude == 200 AND $longitude == -200) {
if ($Q6 == 0 AND $Q3 == 2) {$page = "You see Jerf, the seasoned warrior once again, just as he spots you. He walks over and declares another challenge, but this time not with egotism, but with genuine intrigue with you.<br> <br>";
$page .= "I wish to see you kill 5,000 monsters. Can you do this for me? I wish to see the strongest man fight his hardest and write a book of him. As you know, I weave tales very well.<br> <br> ";
$page .= "You accept this unexpected request without a second thought. You walk back to town to prepare for this long battle";
$page .= "<br>You may return to <a href=\"index.php\">town</a>";
$Q6 = $userrow["Q6"] + 1;
$updatequery = doquery("UPDATE {{table}} SET Q6='$Q6' WHERE id='".$userrow["id"]."' LIMIT 1", "users");}
elseif ($Q6 == 1 AND $kills >= 5000) {$page = "You have returned? Have you slayed the monsters as I have asked? You did! Great! Now tell me of your adventure and I shall begin writing your story!";
$page .= "<br><br> A few months later you receive a letter in the mail from Jern stating the book was an absolute hit! He said he also included a share inside the letter. You are astounded to see 10,000 gold!";
$page .= "<br>You may return to <a href=\"index.php\">town</a>";
$newgold = $userrow["gold"] + 10000;
$Q6 = $userrow["Q6"] + 1;
$updatequery = doquery("UPDATE {{table}} SET Q6='$Q6',gold='$newgold' WHERE id='".$userrow["id"]."' LIMIT 1", "users");}
else {$page = "You walk into the town center. It seems everything is running smoothly, as no one here seems troubled.";
$page .= "<br>You may return to <a href=\"index.php\">town</a>";}
}
elseif ($latitude == -250 AND $longitude == -250) {
if ($Q7 == 0) {$page = "A young girl approaches and states that she is collecting money for the homeless children shelter.<br> <br>";
$page .= "Your heart is struck dead by her story, and before realizing it, you agree to find her 1,000,000 gold!<br> <br> ";
$page .= "What a fool you were! However, you will not break your word, so you go off to find her 1,000,000 gold...";
$page .= "<br>You may return to <a href=\"index.php\">town</a>";
$Q7 = $userrow["Q7"] + 1;
$updatequery = doquery("UPDATE {{table}} SET Q7='$Q7' WHERE id='".$userrow["id"]."' LIMIT 1", "users");}
elseif ($Q7 == 1 AND $gold >= 1000000) {$page = "With a deep sigh, you hand the little girl 1,000,000 gold. You have to say, this was one large life experience.";
$page .= "<br><br> You have gained 50,000 EXP!";
$page .= "<br>You may return to <a href=\"index.php\">town</a>";
$newgold = $userrow["gold"] - 1000000;
$newexp = $userrow["experience"] + 50000;
$Q7 = $userrow["Q7"] + 1;
$updatequery = doquery("UPDATE {{table}} SET Q7='$Q7',gold='$newgold',experience='$newexp' WHERE id='".$userrow["id"]."' LIMIT 1", "users");}
else {$page = "You walk into the town center. It seems everything is running smoothly, as no one here seems troubled.";
$page .= "<br>You may return to <a href=\"index.php\">town</a>";}
}
 
 
else {display("Cheat attempt detected.<br /><br />Get a life, loser.", "Error");}
$updatequery;
display($page, "Quests");
 
}
//quest snippet above developed by Chris R.D. (aka. Vandril Lorde)


I realize this code is a bit messy, but I was/am only self taught and are still new at this.

Top
#18089 - 09/04/08 07:14 AM Re: Quest System [Re: HolyKnight]
Fayt
Crunchberries
***

Registered: 11/08/05
Posts: 1131
Loc: My Computer, USA

Offline
This is by far the most tiny quests thing i've ever seen. A quest should be no less then 200 lines. I would keep working on it and make it longer.
_________________________
MasterFayt - Amara 5 - Manas - Banar

Top
#18092 - 09/04/08 07:46 AM Re: Quest System [Re: Fayt]
gamefreak888
Rice Krispies


Registered: 09/06/07
Posts: 215

Offline
For letting this code work properly you need to add the following fields to your users table:

Q1
Q2
Q3
Q4
Q5
Q6
Q7

And you must paste the following code somewhere in index.php:
 Code:
 elseif ($do[0] == "towncenter") { include('towns.php'); towncenter(); }

Top
#18094 - 09/04/08 04:05 PM Re: Quest System [Re: gamefreak888]
Fayt
Crunchberries
***

Registered: 11/08/05
Posts: 1131
Loc: My Computer, USA

Offline
+2 points for helping him out, -1 point for helping a bad mod.
_________________________
MasterFayt - Amara 5 - Manas - Banar

Top
#18096 - 09/04/08 07:33 PM Re: Quest System [Re: Fayt]
AnmanIndustries
Cookie Crisp
*****

Registered: 03/21/05
Posts: 2876
Loc: Planet Stupid, AKA Earth

Offline
I once took a shit that made me feel good about being here more than you did. Although, that same shit just made me feel plain good about being alive. It was a good shit.

A simple mod like this allows other people to expand on it the way they want to themselves.
_________________________
If you want me to punch you in the nuts go to:
http://www.AnmanIndustries.com

I'll do it for free too. Enjoy.

Top
#18098 - 09/04/08 07:58 PM Re: Quest System [Re: AnmanIndustries]
Fayt
Crunchberries
***

Registered: 11/08/05
Posts: 1131
Loc: My Computer, USA

Offline
Not when it's coded like this.
_________________________
MasterFayt - Amara 5 - Manas - Banar

Top
#18101 - 09/05/08 04:17 AM Re: Quest System [Re: Fayt]
AnmanIndustries
Cookie Crisp
*****

Registered: 03/21/05
Posts: 2876
Loc: Planet Stupid, AKA Earth

Offline
It looks fine to me...
On that note however, I forgot how damn clumsy DK is compared to DS. If I ever have to look at another $page variable again Im going to punch a baby.
_________________________
If you want me to punch you in the nuts go to:
http://www.AnmanIndustries.com

I'll do it for free too. Enjoy.

Top
#18106 - 09/05/08 07:55 AM Re: Quest System [Re: Fayt]
gamefreak888
Rice Krispies


Registered: 09/06/07
Posts: 215

Offline
 Originally Posted By: Fayt
+2 points for helping him out, -1 point for helping a bad mod.


So I've just risen +1 point!

Not so bad after all \:\)

Top
#18107 - 09/05/08 08:43 AM Re: Quest System [Re: gamefreak888]
Fayt
Crunchberries
***

Registered: 11/08/05
Posts: 1131
Loc: My Computer, USA

Offline
Yeah
_________________________
MasterFayt - Amara 5 - Manas - Banar

Top
#18120 - 09/06/08 10:33 PM Re: Quest System [Re: HolyKnight]
HolyKnight
Malt-o-Meal


Registered: 03/03/07
Posts: 5

Offline
Hey now, when I said it was a simple mod, I meant SIMPLE. This is simply the first (and most basic) of implementations going to be made for my installment of DKRPG. xD

I didn't post it as a full and finished mod, nor a mod at all, more of an example on one way you could make a quest mod. One way that could be expanded upon when wanted and could be rather easy to understand. I see no harm in giving a simple layout of a quest system, do you? I figured adding those quests, or in this case simple quest EXAMPLES in there would allow people to understand what I had in mind a little easier then if I said
"quest text goes here".

Anyways, I surprised myself by even logging on here today ^^
So...I'm off.

Top
#18121 - 09/06/08 11:13 PM Re: Quest System [Re: HolyKnight]
Fayt
Crunchberries
***

Registered: 11/08/05
Posts: 1131
Loc: My Computer, USA

Offline
Ok bye bye
_________________________
MasterFayt - Amara 5 - Manas - Banar

Top
#18134 - 09/07/08 07:41 PM Re: Quest System [Re: Fayt]
AnmanIndustries
Cookie Crisp
*****

Registered: 03/21/05
Posts: 2876
Loc: Planet Stupid, AKA Earth

Offline
Way to go dipshit. Scaring the newbes away.
_________________________
If you want me to punch you in the nuts go to:
http://www.AnmanIndustries.com

I'll do it for free too. Enjoy.

Top
#18140 - 09/07/08 09:01 PM Re: Quest System [Re: AnmanIndustries]
Fayt
Crunchberries
***

Registered: 11/08/05
Posts: 1131
Loc: My Computer, USA

Offline
Suck my small penis
_________________________
MasterFayt - Amara 5 - Manas - Banar

Top
#18146 - 09/08/08 02:28 AM Re: Quest System [Re: Fayt]
AnmanIndustries
Cookie Crisp
*****

Registered: 03/21/05
Posts: 2876
Loc: Planet Stupid, AKA Earth

Offline
Dont have a come back to that.
_________________________
If you want me to punch you in the nuts go to:
http://www.AnmanIndustries.com

I'll do it for free too. Enjoy.

Top
#18155 - 09/08/08 08:36 AM Re: Quest System [Re: AnmanIndustries]
Fayt
Crunchberries
***

Registered: 11/08/05
Posts: 1131
Loc: My Computer, USA

Offline
How about we delete this topic?
_________________________
MasterFayt - Amara 5 - Manas - Banar

Top
Page 1 of 4 1234>


Hop to:

se7enet

Barack Obama Logo