Hello.
I'm having a problem with a quest that I've been trying to work out for a few hours, using leo.c as an example. Basically, I'm trying to program this room so that when a player types "plant explosives in soil", it checks to see if the explosives (/obj/bomb) are in the player's inventory, and if they are to destroy them and then check to see if the player already has the quest, awarding them if necessary. (I hope that's clear..). (I'm new to Dead Souls, so I'd think probably (and hopefully) this is a simple-ish problem.)
Here's the code I have for the room :
#include <lib.h>
#include ROOMS_H
inherit LIB_ROOM;
//int read_sign();
void create() {
room::create();
SetClimate("indoors");
SetAmbientLight(30);
SetShort("Boring Room");
SetLong("This is a house which bores you beyond imagine. There is a fireplace, pot of soil, a couch, a table with nothing on it, and another room to the north.");
SetInventory(([
"/obj/soil" : 1,
]));
SetExits( ([
"south" : "/domains/deltov/room/room_four",
"north" : "/domains/deltov/room/building_room_one.c",
]) );
}
int quest(object ob){
string *quests;
object bomb = present("bomb", this_object());
write("You plant the explosives.");
quests = ob->GetQuests();
if(!ob->GetQuest("Boring")){
ob->AddQuest("Boring","Boring");
write("You have solved the Bore-Killer Quest. Congratulations!");
write("I hereby award you 10 quest points, and 2000 experience points!");
ob->AddQuestPoints(10);
ob->AddExperiencePoints(2000);
if(bomb) bomb->eventDestruct();
reload("/domains/deltov/room/building_room_one",0,1);
}
else{
write("You've already completed this quest");
}
return 1;
}
int plant(object foo){
int ret;
object ob, player;
ob = previous_object();
player = this_player();
if( !ob || !(ret = plant(foo)) ) return 0;
if(present("/obj/bomb", this_object())){
call_out("quest", 0, player);
}
return ret;
}
void init(){
::init();
add_action("plant","plant");
}