• 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++ Skull near monster if isSagaMonster()

GhostWD

I'm in love with the var_dump()
Joined
Jan 25, 2009
Messages
185
Solutions
6
Reaction score
29
Hi
I wanted to change protocolgame.cpp near
C++:
    msg->put<char>(player->getSkullType(creature));
To :
C++:
if(creature->getMonster()->isSagaMonster()){
    msg->put<char>(SKULL_YELLOW);
}else{
    msg->put<char>(player->getSkullType(creature));
}
but when i run OT i get Segmentation fault no errors while compiling someone could help me with that? i tried with isHostile etc and same ;/
TFS 0.4
 
Solution
try
C++:
if(creature && creature->getMonster() && creature->getMonster()->isSagaMonster()){
    msg->put<char>(SKULL_YELLOW);
}else{
    msg->put<char>(player->getSkullType(creature));
}
try
C++:
if(creature && creature->getMonster() && creature->getMonster()->isSagaMonster()){
    msg->put<char>(SKULL_YELLOW);
}else{
    msg->put<char>(player->getSkullType(creature));
}
 
Solution
lol it's working! hah thanks. Could you explain why i cant use creature->getMonster()->isSagaMonster() immediately? would be awsome!
 
the function cant do an action on empty object (nullptr)

After it checks if its sagamonster, firstly it checks if creature object exists and then check if its monster. It those are true, then it proceeds to do an action

I suppose your code somehow works on large group of things, and it went on not permitted addresses since not every thing is creature/monster
 
yea i had it in combat.cpp and i was wondering wth is wrong with this! Thank You.
 
Back
Top