Ir para conteúdo

MatheusGlad

Conde
  • Total de itens

    528
  • Registro em

  • Última visita

  • Dias Ganhos

    30

Histórico de Reputação

  1. Upvote
    MatheusGlad recebeu reputação de UsBaun em Auto Loot System.   
    Video demonstrando o que faz o script:

     
    Para usar a talkaction eh simples:
    !autoloot itens (itens separados por virgula)
     
    Exemplo: !autoloot mastermind shield, gold coin
     
    Na pasta mods, bote esse xml, e pronto estara funcionando direitinho.
     
    autoLoot.xml:

    <?xml version="1.0" encoding="UTF-8"?> <mod name="autoLoot" enabled="yes" author="MatheusMkalo" forum="XTibia.com"> <config name="autoLootLib"><![CDATA[ function setPlayerStorageTable(cid, storage, tab) local tabstr = "&" for i,x in pairs(tab) do tabstr = tabstr .. i .. "," .. x .. ";" end setPlayerStorageValue(cid, storage, tabstr:sub(1, #tabstr-1)) end function getPlayerStorageTable(cid, storage) local tabstr = getPlayerStorageValue(cid, storage) local tab = {} if type(tabstr) ~= "string" then return {} end if tabstr:sub(1,1) ~= "&" then return {} end local tabstr = tabstr:sub(2, #tabstr) local a = string.explode(tabstr, ";") for i,x in pairs(a) do local b = string.explode(x, ",") tab[tonumber(b[1]) or b[1]] = tonumber(b[2]) or b[2] end return tab end function getContainerItems(containeruid) local items = {} local containers = {} if type(getContainerSize(containeruid)) ~= "number" then return false end for slot = 0, getContainerSize(containeruid)-1 do local item = getContainerItem(containeruid, slot) if item.itemid == 0 then break end if isContainer(item.uid) then table.insert(containers, item.uid) end table.insert(items, item) end if #containers > 0 then for i,x in ipairs(getContainerItems(containers[1])) do table.insert(items, x) end table.remove(containers, 1) end return items end function getItemsInContainerById(container, itemid) -- Function By Kydrai local items = {} if isContainer(container) and getContainerSize(container) > 0 then for slot=0, (getContainerSize(container)-1) do local item = getContainerItem(container, slot) if isContainer(item.uid) then local itemsbag = getItemsInContainerById(item.uid, itemid) for i=0, #itemsbag do table.insert(items, itemsbag[i]) end else if itemid == item.itemid then table.insert(items, item.uid) end end end end return items end function doPlayerAddItemStacking(cid, itemid, quant) local item = getItemsInContainerById(getPlayerSlotItem(cid, 3).uid, itemid) local piles = 0 if #item > 0 then for i,x in pairs(item) do if getThing(x).type < 100 then local it = getThing(x) doTransformItem(it.uid, itemid, it.type+quant) if it.type+quant > 100 then doPlayerAddItem(cid, itemid, it.type+quant-100) end else piles = piles+1 end end else return doPlayerAddItem(cid, itemid, quant) end if piles == #item then doPlayerAddItem(cid, itemid, quant) end end function corpseRetireItems(corpsepos, killer, itemsarray) local corpse = nil for i = 1, 254 do corpsepos.stackpos = i corpse = getThingFromPos(corpsepos) if corpse.uid > 0 and isCorpse(corpse.uid) then break end end local items = getContainerItems(corpse.uid) for i,x in pairs(items) do if isInArray(itemsarray, tonumber(x.itemid)) then if isItemStackable(x.itemid) then doPlayerAddItemStacking(killer, x.itemid, x.type) else doPlayerAddItem(killer, x.itemid) end doRemoveItem(x.uid, x.type) end end end ]]></config> <creaturescript type="kill" name="autoLootKill" event="script"><![CDATA[ domodlib("autoLootLib") local loots = getPlayerStorageTable(cid, 6616) if lastHit and #loots >= 1 then addEvent(corpseRetireItems, 100, getCreaturePosition(target), cid, loots) end return true ]]></creaturescript> <talkaction words="!autoloot;/autoloot" event="script"><![CDATA[ domodlib("autoLootLib") local t = string.explode(param, ",") for i,x in pairs(t) do if not getItemIdByName(x, false) then return doPlayerSendCancel(cid, "Some of these items don't exist.") end t[i] = getItemIdByName(x, false) end setPlayerStorageTable(cid, 6616, t) doPlayerSendTextMessage(cid, 25, "Auto Looting: " .. param) return true ]]></talkaction> <creaturescript type="login" name="autoLootRegister" event="script"><![CDATA[ registerCreatureEvent(cid, "autoLootKill") return true ]]></creaturescript> </mod>
    autoLoot.xml
  2. Upvote
    MatheusGlad recebeu reputação de 139 em Funçao Doplayeraddmanyitems(Cid, Itemid, Quant)   
    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.
  3. Upvote
    MatheusGlad recebeu reputação de Aragorn100 em [Pedido] Codigo De Skill Attack Speed   
    kkkkkkk SE MATA MLK NAO DA PRA EDITAR CLIENTE POR LUA? OKAY NEH.
     
    Soh pra te zuar ainda faço aki olha:
     
    Fail em demonbholder
     

  4. Upvote
    MatheusGlad recebeu reputação de 139 em Auto Loot System.   
    Video demonstrando o que faz o script:

     
    Para usar a talkaction eh simples:
    !autoloot itens (itens separados por virgula)
     
    Exemplo: !autoloot mastermind shield, gold coin
     
    Na pasta mods, bote esse xml, e pronto estara funcionando direitinho.
     
    autoLoot.xml:

    <?xml version="1.0" encoding="UTF-8"?> <mod name="autoLoot" enabled="yes" author="MatheusMkalo" forum="XTibia.com"> <config name="autoLootLib"><![CDATA[ function setPlayerStorageTable(cid, storage, tab) local tabstr = "&" for i,x in pairs(tab) do tabstr = tabstr .. i .. "," .. x .. ";" end setPlayerStorageValue(cid, storage, tabstr:sub(1, #tabstr-1)) end function getPlayerStorageTable(cid, storage) local tabstr = getPlayerStorageValue(cid, storage) local tab = {} if type(tabstr) ~= "string" then return {} end if tabstr:sub(1,1) ~= "&" then return {} end local tabstr = tabstr:sub(2, #tabstr) local a = string.explode(tabstr, ";") for i,x in pairs(a) do local b = string.explode(x, ",") tab[tonumber(b[1]) or b[1]] = tonumber(b[2]) or b[2] end return tab end function getContainerItems(containeruid) local items = {} local containers = {} if type(getContainerSize(containeruid)) ~= "number" then return false end for slot = 0, getContainerSize(containeruid)-1 do local item = getContainerItem(containeruid, slot) if item.itemid == 0 then break end if isContainer(item.uid) then table.insert(containers, item.uid) end table.insert(items, item) end if #containers > 0 then for i,x in ipairs(getContainerItems(containers[1])) do table.insert(items, x) end table.remove(containers, 1) end return items end function getItemsInContainerById(container, itemid) -- Function By Kydrai local items = {} if isContainer(container) and getContainerSize(container) > 0 then for slot=0, (getContainerSize(container)-1) do local item = getContainerItem(container, slot) if isContainer(item.uid) then local itemsbag = getItemsInContainerById(item.uid, itemid) for i=0, #itemsbag do table.insert(items, itemsbag[i]) end else if itemid == item.itemid then table.insert(items, item.uid) end end end end return items end function doPlayerAddItemStacking(cid, itemid, quant) local item = getItemsInContainerById(getPlayerSlotItem(cid, 3).uid, itemid) local piles = 0 if #item > 0 then for i,x in pairs(item) do if getThing(x).type < 100 then local it = getThing(x) doTransformItem(it.uid, itemid, it.type+quant) if it.type+quant > 100 then doPlayerAddItem(cid, itemid, it.type+quant-100) end else piles = piles+1 end end else return doPlayerAddItem(cid, itemid, quant) end if piles == #item then doPlayerAddItem(cid, itemid, quant) end end function corpseRetireItems(corpsepos, killer, itemsarray) local corpse = nil for i = 1, 254 do corpsepos.stackpos = i corpse = getThingFromPos(corpsepos) if corpse.uid > 0 and isCorpse(corpse.uid) then break end end local items = getContainerItems(corpse.uid) for i,x in pairs(items) do if isInArray(itemsarray, tonumber(x.itemid)) then if isItemStackable(x.itemid) then doPlayerAddItemStacking(killer, x.itemid, x.type) else doPlayerAddItem(killer, x.itemid) end doRemoveItem(x.uid, x.type) end end end ]]></config> <creaturescript type="kill" name="autoLootKill" event="script"><![CDATA[ domodlib("autoLootLib") local loots = getPlayerStorageTable(cid, 6616) if lastHit and #loots >= 1 then addEvent(corpseRetireItems, 100, getCreaturePosition(target), cid, loots) end return true ]]></creaturescript> <talkaction words="!autoloot;/autoloot" event="script"><![CDATA[ domodlib("autoLootLib") local t = string.explode(param, ",") for i,x in pairs(t) do if not getItemIdByName(x, false) then return doPlayerSendCancel(cid, "Some of these items don't exist.") end t[i] = getItemIdByName(x, false) end setPlayerStorageTable(cid, 6616, t) doPlayerSendTextMessage(cid, 25, "Auto Looting: " .. param) return true ]]></talkaction> <creaturescript type="login" name="autoLootRegister" event="script"><![CDATA[ registerCreatureEvent(cid, "autoLootKill") return true ]]></creaturescript> </mod>
    autoLoot.xml
  5. Upvote
    MatheusGlad recebeu reputação de Edenfield em Sistema De Novos Items   
    Bem, como todos sabem, não da pra criar 2 items com o mesmo sprite, somente editando a source e o dat etc...
     
    Usando esse sistema que eu fiz voce nao precisara editar nada somente adicionar os scripts.
     
    Primeiramente vá na pasta lib e crie um arquivo ItemsEditedLib.lua e adicione isso dentro:

    function doPlayerAddEditedItem(cid, itemid) local newxml = io.open("data/items/newitems.xml", "r") local configs = {} for i in newxml:read("*a"):gmatch("<item (.-)</item>") do local itemid = tonumber(i:match('id="(.-)"')) local itemconfig = { ["spriteid"] = tonumber(i:match('spriteid.-=.-"(.-)"')), ["article"] = i:match('article.-=.-"(.-)"'), ["name"] = i:match('name.-=.-"(.-)"'), ["description"] = i:match('key.-=.-"description".-value.-=.-"(.-)"'), ["defense"] = tonumber(i:match('key.-=.-"defense".-value.-=.-"(.-)"')), ["attack"] = tonumber(i:match('key.-=.-"attack".-value.-=.-"(.-)"')), ["extradefense"] = tonumber(i:match('key.-=.-"extradef".-value.-=.-"(.-)"')), ["armor"] = tonumber(i:match('key.-=.-"armor".-value.-=.-"(.-)"')), ["extraattack"] = tonumber(i:match('key.-=.-"extraatk".-value.-=.-"(.-)"')), } configs[itemid] = itemconfig end if configs[itemid] then local item = doPlayerAddItem(cid, configs[itemid].spriteid) for i,x in pairs(configs[itemid]) do doItemSetAttribute(item, i, x) end end end
     
    Depois vá na pasta items e adicione um arquivo newitems.XML (XML NAO LUA!!!) e adicione isso dentro:

    <?xml version="1.0" encoding="UTF-8"?> <items> <item id="100" spriteid="2400" article="a" name="magic edited sword"> <attribute key="description" value="Arma editada." /> <attribute key="defense" value="45" /> <attribute key="attack" value="100" /> <attribute key="extradef" value="10" /> <attribute key="extraatk" value="10" /> </item> <item id="101" spriteid="2472" article="a" name="master plate armor"> <attribute key="description" value="Armor editada." /> <attribute key="armor" value="19" /> </item> </items>
     
    Bem como voces podem ver, o xml guarda os novos items, o xml funciona praticamente como o items.xml so que tem um novo campo o "spriteid", nele fica o itemid original.
     
    Eu sei que ainda faltam atributos, com o tempo e com os pedidos eu vou adicionando. (É importante que voces peçam por novos atributos, porque os outros são mais complicados e eu nao vou faze-los para ninguem usar)
     
    Atributos:

    "description"
    "defense"
    "attack"
    "extradefense"
    "armor"
    "extraattack"

     
    Para adicionar os novos itemids aos players use doPlayerAddEditedItem(cid, ITEMID) em vez de doPlayerAddItem...
  6. Upvote
    MatheusGlad recebeu reputação de dully em War Arena System.   
    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
  7. Upvote
    MatheusGlad recebeu reputação de wolfh123 em Auto Loot System.   
    Video demonstrando o que faz o script:

     
    Para usar a talkaction eh simples:
    !autoloot itens (itens separados por virgula)
     
    Exemplo: !autoloot mastermind shield, gold coin
     
    Na pasta mods, bote esse xml, e pronto estara funcionando direitinho.
     
    autoLoot.xml:

    <?xml version="1.0" encoding="UTF-8"?> <mod name="autoLoot" enabled="yes" author="MatheusMkalo" forum="XTibia.com"> <config name="autoLootLib"><![CDATA[ function setPlayerStorageTable(cid, storage, tab) local tabstr = "&" for i,x in pairs(tab) do tabstr = tabstr .. i .. "," .. x .. ";" end setPlayerStorageValue(cid, storage, tabstr:sub(1, #tabstr-1)) end function getPlayerStorageTable(cid, storage) local tabstr = getPlayerStorageValue(cid, storage) local tab = {} if type(tabstr) ~= "string" then return {} end if tabstr:sub(1,1) ~= "&" then return {} end local tabstr = tabstr:sub(2, #tabstr) local a = string.explode(tabstr, ";") for i,x in pairs(a) do local b = string.explode(x, ",") tab[tonumber(b[1]) or b[1]] = tonumber(b[2]) or b[2] end return tab end function getContainerItems(containeruid) local items = {} local containers = {} if type(getContainerSize(containeruid)) ~= "number" then return false end for slot = 0, getContainerSize(containeruid)-1 do local item = getContainerItem(containeruid, slot) if item.itemid == 0 then break end if isContainer(item.uid) then table.insert(containers, item.uid) end table.insert(items, item) end if #containers > 0 then for i,x in ipairs(getContainerItems(containers[1])) do table.insert(items, x) end table.remove(containers, 1) end return items end function getItemsInContainerById(container, itemid) -- Function By Kydrai local items = {} if isContainer(container) and getContainerSize(container) > 0 then for slot=0, (getContainerSize(container)-1) do local item = getContainerItem(container, slot) if isContainer(item.uid) then local itemsbag = getItemsInContainerById(item.uid, itemid) for i=0, #itemsbag do table.insert(items, itemsbag[i]) end else if itemid == item.itemid then table.insert(items, item.uid) end end end end return items end function doPlayerAddItemStacking(cid, itemid, quant) local item = getItemsInContainerById(getPlayerSlotItem(cid, 3).uid, itemid) local piles = 0 if #item > 0 then for i,x in pairs(item) do if getThing(x).type < 100 then local it = getThing(x) doTransformItem(it.uid, itemid, it.type+quant) if it.type+quant > 100 then doPlayerAddItem(cid, itemid, it.type+quant-100) end else piles = piles+1 end end else return doPlayerAddItem(cid, itemid, quant) end if piles == #item then doPlayerAddItem(cid, itemid, quant) end end function corpseRetireItems(corpsepos, killer, itemsarray) local corpse = nil for i = 1, 254 do corpsepos.stackpos = i corpse = getThingFromPos(corpsepos) if corpse.uid > 0 and isCorpse(corpse.uid) then break end end local items = getContainerItems(corpse.uid) for i,x in pairs(items) do if isInArray(itemsarray, tonumber(x.itemid)) then if isItemStackable(x.itemid) then doPlayerAddItemStacking(killer, x.itemid, x.type) else doPlayerAddItem(killer, x.itemid) end doRemoveItem(x.uid, x.type) end end end ]]></config> <creaturescript type="kill" name="autoLootKill" event="script"><![CDATA[ domodlib("autoLootLib") local loots = getPlayerStorageTable(cid, 6616) if lastHit and #loots >= 1 then addEvent(corpseRetireItems, 100, getCreaturePosition(target), cid, loots) end return true ]]></creaturescript> <talkaction words="!autoloot;/autoloot" event="script"><![CDATA[ domodlib("autoLootLib") local t = string.explode(param, ",") for i,x in pairs(t) do if not getItemIdByName(x, false) then return doPlayerSendCancel(cid, "Some of these items don't exist.") end t[i] = getItemIdByName(x, false) end setPlayerStorageTable(cid, 6616, t) doPlayerSendTextMessage(cid, 25, "Auto Looting: " .. param) return true ]]></talkaction> <creaturescript type="login" name="autoLootRegister" event="script"><![CDATA[ registerCreatureEvent(cid, "autoLootKill") return true ]]></creaturescript> </mod>
    autoLoot.xml
  8. Upvote
    MatheusGlad recebeu reputação de Croof em Cadeira Para God/cm/gm   
    Bem... muita gente tem me pedido no msn uma cadeira que somente Gods,Gms e Cms pudessem sentar entao decidi fazer o script.
     
    Primeiramente o video de demonstraçao:
    http://vimeo.com/12733514
     
    Agora o script:
     
    Vá em movements/scripts e crie o arquivo lua com nome de cadeiras.lua e bote isto dentro:

    function onStepIn(cid, item, frompos, topos) local config = { actiongm = 50181, actioncm = 50182, actiongod = 50183 } if item.actionid == config.actiongod then if getPlayerAccess(cid) < 5 then doCreatureSay(cid, "Desculpe GOD, nao sento mais na sua cadeira.", TALKTYPE_SAY) doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid))) end elseif item.actionid == config.actioncm then if getPlayerAccess(cid) < 4 then doCreatureSay(cid, "Desculpe CM, nao sento mais na sua cadeira.", TALKTYPE_SAY) doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid))) end elseif item.actionid == config.actiongm then if getPlayerAccess(cid) < 3 then doCreatureSay(cid, "Desculpe GM, nao sento mais na sua cadeira.", TALKTYPE_SAY) doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid))) end end return TRUE end
     
    Depois va em movements.xml e adicione esta tag:

    <movevent type="StepIn" actionid="50181;50182;50183" event="script" value="cadeiras.lua"/>
     
    Agora va no map editor e bote os seguintes ActionID's:
    Na cadeira de god, bote o actionid 50183.
    Na cadeira de cm, bote o actionid 50182.
    Na cadeira de gm, bote o actionid 50181.
     
    Pronto, espero que tenham gostado flw.
  9. Upvote
    MatheusGlad recebeu reputação de Vinc em [Arquivado]Funçao Docreateiteminarea(Firstpos, Area, Tab)   
    Function:

    function doCreateItemInArea(firstpos, area, tab) -- function by MatheusMkalo for i, z in pairs(area) do pos = {x=firstpos.x, y=firstpos.y+i-1, z=firstpos.z} for s, x in pairs(z) do pos.x = firstpos.x+s-1 if tab[x] or type(x) == "table" then for l = 1, type(x) == "table" and #x or 1 do item = doCreateItem(type(x) == "table" and (not tab[x[l]].name and tab[x[l]].itemid or getItemIdByName(tab[x[l]].name)) or (not tab[x].name and tab[x].itemid or getItemIdByName(tab[x[l]].name)), type(x) == "table" and (tab[x[l]].count == nil and 1 or tab[x[l]].count) or tab[x].count == nil and 1 or tab[x].count, pos) doItemSetAttribute(item, "aid", type(x) == "table" and (tab[x[l]].actionid == nil and 0 or tab[x[l]].actionid) or tab[x].actionid == nil and 0 or tab[x].actionid) end end end end return TRUE end
     
    Bem oque ela faz eu acho que ja da pra saber né, mas pra quem nao sabe ingles:
    A funçao cria itens em uma area.
     
    Como usar a function:
     
    Bem pra usar eh bem simples, basta criar uma area parecida com a de uma magia e botar a posiçao do primeiro "sqm"
     
    Uma talkaction que cria itens em volta do player:
     
    Vou explicar mais um pouco as coisas:
     
    Oque esta em vermelho eh a pos do primeiro sqm da area que seria o de azul:
     
    Oque esta em rosa seria a area que no caso eh a areacreate.
    Oque esta em laranja sao oque os numeros na area vao representar:
    local items = {
    [1] = {itemid = 2160, count = 1},
    [2] = {itemid = 2160, count = 2},
    [3] = {itemid = 2160, count = 3},
    }
     
    No caso dessa tabela, aonde estiver o numero 1 na area, vai criar 1 item de id 2160 aonde estiver 2, criara 2 items de id 2160, e assim por diante.
     
    Voce nao é obrigado a colocar uma quantidade voce pode deixar somente o itemid que nao ira bugar.
     
     
    Algumas propriedades a mais:
     
    Se voce quiser criar varios items no mesmo tile voce pode, voce so precisa botar eles entre chaves assim:
    local areacreate = {
    {{3,2}, {1,2}, {3,1}},
    {{3,1}, 0, {1,2}},
    {{2,3}, {3,2}, {3,3}},
    }
     
    Voce pode trocar o itemid = 2160 por name = "Crystal Coin" que ira ir perfeitamente:
    local items = {
    [1] = {name = "Golden Helmet"},
    [2] = {name = "Magic Plate Armor"},
    [3] = {name = "Crystal Coin", count = 5},
    }
     
    local areacreate = {
    {{3,2}, {1,2}, {3,1}},
    {{3,1}, 0, {1,2}},
    {{2,3}, {3,2}, {3,3}},
    }
     
    Voce pode botar actionids nos items assim:
    local items = {
    [1] = {name = "Golden Helmet"},
    [2] = {name = "Magic Plate Armor", actionid = 666},
    [3] = {name = "Crystal Coin", count = 5},
    }
     
    Lembre-se que todos os items 2 que forem criados terao akele actionid.
     
     
    Pronto, use e abuse. Nao gaste seu rep+ comigo, so um elogio ja ta otimo.
     
    Algumas areas e ids para brincar:
     
     
  10. Upvote
    MatheusGlad recebeu reputação de Bluetooth em Item Ou Potion De Double Exp.   
    Item ou potion de double exp.

    By: MatheusMkalo


    Primeiramente vamos ver oque o script tem de diferente dos outros:

    Se voce sair com o efeito da exp potion o tempo da potion continuara passando, se voce logar antes que ele acabe voce ainda vai poder aproveitar umpouco da double exp. Voce pode escolher varias opçoes, como escolher se so premium accounts podem usar o item, quanta mana vai gasta, se vai remover quando usar e outros
    AGORA O SCRIPT SOH ESTA DISPONIVEL EM MOD:

    Vá na pasta mods e adicione um arquivo.xml com o nome de ExpPotion.xml e bote isso:

    <?xml version="1.0" encoding="UTF-8"?> <mod name="AdvancedExpPotionSystem" enabled="yes" author="MatheusMkalo" forum="XTibia.com"> <!-- Configs and Functions --> <config name="PotionExpConfigs"><![CDATA[ ------ CONFIGURE SEU SCRIPT ------ TRUE ou FALSE configs = { time = 1, ---- TIME IN MINUTES needpa = TRUE, needlvl = {TRUE, level = 50}, costmana = {TRUE, mana = 300}, addrate = 20, -- Exp que vai adicionar em % removeonuse = TRUE } function getTime(s) local n = math.floor(s / 60) s = s - (60 * n) return n, s end CreatureEventChecker = function(event, ...) -- Colex if isCreature(arg[1]) then event(unpack(arg)) end end creatureEvent = function(event, delay, ...) -- Colex addEvent(CreatureEventChecker, delay, event, unpack(arg)) end function getPlayerExtraExpRate(cid) -- By MatheusMkalo return (getPlayerRates(cid)[8]-1)*100 end ]]></config> <!-- exppotion.lua --> <action itemid="7440" event="script"><![CDATA[ domodlib('PotionExpConfigs') if getPlayerStorageValue(cid, 62164) >= 1 then return doPlayerSendCancel(cid, "You are already taking effect from this item.") end if configs.needpa and not isPremium(cid) then return doPlayerSendCancel(cid, "You need to be a premmium account to use this item.") end if configs.needlvl[1] and getPlayerLevel(cid) < configs.needlvl.level then return doPlayerSendCancel(cid, "You need to be level " .. configs.needlvl.level .. " to use this item.") end if configs.costmana[1] then if getCreatureMana(cid) < configs.costmana.mana then return doPlayerSendCancel(cid, "You need " .. configs.costmana.mana .. " mana to use this item.") else doCreatureAddMana(cid, -configs.costmana.mana) end end if configs.removeonuse then doRemoveItem(item.uid, 1) end for i = configs.time*60, 1, -1 do local a = math.floor(i/60) .. ":" .. i - (60 * math.floor(i/60)) if #a < 4 then a = string.sub(a,1,2) .. "0" .. string.sub(a, 3) end if i == configs.time*60 then creatureEvent(doPlayerSendCancel, configs.time*60*1000, cid, "The effect of the exp potion end.") end creatureEvent(doPlayerSendCancel, (configs.time*60-i)*1000, cid, "The effect of the exp potion will end in "..a..".") end doPlayerSetExperienceRate(cid, (1+(configs.addrate/100))+(getPlayerExtraExpRate(cid)/100)) creatureEvent(doPlayerSetExperienceRate, configs.time *60*1000, cid, 1+(getPlayerExtraExpRate(cid)/100-(configs.addrate/100))) doPlayerSendTextMessage(cid, 22, "Agora voce ira receber mais exp por matar os mosntros.") setPlayerStorageValue(cid, 62164, os.time()) creatureEvent(setPlayerStorageValue, configs.time *60*1000, cid, 62164, 0) return TRUE ]]></action> <creaturescript type="login" name="ExpPotion" event="script"><![CDATA[ domodlib('PotionExpConfigs') local time = configs.time if os.time()-getPlayerStorageValue(cid, 62164) < time *60 then doPlayerSetExperienceRate(cid, (1+(configs.addrate/100))+(getPlayerExtraExpRate(cid)/100)) creatureEvent(doPlayerSetExperienceRate, (time*60-(os.time()-getPlayerStorageValue(cid, 62164))) * 1000, cid, 1+(getPlayerExtraExpRate(cid)/100-(configs.addrate/100))) creatureEvent(setPlayerStorageValue, (time*60-(os.time()-getPlayerStorageValue(cid, 62164))) * 1000 , cid, 62164, 0) for i = (time*60-(os.time()-getPlayerStorageValue(cid, 62164))), 1, -1 do local a = math.floor(i/60) .. ":" .. i - (60 * math.floor(i/60)) if #a < 4 then a = string.sub(a,1,2) .. "0" .. string.sub(a, 3) end if i == (time*60-(os.time()-getPlayerStorageValue(cid, 62164))) then creatureEvent(doPlayerSendCancel, (time*60-(os.time()-getPlayerStorageValue(cid, 62164)))*1000, cid, "The effect of the exp potion end.") end creatureEvent(doPlayerSendCancel, ((time*60-(os.time()-getPlayerStorageValue(cid, 62164)))-i)*1000, cid, "The effect of the exp potion will end in "..a..".") end end return TRUE ]]></creaturescript> </mod>
    Tudo pronto, exp potion funcionando!

    O ID da potion usada no script foi o: 7440 (Mastermind Potion)
    Para usa-lo voce precisa tirar a linha no actions.xml da potion porque se nao vai bugar.

    Para trocar o id da potion eh so mudar essa linha:
    <action itemid="7440" event="script"><![CDATA[



    Resposta para o Topico: Aew Galera Preciso Scripting Da Double Exp
    Potion
  11. Upvote
    MatheusGlad recebeu reputação de tonynamoral em Barco Que Anda Por Uma Rota.   
    Gente peçam coisas adicionais baseadas no meu sistema no topico de pedidos de scripts porfavor.
  12. Upvote
    MatheusGlad recebeu reputação de jamersonandres em War Arena System.   
    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
  13. Upvote
    MatheusGlad recebeu reputação de 749676 em Ajuda Alavanca.   
    smp_id = 7589 -- Item a ser vendido custosmp_id = 1600 -- Valor quant = 100 function onUse(cid, item, fromPosition, itemEx, toPosition) local name = getItemNameById(smp_id) if doPlayerRemoveMoney(cid, custosmp_id) then doPlayerAddItem(cid, smp_id, quant) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have purchased " .. quant .. " ".. name .."s for ".. custosmp_id .." gold.") else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You need ".. custosmp_id .." gold coins for ".. quant .. " ".. name .."s.") end end
  14. Upvote
    MatheusGlad recebeu reputação de KingOFSkyer em Script Para Quests   
    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.
  15. Upvote
    MatheusGlad recebeu reputação de lailton em Tentando Entender O Funcionamento Do Table   
    tenta assim

    itemA = { ["ztibia"]={n=3}, ["xtibia"]={n=1}, ["ytibia"]={n=2} } itemB = {} --for cItem,v in pairs(itemA) do -- table.insert(itemB,{[ itemA[cItem].n ] = { c = cItem } }) --end itemB[3] = {c="ztibia"} itemB[1] = {c="xtibia"} itemB[2] = {c="ytibia"} for i=1,table.maxn( itemB ) do print( itemB[i].c ) -- nao lista os item... end
     
    Automatizado:

    itemA = { ["ztibia"]={n=3}, ["xtibia"]={n=1}, ["ytibia"]={n=2} } itemB = {} for cItem,v in pairs(itemA) do itemB[itemA[cItem].n] = {c = cItem} end for i=1,table.maxn( itemB ) do print( itemB[i].c ) -- nao lista os item... end
  16. Upvote
    MatheusGlad recebeu reputação de gabisaoo em Sistema De Novos Items   
    Bem, como todos sabem, não da pra criar 2 items com o mesmo sprite, somente editando a source e o dat etc...
     
    Usando esse sistema que eu fiz voce nao precisara editar nada somente adicionar os scripts.
     
    Primeiramente vá na pasta lib e crie um arquivo ItemsEditedLib.lua e adicione isso dentro:

    function doPlayerAddEditedItem(cid, itemid) local newxml = io.open("data/items/newitems.xml", "r") local configs = {} for i in newxml:read("*a"):gmatch("<item (.-)</item>") do local itemid = tonumber(i:match('id="(.-)"')) local itemconfig = { ["spriteid"] = tonumber(i:match('spriteid.-=.-"(.-)"')), ["article"] = i:match('article.-=.-"(.-)"'), ["name"] = i:match('name.-=.-"(.-)"'), ["description"] = i:match('key.-=.-"description".-value.-=.-"(.-)"'), ["defense"] = tonumber(i:match('key.-=.-"defense".-value.-=.-"(.-)"')), ["attack"] = tonumber(i:match('key.-=.-"attack".-value.-=.-"(.-)"')), ["extradefense"] = tonumber(i:match('key.-=.-"extradef".-value.-=.-"(.-)"')), ["armor"] = tonumber(i:match('key.-=.-"armor".-value.-=.-"(.-)"')), ["extraattack"] = tonumber(i:match('key.-=.-"extraatk".-value.-=.-"(.-)"')), } configs[itemid] = itemconfig end if configs[itemid] then local item = doPlayerAddItem(cid, configs[itemid].spriteid) for i,x in pairs(configs[itemid]) do doItemSetAttribute(item, i, x) end end end
     
    Depois vá na pasta items e adicione um arquivo newitems.XML (XML NAO LUA!!!) e adicione isso dentro:

    <?xml version="1.0" encoding="UTF-8"?> <items> <item id="100" spriteid="2400" article="a" name="magic edited sword"> <attribute key="description" value="Arma editada." /> <attribute key="defense" value="45" /> <attribute key="attack" value="100" /> <attribute key="extradef" value="10" /> <attribute key="extraatk" value="10" /> </item> <item id="101" spriteid="2472" article="a" name="master plate armor"> <attribute key="description" value="Armor editada." /> <attribute key="armor" value="19" /> </item> </items>
     
    Bem como voces podem ver, o xml guarda os novos items, o xml funciona praticamente como o items.xml so que tem um novo campo o "spriteid", nele fica o itemid original.
     
    Eu sei que ainda faltam atributos, com o tempo e com os pedidos eu vou adicionando. (É importante que voces peçam por novos atributos, porque os outros são mais complicados e eu nao vou faze-los para ninguem usar)
     
    Atributos:

    "description"
    "defense"
    "attack"
    "extradefense"
    "armor"
    "extraattack"

     
    Para adicionar os novos itemids aos players use doPlayerAddEditedItem(cid, ITEMID) em vez de doPlayerAddItem...
  17. Upvote
    MatheusGlad recebeu reputação de bielwayne em Como Editar Magias [Novo Update]   
    Versao 0.1b Tutorial
    Voce nao Sabe nada sobre scripts e nem mesmo como funcionao e quer criar uma magia
    Voce pode ir no classico copy/paste:
    Primeiro Passo:
    Copie uma tag no spells.xml Exemplo:


    E cole logo a baixo uma identica.
    Agora edite certos campos:



    Vermelho Palavras a serem ditas para a magia sair
    Verde Level para Usar a magia
    Amarelo Mana pra Usar a magia

    Negrito Voce deve mudar para o nome do seu script, no caso usaremos eternal extreme winter

    Procure na pasta scripts/attack o bloco de notas chamado eternal winter copieo e cole renomeie-o para eternal extreme winter, abaixo ensino como editar.


    Em seguida voce pode editar certas coisas



    Azul Minimo Dano -- Leve em base que dakele geito que esta 2.7 ira dar 500 de dano se voce multiplicar por 2 o 2.7 ira ficar 5.4 e ira dar 1000 de dano
    Rosa Maximo Dano -- mesmo conceito de cima

    Laranja se voce nao conhece o comando pode ser !z 1,2,3...66 ou /z 1,2,3...66 useo no seu ot e veja um bem legal e apague toda a parte laranja e bote o efeito que voce quer no meu caso irei botar 61

    Conclusao a magia ira ficar com a forma do exevo gran mas frigo com otro dano e com otro efeito

    ___________
    Update 0.2a

    Usando tambem o comando !x ou /x 1,2,3...41

    Na linha da sua magia vai estar assim:




    Para usar os efeitos do /x ou !x voce deve botar antes do EFFECT a palavra DISTANCE e ficara assim:




    Negrito Como devera ficar para utilizar o comando !x ou /x

    Listinha de efeitos e seus devidos nomes:


    ___________________
    Update 0.2b

    Mudando a area da sua spell:

    Repare a linha da nossa primeira spell la em cima




    Neste local voce edita a area da sua magia vamos começar:

    Apague toda akela linha acima em negrito e bote isto:






    Legenda dos numeros:
    0 = nao vai acertar a magia
    1 = aonde a magia vai acertar
    2 = centro que eh o player (nao acertara tambem)

    Agora voce pode fazer uma area que voce queira de qualquer forma
    ___________________
    Update 0.3a

    Como Trocar o Dano da sua Magia:

    Para trocar o tipo de dano repare a linha da magia:



    Vermelho Eh o tipo de dano que ira dar eh so mudalo para outro tipo

    Listinha de Danos:

    COMBAT_PHYSICALDAMAGE - 1COMBAT_ENERGYDAMAGE - 2COMBAT_EARTHDAMAGE - 4COMBAT_POISONDAMAGE - 4COMBAT_FIREDAMAGE - 8COMBAT_UNDEFINEDDAMAGE - 16COMBAT_LIFEDRAIN - 32COMBAT_MANADRAIN - 64COMBAT_HEALING - 128COMBAT_DROWNDAMAGE - 256COMBAT_ICEDAMAGE - 512COMBAT_HOLYDAMAGE - 1024COMBAT_DEATHDAMAGE - 2048PS:Voce pode usar os numeros no lugar das palavras

    ___________________
    Update 0.3b
    Botando em pratica tudo que aprendemos!

    Neste update nos iremos usar todo o conteudo do tutorial para fazer uma magia com varios efeitos,danos e areas diferentes

    Aqui esta o script que criei para trabalharmos em cima dele:


    Legenda:
    Azul Dano de cada wave (onda) da sua magia
    Negrito Area das magias (arr)
    Vermelho Pausa de uma wave para outra, se quizer aumente bote 100,300,500...

    Pronto agora se voce viu os outros updates sabera mudar dano efeito e fazer uma otima magia bem louca

    Video de Demonstraçao:




    __________
    Fim dos Updates (Se voce tiver alguma opniao de update MP para mim que eu faço mais updates)
  18. Upvote
    MatheusGlad recebeu reputação de ALLan162 em [Download]Quest Maker E Como Usar   
    Fikei em duvida se postava na aprovaçao de tutorial ou downloads, pois o meu contem os dois.
    Quest Maker Download: 4shared
     
    Virus Scan Virus Total
    Ps: So 1 antivirus achou, acho que inofensivo.
     
    Como usar:
    Ele e um programa muito simples de se usar porem algumas pessoas nao sabem, irei explicar.
     
    Apos baixar o Quest Maker bote-o na pasta "actions/scripts" do seu otserver.
    Em seguida,abra-o e espera carregar.
     
    Preencha todos os campos do quest maker. Use a ss como exemplo

     
    1 - Nome do Arquivo.lua onde ficara o script (dentro da pasta aonde botou o Quest Maker)
     
    2 - Comentarios (Nao ira modificar em nada seu script)
     
    3 - Unique ID que voce vai botar no bau da quest.(Sempre botar um numero qualquer que n tenha em actions.xml)
     
    4 - Storage ID. (Pode ser o mesmo do Unique ID, mais nao afetara se for diferente)
     
    5 - Mensagem que ira aparecer apos completar a quest.
     
    6 - Botao que cria o script em sua pasta.
     
    7 - ID do item que ira dar na quest.
     
    8 - Apaga todas as suas configuraçoes feitas no programa.
     
    9 - Cria Tag que voce ira botar em actions.xml
     
    10 - NAO USE ESTA BUGADO ELE TE DA OS IDS ERRADOS
    11 - Aonde aparece sua tag criada pelo botao numero 9
    Criando o Bau:
    Agora abra o seu mapa com o seu Map Editor e crie um bau.
    Adicione o UniqueId que voce colocou no Quest Maker.
    Salve e aproveite!
     
    Quest Criada com Sucesso
     
    Tutorial by MatheusMkalo, exclusivo para o Xtibia
    Copia Ilegal,PROIBIDA
     
    Sugestoes,Duvidas,Elogios aceitados nesse topico ou via MP.
  19. Upvote
    MatheusGlad recebeu reputação de malukinho14 em [Download]Quest Maker E Como Usar   
    Fikei em duvida se postava na aprovaçao de tutorial ou downloads, pois o meu contem os dois.
    Quest Maker Download: 4shared
     
    Virus Scan Virus Total
    Ps: So 1 antivirus achou, acho que inofensivo.
     
    Como usar:
    Ele e um programa muito simples de se usar porem algumas pessoas nao sabem, irei explicar.
     
    Apos baixar o Quest Maker bote-o na pasta "actions/scripts" do seu otserver.
    Em seguida,abra-o e espera carregar.
     
    Preencha todos os campos do quest maker. Use a ss como exemplo

     
    1 - Nome do Arquivo.lua onde ficara o script (dentro da pasta aonde botou o Quest Maker)
     
    2 - Comentarios (Nao ira modificar em nada seu script)
     
    3 - Unique ID que voce vai botar no bau da quest.(Sempre botar um numero qualquer que n tenha em actions.xml)
     
    4 - Storage ID. (Pode ser o mesmo do Unique ID, mais nao afetara se for diferente)
     
    5 - Mensagem que ira aparecer apos completar a quest.
     
    6 - Botao que cria o script em sua pasta.
     
    7 - ID do item que ira dar na quest.
     
    8 - Apaga todas as suas configuraçoes feitas no programa.
     
    9 - Cria Tag que voce ira botar em actions.xml
     
    10 - NAO USE ESTA BUGADO ELE TE DA OS IDS ERRADOS
    11 - Aonde aparece sua tag criada pelo botao numero 9
    Criando o Bau:
    Agora abra o seu mapa com o seu Map Editor e crie um bau.
    Adicione o UniqueId que voce colocou no Quest Maker.
    Salve e aproveite!
     
    Quest Criada com Sucesso
     
    Tutorial by MatheusMkalo, exclusivo para o Xtibia
    Copia Ilegal,PROIBIDA
     
    Sugestoes,Duvidas,Elogios aceitados nesse topico ou via MP.
  20. Upvote
    MatheusGlad recebeu reputação de LeoTK em Como Editar Magias [Novo Update]   
    Versao 0.1b Tutorial
    Voce nao Sabe nada sobre scripts e nem mesmo como funcionao e quer criar uma magia
    Voce pode ir no classico copy/paste:
    Primeiro Passo:
    Copie uma tag no spells.xml Exemplo:


    E cole logo a baixo uma identica.
    Agora edite certos campos:



    Vermelho Palavras a serem ditas para a magia sair
    Verde Level para Usar a magia
    Amarelo Mana pra Usar a magia

    Negrito Voce deve mudar para o nome do seu script, no caso usaremos eternal extreme winter

    Procure na pasta scripts/attack o bloco de notas chamado eternal winter copieo e cole renomeie-o para eternal extreme winter, abaixo ensino como editar.


    Em seguida voce pode editar certas coisas



    Azul Minimo Dano -- Leve em base que dakele geito que esta 2.7 ira dar 500 de dano se voce multiplicar por 2 o 2.7 ira ficar 5.4 e ira dar 1000 de dano
    Rosa Maximo Dano -- mesmo conceito de cima

    Laranja se voce nao conhece o comando pode ser !z 1,2,3...66 ou /z 1,2,3...66 useo no seu ot e veja um bem legal e apague toda a parte laranja e bote o efeito que voce quer no meu caso irei botar 61

    Conclusao a magia ira ficar com a forma do exevo gran mas frigo com otro dano e com otro efeito

    ___________
    Update 0.2a

    Usando tambem o comando !x ou /x 1,2,3...41

    Na linha da sua magia vai estar assim:




    Para usar os efeitos do /x ou !x voce deve botar antes do EFFECT a palavra DISTANCE e ficara assim:




    Negrito Como devera ficar para utilizar o comando !x ou /x

    Listinha de efeitos e seus devidos nomes:


    ___________________
    Update 0.2b

    Mudando a area da sua spell:

    Repare a linha da nossa primeira spell la em cima




    Neste local voce edita a area da sua magia vamos começar:

    Apague toda akela linha acima em negrito e bote isto:






    Legenda dos numeros:
    0 = nao vai acertar a magia
    1 = aonde a magia vai acertar
    2 = centro que eh o player (nao acertara tambem)

    Agora voce pode fazer uma area que voce queira de qualquer forma
    ___________________
    Update 0.3a

    Como Trocar o Dano da sua Magia:

    Para trocar o tipo de dano repare a linha da magia:



    Vermelho Eh o tipo de dano que ira dar eh so mudalo para outro tipo

    Listinha de Danos:

    COMBAT_PHYSICALDAMAGE - 1COMBAT_ENERGYDAMAGE - 2COMBAT_EARTHDAMAGE - 4COMBAT_POISONDAMAGE - 4COMBAT_FIREDAMAGE - 8COMBAT_UNDEFINEDDAMAGE - 16COMBAT_LIFEDRAIN - 32COMBAT_MANADRAIN - 64COMBAT_HEALING - 128COMBAT_DROWNDAMAGE - 256COMBAT_ICEDAMAGE - 512COMBAT_HOLYDAMAGE - 1024COMBAT_DEATHDAMAGE - 2048PS:Voce pode usar os numeros no lugar das palavras

    ___________________
    Update 0.3b
    Botando em pratica tudo que aprendemos!

    Neste update nos iremos usar todo o conteudo do tutorial para fazer uma magia com varios efeitos,danos e areas diferentes

    Aqui esta o script que criei para trabalharmos em cima dele:


    Legenda:
    Azul Dano de cada wave (onda) da sua magia
    Negrito Area das magias (arr)
    Vermelho Pausa de uma wave para outra, se quizer aumente bote 100,300,500...

    Pronto agora se voce viu os outros updates sabera mudar dano efeito e fazer uma otima magia bem louca

    Video de Demonstraçao:




    __________
    Fim dos Updates (Se voce tiver alguma opniao de update MP para mim que eu faço mais updates)
  21. Upvote
    MatheusGlad recebeu reputação de EliaWalak em Sistema De Novos Items   
    Bem, como todos sabem, não da pra criar 2 items com o mesmo sprite, somente editando a source e o dat etc...
     
    Usando esse sistema que eu fiz voce nao precisara editar nada somente adicionar os scripts.
     
    Primeiramente vá na pasta lib e crie um arquivo ItemsEditedLib.lua e adicione isso dentro:

    function doPlayerAddEditedItem(cid, itemid) local newxml = io.open("data/items/newitems.xml", "r") local configs = {} for i in newxml:read("*a"):gmatch("<item (.-)</item>") do local itemid = tonumber(i:match('id="(.-)"')) local itemconfig = { ["spriteid"] = tonumber(i:match('spriteid.-=.-"(.-)"')), ["article"] = i:match('article.-=.-"(.-)"'), ["name"] = i:match('name.-=.-"(.-)"'), ["description"] = i:match('key.-=.-"description".-value.-=.-"(.-)"'), ["defense"] = tonumber(i:match('key.-=.-"defense".-value.-=.-"(.-)"')), ["attack"] = tonumber(i:match('key.-=.-"attack".-value.-=.-"(.-)"')), ["extradefense"] = tonumber(i:match('key.-=.-"extradef".-value.-=.-"(.-)"')), ["armor"] = tonumber(i:match('key.-=.-"armor".-value.-=.-"(.-)"')), ["extraattack"] = tonumber(i:match('key.-=.-"extraatk".-value.-=.-"(.-)"')), } configs[itemid] = itemconfig end if configs[itemid] then local item = doPlayerAddItem(cid, configs[itemid].spriteid) for i,x in pairs(configs[itemid]) do doItemSetAttribute(item, i, x) end end end
     
    Depois vá na pasta items e adicione um arquivo newitems.XML (XML NAO LUA!!!) e adicione isso dentro:

    <?xml version="1.0" encoding="UTF-8"?> <items> <item id="100" spriteid="2400" article="a" name="magic edited sword"> <attribute key="description" value="Arma editada." /> <attribute key="defense" value="45" /> <attribute key="attack" value="100" /> <attribute key="extradef" value="10" /> <attribute key="extraatk" value="10" /> </item> <item id="101" spriteid="2472" article="a" name="master plate armor"> <attribute key="description" value="Armor editada." /> <attribute key="armor" value="19" /> </item> </items>
     
    Bem como voces podem ver, o xml guarda os novos items, o xml funciona praticamente como o items.xml so que tem um novo campo o "spriteid", nele fica o itemid original.
     
    Eu sei que ainda faltam atributos, com o tempo e com os pedidos eu vou adicionando. (É importante que voces peçam por novos atributos, porque os outros são mais complicados e eu nao vou faze-los para ninguem usar)
     
    Atributos:

    "description"
    "defense"
    "attack"
    "extradefense"
    "armor"
    "extraattack"

     
    Para adicionar os novos itemids aos players use doPlayerAddEditedItem(cid, ITEMID) em vez de doPlayerAddItem...
  22. Upvote
    MatheusGlad recebeu reputação de soulpop em [Duvida] Ajuda Aqui Urgente !   
    Vai em data/talkactions/scripts abre o teleportto.lua e substitui por isso:

    function getPlayerOnlineWithIp(ip) for i,x in pairs(getPlayersOnline()) do if doConvertIntegerToIp(getPlayerIp(x)) == ip then return x end end end function onSay(cid, words, param, channel) if(param == '') then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires param.") return true end local creature = getCreatureByName(param) local player = getPlayerByNameWildcard(param) local waypoint = getWaypointPosition(param) local tile = string.explode(param, ",") local pos = {x = 0, y = 0, z = 0} local playerbyip = getPlayerOnlineWithIp(param) if(player ~= nil and (not isPlayerGhost(player) or getPlayerGhostAccess(player) <= getPlayerGhostAccess(cid))) then pos = getCreaturePosition(player) elseif(creature ~= nil and (not isPlayer(creature) or (not isPlayerGhost(creature) or getPlayerGhostAccess(creature) <= getPlayerGhostAccess(cid)))) then pos = getCreaturePosition(creature) elseif(type(waypoint) == 'table' and waypoint.x ~= 0 and waypoint.y ~= 0) then pos = waypoint elseif(tile[2] and tile[3]) then pos = {x = tile[1], y = tile[2], z = tile[3]} elseif(isPlayer(playerbyip)) then pos = getCreaturePosition(playerbyip) else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Invalid param specified.") return true end if(not pos or isInArray({pos.x, pos.y}, 0)) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Destination not reachable.") return true end pos = getClosestFreeTile(cid, pos, true, false) if(not pos or isInArray({pos.x, pos.y}, 0)) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Cannot perform action.") return true end local tmp = getCreaturePosition(cid) if(doTeleportThing(cid, pos, true) and not isPlayerGhost(cid)) then doSendMagicEffect(tmp, CONST_ME_POFF) doSendMagicEffect(pos, CONST_ME_TELEPORT) end return true end
     
    Pra usar é igual seu exemplo, /goto 127.0.0.1
  23. Upvote
    MatheusGlad recebeu reputação de hayron87 em Talkaction De Rank Inovadora!   
    Bem, a talkaction é a mesma coisa que o !rank que conhecemos, porem voce pode adicionar outros ranks e ela atualiza exatamente na hora que alguem upa.
     
    Exemplos de novos ranks:
    Rank para ver quem morreu mais.
    Rank para level de players vip.
    Rank para ver quem matou mais monstros no ot.
     
    E varios outros...
     
    Bem se alguem quizer implementar um novo rank, peça no topico e mande PM para mim (Nao adianta so pedir no topico porque eu nao irei lembrar de entrar nele).
     
    O script está em mod, bem mais facil de instalar.
     
    Va na pasta mods do seu ot e adicione o arquivo: RankSystem em formato XML e adicione isso:

    <?xml version="1.0" encoding="UTF-8"?> <mod name="RankSystem" enabled="yes" author="MatheusMkalo" forum="XTibia.com"> <config name="RankLib"><![CDATA[ ranks = { ["fist"] = 74666, ["club"] = 74667, ["sword"] = 74668, ["axe"] = 74669, ["distance"] = 74670, ["shielding"] = 74671, ["fishing"] = 74672, ["magic"] = 74673, ["level"] = 74674, ["monsters"] = 74675, ["guilds"] = 74676 } function havePlayerInRank(rank, playername) -- Checa se o player ja esta no rank. local rankstr = getGlobalStorageValue(ranks[rank]) local players = string.explode(rankstr, "; ") for i,x in pairs(players) do local a, b = string.find(x, "%[") if b ~= nil then if x:sub(1, b-1):lower() == playername:lower() then return TRUE end end end end function getPlayerLevelInRank(rank, playername) -- Pega o level de algum player no rank (Importante para novos tipos de rank.) local rankstr = getGlobalStorageValue(ranks[rank]) local players = string.explode(rankstr, "; ") for i,x in pairs(players) do local a, b = string.find(x, "%[") local t = string.match(x, "%[(.+)]") if b ~= nil and x:sub(1, b-1):lower() == playername:lower() then return t end end return 0 end function addRankPlayer(rank, playername, rankvalue) -- Adiciona um player ao rank ou muda o valor dele no rank. if not havePlayerInRank(rank, playername) then setGlobalStorageValue(ranks[rank], getGlobalStorageValue(ranks[rank]) .. (playername .. "[" .. rankvalue .. "]; ")) else local a,b = string.find(getGlobalStorageValue(ranks[rank]), playername) local c,d = string.find(getGlobalStorageValue(ranks[rank]), playername .. "%[%d+]") setGlobalStorageValue(ranks[rank], getGlobalStorageValue(ranks[rank]):sub(1, b+1) .. rankvalue .. "]; " .. getGlobalStorageValue(ranks[rank]):sub(d+2)) end end function tablelen(tab) -- By MatheusMkalo local result = 0 for i,x in pairs(tab) do result = result+1 end return result end function getRank(rank, maxplayers) -- Pega a lista de players com maior level do rank local rankstr = getGlobalStorageValue(ranks[rank]) local playerstatus = string.explode(rankstr, "; ") local tab = {} local rankTab = {} local rankStr = "Highscore for " .. rank .. "\n\n" .. (isInArray({"monsters", "guilds"}, rank) and "Number of Kills" or "Rank Level") .. " - " .. (rank == "guilds" and "Guild Name" or "Player Name") .. "\n" table.remove(playerstatus, #playerstatus) for i,x in pairs(playerstatus) do local a, b = string.find(x, "%[") local t = string.match(x, "%[(.+)]") tab[x:sub(1, b-1)] = tonumber(t) end local lastname = "" local lastvalue = 0 for i = 1, maxplayers do if tablelen(tab) <= 0 then break end for s,x in pairs(tab) do if x > lastvalue then lastvalue = x lastname = s end end table.insert(rankTab, lastvalue .. " - " .. lastname) tab[lastname] = nil lastname = "" lastvalue = 0 end for i,x in ipairs(rankTab) do rankStr = rankStr .. (i .. ". ") .. x .. "\n" end return rankStr end ]]></config> <talkaction words="!rank;/rank" event="script"><![CDATA[ domodlib('RankLib') if ranks[param:lower()] then setGlobalStorageValue(ranks[param:lower()], getGlobalStorageValue(ranks[param:lower()]) == -1 and "" or getGlobalStorageValue(ranks[param:lower()])) doShowTextDialog(cid, 6500, getRank(param:lower(), 10)) else return doPlayerSendCancel(cid, "Esse rank nao existe ou voce nao digitou corretamente.") end return TRUE ]]></talkaction> <creaturescript type="advance" name="RankSystem" event="script"><![CDATA[ domodlib('RankLib') if skill == 0 then setGlobalStorageValue(74666, getGlobalStorageValue(74666) == -1 and "" or getGlobalStorageValue(74666)) addRankPlayer("fist", getCreatureName(cid), newLevel) elseif skill == 1 then setGlobalStorageValue(74667, getGlobalStorageValue(74667) == -1 and "" or getGlobalStorageValue(74667)) addRankPlayer("club", getCreatureName(cid), newLevel) elseif skill == 2 then setGlobalStorageValue(74668, getGlobalStorageValue(74668) == -1 and "" or getGlobalStorageValue(74668)) addRankPlayer("sword", getCreatureName(cid), newLevel) elseif skill == 3 then setGlobalStorageValue(74669, getGlobalStorageValue(74669) == -1 and "" or getGlobalStorageValue(74669)) addRankPlayer("axe", getCreatureName(cid), newLevel) elseif skill == 4 then setGlobalStorageValue(74670, getGlobalStorageValue(74670) == -1 and "" or getGlobalStorageValue(74670)) addRankPlayer("distance", getCreatureName(cid), newLevel) elseif skill == 5 then setGlobalStorageValue(74671, getGlobalStorageValue(74671) == -1 and "" or getGlobalStorageValue(74671)) addRankPlayer("shielding", getCreatureName(cid), newLevel) elseif skill == 6 then setGlobalStorageValue(74672, getGlobalStorageValue(74672) == -1 and "" or getGlobalStorageValue(74672)) addRankPlayer("fishing", getCreatureName(cid), newLevel) elseif skill == 7 then setGlobalStorageValue(74673, getGlobalStorageValue(74673) == -1 and "" or getGlobalStorageValue(74673)) addRankPlayer("magic", getCreatureName(cid), newLevel) elseif skill == 8 then setGlobalStorageValue(74674, getGlobalStorageValue(74674) == -1 and "" or getGlobalStorageValue(74674)) addRankPlayer("level", getCreatureName(cid), newLevel) end return TRUE ]]></creaturescript> <creaturescript type="kill" name="KillRank" event="script"><![CDATA[ domodlib('RankLib') setGlobalStorageValue(74675, getGlobalStorageValue(74675) == -1 and "" or getGlobalStorageValue(74675)) if isMonster(target) then addRankPlayer("monsters", getCreatureName(cid), getPlayerLevelInRank("monsters", getCreatureName(cid))+1) end if isPlayer(target) then if getPlayerGuildId(cid) > 0 then if lastHit then if getPlayerGuildId(target) <= 0 or getPlayerGuildId(target) ~= getPlayerGuildId(cid) then addRankPlayer("guilds", getPlayerGuildName(cid), getPlayerLevelInRank("guilds", getPlayerGuildName(cid))+1) end end end end return TRUE ]]></creaturescript> <creaturescript type="login" name="RankEvents" event="script"><![CDATA[ registerCreatureEvent(cid, "KillRank") registerCreatureEvent(cid, "RankSystem") return TRUE ]]></creaturescript> </mod>
     
     
    Alem dos ranks normais, eu inclui um rank para os maiores matadores de monstros, para voces poderem ter uma ideia de como incluir novos ranks.
     
    PARA QUE O SCRIPT FUNCIONE RETIRE ESSA LINHA DO TALKACTIONS.XML:

    <talkaction words="!rank;/rank" event="script" value="ranks.lua"/>
     
    OBS: Para usar o rank novo use /rank ou !rank e o nome dos skills que se encontram nessa table:
    ranks = {
    ["fist"] = 74666,
    ["club"] = 74667,
    ["sword"] = 74668,
    ["axe"] = 74669,
    ["distance"] = 74670,
    ["shielding"] = 74671,
    ["fishing"] = 74672,
    ["magic"] = 74673,
    ["level"] = 74674,
    ["monsters"] = 74675
    }
     
    No caso do novo rank seria /rank monsters.
     
    Para mudar o numero de players mostrados no rank mude essa linha no mod:

    doShowTextDialog(cid, 2160, getRank(param:lower(), 10))
     
    10 eh o numero de players que vai mostrar.
    Adicionado /rank guilds, que mostra as guilds que mais mataram no ot.
    Agora com aparencia e frases exatamente iguais ao /rank padrao.
     
    È Isso ai comentem!
  24. Upvote
    MatheusGlad recebeu reputação de ChockerrGamer em Sistema De Owner Para Equips.   
    Bem o sistema é basicamente isso: Fazer com que so um player possa equipar determinado item.
    Eu fiquei em duvida se botava ou nao botava para aparecer o nome do owner no item, por isso fiz uma enquete para esse topico, a que vencer eu faço.
     
    Youtube:


     
    O script esta em mod, voce nao precisa nem mexer no mod.
     
    Crie um arquivo.xml na pasta mods do seu ot e nomeie-o de ownersystem (é extremamente importante que o nome seja esse.) e bote esse script:

    <?xml version="1.0" encoding="UTF-8"?> <mod name="OwnerSystem" enabled="yes" author="MatheusMkalo" credits="Cezar (Patterns)"> <config name="OwnerLib"><![CDATA[ function getSlotIds(tag) local file = "mods/ownersystem.xml" local input = assert(io.open(file)) local content = assert(input:read("*a")) local tag = content:match("(<movevent[^>]*slot=[\"']".. tag .."[\"'][^>]*>)") local itemid = tag:match("itemid=[\"'](.-)[\"']") input:close() return itemid:explode(";") end function writeId(tag, id) local file = "mods/ownersystem.xml" local input = assert(io.open(file)) local content = assert(input:read("*a")) local tag = content:match("(<movevent[^>]*slot=[\"']".. tag .."[\"'][^>]*>)") local itemid = tag:match("itemid=[\"'](.-)[\"']") input:close() if(itemid:match(tostring(id))) then return true end if(itemid == "") then itemid = id else itemid = itemid .. ";" .. id end local ntag = tag:gsub("itemid=[\"'](.-)[\"']", "itemid=\"" .. itemid .. "\"") local content = content:gsub(tag, ntag) local output = assert(io.open(file, "w")) output:write(content) output:close() addEvent(doReloadInfo, 1000, 22) end function getItemType(itemid) local slottypes = {"head", "body", "legs", "feet"} local arq = io.open("data/items/items.xml", "r"):read("*all") local attributes = arq:match('<item id="' .. itemid .. '".+name="' .. getItemNameById(itemid) ..'">(.-)</item>') local slot = "" for i,x in pairs(slottypes) do if attributes:find(x) then slot = x break end end if slot == "body" then slot = "armor" end return slot end function isHandedWeapon(itemuid) local typee = getItemWeaponType(itemuid) or 0 if typee >= 1 and typee <= 6 then return TRUE end end function isPlayerOwnerItem(cid, itemuid) return not getItemAttribute(itemuid, "ownerguid") or getItemAttribute(itemuid, "ownerguid") == getPlayerGUID(cid) end function setItemOwner(itemuid, cid) if isHandedWeapon(itemuid) then local equips = getSlotIds("hand") if not table.find(equips, getItemIdByName(getItemName(itemuid))) then writeId("hand", getItemIdByName(getItemName(itemuid))) end doItemSetAttribute(itemuid, "ownerguid", getPlayerGUID(cid)) elseif getItemType(getItemIdByName(getItemName(itemuid))) then local equips = getSlotIds(getItemType(getItemIdByName(getItemName(itemuid)))) if not table.find(equips, getItemIdByName(getItemName(itemuid))) then writeId(getItemType(getItemIdByName(getItemName(itemuid))), getItemIdByName(getItemName(itemuid))) end doItemSetAttribute(itemuid, "ownerguid", getPlayerGUID(cid)) end end ]]></config> <movevent type="Equip" itemid="" slot="head" event="script"><![CDATA[ domodlib("OwnerLib") if not isPlayerOwnerItem(cid, item.uid) then addEvent(doPlayerSendCancel, 1, cid, "You are not the owner of this item.") else return TRUE end ]]></movevent> <movevent type="Equip" itemid="" slot="hand" event="script"><![CDATA[ domodlib("OwnerLib") if not isPlayerOwnerItem(cid, item.uid) then addEvent(doPlayerSendCancel, 1, cid, "You are not the owner of this item.") else return TRUE end ]]></movevent> <movevent type="Equip" itemid="" slot="legs" event="script"><![CDATA[ domodlib("OwnerLib") if not isPlayerOwnerItem(cid, item.uid) then addEvent(doPlayerSendCancel, 1, cid, "You are not the owner of this item.") else return TRUE end ]]></movevent> <movevent type="Equip" itemid="" slot="armor" event="script"><![CDATA[ domodlib("OwnerLib") if not isPlayerOwnerItem(cid, item.uid) then addEvent(doPlayerSendCancel, 1, cid, "You are not the owner of this item.") else return TRUE end ]]></movevent> <movevent type="Equip" itemid="" slot="feet" event="script"><![CDATA[ domodlib("OwnerLib") if not isPlayerOwnerItem(cid, item.uid) then addEvent(doPlayerSendCancel, 1, cid, "You are not the owner of this item.") else return TRUE end ]]></movevent> </mod>
     
    Agora vá na pasta libs e abra o arquivo.lua que tem o nome de functions ou 050-functions (pode variar de ot pra ot) e adicione essa funçao:

    function setItemOwner(itemuid, cid) domodlib("OwnerLib") return setItemOwner(itemuid, cid) end
     
    Agora vá em data/talkactions/scripts e abra o arquivo createitem.lua e mude o script para esse:

    function onSay(cid, words, param, channel) if(param == '') then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.") return true end local t = string.explode(param, ",") local ret = RETURNVALUE_NOERROR local pos = getCreaturePosition(cid) local id = tonumber(t[1]) if(not id) then id = getItemIdByName(t[1], false) if(not id) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Item wich such name does not exists.") return true end end local amount = 100 if(t[2]) then amount = t[2] end local item = doCreateItemEx(id, amount) if(t[3] and getBooleanFromString(t[3])) then if(t[4] and getBooleanFromString(t[4])) then pos = getCreatureLookPosition(cid) end ret = doTileAddItemEx(pos, item) else doPlayerAddItem(cid, id, amount) ret = RETURNVALUE_NOERROR end if(ret ~= RETURNVALUE_NOERROR) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Couldn't add item: " .. t[1]) return true end doDecayItem(item) if(not isPlayerGhost(cid)) then doSendMagicEffect(pos, CONST_ME_MAGIC_RED) end return true end
     
    É de extrema importancia que voce mude o script do /i, pois o i que vem nos ots contem um bug que arruina com o sistema de owner.
     
    Pronto agora você so precisa juntar a minha funçao setItemOwner(itemuid, cid) com qualquer outro script de quest whatever.
     
    Lembre-se se voce quizer algum script que use esse meu sistema, peça-o na sessao de pedidos de scripts, não aqui.
  25. Upvote
    MatheusGlad recebeu reputação de KingOFSkyer em War Arena System.   
    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
  • Quem Está Navegando   0 membros estão online

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