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

OTClient.exe file doesn't work

Oskar1121

Excellent OT User
Joined
Jul 15, 2009
Messages
634
Reaction score
537
Location
Poland
I compiled otclient source into CodeBlocks:
2lcmcf4.png

And when I try to open the client I've an error and client crashed:
f0rupz.png


I've 'Relased' CMake type and client have ~7Mb
 
But otclient_dx9.exe be a file from download, not compiled in CodeBlocks. If you know what I mean.

#edit
SS with CMake:
b85wkj.jpg
 
Last edited:
But otclient_dx9.exe be a file from download, not compiled in CodeBlocks. If you know what I mean.

#edit
SS with CMake:
b85wkj.jpg

On cmake, find "OPENGLES" and change to 2.0

Click on generate, then recompile your client and try xD
 
Ok, Client works, but now don't read a tibia.dat:
1jug6t.jpg


I've original tibia.spr and tibia.dat files
 
Looks like you're using a pretty old otclient version o0
Now the .dat and .spr are stored into data/things/version xD

Well, i'll try to help you using THAT version, but i would suggest you to download and compile a newer version from the rep.

First: the Tibia.dat and Tibia.spr are inside /modules/game_tibiafiles/854/ ?

If they are, please paste here any .lua file on game_tibiafiles folder
 
Yes, you're right. Thanks you ^^
But I've next question. I've protocolgameparse.cpp into client source and function:
PHP:
CreaturePtr ProtocolGame::getCreature(const InputMessagePtr& msg, int type) 
{ 
    if(type == 0) 
        type = msg->getU16(); 

    CreaturePtr creature; 
    bool known = (type != Proto::UnknownCreature); 

    if(type == Proto::OutdatedCreature || type == Proto::UnknownCreature) { 
        if(known) { 
            uint id = msg->getU32(); 
            creature = g_map.getCreatureById(id); 
            if(!creature) 
                g_logger.traceError("server said that a creature is known, but it's not"); 
        } else { 
            uint removeId = msg->getU32(); 
            g_map.removeCreatureById(removeId); 

            uint id = msg->getU32(); 

            int creatureType; 
            if(g_game.getProtocolVersion() >= 910) 
                creatureType = msg->getU8(); 
            else { 
                if(id >= Proto::PlayerStartId && id < Proto::PlayerEndId) 
                    creatureType = Proto::CreatureTypePlayer; 
                else if(id >= Proto::MonsterStartId && id < Proto::MonsterEndId) 
                    creatureType = Proto::CreatureTypeMonster; 
                else 
                    creatureType = Proto::CreatureTypeNpc; 
            } 

            std::string name = g_game.formatCreatureName(msg->getString()); 

            if(id == m_localPlayer->getId()) 
                creature = m_localPlayer; 
            else if(creatureType == Proto::CreatureTypePlayer) { 
                // fixes a bug server side bug where GameInit is not sent and local player id is unknown 
                if(m_localPlayer->getId() == 0 && name == m_localPlayer->getName()) 
                    creature = m_localPlayer; 
                else 
                    creature = PlayerPtr(new Player); 
            } 
            else if(creatureType == Proto::CreatureTypeMonster) 
                creature = MonsterPtr(new Monster); 
            else if(creatureType == Proto::CreatureTypeNpc) 
                creature = NpcPtr(new Npc); 
            else 
                g_logger.traceError("creature type is invalid"); 

            if(creature) { 
                creature->setId(id); 
                creature->setName(name); 

                g_map.addCreature(creature); 
            } 
        } 

        int healthPercent = msg->getU8(); 
        Otc::Direction direction = (Otc::Direction)msg->getU8(); 
        Outfit outfit = getOutfit(msg); 

        Light light; 
        light.intensity = msg->getU8(); 
        light.color = msg->getU8(); 

        int speed = msg->getU16(); 
        int skull = msg->getU8(); 
        int shield = msg->getU8(); 

        // emblem is sent only when the creature is not known 
        int emblem = -1; 
        bool unpass = true; 

        if(g_game.getFeature(Otc::GameCreatureEmblems) && !known) 
            emblem = msg->getU8(); 

        if(g_game.getProtocolVersion() >= 854) 
            unpass = msg->getU8(); 

        if(creature) { 
            creature->setHealthPercent(healthPercent); 
            creature->setDirection(direction); 
            creature->setOutfit(outfit); 
            creature->setSpeed(speed); 
            creature->setSkull(skull); 
            creature->setShield(shield); 
            creature->setPassable(!unpass); 
            creature->setLight(light); 
            if(emblem != -1) 
                creature->setEmblem(emblem); 

            if(creature == m_localPlayer && !m_localPlayer->isKnown()) 
                m_localPlayer->setKnown(true); 
        } 
    } else if(type == Proto::Creature) { 
        uint id = msg->getU32(); 
        creature = g_map.getCreatureById(id); 

        if(!creature) 
            g_logger.traceError("invalid creature"); 

        Otc::Direction direction = (Otc::Direction)msg->getU8(); 
        if(creature) 
            creature->turn(direction); 

        if(g_game.getProtocolVersion() >= 953) { 
            bool unpass = msg->getU8(); 

            if(creature) 
                creature->setPassable(!unpass); 
        } 

    } else { 
        stdext::throw_exception("invalid creature opcode"); 
    } 

    return creature; 
}
How can I get a mana? Health declaration is here:
PHP:
int healthPercent = msg->getU8();
But I don't know where can I found mana.
 
Yes, you're right. Thanks you ^^
But I've next question. I've protocolgameparse.cpp into client source and function:
PHP:
CreaturePtr ProtocolGame::getCreature(const InputMessagePtr& msg, int type) 
{ 
    if(type == 0) 
        type = msg->getU16(); 

    CreaturePtr creature; 
    bool known = (type != Proto::UnknownCreature); 

    if(type == Proto::OutdatedCreature || type == Proto::UnknownCreature) { 
        if(known) { 
            uint id = msg->getU32(); 
            creature = g_map.getCreatureById(id); 
            if(!creature) 
                g_logger.traceError("server said that a creature is known, but it's not"); 
        } else { 
            uint removeId = msg->getU32(); 
            g_map.removeCreatureById(removeId); 

            uint id = msg->getU32(); 

            int creatureType; 
            if(g_game.getProtocolVersion() >= 910) 
                creatureType = msg->getU8(); 
            else { 
                if(id >= Proto::PlayerStartId && id < Proto::PlayerEndId) 
                    creatureType = Proto::CreatureTypePlayer; 
                else if(id >= Proto::MonsterStartId && id < Proto::MonsterEndId) 
                    creatureType = Proto::CreatureTypeMonster; 
                else 
                    creatureType = Proto::CreatureTypeNpc; 
            } 

            std::string name = g_game.formatCreatureName(msg->getString()); 

            if(id == m_localPlayer->getId()) 
                creature = m_localPlayer; 
            else if(creatureType == Proto::CreatureTypePlayer) { 
                // fixes a bug server side bug where GameInit is not sent and local player id is unknown 
                if(m_localPlayer->getId() == 0 && name == m_localPlayer->getName()) 
                    creature = m_localPlayer; 
                else 
                    creature = PlayerPtr(new Player); 
            } 
            else if(creatureType == Proto::CreatureTypeMonster) 
                creature = MonsterPtr(new Monster); 
            else if(creatureType == Proto::CreatureTypeNpc) 
                creature = NpcPtr(new Npc); 
            else 
                g_logger.traceError("creature type is invalid"); 

            if(creature) { 
                creature->setId(id); 
                creature->setName(name); 

                g_map.addCreature(creature); 
            } 
        } 

        int healthPercent = msg->getU8(); 
        Otc::Direction direction = (Otc::Direction)msg->getU8(); 
        Outfit outfit = getOutfit(msg); 

        Light light; 
        light.intensity = msg->getU8(); 
        light.color = msg->getU8(); 

        int speed = msg->getU16(); 
        int skull = msg->getU8(); 
        int shield = msg->getU8(); 

        // emblem is sent only when the creature is not known 
        int emblem = -1; 
        bool unpass = true; 

        if(g_game.getFeature(Otc::GameCreatureEmblems) && !known) 
            emblem = msg->getU8(); 

        if(g_game.getProtocolVersion() >= 854) 
            unpass = msg->getU8(); 

        if(creature) { 
            creature->setHealthPercent(healthPercent); 
            creature->setDirection(direction); 
            creature->setOutfit(outfit); 
            creature->setSpeed(speed); 
            creature->setSkull(skull); 
            creature->setShield(shield); 
            creature->setPassable(!unpass); 
            creature->setLight(light); 
            if(emblem != -1) 
                creature->setEmblem(emblem); 

            if(creature == m_localPlayer && !m_localPlayer->isKnown()) 
                m_localPlayer->setKnown(true); 
        } 
    } else if(type == Proto::Creature) { 
        uint id = msg->getU32(); 
        creature = g_map.getCreatureById(id); 

        if(!creature) 
            g_logger.traceError("invalid creature"); 

        Otc::Direction direction = (Otc::Direction)msg->getU8(); 
        if(creature) 
            creature->turn(direction); 

        if(g_game.getProtocolVersion() >= 953) { 
            bool unpass = msg->getU8(); 

            if(creature) 
                creature->setPassable(!unpass); 
        } 

    } else { 
        stdext::throw_exception("invalid creature opcode"); 
    } 

    return creature; 
}
How can I get a mana? Health declaration is here:
PHP:
int healthPercent = msg->getU8();
But I don't know where can I found mana.

The health and mana are sent on "parsePlayerStats", check for that!

And you can get them from lua mods/modules by using the XXX->getHealth() and XXX->getMana()

- - - Updated - - -

Same here, tried with this config:
98624102440355798927.png


What error you get, Kuzara?
 
I've wrongs CodeBlocks libs. When I get same folder with CodeBlocks from my friend, then I compiled good.
If you want my CodeBlocks:
Code:
http://speedy*****malware.localhost/Fpbxe/CodeBlocks.rar


#edit
ok, but I need get mana to same at health. I build mana bar, under health bar, and I don't know how can I updated status of this bar.
PHP:
            case Proto::GameServerCreatureHealth:
                parseCreatureHealth(msg);
                break;
What is it?
 
@kuzara, sorry, then i don't know how to help you :S

@Oskar, Didn't understood what you want...

You want to get health percent, like the health percent?

If it is that, simple do that:

function getManaPercent(player)
return ((player:getMana()/player:getMaxMana())*100)
end

and when you want to get the manapercent, use something like:

local manaPercent = getManaPercent(g_game.getLocalPlayer())
 
I would make like this:
Item-hover1.jpg

sh-26.jpg

When invade mouse on the object, then there is a window in which you are a description of the object.
 
I create a new mod into mods folder, but when I try close new window then I'll get an error in console:
Code:
ERROR: ...aryInventory/mercenary_inventory.otui:33: [@onClose]:2: attempt to index global 'mods' (a nil value)
All is correct, but why not found global mods folder?
 
Please, show me the line 33 of mercenary_inventory.otui, and the onClose function on mercenary_inventory.lua
 
PHP:
  @onClose: mods.mercenaryInventory.onMiniWindowClose()

function onMiniWindowClose()
  mercenaryButton:setOn(false)
end

#edit
And I've a new problem. Why, when I added more than four new slot types, my client will crash?
 
Last edited:
Back
Top