craigmabbit 36 Postado Março 11, 2014 Share Postado Março 11, 2014 Alguem podia concertar esse codigo dele porque o nome realmente não aparece Link para o comentário https://xtibia.com/forum/topic/227752-docreatemonsternickmonster-nick-pos/page/2/#findComment-1621855 Compartilhar em outros sites More sharing options...
Nu77 81 Postado Março 11, 2014 Share Postado Março 11, 2014 virtual const std::string& getName() const {return nick;} por virtual const std::string& getName() const {return mType->name;} Link para o comentário https://xtibia.com/forum/topic/227752-docreatemonsternickmonster-nick-pos/page/2/#findComment-1621864 Compartilhar em outros sites More sharing options...
caotic 393 Postado Março 11, 2014 Autor Share Postado Março 11, 2014 (editado) Basta ir em monster.cpp e procurar: currentOutfit = mType->outfit; Adicionar embaixo: nick = mType->name; Editado Março 11, 2014 por caotic Link para o comentário https://xtibia.com/forum/topic/227752-docreatemonsternickmonster-nick-pos/page/2/#findComment-1621993 Compartilhar em outros sites More sharing options...
Aberos 71 Postado Março 11, 2014 Share Postado Março 11, 2014 é possivel usar essa função em um goback de poketibia para atribuir nick? Link para o comentário https://xtibia.com/forum/topic/227752-docreatemonsternickmonster-nick-pos/page/2/#findComment-1622042 Compartilhar em outros sites More sharing options...
craigmabbit 36 Postado Março 11, 2014 Share Postado Março 11, 2014 if(Monster* monster = env->getCreatureByUID(popNumber(L))->getMonster()) lua_pushstring(L, monster->realname.c_str()); else { errorEx(getError(LUA_ERROR_CREATURE_NOT_FOUND)); lua_pushboolean(L, false); } tem como por pra se não tiver um nick, ele executar a : lua_pushstring(L, creature->getName().c_str());por uso um sistema onKill que pega a informação do nome, e eu preciso dessa sua função , mas ai ele só pega o nome real de creatura que tem nick, queria que funcionasse com monstro normal também. Link para o comentário https://xtibia.com/forum/topic/227752-docreatemonsternickmonster-nick-pos/page/2/#findComment-1622051 Compartilhar em outros sites More sharing options...
caotic 393 Postado Março 12, 2014 Autor Share Postado Março 12, 2014 (editado) if(Monster* monster = env->getCreatureByUID(popNumber(L))->getMonster()) lua_pushstring(L, monster->realname.c_str()); else { errorEx(getError(LUA_ERROR_CREATURE_NOT_FOUND)); lua_pushboolean(L, false); } tem como por pra se não tiver um nick, ele executar a : lua_pushstring(L, creature->getName().c_str());por uso um sistema onKill que pega a informação do nome, e eu preciso dessa sua função , mas ai ele só pega o nome real de creatura que tem nick, queria que funcionasse com monstro normal também. int32_t LuaScriptInterface::luaGetCreatureNickRealName(lua_State* L) { //getCreatureNickRealName(cid) std::string name; if(!Monster* monster = env->getCreatureByUID(popNumber(L))->getMonster()) { errorEx(getError(LUA_ERROR_CREATURE_NOT_FOUND)); lua_pushboolean(L, false); return 1; } name = monster->realname; if (name || name != "") { lua_pushstring(L, name.c_str()); return 1; } lua_pushstring(L, monster->getName().c_str()); return 1; } Editado Março 12, 2014 por caotic Link para o comentário https://xtibia.com/forum/topic/227752-docreatemonsternickmonster-nick-pos/page/2/#findComment-1622152 Compartilhar em outros sites More sharing options...
nociam 90 Postado Março 15, 2014 Share Postado Março 15, 2014 Se pode dar um exemplo de como usar ele em um goback de pokemon pra quanto o pokemon tiver exemplo o nome shiny pikachu na hora de sumonar aparece so pikachu? Link para o comentário https://xtibia.com/forum/topic/227752-docreatemonsternickmonster-nick-pos/page/2/#findComment-1623464 Compartilhar em outros sites More sharing options...
Slicer 1070 Postado Março 15, 2014 Share Postado Março 15, 2014 (editado) if string.find(name, "Shiny") then doCreateMonsterNick(name, name:match("Shiny (.*)"), getThingPos(cid)) else doCreateMonster(name, getThingPos(cid)) end algu +/- assim eu achu... -no caso o 'name' ali seria o nome do poke q vai ser invocado...- Editado Março 15, 2014 por Slicer Link para o comentário https://xtibia.com/forum/topic/227752-docreatemonsternickmonster-nick-pos/page/2/#findComment-1623505 Compartilhar em outros sites More sharing options...
Jakson Souza 95 Postado Março 16, 2014 Share Postado Março 16, 2014 muito bom! Link para o comentário https://xtibia.com/forum/topic/227752-docreatemonsternickmonster-nick-pos/page/2/#findComment-1623705 Compartilhar em outros sites More sharing options...
lucasromero 21 Postado Março 16, 2014 Share Postado Março 16, 2014 (editado) Continue em luascript.cpp e procure isto: 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; } Coloque isto: int32_t LuaScriptInterface::luaGetCreatureNickRealName(lua_State* L) { //getCreatureNickRealName(cid) ScriptEnviroment* env = getEnv(); if(Monster* monster = env->getCreatureByUID(popNumber(L))->getMonster()) lua_pushstring(L, monster->realname.c_str()); else { errorEx(getError(LUA_ERROR_CREATURE_NOT_FOUND)); lua_pushboolean(L, false); } return 1; } int32_t LuaScriptInterface::luaDoCreateMonsterNick(lua_State* L) { //doCreateMonsterNick(monster, nick, pos) ScriptEnviroment* env = getEnv(); PositionEx pos; popPosition(L, pos); std::string nick = popString(L); const std::string name = popString(L).c_str(); Monster* monster = Monster::createMonsterNick(name, nick); if(!monster) { errorEx(getError(LUA_ERROR_CREATURE_NOT_FOUND)); lua_pushboolean(L, false); return 1; } if(!g_game.placeCreature(monster, pos)) { delete monster; errorEx("Cannot create monster: " + name); lua_pushboolean(L, false); return 1; } monster->realname = name; lua_pushnumber(L, env->addThing((Thing*)monster)); return 1; } Substituir ou colocar em baixo do código? Pois se eu substituir dá erro na hora de compilar. Outra coisa, o script funcionou, copiou nome etc.. Mais quando eu estou UPANDO e mato um bixo não nasce o respawn. Poderia ajudar? @Edit Pronto, arrumei o erro, era só dar uma editada no script(distro) e fica funcional para mim. Ótimo script. Editado Março 16, 2014 por lucasromero Link para o comentário https://xtibia.com/forum/topic/227752-docreatemonsternickmonster-nick-pos/page/2/#findComment-1623748 Compartilhar em outros sites More sharing options...
nociam 90 Postado Março 17, 2014 Share Postado Março 17, 2014 Continue em luascript.cpp e procure isto: 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; } Coloque isto: int32_t LuaScriptInterface::luaGetCreatureNickRealName(lua_State* L) { //getCreatureNickRealName(cid) ScriptEnviroment* env = getEnv(); if(Monster* monster = env->getCreatureByUID(popNumber(L))->getMonster()) lua_pushstring(L, monster->realname.c_str()); else { errorEx(getError(LUA_ERROR_CREATURE_NOT_FOUND)); lua_pushboolean(L, false); } return 1; } int32_t LuaScriptInterface::luaDoCreateMonsterNick(lua_State* L) { //doCreateMonsterNick(monster, nick, pos) ScriptEnviroment* env = getEnv(); PositionEx pos; popPosition(L, pos); std::string nick = popString(L); const std::string name = popString(L).c_str(); Monster* monster = Monster::createMonsterNick(name, nick); if(!monster) { errorEx(getError(LUA_ERROR_CREATURE_NOT_FOUND)); lua_pushboolean(L, false); return 1; } if(!g_game.placeCreature(monster, pos)) { delete monster; errorEx("Cannot create monster: " + name); lua_pushboolean(L, false); return 1; } monster->realname = name; lua_pushnumber(L, env->addThing((Thing*)monster)); return 1; } Substituir ou colocar em baixo do código? Pois se eu substituir dá erro na hora de compilar. Outra coisa, o script funcionou, copiou nome etc.. Mais quando eu estou UPANDO e mato um bixo não nasce o respawn. Poderia ajudar? @Edit Pronto, arrumei o erro, era só dar uma editada no script(distro) e fica funcional para mim. Ótimo script. Nao tinha reprado nisso mais o que vc fez pra arrumar o erro? Link para o comentário https://xtibia.com/forum/topic/227752-docreatemonsternickmonster-nick-pos/page/2/#findComment-1624765 Compartilhar em outros sites More sharing options...
caotic 393 Postado Março 18, 2014 Autor Share Postado Março 18, 2014 (editado) Continue em luascript.cpp e procure isto: 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; } Coloque isto: int32_t LuaScriptInterface::luaGetCreatureNickRealName(lua_State* L) { //getCreatureNickRealName(cid) ScriptEnviroment* env = getEnv(); if(Monster* monster = env->getCreatureByUID(popNumber(L))->getMonster()) lua_pushstring(L, monster->realname.c_str()); else { errorEx(getError(LUA_ERROR_CREATURE_NOT_FOUND)); lua_pushboolean(L, false); } return 1; } int32_t LuaScriptInterface::luaDoCreateMonsterNick(lua_State* L) { //doCreateMonsterNick(monster, nick, pos) ScriptEnviroment* env = getEnv(); PositionEx pos; popPosition(L, pos); std::string nick = popString(L); const std::string name = popString(L).c_str(); Monster* monster = Monster::createMonsterNick(name, nick); if(!monster) { errorEx(getError(LUA_ERROR_CREATURE_NOT_FOUND)); lua_pushboolean(L, false); return 1; } if(!g_game.placeCreature(monster, pos)) { delete monster; errorEx("Cannot create monster: " + name); lua_pushboolean(L, false); return 1; } monster->realname = name; lua_pushnumber(L, env->addThing((Thing*)monster)); return 1; } Substituir ou colocar em baixo do código? Pois se eu substituir dá erro na hora de compilar. Outra coisa, o script funcionou, copiou nome etc.. Mais quando eu estou UPANDO e mato um bixo não nasce o respawn. Poderia ajudar? @Edit Pronto, arrumei o erro, era só dar uma editada no script(distro) e fica funcional para mim. Ótimo script. Nao tinha reprado nisso mais o que vc fez pra arrumar o erro? e para colocar embaixo. Editado Março 18, 2014 por caotic Link para o comentário https://xtibia.com/forum/topic/227752-docreatemonsternickmonster-nick-pos/page/2/#findComment-1625094 Compartilhar em outros sites More sharing options...
Creatserv 0 Postado Abril 22, 2014 Share Postado Abril 22, 2014 Vou teste. Link para o comentário https://xtibia.com/forum/topic/227752-docreatemonsternickmonster-nick-pos/page/2/#findComment-1640410 Compartilhar em outros sites More sharing options...
wallaceprado1 1 Postado Março 29, 2018 Share Postado Março 29, 2018 Meu monster.cpp não esta assim: Base tbm 0.3.6 Nao tem: Monster* Monster::createMonster(const std::string& name) { MonsterType* mType = g_monsters.getMonsterType(name); if(!mType) return NULL; return createMonster(mType); } para poder Substituir por: Monster* Monster::createMonster(const std::string& name) { MonsterType* mType = g_monsters.getMonsterType(name); if(!mType) return NULL; mType->name = name; return createMonster(mType); } Monster* Monster::createMonsterNick(const std::string& name, std::string nick) { MonsterType* mType = g_monsters.getMonsterType(name); if(!mType) return NULL; if (!(nick == "")) { mType->name = nick; } return createMonster(mType); } nem: currentOutfit = mType->outfit; para add: nick = mType->name; Segue em anexo meus monster.cpp se tiver como ajudar e revisalo fico grato. monster.rar Link para o comentário https://xtibia.com/forum/topic/227752-docreatemonsternickmonster-nick-pos/page/2/#findComment-1727275 Compartilhar em outros sites More sharing options...
Posts Recomendados