Postado Janeiro 20, 2015 10 anos Pessoal estava eu e meu amigo (que é scripter) mechendo algumas coisas no evento Gran Tower, ele fez esse script aqui para que quando o cara matar a Gran Tower todos sejam teletransportado para fora do evento, mas agora ele foi viajar e não consigo contato com ele, e esta dando um erro ao abrir o OT: http://prntscr.com/5uv53g Script: function onDeath(cid, corpse, lastHitKiller, mostDamageKiller) local killer = lastHitKiller[1] if isPlayer(killer) and (getCreatureName(cid) == "Gran Tower") then if (getGlobalStorageValue(GRANTOWER.FINALWINNER) ~= getCreatureName(killer)) then if getPlayerGuildId(killer) >= 1 then for index, creature in ipairs(getGranTowerPlayers()) do doTeleportThing(creature, GRANTOWER.ENTER, true) end else for index, creature in ipairs(getGranTowerPlayers()) do if getPlayerStorageValue(creature, GRANTOWER.AURA) ~= -1 then doTeleportThing(creature, GRANTOWER.ENTER, true) end end end if (getPlayerGuildId(killer) >= 1) then setGlobalStorageValue(GRANTOWER.SAVEWINNERGUILDID, getPlayerGuildId(killer)) for index, creature in ipairs(getGranTowerGuild(getPlayerGuildId(killer))) do setPlayerStorageValue(creature, GRANTOWER.AURA, 1) end end setPlayerStorageValue(killer, GRANTOWER.AURA, 1) addEvent(changeOutfit, 0, killer) setGlobalStorageValue(GRANTOWER.SAVELASTWINNER, getCreatureName(killer)) addEvent(doCreateMonster, 2 * 1000, "Gran Tower", GRANTOWER.TOWERPOSITION) for i, 5 do doRemoveCreature(getThingPos(GRANTOWER.GUARDS[i].pos).uid)) addEvent(doCreateMonster, 500, GRANTOWER.GUARDS[i].name, GRANTOWER.GUARDS[i].pos) end for v, 18 do if getThingPos(GRANTOWER.GATES[v].pos).id ~= 9485 and 9533 then addEvent(doCreateItem, 500, GRANTOWER.GATES[i].id, GRANTOWER.GATES[v].pos) end end setGlobalStorageValue(GRANTOWER.FINALWINNER, getCreatureName(killer)) setGlobalStorageValue(GRANTOWER.DESTROYCOUNT, (getGlobalStorageValue(GRANTOWER.DESTROYCOUNT) + 1)) doBroadcastMessage("[Gran Tower] The Gran Aura is with "..getCreatureName(killer)..", run to destroy the Grand Tower and take it.") end end return true end function onTarget(cid, target) if isPlayer(cid) and isMonster(target) and (getCreatureName(target) == "Gran Tower") then if (getGlobalStorageValue(GRANTOWER.FINALWINNER) == getCreatureName(cid)) then doPlayerSendCancel(cid, "Você não pode atacar o Gran Tower, proteja ele!") return false end end return true end function onStatsChange(cid, attacker, type, combat, value) if (type == STATSCHANGE_HEALTHLOSS) and isMonster(cid) and isPlayer(attacker) and (getCreatureName(cid) == "Gran Tower") then if (getGlobalStorageValue(GRANTOWER.FINALWINNER) == getCreatureName(attacker)) then return false end end return true end
Postado Janeiro 20, 2015 10 anos Troque: for i, 5 do por: for i = 1, #GRANTOWER.GUARDS do e troca: for v, 18 do por: for v = 1, #GRANTOWER.GATES do troque também: addEvent(doCreateItem, 500, GRANTOWER.GATES[i].id, GRANTOWER.GATES[v].pos) por: addEvent(doCreateItem, 500, GRANTOWER.GATES[v].id, GRANTOWER.GATES[v].pos) não respondo pms solicitando suporte em programação/scripting
Postado Janeiro 20, 2015 10 anos o erro na distro tá dizendo que vc colocou o nome errado na linha 26 (e vai dar erro na linha 30 tb). for i, 5 do for v, 18 do o correto é for i = 1, 5 do e for v = 1, 18 do em todo caso eu já fiz esse evento (ta no meu perfil) e já que isso daí é só uma modificação no script original eu sugiro que vc use ele caso os erros persistam e recomece as modificações partindo dele como base function onDeath(cid, corpse, lastHitKiller, mostDamageKiller) local killer = lastHitKiller[1] if isPlayer(killer) and (getCreatureName(cid) == "Gran Tower") then if (getGlobalStorageValue(GRANTOWER.FINALWINNER) ~= getCreatureName(killer)) then if getPlayerGuildId(killer) >= 1 then for index, creature in ipairs(getGranTowerPlayers()) do if getPlayerGuildId(creature) ~= getPlayerGuildId(killer) then doTeleportThing(creature, getTownTemplePosition(getPlayerTown(creature)), true) end end else for index, creature in ipairs(getGranTowerPlayers()) do if getPlayerStorageValue(creature, GRANTOWER.AURA) ~= -1 then doTeleportThing(creature, getTownTemplePosition(getPlayerTown(creature)), true) end end end if (getPlayerGuildId(killer) >= 1) then setGlobalStorageValue(GRANTOWER.SAVEWINNERGUILDID, getPlayerGuildId(killer)) for index, creature in ipairs(getGranTowerGuild(getPlayerGuildId(killer))) do setPlayerStorageValue(creature, GRANTOWER.AURA, 1) end end setPlayerStorageValue(killer, GRANTOWER.AURA, 1) addEvent(changeOutfit, 0, killer) setGlobalStorageValue(GRANTOWER.SAVELASTWINNER, getCreatureName(killer)) addEvent(doCreateMonster, 2 * 1000, "Gran Tower", GRANTOWER.TOWERPOSITION) setGlobalStorageValue(GRANTOWER.FINALWINNER, getCreatureName(killer)) setGlobalStorageValue(GRANTOWER.DESTROYCOUNT, (getGlobalStorageValue(GRANTOWER.DESTROYCOUNT) + 1)) doBroadcastMessage("[Gran Tower] The Gran Aura is with "..getCreatureName(killer)..", run to destroy the Grand Tower and take it.") end end return true end function onTarget(cid, target) if isPlayer(cid) and isMonster(target) and (getCreatureName(target) == "Gran Tower") then if (getGlobalStorageValue(GRANTOWER.FINALWINNER) == getCreatureName(cid)) then doPlayerSendCancel(cid, "Você não pode atacar o Gran Tower, proteja ele!") return false end end return true end function onStatsChange(cid, attacker, type, combat, value) if (type == STATSCHANGE_HEALTHLOSS) and isMonster(cid) and isPlayer(attacker) and (getCreatureName(cid) == "Gran Tower") then if (getGlobalStorageValue(GRANTOWER.FINALWINNER) == getCreatureName(attacker)) then return false end end return true end Todos os meus trabalhos importantes estão na seção "Sobre mim" no meu perfil; Dá uma passada lá! "Há três caminhos para o fracasso: não ensinar o que se sabe, não praticar o que se ensina, e não perguntar o que se ignora." - São Beda (obg ao @Beeny por fazer essa linda sign <3)
Postado Janeiro 20, 2015 10 anos Autor Obrigado pela ajuda dos Membros mas ainda não deu certo, segue o erro na outra linha agora: http://prntscr.com/5uwgeh Ele mudou algumas coisas na LIB tambem para criar os portões em alguns lugares, a lib agora esta assim: GRANTOWER = {} GRANTOWER.PREPARETIME = 2 -- Tempo até liberar a entrada para o evento. GRANTOWER.CLOSETIME = 10 -- Tempo em minutos de duração do evento. GRANTOWER.LEVEL = 80 -- Mínimo de level para participar do evento. GRANTOWER.MAXGUILD = 7 -- Máximo de players por guild dentro do evento. GRANTOWER.DATES = {{"Monday", "19:00"}, {"Tuesday", "19:00"}, {"Saturday", "19:00"}, {"Sunday", "22:30"}} -- Dias e horários que ocorrem o evento. GRANTOWER.ENTER = {x = 245, y = 641, z = 7} -- A posição da entrada do castelo, aonde os players são mandados pelo NPC. GRANTOWER.TOWERPOSITION = {x = 264, y = 613, z = 6} -- Posição aonde fica o Gran Tower (o monstro). GRANTOWER.AREA = {{x = 236, y = 587, z = 7}, {x = 283, y = 643, z = 5}} --[[A primeira posição é o canto superior esquerdo do mapa do castelo, e a segunda é o canto direito inferior OBSERVAÇÃO IMPORTANTE: O script foi modificado por mim (xWhiteWolf) para aguentar diferentes andares, apenas coloque a posição dos cantos e o primeiro até o ultimo andar que ele irá remover todo mundo em todos os andares quando alguém matar a gran tower, pra remover isso apenas coloque o z do mesmo andar da gran tower e apenas os membros que estão nesse andar serão teleportados, contudo isso pode ocasionar que pessoas consigam ficar dentro do castelo mesmo após o evento ter sido encerrado!]] GRANTOWER.AURAPERCENT = 0.8 --- porcentagem do dano que irá levar (0.8 = 80%) significa que ele ignora 20% de dano! (adicionado por xWhiteWolf) GRANTOWER.SHURIAURA = true --- colocar true/false se quiser ativar/desativar a aura de shurikens pro player que tem a gran aura. (adicionado por xWhiteWolf) GRANTOWER.GATES = { [1] = {id = 9485, pos = {x=1471, y=134, z=6, stackpos=1}}, [2] = {id = 9485, pos = {x=1472, y=134, z=6, stackpos=1}}, [3] = {id = 9533, pos = {x=1469, y=136, z=6, stackpos=1}}, [4] = {id = 9533, pos = {x=1469, y=137, z=6, stackpos=1}}, [5] = {id = 9485, pos = {x=1451, y=119, z=7, stackpos=1}}, [6] = {id = 9485, pos = {x=1452, y=119, z=7, stackpos=1}}, [7] = {id = 9485, pos = {x=1465, y=123, z=6, stackpos=1}}, [8] = {id = 9485, pos = {x=1466, y=123, z=6, stackpos=1}}, [9] = {id = 9485, pos = {x=1459, y=141, z=7, stackpos=1}}, [10] = {id = 9485, pos = {x=1460, y=141, z=7, stackpos=1}}, [11] = {id = 9485, pos = {x=1457, y=141, z=7, stackpos=1}}, [12] = {id = 9485, pos = {x=1458, y=141, z=7, stackpos=1}}, [13] = {id = 9485, pos = {x=1461, y=141, z=7, stackpos=1}}, [14] = {id = 9485, pos = {x=1448, y=130, z=5, stackpos=1}}, [15] = {id = 9485, pos = {x=1449, y=130, z=5, stackpos=1}}, [16] = {id = 9485, pos = {x=1450, y=130, z=5, stackpos=1}}, [17] = {id = 9485, pos = {x=1451, y=130, z=5, stackpos=1}}, [18] = {id = 9485, pos = {x=1452, y=130, z=5, stackpos=1}} } GRANTOWER.GUARDS = { [1] = {name = "Castle Dark Magician", pos = {x=1463, y=132, z=6}}, [2] = {name = "Castle Guardian", pos = {x=1451, y=122, z=7}}, [3] = {name = "Castle Magician", pos = {x=1467, y=115, z=6}}, [4] = {name = "Castle Soldier", pos = {x=1463, y=146, z=7}}, [5] = {name = "Castle Spellcaster", pos = {x=1449, y=115, z=5}} } --// Favor não mexer daqui para baixo se não souber oque está fazendo!!! GRANTOWER.EMPTYWINNER = "# [Nobody] #" GRANTOWER.PREPARE = 201405051746 GRANTOWER.RUNNING = 201405051747 GRANTOWER.AURA = 201405052018 GRANTOWER.DESTROYCOUNT = 201405051800 GRANTOWER.FINALWINNER = 201405051805 GRANTOWER.SAVELASTWINNER = 201405061333 GRANTOWER.SAVEWINNERGUILDID = 201405061403 function doPrepareGranTower() if ((getGlobalStorageValue(GRANTOWER.PREPARE) ~= 1) and (getGlobalStorageValue(GRANTOWER.RUNNING) ~= 1)) then setGlobalStorageValue(GRANTOWER.PREPARE, 1) addEvent(doStartGranTower, GRANTOWER.PREPARETIME * 60 * 1000) addEvent(doBroadcastMessage, ((GRANTOWER.PREPARETIME / 2) * 60 * 1000), "[Gran Tower] Missing "..tostring((GRANTOWER.PREPARETIME / 2)).." minutes NPC Melkrapo will release the entrance to the event, get ready!") doBroadcastMessage("[Gran Tower] The event will be started in "..tostring(GRANTOWER.PREPARETIME).." minutes, please prepare your weapons and your team.") else print("[Erro] Gran Tower tentou ser iniciado ja ligado, favor verificar o codigo. (Roksas).") end return true end function doStartGranTower() if ((getGlobalStorageValue(GRANTOWER.PREPARE) ~= -1) and (getGlobalStorageValue(GRANTOWER.RUNNING) ~= 1)) then setGlobalStorageValue(GRANTOWER.RUNNING, 1) setGlobalStorageValue(GRANTOWER.PREPARE, -1) setGlobalStorageValue(GRANTOWER.SAVEWINNERGUILDID, -1) setGlobalStorageValue(GRANTOWER.FINALWINNER, GRANTOWER.EMPTYWINNER) setGlobalStorageValue(GRANTOWER.SAVELASTWINNER, GRANTOWER.EMPTYWINNER) setGlobalStorageValue(GRANTOWER.DESTROYCOUNT, 0) doCreateMonster("Gran Tower", GRANTOWER.TOWERPOSITION) addEvent(doBroadcastMessage, ((GRANTOWER.CLOSETIME - 1) * 60 * 1000), "[Gran Tower] The event will be closed in one minute. Hurry up!") addEvent(doCloseGranTower, GRANTOWER.CLOSETIME * 60 * 1000) doBroadcastMessage("[Gran Tower] Open event! Run to destroy the Gran Tower.") else print("[Erro] Gran Tower tentou ser iniciado já ligado, favor verificar o código.") end return true end function doCloseGranTower() if ((getGlobalStorageValue(GRANTOWER.PREPARE) ~= 1) and (getGlobalStorageValue(GRANTOWER.RUNNING) ~= -1)) then for index, creature in ipairs(getGranTowerPlayers()) do doTeleportThing(creature, getTownTemplePosition(getPlayerTown(creature))) end for index, creature in ipairs(getPlayersOnline()) do if (getPlayerGuildId(creature) >= 1) then if getPlayerGuildId(creature) ~= getGlobalStorageValue(GRANTOWER.SAVEWINNERGUILDID) then setPlayerStorageValue(creature, GRANTOWER.AURA, -1) end end end setGlobalStorageValue(GRANTOWER.RUNNING, -1) if (getCreatureByName("Gran Tower")) then doRemoveCreature(getCreatureByName("Gran Tower"), true) end local TMP_WINNER = getGlobalStorageValue(GRANTOWER.FINALWINNER) doBroadcastMessage("[Gran Tower] The event was completed with "..tostring(getGlobalStorageValue(GRANTOWER.DESTROYCOUNT)).." wrecks to Gran Tower, the final winner was "..(TMP_WINNER)..".") setGlobalStorageValue(GRANTOWER.DESTROYCOUNT, -1) setGlobalStorageValue(GRANTOWER.SAVELASTWINNER, TMP_WINNER) setGlobalStorageValue(GRANTOWER.FINALWINNER, -1) local TMP_WINNER = nil end return true end function getGranTowerPlayers() -- xWhiteWolf local players = {} local andares = math.abs(GRANTOWER.AREA[1].z - GRANTOWER.AREA[2].z) for index, creature in ipairs(getPlayersOnline()) do local z = 0 local pos1 = {x = GRANTOWER.AREA[1].x, y = GRANTOWER.AREA[1].y, z = GRANTOWER.AREA[1].z} local pos2 = {x = GRANTOWER.AREA[2].x, y = GRANTOWER.AREA[2].y, z = GRANTOWER.AREA[2].z} for i = 0, andares do z = z or 0 pos1.z = pos1.z > pos2.z and pos2.z + z or pos1.z + z pos2.z = pos1.z z = 1 if isInArea(getThingPos(creature), pos1, pos2) then table.insert(players, creature) end end end return players end function getGranTowerGuild(guild_id) -- xWhiteWolf local players = {} local andares = math.abs(GRANTOWER.AREA[1].z - GRANTOWER.AREA[2].z) for index, creature in ipairs(getPlayersOnline()) do local z = 0 local pos1 = {x = GRANTOWER.AREA[1].x, y = GRANTOWER.AREA[1].y, z = GRANTOWER.AREA[1].z} local pos2 = {x = GRANTOWER.AREA[2].x, y = GRANTOWER.AREA[2].y, z = GRANTOWER.AREA[2].z} for i = 0, andares do z = z or 0 pos1.z = pos1.z > pos2.z and pos2.z + z or pos1.z + z pos2.z = pos1.z z = 1 if isInArea(getThingPos(creature), pos1, pos2) then if (getPlayerGuildId(creature) == guild_id) then table.insert(players, creature) end end end end return players end -- // Gran Aura \/ function newColor(n) local n = tonumber(n) or 0 local n = n + 19 return tonumber(n) or 0 end function newColor(n) local n = tonumber(n) or 132 local n = n - 19 return tonumber(n) or 132 end -- comentario: se a cor for preta o addon vai para branco sendo que o certo é diminuir 19.. local events = {} function changeOutfit(uid) -- arrumado por xWhiteWolf e adicionado a opção da Shuri local sec = 0.5 local temp = getCreatureOutfit(uid) if (type(temp) == "number") then return true end if getGlobalStorageValue(GRANTOWER.SAVELASTWINNER) ~= getCreatureName(uid) then if getGlobalStorageValue(GRANTOWER.SAVEWINNERGUILDID) ~= getPlayerGuildId(uid) then return true end end if GRANTOWER.SHURIAURA then local pos = getCreaturePosition(uid) local effectPos = { [1] = {x = pos.x - 2, y = pos.y - 2, z = pos.z}, [2] = {x = pos.x + 2, y = pos.y + 2, z = pos.z} } for i = 1, #effectPos do position = effectPos[i + 1] or effectPos[i - 1] doSendDistanceShoot(effectPos[i], position, 66) end end local outfit = { lookType = temp.lookType, lookHead = newColor(temp.lookHead), lookBody = newColor(temp.lookBody), lookLegs = newColor(temp.lookLegs), lookFeet = newColor(temp.lookFeet), lookAddons = getCreatureOutfit(uid).lookAddons, } doSetCreatureOutfit(uid, outfit, sec) local event = addEvent(function() if isCreature(uid) then changeOutfit(uid) end end, 3.0 * sec * 450) events[uid] = event return true end
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.