EOSERV Forum > EO Server Building > Better NPC/Pet Interaction Idea
Page: << 1 >>
Better NPC/Pet Interaction Idea
Author Message
Post #201451 Better NPC/Pet Interaction Idea

So I've made a couple servers where I had the idea of players finding NPC's on the way of their journeys, and if click the right answers, the NPC will "like them" and then follow them like a pet, and basically become their "friend". The NPC would follow them around and defend them/attack enemies until they are at a certain point of a quest, is this possible? it would also be cool if dialogs could somehow pop up at a certain state, without you even clicking the NPC. 

7 years, 24 weeks ago
Post #201455 Re: Better NPC/Pet Interaction Idea

It certainly is yeah, I've been doing some work recently for the Forbidden Realm server and the pet system they'll have will someday allow players to go out and "tame" wild npcs if they want. I believe Ryouken has done something similar to this aswell.

7 years, 24 weeks ago
Post #201456 Re: Better NPC/Pet Interaction Idea

Ya ryou Has a great system where you have a chance on any kill to gain that monster as a pet..How ever his rev is very old :(

7 years, 24 weeks ago
Post #201458 Re: Better NPC/Pet Interaction Idea

Its seems like most of that can be completed with manipulation of the quest sytem and few variables. This is how I use the quest for pets

void Quest_Use(Character *character, PacketReader &reader)
{
    short npc_index = reader.GetShort();
    short quest_id = reader.GetShort();

    UTIL_FOREACH(character->map->npcs, npc)
    {
        if (npc->index == npc_index && npc->ENF().type == ENF::Quest && character->InRange(npc))
        {
            if(npc->owner && npc->owner->pet && npc->owner->pet->index == npc_index)
            {
                character->PetFunctions(npc);
                return;
            }

            // The rest of the original quest_use here


and then I have an enum Character TempQuest to switch states

// Response to an NPC dialog
void Quest_Accept(Character *character, PacketReader &reader)
{
    /*short session = */reader.GetShort();
    /*short dialog_id = */reader.GetShort();
    short quest_id = reader.GetShort();
    /*short npc_index = */reader.GetShort();
    DialogReply type = DialogReply(reader.GetChar());

    char action = 0;

    if (type == DIALOG_REPLY_LINK)
        action = reader.GetChar();

    if(character->tempquest == TempQuest::PetFunction1)
    {

         if(action == 1) // View Bank
        {

        //do stuff

        }

        else if(action == 2) // Heal
        {

        //do stuff

        }


    }

    else  if(character->tempquest == TempQuest::PetFunction2)
    {

        if(action == 1) // do stuff
        {

        //do stuff

        }

        else if(action == 2) // do stuff
        {

        //do stuff

        }  
    else
   {
    // The original quest_accept function
   }
  
you also need to make your pets a quest type so basicly in your eodata.cpp file edit the enf_data
if(newdata.type == ENF::Pet)
        newdata.type = ENF::Quest;

thats a good start anyway :D
7 years, 24 weeks ago
Post #201459 Re: Better NPC/Pet Interaction Idea
insomniac posted: (15th Nov 2016, 02:00 am)

Its seems like most of that can be completed with manipulation of the quest sytem and few variables. This is how I use the quest for pets

void Quest_Use(Character *character, PacketReader &reader)
{
    short npc_index = reader.GetShort();
    short quest_id = reader.GetShort();

    UTIL_FOREACH(character->map->npcs, npc)
    {
        if (npc->index == npc_index && npc->ENF().type == ENF::Quest && character->InRange(npc))
        {
            if(npc->owner && npc->owner->pet && npc->owner->pet->index == npc_index)
            {
                character->PetFunctions(npc);
                return;
            }

            // The rest of the original quest_use here


and then I have an enum Character TempQuest to switch states

// Response to an NPC dialog
void Quest_Accept(Character *character, PacketReader &reader)
{
    /*short session = */reader.GetShort();
    /*short dialog_id = */reader.GetShort();
    short quest_id = reader.GetShort();
    /*short npc_index = */reader.GetShort();
    DialogReply type = DialogReply(reader.GetChar());

    char action = 0;

    if (type == DIALOG_REPLY_LINK)
        action = reader.GetChar();

    if(character->tempquest == TempQuest::PetFunction1)
    {

         if(action == 1) // View Bank
        {

        //do stuff

        }

        else if(action == 2) // Heal
        {

        //do stuff

        }


    }

    else  if(character->tempquest == TempQuest::PetFunction2)
    {

        if(action == 1) // do stuff
        {

        //do stuff

        }

        else if(action == 2) // do stuff
        {

        //do stuff

        }  
    else
   {
    // The original quest_accept function
   }
  
you also need to make your pets a quest type so basicly in your eodata.cpp file edit the enf_data
if(newdata.type == ENF::Pet)
        newdata.type = ENF::Quest;

thats a good start anyway :D

I've done something similar. For simplicity in the packet handlers, I internalize almost everything to the character function - instead of just having it display options it will also handle inputs.

The internal pet type is also handled a little differently to differentiate it from other quest NPCs without a boolean.

---
Want to learn to pixel?
Pixelsource.org
7 years, 24 weeks ago
Post #201464 Re: Better NPC/Pet Interaction Idea
Cirras posted: (15th Nov 2016, 05:58 am)

insomniac posted: (15th Nov 2016, 02:00 am)

Its seems like most of that can be completed with manipulation of the quest sytem and few variables. This is how I use the quest for pets

void Quest_Use(Character *character, PacketReader &reader)
{
    short npc_index = reader.GetShort();
    short quest_id = reader.GetShort();

    UTIL_FOREACH(character->map->npcs, npc)
    {
        if (npc->index == npc_index && npc->ENF().type == ENF::Quest && character->InRange(npc))
        {
            if(npc->owner && npc->owner->pet && npc->owner->pet->index == npc_index)
            {
                character->PetFunctions(npc);
                return;
            }

            // The rest of the original quest_use here


and then I have an enum Character TempQuest to switch states

// Response to an NPC dialog
void Quest_Accept(Character *character, PacketReader &reader)
{
    /*short session = */reader.GetShort();
    /*short dialog_id = */reader.GetShort();
    short quest_id = reader.GetShort();
    /*short npc_index = */reader.GetShort();
    DialogReply type = DialogReply(reader.GetChar());

    char action = 0;

    if (type == DIALOG_REPLY_LINK)
        action = reader.GetChar();

    if(character->tempquest == TempQuest::PetFunction1)
    {

         if(action == 1) // View Bank
        {

        //do stuff

        }

        else if(action == 2) // Heal
        {

        //do stuff

        }


    }

    else  if(character->tempquest == TempQuest::PetFunction2)
    {

        if(action == 1) // do stuff
        {

        //do stuff

        }

        else if(action == 2) // do stuff
        {

        //do stuff

        }  
    else
   {
    // The original quest_accept function
   }
  
you also need to make your pets a quest type so basicly in your eodata.cpp file edit the enf_data
if(newdata.type == ENF::Pet)
        newdata.type = ENF::Quest;

thats a good start anyway :D

I've done something similar. For simplicity in the packet handlers, I internalize almost everything to the character function - instead of just having it display options it will also handle inputs.

The internal pet type is also handled a little differently to differentiate it from other quest NPCs without a boolean.


Yes sir when you created the pet dialogs on BU I was like damn thats clean also switching the bool temp_quest to an enum was very effecient for manipulating the quest system and switching states in temp_quests.
7 years, 24 weeks ago
Page: << 1 >>

EOSERV Forum > EO Server Building > Better NPC/Pet Interaction Idea