PDA

View Full Version : random quest rewards


stormgod
04-16-2002, 10:05 AM
Is it possible to code a new quest option so you can reward the player with a random item in a list ( like one of all the cloth armor pieces or things like that ) ?
it would be usefull to add new quests ;o)

Malevolent
04-27-2002, 07:17 AM
i OP_ClickGive

if (tmp->IsNPC()) {
if (TradeList[0]==tmp->CastToNPC()->GetItemRequested()) {

this->Message(MT_Say, "%s says, 'Thank you for your hard work!'", tmp->GetName());

if (tmp->CastToNPC()->GetMaster() !=0)
this->Message(MT_Say, "%s says, 'I'm sure %s will look kindly upon this act'", tmp->GetName(), entity_list.RemoveNumbers(tmp->CastToNPC()->GetMaster()));
uint32 somenum=rand()%32531;
Item_Struct* award_item = database.GetItem(somenum);
if (award_item->name!=0) {
this->Message(MT_Emote, "%s opens a small box and hands you a %s'", tmp->GetName(), award_item->name);
this->Message(MT_Say, "%s says, 'I hope you enjoy it!'", tmp->GetName());
this->PutItemInInventory(0,award_item);
} else {
this->Message(MT_Say, "%s says, 'I haven't anything spare, but maybe you'll have learned something.'", tmp->GetName());
this->AddEXP(somenum*10);
}

} else {

this->Message(MT_Emote, "%s looks oddly at what you just handed them.'", tmp->GetName());
}
CheckQuests(zone->GetShortName(), "%%item%%", tmp->CastToNPC()->GetNPCTypeID(), TradeList[0]);

}


Ideally the random item would be a random item within a predefined list. But, the above works pretty well.