• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

C++ Red name when get red skull

Helliot1

Owner of Empire Online
Joined
Jul 26, 2017
Messages
315
Solutions
1
Reaction score
58
Hello everyone,

I was looking on OTClient Sources to edit my red skull, i want change it for a Red name without the skull, anyone can help me ?

I found this, and I think need change setSkullTexture, its right?

Creature.cpp
C++:
}

void Creature::setSkull(uint8 skull)
{
    m_skull = skull;
    callLuaField("onSkullChange", m_skull);
}

void Creature::setShield(uint8 shield)
{
    m_shield = shield;
    callLuaField("onShieldChange", m_shield);
}

void Creature::setEmblem(uint8 emblem)
{
    m_emblem = emblem;
    callLuaField("onEmblemChange", m_emblem);
}

void Creature::setIcon(uint8 icon)
{
    m_icon = icon;
    callLuaField("onIconChange", m_icon);
}

void Creature::setSkullTexture(const std::string& filename)
{
    m_skullTexture = g_textures.getTexture(filename);
}
 
Last edited:
Solution
Thanks @Summ Now it's perfectly :)

I have another question, when I have the Red Name, or when I'm in party and have blue name, with 100% life It's okay. But when somebody hit me, the color comeback to normal, how I can fix it ? I tried some things and can't fix it :(

creature.cpp

C++:
    if (drawFlags & Otc::DrawNames) {
        if (m_skull == Otc::SkullRed && isPlayer() && m_healthPercent >= 100)
            g_painter->setColor(Color(0xDC, 0xC8, 0x46));
        else if (g_painter->getColor() != fillColor)
            g_painter->setColor(fillColor);
        m_nameCache.draw(textRect);

        if (m_shield == Otc::ShieldBlue && isPlayer() && m_healthPercent >= 100)
            m_informationColor = Color(0x4D, 0xAC, 0xB8)...
Hello everyone,

I was looking on OTClient Sources to edit my red skull, i want change it for a Red name without the skull, anyone can help me ?

I found this, and I think need change setSkullTexture, its right?

Creature.cpp
C++:
}

void Creature::setSkull(uint8 skull)
{
    m_skull = skull;
    callLuaField("onSkullChange", m_skull);
}

void Creature::setShield(uint8 shield)
{
    m_shield = shield;
    callLuaField("onShieldChange", m_shield);
}

void Creature::setEmblem(uint8 emblem)
{
    m_emblem = emblem;
    callLuaField("onEmblemChange", m_emblem);
}

void Creature::setIcon(uint8 icon)
{
    m_icon = icon;
    callLuaField("onIconChange", m_icon);
}

void Creature::setSkullTexture(const std::string& filename)
{
    m_skullTexture = g_textures.getTexture(filename);
}

You could most likely edit Creature:.setSkull insted.
C++:
if (skull == ??) {
     // change name
} else {
    m_skull = skull;
    callLuaField("onSkullChange", m_skull);
}
 
You could most likely edit Creature:.setSkull insted.
C++:
if (skull == ??) {
     // change name
} else {
    m_skull = skull;
    callLuaField("onSkullChange", m_skull);
}

Like this ?

C++:
void Creature::setSkull(uint8 skull)   

    if (skull = Red) {
        m_informationColor = Color(0xDC, 0xC8, 0x46);
    }
    else {
        m_skull = skull;
        callLuaField("onSkullChange", m_skull);
}
 
Like this ?

C++:
void Creature::setSkull(uint8 skull) 

    if (skull = Red) {
        m_informationColor = Color(0xDC, 0xC8, 0x46);
    }
    else {
        m_skull = skull;
        callLuaField("onSkullChange", m_skull);
}

Lua:
void Creature::setSkull(uint8 skull)
{
    if (skull == Otc::SkullRed) {
        m_informationColor = Color(0xDC, 0xC8, 0x46);
    } else {
        m_skull = skull;
        callLuaField("onSkullChange", m_skull);
    }
}
 
Lua:
void Creature::setSkull(uint8 skull)
{
    if (skull == Otc::SkullRed) {
        m_informationColor = Color(0xDC, 0xC8, 0x46);
    } else {
        m_skull = skull;
        callLuaField("onSkullChange", m_skull);
    }
}

Thanks bro!! Now it works :)

Lua:
void Creature::setSkull(uint8 skull)
{
    if (skull == Otc::SkullRed) {
        m_informationColor = Color(0xDC, 0xC8, 0x46);
    } else {
        m_skull = skull;
        callLuaField("onSkullChange", m_skull);
    }
}

Do you know why everytime my Life change , my red name leave?
I think need put a
C++:
if(healthPercent > 100)
and later the informationColor in this formula, But i don't know how I put it
 
Last edited by a moderator:
Do you know why everytime my Life change , my red name leave?
I think need put a
C++:
if(healthPercent > 100)
and later the informationColor in this formula, But i don't know how I put it

Because there is code for that, so you can see how much you have etc
Do a serach for m_informationColor and see what you come up with.

It's either coded in some module (Lua) or hard coded in C++.
 
creature.cpp

Search for
Code:
    if(drawFlags & Otc::DrawNames) {

replace the block with:
Code:
    if(drawFlags & Otc::DrawNames) {
        if(m_skull == Otc::SkullRed && isPlayer())
            g_painter->setColor(Color(0xDC, 0xC8, 0x46));
        else if(g_painter->getColor() != fillColor)
            g_painter->setColor(fillColor);

        m_nameCache.draw(textRect);
    }
 
Thanks @Summ Now it's perfectly :)

I have another question, when I have the Red Name, or when I'm in party and have blue name, with 100% life It's okay. But when somebody hit me, the color comeback to normal, how I can fix it ? I tried some things and can't fix it :(

creature.cpp

C++:
    if (drawFlags & Otc::DrawNames) {
        if (m_skull == Otc::SkullRed && isPlayer() && m_healthPercent >= 100)
            g_painter->setColor(Color(0xDC, 0xC8, 0x46));
        else if (g_painter->getColor() != fillColor)
            g_painter->setColor(fillColor);
        m_nameCache.draw(textRect);

        if (m_shield == Otc::ShieldBlue && isPlayer() && m_healthPercent >= 100)
            m_informationColor = Color(0x4D, 0xAC, 0xB8);
        else if (g_painter->getColor() != fillColor)
            g_painter->setColor(fillColor);
        m_nameCache.draw(textRect);

        if (m_shield == Otc::ShieldYellow && isPlayer() && m_healthPercent >= 100)
            m_informationColor = Color(0x4D, 0xAC, 0xB8);
        else if (g_painter->getColor() != fillColor)
            g_painter->setColor(fillColor);
        m_nameCache.draw(textRect);
    }
C++:
void Creature::setHealthPercent(uint8 healthPercent)
{
    if (m_skull == Otc::SkullRed && m_healthPercent <= 100)
        g_painter->setColor(Color(0xDC, 0xC8, 0x46));
    else if(m_skull == Otc::ShieldBlue && m_healthPercent <= 100)
        g_painter->setColor(Color(0x4D, 0xAC, 0xB8));
    else if (m_skull == Otc::ShieldYellow && m_healthPercent <= 100)
        g_painter->setColor(Color(0x4D, 0xAC, 0xB8));
    else if(healthPercent >= 100)
        m_informationColor = Color(0xDC, 0xC8, 0x46);
    else if(healthPercent > 60)
        m_informationColor = Color(0xDC, 0xB6, 0x3F);
    else if(healthPercent > 30)
        m_informationColor = Color(0xDC, 0x94, 0x33);
    else if(healthPercent > 8)
        m_informationColor = Color(0xDC, 0x5A, 0x1F);
    else if(healthPercent > 3)
        m_informationColor = Color(0xDC, 0x4C, 0x1A);
    else
        m_informationColor = Color(0xDC, 0x2E, 0x10);

    m_healthPercent = healthPercent;
    callLuaField("onHealthPercentChange", healthPercent);

    if(healthPercent <= 0)
        onDeath();
}

Bump

Bump
 
Last edited by a moderator:
Thanks @Summ Now it's perfectly :)

I have another question, when I have the Red Name, or when I'm in party and have blue name, with 100% life It's okay. But when somebody hit me, the color comeback to normal, how I can fix it ? I tried some things and can't fix it :(

creature.cpp

C++:
    if (drawFlags & Otc::DrawNames) {
        if (m_skull == Otc::SkullRed && isPlayer() && m_healthPercent >= 100)
            g_painter->setColor(Color(0xDC, 0xC8, 0x46));
        else if (g_painter->getColor() != fillColor)
            g_painter->setColor(fillColor);
        m_nameCache.draw(textRect);

        if (m_shield == Otc::ShieldBlue && isPlayer() && m_healthPercent >= 100)
            m_informationColor = Color(0x4D, 0xAC, 0xB8);
        else if (g_painter->getColor() != fillColor)
            g_painter->setColor(fillColor);
        m_nameCache.draw(textRect);

        if (m_shield == Otc::ShieldYellow && isPlayer() && m_healthPercent >= 100)
            m_informationColor = Color(0x4D, 0xAC, 0xB8);
        else if (g_painter->getColor() != fillColor)
            g_painter->setColor(fillColor);
        m_nameCache.draw(textRect);
    }
C++:
void Creature::setHealthPercent(uint8 healthPercent)
{
    if (m_skull == Otc::SkullRed && m_healthPercent <= 100)
        g_painter->setColor(Color(0xDC, 0xC8, 0x46));
    else if(m_skull == Otc::ShieldBlue && m_healthPercent <= 100)
        g_painter->setColor(Color(0x4D, 0xAC, 0xB8));
    else if (m_skull == Otc::ShieldYellow && m_healthPercent <= 100)
        g_painter->setColor(Color(0x4D, 0xAC, 0xB8));
    else if(healthPercent >= 100)
        m_informationColor = Color(0xDC, 0xC8, 0x46);
    else if(healthPercent > 60)
        m_informationColor = Color(0xDC, 0xB6, 0x3F);
    else if(healthPercent > 30)
        m_informationColor = Color(0xDC, 0x94, 0x33);
    else if(healthPercent > 8)
        m_informationColor = Color(0xDC, 0x5A, 0x1F);
    else if(healthPercent > 3)
        m_informationColor = Color(0xDC, 0x4C, 0x1A);
    else
        m_informationColor = Color(0xDC, 0x2E, 0x10);

    m_healthPercent = healthPercent;
    callLuaField("onHealthPercentChange", healthPercent);

    if(healthPercent <= 0)
        onDeath();
}

Bump

Bump

Try to remove this;
Lua:
    if (m_skull == Otc::SkullRed && m_healthPercent <= 100)
        g_painter->setColor(Color(0xDC, 0xC8, 0x46));
    else if(m_skull == Otc::ShieldBlue && m_healthPercent <= 100)
        g_painter->setColor(Color(0x4D, 0xAC, 0xB8));
    else if (m_skull == Otc::ShieldYellow && m_healthPercent <= 100)
        g_painter->setColor(Color(0x4D, 0xAC, 0xB8));
    else if(healthPercent >= 100)
        m_informationColor = Color(0xDC, 0xC8, 0x46);
    else if(healthPercent > 60)
        m_informationColor = Color(0xDC, 0xB6, 0x3F);
    else if(healthPercent > 30)
        m_informationColor = Color(0xDC, 0x94, 0x33);
    else if(healthPercent > 8)
        m_informationColor = Color(0xDC, 0x5A, 0x1F);
    else if(healthPercent > 3)
        m_informationColor = Color(0xDC, 0x4C, 0x1A);
    else
        m_informationColor = Color(0xDC, 0x2E, 0x10);

Then it won't change the color when health changes.
 
Solution
Thanks @Summ Now it's perfectly :)

I have another question, when I have the Red Name, or when I'm in party and have blue name, with 100% life It's okay. But when somebody hit me, the color comeback to normal, how I can fix it ? I tried some things and can't fix it :(

creature.cpp

C++:
    if (drawFlags & Otc::DrawNames) {
        if (m_skull == Otc::SkullRed && isPlayer() && m_healthPercent >= 100)
            g_painter->setColor(Color(0xDC, 0xC8, 0x46));
        else if (g_painter->getColor() != fillColor)
            g_painter->setColor(fillColor);
        m_nameCache.draw(textRect);

        if (m_shield == Otc::ShieldBlue && isPlayer() && m_healthPercent >= 100)
            m_informationColor = Color(0x4D, 0xAC, 0xB8);
        else if (g_painter->getColor() != fillColor)
            g_painter->setColor(fillColor);
        m_nameCache.draw(textRect);

        if (m_shield == Otc::ShieldYellow && isPlayer() && m_healthPercent >= 100)
            m_informationColor = Color(0x4D, 0xAC, 0xB8);
        else if (g_painter->getColor() != fillColor)
            g_painter->setColor(fillColor);
        m_nameCache.draw(textRect);
    }
C++:
void Creature::setHealthPercent(uint8 healthPercent)
{
    if (m_skull == Otc::SkullRed && m_healthPercent <= 100)
        g_painter->setColor(Color(0xDC, 0xC8, 0x46));
    else if(m_skull == Otc::ShieldBlue && m_healthPercent <= 100)
        g_painter->setColor(Color(0x4D, 0xAC, 0xB8));
    else if (m_skull == Otc::ShieldYellow && m_healthPercent <= 100)
        g_painter->setColor(Color(0x4D, 0xAC, 0xB8));
    else if(healthPercent >= 100)
        m_informationColor = Color(0xDC, 0xC8, 0x46);
    else if(healthPercent > 60)
        m_informationColor = Color(0xDC, 0xB6, 0x3F);
    else if(healthPercent > 30)
        m_informationColor = Color(0xDC, 0x94, 0x33);
    else if(healthPercent > 8)
        m_informationColor = Color(0xDC, 0x5A, 0x1F);
    else if(healthPercent > 3)
        m_informationColor = Color(0xDC, 0x4C, 0x1A);
    else
        m_informationColor = Color(0xDC, 0x2E, 0x10);

    m_healthPercent = healthPercent;
    callLuaField("onHealthPercentChange", healthPercent);

    if(healthPercent <= 0)
        onDeath();
}

Bump

Bump


Try this

C++:
void Creature::setHealthPercent(uint8 healthPercent)
{
    if (m_skull == Otc::SkullRed)
        m_informationColor = Color(0xDC, 0xC8, 0x46);
    else if(m_skull == Otc::ShieldBlue)
        m_informationColor = Color(0x4D, 0xAC, 0xB8);
    else if (m_skull == Otc::ShieldYellow)
        m_informationColor = Color(0x4D, 0xAC, 0xB8);
    else if(healthPercent >= 100)
        m_informationColor = Color(0xDC, 0xC8, 0x46);
    else if(healthPercent > 60)
        m_informationColor = Color(0xDC, 0xB6, 0x3F);
    else if(healthPercent > 30)
        m_informationColor = Color(0xDC, 0x94, 0x33);
    else if(healthPercent > 8)
        m_informationColor = Color(0xDC, 0x5A, 0x1F);
    else if(healthPercent > 3)
        m_informationColor = Color(0xDC, 0x4C, 0x1A);
    else
        m_informationColor = Color(0xDC, 0x2E, 0x10);

    m_healthPercent = healthPercent;
    callLuaField("onHealthPercentChange", healthPercent);

    if(healthPercent <= 0)
        onDeath();
}
 
Try this

C++:
void Creature::setHealthPercent(uint8 healthPercent)
{
    if (m_skull == Otc::SkullRed)
        m_informationColor = Color(0xDC, 0xC8, 0x46);
    else if(m_skull == Otc::ShieldBlue)
        m_informationColor = Color(0x4D, 0xAC, 0xB8);
    else if (m_skull == Otc::ShieldYellow)
        m_informationColor = Color(0x4D, 0xAC, 0xB8);
    else if(healthPercent >= 100)
        m_informationColor = Color(0xDC, 0xC8, 0x46);
    else if(healthPercent > 60)
        m_informationColor = Color(0xDC, 0xB6, 0x3F);
    else if(healthPercent > 30)
        m_informationColor = Color(0xDC, 0x94, 0x33);
    else if(healthPercent > 8)
        m_informationColor = Color(0xDC, 0x5A, 0x1F);
    else if(healthPercent > 3)
        m_informationColor = Color(0xDC, 0x4C, 0x1A);
    else
        m_informationColor = Color(0xDC, 0x2E, 0x10);

    m_healthPercent = healthPercent;
    callLuaField("onHealthPercentChange", healthPercent);

    if(healthPercent <= 0)
        onDeath();
}

This don't works bro :(, when my life goes down, the red name, and blue name leave. But thanks for helping!!!

Try to remove this;
Lua:
    if (m_skull == Otc::SkullRed && m_healthPercent <= 100)
        g_painter->setColor(Color(0xDC, 0xC8, 0x46));
    else if(m_skull == Otc::ShieldBlue && m_healthPercent <= 100)
        g_painter->setColor(Color(0x4D, 0xAC, 0xB8));
    else if (m_skull == Otc::ShieldYellow && m_healthPercent <= 100)
        g_painter->setColor(Color(0x4D, 0xAC, 0xB8));
    else if(healthPercent >= 100)
        m_informationColor = Color(0xDC, 0xC8, 0x46);
    else if(healthPercent > 60)
        m_informationColor = Color(0xDC, 0xB6, 0x3F);
    else if(healthPercent > 30)
        m_informationColor = Color(0xDC, 0x94, 0x33);
    else if(healthPercent > 8)
        m_informationColor = Color(0xDC, 0x5A, 0x1F);
    else if(healthPercent > 3)
        m_informationColor = Color(0xDC, 0x4C, 0x1A);
    else
        m_informationColor = Color(0xDC, 0x2E, 0x10);

Then it won't change the color when health changes.

Thanks WibbenZ!! I tried a lot of times and any attempt mine don't showed results. But when I remove this part of script, it worked!! The only question that I have now its how I can change the name color (when I have no party and no pk red) without this script that I removed ?
 
This don't works bro :(, when my life goes down, the red name, and blue name leave. But thanks for helping!!!



Thanks WibbenZ!! I tried a lot of times and any attempt mine don't showed results. But when I remove this part of script, it worked!! The only question that I have now its how I can change the name color (when I have no party and no pk red) without this script that I removed ?

Not sure, but if you use the serach function on github; Search · setHealthPercent · GitHub
You can see where these functions are used.

In those you have to check (or in the function w/e you wanna do) if the player is in a party or not, if it isn't you can set a certain color.
 
Back
Top