Jump to content

NPC Creation in core


Recommended Posts

Posted

Hello,

I wanted to make a NPC to complete bugged quests but I didn't discovered a useful way to program because... for example I want to make a NPC in all main towns like this: (pseudo code)

map,x,y,face,npc name,view id,{
// Once we click the npc, executing this...
msg "Hello I can make all yours bugged quest";
switch (faction) {
   case Alliance:
       switch (Class) {
           case Paladin:
               switch (select("Mission 1:Mission 2")) {
                   case 1:
                       if (Mission1)
                           msg "This mission is already done.";
                       else {
                           // Give all mission1 reward
                           Mission1 = 1; // Mission done
                       }
                       break;

                   case 2:
                       if (Mission2)
                           msg "This mission is already done.";
                       else {
                           // Give all mission2 reward
                           Mission2 = 1; // Mission done
                       }
                       break;
               }
               break;

           case ...:
               break;
       }
       break;

   case Horde:
       switch (Class) {
           case Paladin:
               break;

           case ...:
               break;
       }
}
end;
}
// Duplicating NPCs in other towns/maps
duplicate (npc name) map,x,y,face,viewid

This is an example what I want to do, but I didn't know where to post if in scriptdev2 or udb whatever, I decided to post here because is the main core to start programming...

Posted
I want a NPC that you talk with him and check active quests, if those active quests are bugged (defined in the NPC) the character can complete there and give all reward...

Heres an example script using the function Player::CompleteQuest(). I didnt test the script and don't expect it to work

#define GOSSIP_COMPLETESOMEQUEST "Complete some quest"
#define GOSSIP_COMPLETESOMEOTHERQUEST "Complete some other quest"

#define QUEST1      quest_id
#define QUEST2      quest_id
bool GossipHello_quest_fixer(Player* pPlayer, Creature* pCreature)
{
   pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_COMPLETESOMEQUEST            , GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
   pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_COMPLETESOMEOTHERQUEST            , GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2);
   pPlayer->SEND_GOSSIP_MENU(1, pCreature->GetGUID());
   return true;
}

void SendDefaultMenu_quest_fixer(Player* pPlayer, Creature* pCreature, uint32 uiAction)
{
   switch(uiAction)
   {
       case GOSSIP_ACTION_INFO_DEF + 1:                   
           pPlayer->CompleteQuest(QUEST_1);
           break;
       case GOSSIP_ACTION_INFO_DEF + 2:                 
           pPlayer->CompleteQuest(QUEST_2);
           break;
   }
}

bool GossipSelect_quest_fixer(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction)
{
   switch (uiSender)
   {
       case GOSSIP_SENDER_MAIN:            SendDefaultMenu_quest_fixer(pPlayer, pCreature, uiAction); break;
   }
   return true;
}

CreatureAI* GetAI_quest_fixer(Creature* pCreature)
{
   return new creatureAI(pCreature);
}

void AddSC_quest_npc()
{
   Script *newscript;

   newscript = new Script;
   newscript->Name = "quest_fixer";
   newscript->pGossipHello          = &GossipHello_quest_fixer;
   newscript->pGossipSelect         = &GossipSelect_quest_fixer;
   newscript->GetAI = &GetAI_quest_fixer;
   newscript->RegisterSelf();
}

Posted

wouldn't it be easier to check what quests are broken yourself and then remove the quests and add new ones that are completable with the same rewards.. or make a npc who holds all these quests..If you just want a more instant reward then have the npc give you something like a book that you just give back to him to complete. I know you wanna code it so the npc can auto figure out which ones are broken but i have no clue how you plan to do that without coding in all the broken quests yourself which to me seems a little pointless. but for the same effect some simple db editing should do the trick. :D

EDIT: also with this method you won't ever be accepting the broken quests. I'd rather not get the broken quest then get it then find out its broken then walk/ride to a city to get my reward.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use