Jump to content

Pet system (name)


Recommended Posts

Hey everyone.

void CPetActor::SetName(const char* name)
{
    std::string petName = m_pkOwner->GetName();
 
    if (0 != m_pkOwner && 
        0 == name && 
        0 != m_pkOwner->GetName())
    {
        petName += "'s Pet";
    }
    else
        petName += name;
 
    if (true == IsSummoned())
        m_pkChar->SetName(petName);
 
    m_name = petName;
}

I wanna change the pet name which we can see ingame.

Now: [sA]xy's Pet.

I want to put a mysql_query function that looks like:

mysql_query("SELECT pet_name from player.player WHERE name='"..pc.get_name().."' LIMIT 1")

 

So if i change the pet_name in the player table, ingame the pet name is gonna be same.

 

Can anyone help me how to write it?

 

Sorry for bad english!  :(

 

 

Link to comment
Share on other sites

if (ch->pet_name == true)

{

std::string petName = "";

}

 

open char.h
add bool            pet_name

 

add questpet.lua
 

int _pet_name(lua_StateL)
{
    
LPCHARACTER ch CQuestManager::instance().GetCurrentCharacterPtr();
    
ch->pet_name true;
    return 
0;
}

 

when itemname.use begin

pc.pet_name()

end

end

 

 

Link to comment
Share on other sites

Make the SetName function looks like this:

void CPetActor::SetName(const char* name)
{
    std::string petName = m_pkOwner->GetName();
  
    if (0 != m_pkOwner &&
        0 == name &&
        0 != m_pkOwner->GetName())
    {
        petName += "";
    }
    else
        petName += name;
  
    if (true == IsSummoned())
        m_pkChar->SetName(petName);
  
    m_name = petName;
}

then at your quest:

local name = mysql_query("SELECT pet_name from player.player WHERE name='"..pc.get_name().."' LIMIT 1")
pet.summon(petVnum,pc.get_name().."'s "..name.pet_name[1],false)
  • Love 2
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / 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.