Postado Julho 25, 2017 7 anos Como verifico que umas pos é andavel? tenho esse script que jorra itens pelo mapa em uma determinada area, so que ele cria itens ate nas paredes. acho que se verrificasse se as pos fossem andaveis antes de criar o item no chão ja resolveria... alguém pode me ajudar? Spoiler -- Rain item Events created by Maniucza (c) -- local fromPos = {x=1028, y=1016, z=7} local toPos = {x=1034, y=1024, z=7} local items = {{2402,1},{2380,1},{2394,1}, -- armas {2456,1},{2544,30},{2544,30},{2410,5},{2410,5}, -- arma pala {2482,1},{2484,1},{2526,1},{2468,1},{2643,1},{1988,1}, -- equips {2301,2},{2305,2},{2269,2},{2261,2},{2291,3},{2266,2},{2263,1},{2313,2}, --runas {7618,1},{7620,1},{8704,1},{8704,1}} -- potions local maxItems = 40 function isWalkable(pos, creature, proj, pz) if getTileThingByPos({x=pos.x,y=pos.y,z=pos.z,stackpos=0}).itemid == 0 then return false end local n = not proj and 3 or 2 for i = 0, 255 do pos.stackpos = i local tile = getTileThingByPos(pos) if tile.itemid ~= 0 and not isCreature(tile.uid) then if hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) then return true end end end return true end function checkPositions(n) local pos = {x=math.random(fromPos.x,toPos.x), y=math.random(fromPos.y,toPos.y), z=math.random(fromPos.z,toPos.z)} if isWalkable(pos, true, false, true) then return pos end return (n < 50 and checkPositions(n+1) or false) end function onSay(cid, words, param) doBroadcastMessage("Rain item will start in 1 second. GOOD LUCK.", MESSAGE_EVENT_ADVANCE) return addEvent(spawnItem, 100, 1) end function spawnItem(created) if created >= maxItems then return doBroadcastMessage("Rain Item just finished [total: 25 items]!", MESSAGE_EVENT_ADVANCE) end local itemPos, itemInf = checkPositions(1), math.random(#items) doCreateItem(items[itemInf][1], items[itemInf][2], itemPos) doSendMagicEffect(itemPos, CONST_ME_LOSEENERGY) doSendMagicEffect(itemPos, 55) doSendMagicEffect(itemPos, 56) return addEvent(spawnItem, 10000, created+1) end Scriptszinhos: Spoiler [CREATURESCRIPT] Auto TP depois de matar boss [ACTION] Clean Area [TALKACTION] !FelizAnoNovo [ACTION + MOVEMENT] Cartas ao GOD [CREATURESCRIPT] Always Emblem System [ACTION] Anihi simples [TALKACTIONS] Urinar / fazer xixi Não abandone seu tópico, quando você tiver a dúvida resolvida sozinho tente ensinar aos outros como resolve-la (você pode não ser o único com o problema) e quando ela for resolvida por outra pessoa não se esqueça de marcar como melhor resposta e deixar o gostei.
Postado Julho 25, 2017 7 anos Solução Tenta mudar aquela função isWalkable por essa aqui: function isWalkable(pos) local tile = getThingfromPos(pos) if hasProperty(tile.uid, 0) == true or hasProperty(tile.uid, 3) == true then return false end return true end E depois troca essa parte: if isWalkable(pos, true, false, true) then Por: if isWalkable(pos) then Ajudei? De nada \o/ Att Rusherzin
Postado Julho 25, 2017 7 anos Autor 4 horas atrás, Rusherzin disse: Tenta mudar aquela função isWalkable por essa aqui: function isWalkable(pos) local tile = getThingfromPos(pos) if hasProperty(tile.uid, 0) == true or hasProperty(tile.uid, 3) == true then return false end return true end E depois troca essa parte: if isWalkable(pos, true, false, true) then Por: if isWalkable(pos) then Valeu!! Scriptszinhos: Spoiler [CREATURESCRIPT] Auto TP depois de matar boss [ACTION] Clean Area [TALKACTION] !FelizAnoNovo [ACTION + MOVEMENT] Cartas ao GOD [CREATURESCRIPT] Always Emblem System [ACTION] Anihi simples [TALKACTIONS] Urinar / fazer xixi Não abandone seu tópico, quando você tiver a dúvida resolvida sozinho tente ensinar aos outros como resolve-la (você pode não ser o único com o problema) e quando ela for resolvida por outra pessoa não se esqueça de marcar como melhor resposta e deixar o gostei.
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.