Author Topic: Newbie, Trying to make a simple quest work.  (Read 4810 times)

Offline Scars

  • Acquaintance
  • *
  • Posts: 5
    • View Profile
Newbie, Trying to make a simple quest work.
« on: January 08, 2010, 01:47:19 am »
Hey there!

I just started working with this codebase, and I have the whole SetTalkResponses thing down, so I decided to move on to quest code, and well... It doesn't work at all..

Here's my code, it's the simplest copy off of the LEO quest that I could get but for whatever reason I can't figure it out.

Code: [Select]
#include <lib.h>

inherit LIB_SENTIENT;

static void create() {
sentient::create();
SetPolyglot(1);
    SetKeyName("Pedobear");
    SetId(({"pedobear"}));
    SetAdjectives(({"non player"}));
    SetShort("Pedobear");
    SetLong("Pedobear is standing, staring at you, he lookes like he could use some help.");
    SetLevel(1);
    SetMelee(1);
    SetRace("humanoid");
    SetGender("male");

    SetTalkResponses(([
        ({"hello","hi","hey"}) : "You're too old for me, but you can help me!",
        ({"how","help","need"}) : "All I need you to do is find me a small child, it NEEDS to be a small one.",
        ({"where","find","child"}) : "You can probably find some children in the orphanage to the south!",
      ]));
}   


int CompleteQuest(object ob){
    string *quests;
    object item = present("a Small Child", this_object());
    quests = ob->GetQuests();
    if(!ob->GetQuest("a Child for Pedobear")){
        ob->AddQuest("Pedobears Small child Quest");
        eventForce("say Pedobear is now happy! Grats!");
        eventForce("say here, take 10 quest points, and 2000 experience points!");
        ob->AddQuestPoints(10);
        ob->AddExperiencePoints(2000);
        if(item) item->eventDestruct();

    }
    return 1;
}

int eventReceiveObject(object foo) {
    int ret;
    object ob, player;
    ob = previous_object();
    player = this_player();

    if( !ob || !(ret = ::eventReceiveObject(foo)) ) return 0;
    if(base_name(ob) == "/domains/lulzville/obj/aSmallChild"){
        this_object()->DisableActions(1);
        call_out("CompleteQuest", 0, player);
        call_out("EnableActions", 300, 1);
    }
    return ret;
}
void init(){
    ::init();
}

All you have to do is give the 'a small child' item to pedobear, at least I THINK That's all you have to do, but I get absolutely no responses for giving it to him!

Thanks for any help
-Mike

Offline cratylus

  • Your favorite and best
  • Administrator
  • ***
  • Posts: 1022
  • Cratylus@Dead Souls <ds> np
    • View Profile
    • About Cratylus
Re: Newbie, Trying to make a simple quest work.
« Reply #1 on: January 08, 2010, 08:21:29 am »
Works fine for me.

Code: [Select]
This is the dark, musty basement of the village church. An elevator door is in
the west wall.
Obvious exit: west
A beat-up old couch is here.
Pedobear is standing here.

04:13:52 Dead_Souls_cratylus /domains/town/npc > clone ../../lulzville/obj/aSmallChild.c
You clone a finely crafted short sword ( /domains/lulzville/obj/aSmallChild.c).
give sword to pedobear
You give Pedobear a finely crafted short sword.
Pedobear exclaims in English, "Pedobear is now happy! Grats!"
Pedobear exclaims in English, "Here, take 10 quest points, and 2000 experience
points!"
04:14:08 Dead_Souls_cratylus /domains/town/npc >

You're probably Doing It Wrong. Maybe you're not giving pedobear what he wants...
have you capitalized properly the object you're cloning?

Without seeing copypasta of what you're actually doing, it's hard guessing.

-Crat

Offline Scars

  • Acquaintance
  • *
  • Posts: 5
    • View Profile
Re: Newbie, Trying to make a simple quest work.
« Reply #2 on: January 08, 2010, 09:38:10 am »
Craziest thing, I tried again this morning and it worked!

The one question i have left is when I type quest it says i have completed no quests, is that code not in my pedobear or do i have to do something extra?

Offline cratylus

  • Your favorite and best
  • Administrator
  • ***
  • Posts: 1022
  • Cratylus@Dead Souls <ds> np
    • View Profile
    • About Cratylus
Re: Newbie, Trying to make a simple quest work.
« Reply #3 on: January 08, 2010, 09:46:31 am »
The AddQuest() lfun takes two parameters, questor title and quest name:

Code: [Select]
ob->AddQuest("the partyvan bait", "Pedobears Small child Quest");

-Crat

Offline Raudhrskal

  • BFF
  • ***
  • Posts: 214
  • The MUD community needs YOUR help!
    • View Profile
Re: Newbie, Trying to make a simple quest work.
« Reply #4 on: January 08, 2010, 10:10:23 am »
Craziest thing, I tried again this morning and it worked!
I guess you did shut down the MUD yesterday, and rebooted it.

On that basis I guess further, that, once you arrived at a version of code that worked, you forgot to 'update' the template from disk into the MUD environment, and/or 'reload' the in-world clones from the updated template.
Freshly booted MUD did not have the "stale" version in memory, and thus loaded the working one when it has been accessed.
I think, therefore i may be wrong.
Please note that if you met a Raudhrskal in a place that's not related to muds, it wasn't me. *sigh*... back when I started there was zero hits on google for that name...

Offline Scars

  • Acquaintance
  • *
  • Posts: 5
    • View Profile
Re: Newbie, Trying to make a simple quest work.
« Reply #5 on: January 08, 2010, 10:26:12 am »
I guess that's what happened as well, i tried reloading and updating but I was really tired and getting a bit stressed out so i probably missed something key haha..

Got it fully working, thanks very much for the help! :D

Edit: actually one last thing;

The item is dropped off a mob; is there a way i can prevent that item from dropping or anything after the quest is done; because the item only really is used  for that quest, and I don't want anyone doing it more than once.

Offline cratylus

  • Your favorite and best
  • Administrator
  • ***
  • Posts: 1022
  • Cratylus@Dead Souls <ds> np
    • View Profile
    • About Cratylus
Re: Newbie, Trying to make a simple quest work.
« Reply #6 on: January 08, 2010, 10:31:00 am »
The item is dropped off a mob; is there a way i can prevent that item from dropping or anything after the quest is done; because the item only really is used  for that quest, and I don't want anyone doing it more than once.

Remove it from the game, the way I do with Leo's orcslayer.

-Crat

Offline Scars

  • Acquaintance
  • *
  • Posts: 5
    • View Profile
Re: Newbie, Trying to make a simple quest work.
« Reply #7 on: January 08, 2010, 11:56:04 am »
is that this part?

Code: [Select]
        if(item) item->eventDestruct();
reload("/domains/lulzville/obj/aSmallChild",0,1);

I have it in there but I keep getting the item i don't want haha