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

setCreatureName and getCreatureName

aberos

New Member
Joined
Feb 26, 2014
Messages
17
Reaction score
0
I wonder how do I getCreatureName read the true name of the creature whenever setcreaturename use the function that changes the name of the creature? getCreatureName reading this because the modified real name and not name

Here the function I use:

int32_t LuaScriptInterface::luaDoCreatureSetNick(lua_State* L)
{
//doCreatureSetNick(cid, newName)
std::string newName = popString(L);
ScriptEnviroment* env = getEnv();
Creature* creature;
if(creature = env->getCreatureByUID(popNumber(L))){
Monster* monster = (Monster*)creature;
monster->name = newName;
lua_pushboolean(L, true);
}
else{
errorEx(getError(LUA_ERROR_CREATURE_NOT_FOUND));
lua_pushboolean(L, false);
}
return 1;
}


here getCreatureName

int32_t LuaScriptInterface::luaGetCreatureName(lua_State* L)
{
//getCreatureName(cid)
ScriptEnviroment* env = getEnv();
if(Creature* creature = env->getCreatureByUID(popNumber(L)))
lua_pushstring(L, creature->getName().c_str());
else
{
errorEx(getError(LUA_ERROR_CREATURE_NOT_FOUND));
lua_pushboolean(L, false);
}

return 1;
}
 
Last edited:

Similar threads

Replies
2
Views
556
Back
Top