Jump to content
  • 0

Pet system (name)


Sephere92

Question

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

3 answers to this question

Recommended Posts

  • 0

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
  • 0

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×
×
  • 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.