Postado Junho 3, 2020 5 anos Diretor Este é um post popular. L3K0Ttfs 0.4 Bom galera hoje vim trazer para aqueles que não tem em seu tfs a função DoSetCreatureLight, é uma função de LUZ, alguns tfs tem e outros não tem então resolvi compartilhar. abra seu luascript.cpp e procure por: lua_register(m_luaState, "getCreatureHealth", LuaInterface::luaGetCreatureHealth); em baixo add //doSetCreatureLight(cid, lightLevel, lightColor, time) lua_register(m_luaState, "doSetCreatureLight", LuaInterface::luaDoSetCreatureLight); Procure;; int32_t LuaInterface::luaGetThingFromPos(lua_State* L) { //getThingFromPos(pos[, displayError = true]) //Note: // stackpos = 255- top thing (movable item or creature) // stackpos = 254- magic field // stackpos = 253- top creature bool displayError = true; if(lua_gettop(L) > 1) displayError = popNumber(L); PositionEx pos; popPosition(L, pos); ScriptEnviroment* env = getEnv(); Thing* thing = NULL; if(Tile* tile = g_game.getMap()->getTile(pos)) { if(pos.stackpos == 255) { if(!(thing = tile->getTopCreature())) { Item* item = tile->getTopDownItem(); if(item && item->isMovable()) thing = item; } } else if(pos.stackpos == 254) thing = tile->getFieldItem(); else if(pos.stackpos == 253) thing = tile->getTopCreature(); else thing = tile->__getThing(pos.stackpos); if(thing) pushThing(L, thing, env->addThing(thing)); else pushThing(L, NULL, 0); return 1; } if(displayError) errorEx(getError(LUA_ERROR_TILE_NOT_FOUND)); pushThing(L, NULL, 0); return 1; } em baixo add;; int32_t LuaInterface::luaDoSetCreatureLight(lua_State* L) { //doSetCreatureLight(cid, lightLevel, lightColor, time) uint32_t time = popNumber(L); uint8_t color = (uint8_t)popNumber(L); uint8_t level = (uint8_t)popNumber(L); uint32_t cid = popNumber(L); ScriptEnviroment* env = getEnv(); Creature* creature = env->getCreatureByUID(cid); if(creature) { Condition* condition = Condition::createCondition(CONDITIONID_COMBAT, CONDITION_LIGHT, time, level | (color << 8)); creature->addCondition(condition); lua_pushboolean(L, true); } else { errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND)); lua_pushboolean(L, false); } return 1; } Agora em Luascript.h procure por:;; static int32_t luaCanPlayerWearOutfit(lua_State* L); em baixo add;; static int32_t luaDoSetCreatureLight(lua_State *L); salva tudo em compila no modo rebuild. Usando em Summons;; doSetCreatureLight(getCreatureSummons(cid)[1], 10, 215, 60*1000) Usando em players;; doSetCreatureLight(cid, 9, 65, 10*60*1000) usando em Equipe;; function onEquip(cid, item, slot) doSetCreatureLight(cid, 9, 65, 10*60*1000) end function onDeEquip(cid, item, slot) doSetCreatureLight(cid, 7, 215, 1*1000) end Espero que gostem Eu sou um entusiasta da programação apaixonado por ajudar a comunidade open source a crescer. Sempre em busca de novos desafios e oportunidades para contribuir com meu código. #OpenSource #Programação #Contribuição
Postado Junho 3, 2020 5 anos Deixa uma breve explicação resumida do que ele faz? coloca luz nos monstros?
Postado Junho 3, 2020 5 anos Autor Diretor Agora, NTORox OTServer disse: Deixa uma breve explicação resumida do que ele faz? coloca luz nos monstros? isso Eu sou um entusiasta da programação apaixonado por ajudar a comunidade open source a crescer. Sempre em busca de novos desafios e oportunidades para contribuir com meu código. #OpenSource #Programação #Contribuição
Postado Março 29, 2021 4 anos Em 03/06/2020 em 17:43, L3K0T disse: L3K0Ttfs 0.4 Bom galera hoje vim trazer para aqueles que não tem em seu tfs a função DoSetCreatureLight, é uma função de LUZ, alguns tfs tem e outros não tem então resolvi compartilhar. abra seu luascript.cpp e procure por: lua_register(m_luaState, "getCreatureHealth", LuaInterface::luaGetCreatureHealth); em baixo add //doSetCreatureLight(cid, lightLevel, lightColor, time) lua_register(m_luaState, "doSetCreatureLight", LuaInterface::luaDoSetCreatureLight); Procure;; int32_t LuaInterface::luaGetThingFromPos(lua_State* L) { //getThingFromPos(pos[, displayError = true]) //Note: // stackpos = 255- top thing (movable item or creature) // stackpos = 254- magic field // stackpos = 253- top creature bool displayError = true; if(lua_gettop(L) > 1) displayError = popNumber(L); PositionEx pos; popPosition(L, pos); ScriptEnviroment* env = getEnv(); Thing* thing = NULL; if(Tile* tile = g_game.getMap()->getTile(pos)) { if(pos.stackpos == 255) { if(!(thing = tile->getTopCreature())) { Item* item = tile->getTopDownItem(); if(item && item->isMovable()) thing = item; } } else if(pos.stackpos == 254) thing = tile->getFieldItem(); else if(pos.stackpos == 253) thing = tile->getTopCreature(); else thing = tile->__getThing(pos.stackpos); if(thing) pushThing(L, thing, env->addThing(thing)); else pushThing(L, NULL, 0); return 1; } if(displayError) errorEx(getError(LUA_ERROR_TILE_NOT_FOUND)); pushThing(L, NULL, 0); return 1; } em baixo add;; int32_t LuaInterface::luaDoSetCreatureLight(lua_State* L) { //doSetCreatureLight(cid, lightLevel, lightColor, time) uint32_t time = popNumber(L); uint8_t color = (uint8_t)popNumber(L); uint8_t level = (uint8_t)popNumber(L); uint32_t cid = popNumber(L); ScriptEnviroment* env = getEnv(); Creature* creature = env->getCreatureByUID(cid); if(creature) { Condition* condition = Condition::createCondition(CONDITIONID_COMBAT, CONDITION_LIGHT, time, level | (color << 8)); creature->addCondition(condition); lua_pushboolean(L, true); } else { errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND)); lua_pushboolean(L, false); } return 1; } Agora em Luascript.h procure por:;; static int32_t luaCanPlayerWearOutfit(lua_State* L); em baixo add;; static int32_t luaDoSetCreatureLight(lua_State *L); salva tudo em compila no modo rebuild. Usando em Summons;; doSetCreatureLight(getCreatureSummons(cid)[1], 10, 215, 60*1000) Usando em players;; doSetCreatureLight(cid, 9, 65, 10*60*1000) usando em Equipe;; function onEquip(cid, item, slot) doSetCreatureLight(cid, 9, 65, 10*60*1000) end function onDeEquip(cid, item, slot) doSetCreatureLight(cid, 7, 215, 1*1000) end Espero que gostem to com error aqi
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.