Luffy Posted December 3, 2017 at 03:38 AM Share Posted December 3, 2017 at 03:38 AM Pessoal eu tava tentando conseguir o hp maximo de um mob através do mysql.query, mas parece não funcionar o código é esse logo abaixo Alguém pode me ajudar? Spoiler quest testmaxhpmob begin state start begin when kill with not npc.is_pc() begin local hp = mysql.query("SELECT max_hp FROM player.mob_proto WHERE vnum ='"..npc.get_race().."' LIMIT 1;") chat(""..hp.."') end end end Link to comment Share on other sites More sharing options...
juniorsilva Posted December 3, 2017 at 05:28 AM Share Posted December 3, 2017 at 05:28 AM (edited) Não seria mais fácil assim? Vá em questlua_npc.cpp e adicione abaixo da função: int npc_set_vid_damage_mul(lua_State* L) int npc_get_max_hp(lua_State* L) { LPCHARACTER npc = CQuestManager::instance().GetCurrentNPCCharacterPtr(); lua_pushnumber(L, npc ? npc->GetMobTable().dwMaxHP : 0); return 1; } depois vá em void RegisterNPCFunctionTable() e adicione isso : { "get_max_hp", npc_get_max_hp }, abaixo da definição: {"set_vid_damage_mul", npc_set_vid_damage_mul}, Mini quest com a nova função npc.get_max_hp() : quest mob_max_hp begin state start begin when kill with not npc.is_pc() begin syschat("HP: "..npc.get_max_hp()) end end end Edited December 3, 2017 at 06:18 AM by juniorsilva Link to comment Share on other sites More sharing options...
znyR Posted December 3, 2017 at 03:52 PM Share Posted December 3, 2017 at 03:52 PM 10 horas atrás, juniorsilva disse: Não seria mais fácil assim? Vá em questlua_npc.cpp e adicione abaixo da função: int npc_set_vid_damage_mul(lua_State* L) int npc_get_max_hp(lua_State* L) { LPCHARACTER npc = CQuestManager::instance().GetCurrentNPCCharacterPtr(); lua_pushnumber(L, npc ? npc->GetMobTable().dwMaxHP : 0); return 1; } depois vá em void RegisterNPCFunctionTable() e adicione isso : { "get_max_hp", npc_get_max_hp }, abaixo da definição: {"set_vid_damage_mul", npc_set_vid_damage_mul}, Mini quest com a nova função npc.get_max_hp() : quest mob_max_hp begin state start begin when kill with not npc.is_pc() begin syschat("HP: "..npc.get_max_hp()) end end end Tudo dito aqui, bom trabalho. Link to comment Share on other sites More sharing options...
Luffy Posted December 4, 2017 at 03:13 AM Author Share Posted December 4, 2017 at 03:13 AM 21 horas atrás, juniorsilva disse: Não seria mais fácil assim? Vá em questlua_npc.cpp e adicione abaixo da função: int npc_set_vid_damage_mul(lua_State* L) int npc_get_max_hp(lua_State* L) { LPCHARACTER npc = CQuestManager::instance().GetCurrentNPCCharacterPtr(); lua_pushnumber(L, npc ? npc->GetMobTable().dwMaxHP : 0); return 1; } depois vá em void RegisterNPCFunctionTable() e adicione isso : { "get_max_hp", npc_get_max_hp }, abaixo da definição: {"set_vid_damage_mul", npc_set_vid_damage_mul}, Mini quest com a nova função npc.get_max_hp() : quest mob_max_hp begin state start begin when kill with not npc.is_pc() begin syschat("HP: "..npc.get_max_hp()) end end end Muito Obrigado, Junior! Eu até tentei criar algumas funções, mas ainda não compreendo a "lógica" da source do metin Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now