EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Archive::Development (https://www.eqemulator.org/forums/forumdisplay.php?f=621)
-   -   Dynamic Simple Quest Generation 1 (https://www.eqemulator.org/forums/showthread.php?t=1403)

Malevolent 04-23-2002 06:36 AM

Dynamic Simple Quest Generation 1
 
I have three ideas I'm experimenting with to implement pseudo-random. This is the first.

Theory:

A random trigger to set off an auction in the auction channel for a given item sets a property on an individual mob --npc--. Then, should a player have an item and turn that item in, it results in some random reward.

Results:

No rewards yet, but the basics work.

Snippets:

Code:


npc::process

        if (this->MerchantType>0)
                if (rand()%650==2){
                        uint32 someitem = rand()%3500;
                        Item_Struct* item = database.GetItem(someitem);
                       
                        if (item->name!=0)
                        if (rand()%2==0) {
                               
                                entity_list.Message(0,MT_Auction, "%s auctions, 'WTS %s'", GetName(), item->name);

                        } else {
                                this->SetItemRequested(someitem);
                                entity_list.Message(0,MT_Auction, "%s auctions, 'WTT %s'", GetName(), item->name);
                        }
                        //else WTB
                }

npc.h

        /****************************************************
        Merchant Role & AutoQuest Gen
        *****************************************************/
        void        SetItemRequested(uint32 item) { ItemRequested=item;}
        uint32        GetItemRequested(){return ItemRequested;}
        uint32        ItemRequested;

client_process.cpp @2236

                QueuePacket(outapp);
                                                                        cout << "npc deal ended" << endl;
                                                                        InTrade = 0;
                                                                        TradeWithEnt = 0;
                                                                        delete outapp;
                                                                        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(), tmp->CastToNPC()->GetMaster());

                                                                                        //this->PutItemInInventory..
                                                                                } else {
                                                                                       
                                                                                        this->Message(MT_Say, "%s says, 'This is not what I wanted! No, not at all!'", tmp->GetName());
                                                                                }

                                                                                CheckQuests(zone->GetShortName(), "%%item%%", tmp->CastToNPC()->GetNPCTypeID(), TradeList[0]);

                                                                        }

Notes:

You can test this out on Malevolent's Lab, a publicly available server on the EQEmu Network.

--MV

Hmm 04-23-2002 12:26 PM

heh you sure pushs emu to the limits nice!!

Malevolent 04-23-2002 01:12 PM

This might be considered authentic verant. I turned in jboots and got a bronze claymore. Dah. :P

Rewards snippet -- replace the obvious below with this update. Also may need

client_process.cpp
Code:

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_Emotey, "%s looks oddly at what you just handed them.'", tmp->GetName());
                                                                                }
                                                                                CheckQuests(zone->GetShortName(), "%%item%%", tmp->CastToNPC()->GetNPCTypeID(), TradeList[0]);

                                                                        }

npc.cpp::process

Code:

        if (this->MerchantType>0)
                if (rand()%650==2){
                        uint32 someitem = rand()%32531;
                        Item_Struct* item = database.GetItem(someitem);
                       
                        if (item->name!=0)
                        if (rand()%2==0) {
                               
                                entity_list.Message(0,MT_Auction, "%s auctions, 'WTS %s'", GetName(), item->name);

                        } else {
                                this->SetItemRequested(someitem);
                                entity_list.Message(0,MT_Auction, "%s auctions, 'WTT %s'", GetName(), item->name);
                        }
                        //else WTB
                }



All times are GMT -4. The time now is 06:12 AM.

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.