Ir para conteúdo

MatheusGlad

Conde
  • Total de itens

    528
  • Registro em

  • Última visita

  • Dias Ganhos

    30

Tudo que MatheusGlad postou

  1. MatheusGlad

    [Pedido]

    Mas enquanto o castelo for "virgem" ele nao vai ter dono e pode haver empate
  2. MatheusGlad

    [Pedido]

    Explique o sistema, o video esta muito cortado falta informaçoes. Exemplo: Oque acontece depois que uma guild domina o castelo? Porque o ultimo cristal eh diferente dos demais? Se der empate, oque acontece? ... Já fiz o script so falta essas informaçoes extras. Video:
  3. Nao da para entender nada que voce falou '-'
  4. Aceitando ideias para script via PM (Nao quer dizer que a sua vai ser feita)

  5. Affe ideias para script plz '-'

  6. data/actions/scripts/Alavanca.lua: function getItemCap(itemid, quant) -- function by MatheusMkalo return getItemInfo(itemid).weight*(quant or 1) end function onUse(cid, item, fromPosition, itemEx, toPosition) local items = { [2160] = 10, [2471] = 1, [2463] = 1, [2495] = 1, [9933] = 1, } local capneed = 0 for i,x in pairs(items) do capneed = capneed+getItemCap(i, x) end capneed = math.ceil(capneed)+18 if getPlayerFreeCap(cid) >= capneed then if getPlayerItemCount(cid, 12427) >= 30 then local backpack = doPlayerAddItem(cid, 2002) for i,x in pairs(items) do doAddContainerItem(backpack, i, x) end doPlayerRemoveItem(cid, 12427, 30) else return doPlayerSendCancel(cid, "You need 30 NOMEDOITEM.") end else return doPlayerSendCancel(cid, "You need " .. capneed .. " cap.") end return TRUE end data/actions/actions.xml (Adicione essa linha): <action actionid="45690" event="script" value="Alavanca.lua"/> Depois é so botar o ActionID 45690 na alavanca e pronto.
  7. Aaaa ja existem milhares de scripts sobre isso e talz mas eu tava fazendo um pedido me enrolei entendi errado e fiz merda entao eu vou postar somente porque ele tem um negocio de cap que precisa pra comprar e nao cair no chao e talz. data/actions/scripts/Alavancas.lua: function getItemCap(itemid, quant) -- function by MatheusMkalo return getItemInfo(itemid).weight*(quant or 1) end function onUse(cid, item, fromPosition, itemEx, toPosition) local configs = { [45690] = {itemid = 2160, quantperslot = 10, cost = 5, backpackid = 2002}, [45691] = {itemid = 2268, quantperslot = 50, cost = 2, backpackid = 2003}, } local coinid = 9971 -- Use o id da gold coin (2148) se voce quizer usar o sistema de dinheiro mesmo. (Caso o itemid for 2148 o cost sera de gps ou seja 30 = 30 gps) if configs[item.actionid] then if getPlayerFreeCap(cid) >= math.ceil((getItemCap(configs[item.actionid].itemid, configs[item.actionid].quantperslot)*20)+getItemCap(configs[item.actionid].backpackid)) then if coinid ~= 2148 and getPlayerItemCount(cid, coinid) >= configs[item.actionid].cost or doPlayerRemoveMoney(cid, configs[item.actionid].cost) then local backpack = doPlayerAddItem(cid, configs[item.actionid].backpackid) for i = 1, 20 do doAddContainerItem(backpack, configs[item.actionid].itemid, configs[item.actionid].quantperslot) end doPlayerRemoveItem(cid, coinid == 2148 and 0000 or coinid, configs[item.actionid].cost) else return doPlayerSendCancel(cid, ("You need " .. configs[item.actionid].cost) .. (coinid == 2148 and " gold coins" or (" " .. getItemPluralNameById(coinid):lower())) .. " to buy this item.") end else return doPlayerSendCancel(cid, "You need " .. math.ceil((getItemCap(configs[item.actionid].itemid, configs[item.actionid].quantperslot)*20)+getItemCap(configs[item.actionid].backpackid)) .. " cap for buy that.") end end return TRUE end data/actions/actions.xml (Adicione essa linha): <action actionid="45690;45691" event="script" value="Alavancas.lua"/> Configuraçao bem facil, mas como ainda tem gente que nao consegue intender entao: Negrito - Action Ids das alavancas que vao dar tals itens. (Eles devem estar na linha que voce adicionou no xml separados por ; "ponto e virgula", NAO VIRGULA, NAO PONTO, E SIM PONTO E VIRGULA O resto eu usei ingles entao acho que da pra ve, se nao souber vai testando ate consiguir champz.
  8. Nao intendi, explica denovo? Sao varias alavancas ou so 1?
  9. O maior problema seria mudar a fechadura, vou tentar fazer depois se tiver tempo.
  10. Alienado: Qual a funçao do script? Mkalo: Ela vai adicionando vida para o player ate ele ser atacado. (nao exatamente) Bem, como eu nao mexi na source pra fazer (eu nem sei como), a funçao pode ter seus fails classicos, porque ela funciona guardando a life antiga, se voce perder life e ficar com uma life menor que a life antiga, o script para. Bugs: Se voce healar sua vida com exura gran, e almentar 50 de life e voce perder 10 de life, o script nao ira parar. Function: function addHealth(cid, amount, times, interval, deny, s) return times > 0 and addEvent(function() if isCreature(cid) then if s == nil or s <= getCreatureHealth(cid) then doCreatureAddHealth(cid, amount) addHealth(cid, amount, times-1, interval, deny, getCreatureHealth(cid)) else doSendAnimatedText(getCreaturePos(cid), deny, 180) end end end, interval*1000) end Exemplo de uso: addHealth(cid, 100, 10, 2, "LOST", getCreatureHealth(cid)) o getCreatureHealth(cid) é opcional, mas impede possiveis bugs. Parametros: amount: Quanto de vida vai adicionar cada vez que for adicionar times: Quantas vezes vai adicionar vida interval: Intervalo em segundos de cada "adicionada" deny: Mensagem em vermelho que subira na cabeça do player (Max 9 letras eu acho) s: Nao use-o ou use com getCreatureHealth(cid) somente.
  11. Bem, o nome ja diz tudo, mas pra nao deixar duvidas: A função muda 2 letras de lugar, exemplo: str = "Matheus" result = letterReplace(str, 1, 5) no caso result = eathMus function letterReplace(str, place1, place2) a = place1 > place2 and place2 or place1 b = place2 < place1 and place1 or place2 return a ~= b and str:sub(1, a-1) .. str:sub(b, b) .. str:sub(a+1, b-1) .. str:sub(a, a) .. str:sub(b+1) or str end
  12. Humm... A ideia é boa mas o script podia ser melhor se voce usa-se in pairs Pra que botar function na lib? Soh sao 2 functions '-' Eu falei que ia refazer sou mal:
  13. Todos os scripts foram testados em um ot 8.6 Bem o script é auto-explicativo, e ainda tem um video do sistema, acho que nao preciso explicar o que faz ne? AGORA EM MOD, MUITO MAIS PRATICO DE INSTALAR. SE FOR USAR O MOD VA ATE O FINAL DO POST, É EXATAMENTE IGUAL A VERSAO NORMAL, SO QUE MAIS PRATICO. FUNCIONA DO MESMO JEITO. Video: obs: Veja em fullscreen para ver melhor as msgs que retornam. Vá em data/lib e adicione esse script.lua com o nome de WarArenaLib: -- [[ Area and Positions Infos ]] -- areaplayersteam = { {1,1,1,1}, {1,1,1,1}, {1,1,1,1}, {1,1,1,1}, {1,1,1,1} } areateam1ext = {x=80, y=305, z=7} -- Ponta superior esquerda da area do time um areateam2ext = {x=87, y=305, z=7} -- Ponta superior esquerda da area do time dois leaderteam1pos = {x=83, y=307, z=7, stackpos=255} -- Posição do lider do time um (que puxara a alavanca) leaderteam2pos = {x=87, y=307, z=7, stackpos=255} -- Posição do lider do time dois (que puxara a alavanca) newplayersposteam1 = {x=67, y=300, z=7} -- Posição para onde os players do time um serao teleportados newplayersposteam2 = {x=67, y=330, z=7} -- Posição para onde os players do time dois serao teleportados team1leverpos = {x=84, y=307, z=7, stackpos=1} -- Posição da alavanca que o lider do time um puxara team2leverpos = {x=86, y=307, z=7, stackpos=1} -- Posição da alavanca que o lider do time dois puxara leverafter, leverbefore = 9825, 9826 -- Ids das alavancas antes de puxadas e depois, consecutivamente (9825 = antes; 9826 = depois) posbenterteam1 = {x=78, y=307, z=7} -- Posiçao do sqm antes de entrar na arena do time 1 posbenterteam2 = {x=92, y=307, z=7} -- Posiçao do sqm antes de entrar na arena do time 2 backteampos = {x=77, y=307, z=7} -- [[ Storage Infos ]] -- team1leverstorage = 123497 -- Storage que sera usado quando puxarem a alavanca do time 1 team2leverstorage = 123498 -- Storage que sera usado quando puxarem a alavanca do time 2 haveteaminarena = 123499 -- Storage que sera usado para ve se tem algum time lutando na arena storageteam1death = 123500 -- Storage usado para ver quantos morreram do time 1 storageteam2death = 123501 -- Storage usado para ver quantos morreram do time 2 storageteam1 = 123502 -- Storage usado para ver quantas pessoas entraram na arena no time 1 storageteam2 = 123503 -- Storage usado para ver quantas pessoas entraram na arena no time 2 storageleader1 = 123504 -- Storage onde ficara guardado o uid do lider do time 1 storageleader2 = 123505 -- Storage onde ficara guardado o uid do lider do time 2 storageplayersteam1 = 123506 -- Storage que todos os players do team 1 iram ter. storageplatersteam2 = 123507 -- Storage que todos os players do team 2 iram ter. -- [[ Player Infos ]] -- needlevelarena = 20 -- Level que os outros jogadores sem ser o lider teram que ter. leaderlevel = 4000 -- Level que o lider tera que ter. onlyguildwars = true -- Se os membros de um time tem que ser da mesma guild do lider. (Nesse caso somente o lider da guild podera puxar a alavanca.) needplayers = 2 -- Quantidade de players que cada time tem que ter. -- [[ Functions ]] -- function getUidsFromArea(firstpos, area) local result = {} for i,x in pairs(area) do for s,z in pairs(x) do if isPlayer(getThingFromPos({x=firstpos.x+s-1, y=firstpos.y+i-1, z=firstpos.z, stackpos=255}).uid) then table.insert(result, getThingFromPos({x=firstpos.x+s-1, y=firstpos.y+i-1, z=firstpos.z, stackpos=255}).uid) end end end return result end function teleportUidsToPos(uids, pos) for i,x in pairs(uids) do doTeleportThing(x, pos) end end function isAllUidsSameGuild(uids, guildid) for i,x in pairs(uids) do if not (getPlayerGuildId(x) == guildid) then return false end end return true end function isAllUidsLevel(uids, level) for i,x in pairs(uids) do if not (getPlayerLevel(x) >= level) then return false end end return true end function haveQuantPlayersInArea(firstpos, area, quant) local result = 0 for i,x in pairs(area) do for s,z in pairs(x) do if isPlayer(getThingFromPos({x=firstpos.x+s-1, y=firstpos.y+i-1, z=firstpos.z, stackpos=255}).uid) then result = result+1 end end end return result >= quant end function addStorageToUids(uids, storage, value) for i,x in pairs(uids) do setPlayerStorageValue(x, storage, value) end end function checkPoses(pos1, pos2) if pos1.x == pos2.x and pos1.y == pos2.y and pos1.z == pos2.z then return true end return false end function startArena() setGlobalStorageValue(storageleader1, getThingFromPos(leaderteam1pos).uid) setGlobalStorageValue(storageleader2, getThingFromPos(leaderteam2pos).uid) addStorageToUids(team1uids, storageplayersteam1, 1) addStorageToUids(team2uids, storageplayersteam2, 1) teleportUidsToPos(team1uids, newplayersposteam1) teleportUidsToPos(team2uids, newplayersposteam2) setGlobalStorageValue(storageteam1, #team1uids) registerCreatureEventUids(team1uids, "DeathTeam1") registerCreatureEventUids(team2uids, "DeathTeam2") setGlobalStorageValue(storageteam2, #team2uids) setGlobalStorageValue(haveteaminarena, 1) setGlobalStorageValue(team1leverstorage, 0) setGlobalStorageValue(team2leverstorage, 0) doTransformItem(getThingFromPos(team1leverpos).uid, leverafter) doTransformItem(getThingFromPos(team2leverpos).uid, leverafter) end function haveTeamInArena() return getGlobalStorageValue(haveteaminarena) == 1 and true or false end function isSqmFromArea(firstpos, area, sqmpos) for i,x in pairs(area) do for s,z in pairs(x) do if sqmpos.x == firstpos.x+s-1 and sqmpos.y == firstpos.y+i-1 and sqmpos.z == firstpos.z then return true end end end return false end function registerCreatureEventUids(uids, event) for i,x in pairs(uids) do registerCreatureEvent(x, event) end end Agora vá em data/actions/scripts e adicione um script.lua com o nome de WarArenaLever: function onUse(cid, item, fromPosition, itemEx, toPosition) team1uids = getUidsFromArea(areateam1ext, areaplayersteam) team2uids = getUidsFromArea(areateam2ext, areaplayersteam) if haveTeamInArena() then return doPlayerSendCancel(cid, "Already have a team in arena.") end if checkPoses(toPosition, team1leverpos) then if checkPoses(getCreaturePosition(cid), leaderteam1pos) then if getGlobalStorageValue(team1leverstorage) == 1 then setGlobalStorageValue(team1leverstorage, 0) return doTransformItem(getThingFromPos(team1leverpos).uid, leverafter) end if onlyguildwars and getPlayerGuildLevel(cid) < 3 then return doPlayerSendCancel(cid, "You need to be the leader of your guild.") end if onlyguildwars and not isAllUidsSameGuild(team1uids, getPlayerGuildId(cid)) then return doPlayerSendCancel(cid, "All of your team need to be in your guild.") end if not isAllUidsLevel(team1uids, needlevelarena) then return doPlayerSendCancel(cid, "All of your team need to be level " .. needlevelarena .. " or more.") end if getPlayerLevel(cid) < leaderlevel then return doPlayerSendCancel(cid, "You, the leader of the team, need to be level " .. leaderlevel .. " or more.") end if not haveQuantPlayersInArea(areateam1ext, areaplayersteam, needplayers) then return doPlayerSendCancel(cid, "Your team need " .. tostring(needplayers) .. " players.") end setGlobalStorageValue(team1leverstorage, 1) doTransformItem(getThingFromPos(team1leverpos).uid, leverbefore) if getGlobalStorageValue(team2leverstorage) >= 1 then startArena() end else doPlayerSendCancel(cid, "You must be the leader of the team to pull the lever.") end elseif checkPoses(toPosition, team2leverpos) then if checkPoses(getCreaturePosition(cid), leaderteam2pos) then if getGlobalStorageValue(team2leverstorage) == 1 then setGlobalStorageValue(team2leverstorage, 0) return doTransformItem(getThingFromPos(team2leverpos).uid, leverafter) end if onlyguildwars and getPlayerGuildLevel(cid) < 3 then return doPlayerSendCancel(cid, "You need to be the leader of your guild.") end if onlyguildwars and not isAllUidsSameGuild(team2uids, getPlayerGuildId(cid)) then return doPlayerSendCancel(cid, "All of your team need to be in your guild.") end if not isAllUidsLevel(team2uids, needlevelarena) then return doPlayerSendCancel(cid, "All of your team need to be level " .. needlevelarena .. " or more.") end if getPlayerLevel(cid) < leaderlevel then return doPlayerSendCancel(cid, "You, the leader of the team, need to be level " .. leaderlevel .. " or more.") end if not haveQuantPlayersInArea(areateam2ext, areaplayersteam, needplayers) then return doPlayerSendCancel(cid, "Your team need " .. tostring(needplayers) .. " players.") end setGlobalStorageValue(team2leverstorage, 1) doTransformItem(getThingFromPos(team2leverpos).uid, leverbefore) if getGlobalStorageValue(team1leverstorage) >= 1 then startArena() end else doPlayerSendCancel(cid, "You must be the leader of the team to pull the lever.") end end return TRUE end E em actions.xml bote essa linha: <action actionid="12349" event="script" value="WarArenaLever.lua"/> Agora vá em data/creaturescripts/scripts e adicione dois scripts.lua com esses nomes: WarArenaDeathTeam1: function onDeath(cid) setPlayerStorageValue(cid, storageplayersteam1, 0) setGlobalStorageValue(storageteam1death, getGlobalStorageValue(storageteam1death) >= 0 and getGlobalStorageValue(storageteam1death)+1 or 1) if getGlobalStorageValue(storageteam1death) >= getGlobalStorageValue(storageteam1) then if onlyguildwars then doBroadcastMessage("The Team 2 won the war, guild " .. getPlayerGuildName(getGlobalStorageValue(storageleader2)) .. ".") else doBroadcastMessage("The Team 2 won the war, team leader name is " .. getCreatureName(getGlobalStorageValue(storageleader2)) .. ".") end setGlobalStorageValue(storageteam1death, 0) setGlobalStorageValue(storageteam2death, 0) setGlobalStorageValue(haveteaminarena, 0) end return TRUE end WarArenaDeathTeam2: function onDeath(cid) setPlayerStorageValue(cid, storageplayersteam2, 0) setGlobalStorageValue(storageteam2death, getGlobalStorageValue(storageteam2death) >= 0 and getGlobalStorageValue(storageteam2death)+1 or 1) if getGlobalStorageValue(storageteam2death) >= getGlobalStorageValue(storageteam2) then if onlyguildwars then doBroadcastMessage("The Team 1 won the war, guild " .. getPlayerGuildName(getGlobalStorageValue(storageleader1)) .. ".") else doBroadcastMessage("The Team 1 won the war, team leader name is " .. getCreatureName(getGlobalStorageValue(storageleader1)) .. ".") end setGlobalStorageValue(storageteam1death, 0) setGlobalStorageValue(storageteam2death, 0) setGlobalStorageValue(haveteaminarena, 0) end return TRUE end Agora abra o creaturescripts.xml e adicione essas linhas: <event type="death" name="DeathTeam1" event="script" value="WarArenaDeathTeam1.lua"/> <event type="death" name="DeathTeam2" event="script" value="WarArenaDeathTeam2.lua"/> Agora vá em data/movements/scripts e adicione tres scripts.lua com esses nomes: WarArenaMovement1: function onStepOut(cid, item, position, fromPosition) local team = (fromPosition.x == leaderteam1pos.x and fromPosition.y == leaderteam1pos.y and fromPosition.z == leaderteam1pos.z) and "team1" or (fromPosition.x == leaderteam2pos.x and fromPosition.y == leaderteam2pos.y and fromPosition.z == leaderteam2pos.z) and "team2" if team == "team1" then if getGlobalStorageValue(team1leverstorage) == 1 then setGlobalStorageValue(team1leverstorage, 0) doTransformItem(getThingFromPos(team1leverpos).uid, leverafter) end elseif team == "team2" then if getGlobalStorageValue(team2leverstorage) == 1 then setGlobalStorageValue(team2leverstorage, 0) doTransformItem(getThingFromPos(team2leverpos).uid, leverafter) end end end WarArenaMovement2: function onStepIn(cid, item, position, fromPosition) local team = isSqmFromArea(areateam1ext, areaplayersteam, fromPosition) and "team1" or isSqmFromArea(areateam2ext, areaplayersteam, fromPosition) and "team2" if team == "team1" then if getGlobalStorageValue(team1leverstorage) == 1 then if not haveQuantPlayersInArea(areateam1ext, areaplayersteam, needplayers) then setGlobalStorageValue(team1leverstorage, 0) doTransformItem(getThingFromPos(team1leverpos).uid, leverafter) end end elseif team == "team2" then if getGlobalStorageValue(team2leverstorage) == 1 then if not haveQuantPlayersInArea(areateam2ext, areaplayersteam, needplayers) then setGlobalStorageValue(team2leverstorage, 0) doTransformItem(getThingFromPos(team2leverpos).uid, leverafter) end end end if getGlobalStorageValue(team1leverstorage) == 1 then if checkPoses(fromPosition, posbenterteam1) then doTeleportThing(cid, fromPosition) return doPlayerSendCancel(cid, "You can't enter now.") end elseif getGlobalStorageValue(team2leverstorage) == 1 then if checkPoses(fromPosition, posbenterteam2) then doTeleportThing(cid, fromPosition) return doPlayerSendCancel(cid, "You can't enter now.") end end end WarArenaMovement3: function onStepIn(cid, item, position, fromPosition) if getPlayerStorageValue(cid, storageplayersteam1) >= 1 then setPlayerStorageValue(cid, storageplayersteam1, 0) doTeleportThing(cid, posbenterteam1) setGlobalStorageValue(storageteam1death, getGlobalStorageValue(storageteam1death) >= 0 and getGlobalStorageValue(storageteam1death)+1 or 1) if getGlobalStorageValue(haveteaminarena) >= 1 then if getGlobalStorageValue(storageteam1death) >= getGlobalStorageValue(storageteam1) then if onlyguildwars then doBroadcastMessage("The Team 2 won the war, guild " .. getPlayerGuildName(getGlobalStorageValue(storageleader2)) .. ".") else doBroadcastMessage("The Team 2 won the war, team leader name is " .. getCreatureName(getGlobalStorageValue(storageleader2)) .. ".") end setGlobalStorageValue(storageteam1death, 0) setGlobalStorageValue(storageteam2death, 0) setGlobalStorageValue(haveteaminarena, 0) end end elseif getPlayerStorageValue(cid, storageplayersteam2) >= 1 then setPlayerStorageValue(cid, storageplayersteam2, 0) doTeleportThing(cid, posbenterteam2) setGlobalStorageValue(storageteam2death, getGlobalStorageValue(storageteam2death) >= 0 and getGlobalStorageValue(storageteam2death)+1 or 1) if getGlobalStorageValue(haveteaminarena) >= 1 then if getGlobalStorageValue(storageteam2death) >= getGlobalStorageValue(storageteam2) then if onlyguildwars then doBroadcastMessage("The Team 1 won the war, guild " .. getPlayerGuildName(getGlobalStorageValue(storageleader1)) .. ".") else doBroadcastMessage("The Team 1 won the war, team leader name is " .. getCreatureName(getGlobalStorageValue(storageleader1)) .. ".") end setGlobalStorageValue(storageteam1death, 0) setGlobalStorageValue(storageteam2death, 0) setGlobalStorageValue(haveteaminarena, 0) end end end return TRUE end E adicione essas linhas em movements.xml: <movevent type="StepOut" actionid="12350" event="script" value="WarArenaMovement1.lua"/> <movevent type="StepIn" actionid="12351" event="script" value="WarArenaMovement2.lua"/> <movevent type="StepIn" actionid="12352" event="script" value="WarArenaMovement3.lua"/> Pronto acabou rairiaria. Adicionando os Actions IDS: Nas 2 alavancas, adicione o actionid 12349. Nos 2 sqms que os players vao estar antes de entrar na arena adicione o actionid 12351. Nos 2 quadrados aonde os lideres irao ficar (na frente da alavanca) bote o actionid 12350. No sqm de sair da arena bote o actionid 12352. NA AREA DOS TIMES E NA ARENA, BOTE PELO MAP EDITOR PARA NAO PODER LOGAR. (Se voce nao fizer isso pode haver bugs.) Bem, se voce souber ler o script da lib, vai saber configura-lo para seu otserver. Versão MOD: (Abra o spoiler) O modo de configurar é exatamente igual ao normal. Flws. By MatheusMkalo
  14. Sim, existe para itens agrupaveis, mas nao funciona com os que nao sao, como a magic sword. Vou tentar bota pra adicionar tudo em uma bp so.
  15. function doPlayerAddManyItems(cid, itemid, quant) local amountadd, quebradinhos = math.floor(quant/100), quant%100 if not isItemStackable(itemid) then amountadd, quebradinhos = quant, quant%20 end local blabla = quebradinhos >= 1 and amountadd+1 or amountadd if blabla >= 20 then for s = 1, math.ceil(blabla/20) do local backpack = doPlayerAddItem(cid, 1988) for i = 1, amountadd do doAddContainerItem(backpack, itemid, isItemStackable(itemid) and 100 or 1) end amountadd = amountadd-20 if s == math.ceil(blabla/20) and isItemStackable(itemid) then doAddContainerItem(backpack, itemid, quebradinhos) end end else local backpack = doPlayerAddItem(cid, 1988) for i = 1, amountadd do doAddContainerItem(backpack, itemid, isItemStackable(itemid) and 100 or 1) end if isItemStackable(itemid) then doAddContainerItem(backpack, itemid, quebradinhos) end end return TRUE end Exemplo: Se voce botar doPlayerAddManyItems(cid, 2160, 4000) vai adicionar 2 bps, cada uma com 2000 crystal coins, ou seja, 20kk Exemplo2: Se voce botar doPlayerAddManyItems(cid, 2400, 41) vai adicionar 3 bps, duas com 20 magic swords e uma bp com apenas 1 magic sword Facilita um pouco.
  16. Fiz algumas modificaçoes, agora da pra usar com mais de uma letra mais ainda deve ter alguns bugs.
  17. Ela funciona como a funçao string.gsub so que nao funciona com patterns... function stringsub(s, str, repl, n) n = n ~= nil and n or "inf" lastpos = 1 for i = 1, #s do if s:sub(i, i+#str-1) == str then if n == "inf" then s = s:sub(lastpos, i-1) .. repl .. s:sub(i+#str) a = a ~= nil and a+1 or 1 else if a == nil or a < n then s = s:sub(lastpos, i-1) .. repl .. s:sub(i+#str) a = a ~= nil and a+1 or 1 else break end end end end return s , a end Eu sei que dava pra fazer usando string.find facilmente. Mas nao teria graça ne? xD
  18. Nao abandonei, mas nao mexo mais com pokemon. Pelo simples fato de eu ter postado os systems e quase ninguem ter usados.
  19. So em baixo de doTransformItem(getThingFromPos(tilepos).uid, 406) isso: doSendMagicEffect(tilepos, EFEITODASPURPURINAS)
  20. Demonstraçao: data/movements/questname.lua: local route = { {0,0,0,0,0,1,0,0,0}, {0,0,0,0,1,0,1,0,0}, {1,0,0,1,0,0,0,1,1}, {0,1,1,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0} } local extrtilepos = {x=88, y=310, z=7} -- Posiçao do tile << /\ local start = {x=87, y=312, z=7} -- Posiçao do tile que o cara vai estar antes de começar a pisar nos tiles pretos. local final = {x=97, y=312, z=7} -- Posiçao do tile que o cara vai estar dps de ter passado pelo percurso function isPosInRoute(tilesroutepos, tilepos) for i,s in pairs(tilesroutepos) do if s.x == tilepos.x and s.y == tilepos.y and s.z == tilepos.z then return TRUE end end return FALSE end function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition) local tilesroutepos = {} for i, t in pairs(route) do for s, p in pairs(t) do if p == 1 then table.insert(tilesroutepos, {x=extrtilepos.x+s-1, y=extrtilepos.y+i-1, z=extrtilepos.z}) end end end if toPosition.x == final.x and toPosition.y == final.y and toPosition.z == final.z then for i,x in pairs(tilesroutepos) do x.stackpos = 0 doTransformItem(getThingFromPos(x).uid, 407) end return TRUE end if toPosition.x == start.x and toPosition.y == start.y and toPosition.z == start.z then for i,x in pairs(tilesroutepos) do x.stackpos = 0 doTransformItem(getThingFromPos(x).uid, 407) end return TRUE end if fromPosition.x == final.x and fromPosition.y == final.y and fromPosition.z == final.z then doTeleportThing(cid, fromPosition) return doPlayerSendCancel(cid, "Enter in the teleport.") end if isPosInRoute(tilesroutepos, toPosition) then local tilepos = toPosition tilepos.stackpos = 0 doTransformItem(getThingFromPos(tilepos).uid, 406) else doTeleportThing(cid, start) for i,x in pairs(tilesroutepos) do x.stackpos = 0 doTransformItem(getThingFromPos(x).uid, 407) end end return TRUE end data/movements/movements.xml: <movevent type="StepIn" actionid="123666" event="script" value="questname.lua"/> Em quais tiles botar o actionid 123666: Editar a rota que o player tem que fazer: local route = { {0,0,0,0,0,1,0,0,0}, {0,0,0,0,1,0,1,0,0}, {1,0,0,1,0,0,0,1,1}, {0,1,1,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0} } So mudar essa table. Aonde eh 1 eh por onde o player tem que passar.
  21. O tempo é no items.xml: <item id="1499" article="a" name="rush wood"> <attribute key="type" value="magicfield" /> <attribute key="decayTo" value="0" /> <attribute key="duration" value="45" /> </item> duration = 45 segundos. O negocio de nao fazer no templo eu nao sei, so se nao fosse spell e sim talkaction.
  22. data/spells/scripts/trapw.lua: local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_EARTH) setCombatParam(combat, COMBAT_PARAM_CREATEITEM, 1499) local area = { {0, 1, 1, 1, 1, 1, 0}, {1, 1, 0, 0, 0, 1, 1}, {1, 0, 0, 0, 0, 0, 1}, {1, 0, 0, 3, 0, 0, 1}, {1, 0, 0, 0, 0, 0, 1}, {1, 1, 0, 0, 0, 1, 1}, {0, 1, 1, 1, 1, 1, 0} } setCombatArea(combat, createCombatArea(area)) function onCastSpell(cid, var) return doCombat(cid, combat, var) end data/spells/spells.xml: <instant name="Trap Wild" words="exevo mas trap" lvl="50" mana="160" prem="1" selftarget="1" exhaustion="2000" needlearn="0" event="script" value="trapw.lua"> </instant> Nao precisa fazer a runa, pra isso existe o machete. Caso ainda queria a runa eh so falar.
  23. E o miih sempre de brinks com a galeris. function executeClean() doCleanMap() doBroadcastMessage("Game map cleaned, next clean in 24 hours.") return true end function onTimer() doBroadcastMessage("Game map cleaning within 1 minute, please pick up your items!") addEvent(executeClean, 60000) return true end Roubei seu rep+ miih.
  24. Funçao: Pega os uids de criaturas de uma area quadrada. function getUidsInArea(extr1, extr2) local dat = {} for i = 1, (extr2.y-extr1.y)+1 do for s = 1, (extr2.x-extr1.x)+1 do if isCreature(getThingFromPos({x=extr1.x+s-1, y=extr1.y+i-1, z=extr1.z, stackpos=255}).uid) then table.insert(dat, getThingFromPos({x=extr1.x+s-1, y=extr1.y+i-1, z=extr1.z, stackpos=255}).uid) end end end return dat end Como usar: O parametro extr1 e extr2 sao as pos de 2 "vertices" opostos de uma area quadrada. local uids = getUidsInArea({x = 3, y = 5, z = 7}, {x = 17, y = 15, z = 7}) Eu acho que tem uma funçao parecida no tibia, getSpectators, mas essa é mais facil de usar. OBS: Retorna uma table com todas as uids da pos.
  • Quem Está Navegando   0 membros estão online

    • Nenhum usuário registrado visualizando esta página.
×
×
  • Criar Novo...