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 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)
  2. Upvote
    MatheusGlad recebeu reputação de bielwayne em Como Editar Magias [Novo Update]   
    UPDATE 0.3a
    Como mudar o dano da spell
    Confiram ja
     
    Obrigado a todos que gostarao
    Em breve novos tutoriais
  3. 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)
  4. Upvote
    MatheusGlad recebeu reputação de VaizardX em [Systems] Pokemon Systems   
    Scripts para TFS 0.3.6pl1 NAO FOI TESTADO EM OUTRA!
     
    Preview:


     
    Antes de tudo, va na pasta data/lib e adicione um script.lua com o nome de pokeLib e adicione isso:

    --[[ This file is part of Pokemon Systems by Mkalo. Pokemon Systems by Mkalo is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Pokemon System By Mkalo is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Pokemon System By Mkalo. If not, see <http://www.gnu.org/licenses/>. ]]-- pokein, pokeout = 2222,2223 function doRemoveTile(pos)-- Script by mock pos.stackpos = 0 local sqm = getTileThingByPos(pos) doRemoveItem(sqm.uid,1) end function doCreateTile(id,pos) -- By mock doAreaCombatHealth(0,0,pos,0,0,0,CONST_ME_NONE) doCreateItem(id,1,pos) end function getPosDirs(p, dir) -- By MatheusMkalo return dir == 1 and {x=p.x-1, y=p.y, z=p.z} or dir == 2 and {x=p.x-1, y=p.y+1, z=p.z} or dir == 3 and {x=p.x, y=p.y+1, z=p.z} or dir == 4 and {x=p.x+1, y=p.y+1, z=p.z} or dir == 5 and {x=p.x+1, y=p.y, z=p.z} or dir == 6 and {x=p.x+1, y=p.y-1, z=p.z} or dir == 7 and {x=p.x, y=p.y-1, z=p.z} or dir == 8 and {x=p.x-1, y=p.y-1, z=p.z} end function doItem(pos,a,d)-- Script by mock doCreateTile(460,pos) pos.stackpos = 0 local c = getTileThingByPos(pos) doItemSetAttribute(c.uid, "aid", a) end function getDescription(uid) for i,x in pairs(getItemDescriptions(uid)) do if i == "special" then return x end end end function findLetter(string, letter) for i = 1, #string do if string:sub(i, i) == letter then return i end end end function isWalkable(pos, creature, proj, pz)-- by Nord if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then return false end if getTopCreature(pos).uid > 0 and creature then return false end if getTileInfo(pos).protection and pz then return false, true end local n = not proj and 3 or 2 for i = 0, 255 do pos.stackpos = i local tile = getTileThingByPos(pos) if tile.itemid ~= 0 and not isCreature(tile.uid) then if hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) then return false end end end return true end function getPosDirs(p, dir) return dir == 1 and {x=p.x-1, y=p.y, z=p.z} or dir == 2 and {x=p.x-1, y=p.y+1, z=p.z} or dir == 3 and {x=p.x, y=p.y+1, z=p.z} or dir == 4 and {x=p.x+1, y=p.y+1, z=p.z} or dir == 5 and {x=p.x+1, y=p.y, z=p.z} or dir == 6 and {x=p.x+1, y=p.y-1, z=p.z} or dir == 7 and {x=p.x, y=p.y-1, z=p.z} or dir == 8 and {x=p.x-1, y=p.y-1, z=p.z} end function canSummon(cid) local pos = getCreaturePosition(cid) local state = false for i = 1, 8 do if isWalkable(getPosDirs(getCreaturePosition(cid), i)) then state = true end end return state end function isPlayerSummon(cid, uid) if getCreatureMaster(uid) == cid then return TRUE end return FALSE end function getSummonLifes(cid) for _,x in pairs(getCreatureSummons(cid)) do return getCreatureHealth(x), getCreatureMaxHealth(x) end 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 addPokeball(cid, pokename, maxh) local s = doPlayerAddItem(cid, pokein) doItemSetAttribute(s, "poke", "This is "..pokename.."'s pokeball. HP = ["..maxh.."/"..maxh.."]") doItemSetAttribute(s, "description", "Contains a " .. pokename) end function getPokeOutLive(cid) dat = {} for slot = CONST_SLOT_FIRST, CONST_SLOT_LAST do local item = getPlayerSlotItem(cid, slot) if isContainer(item.uid) then local items = getItemsInContainerById(item.uid, pokeout) for _, ui in pairs(items) do if getItemAttribute(ui, "poke"):sub(#getItemAttribute(ui, "poke")) == "." then table.insert(dat, ui) end end end if item.itemid == pokeout then if getItemAttribute(item.uid, "poke"):sub(#getItemAttribute(item.uid, "poke")) == "." then table.insert(dat, item.uid) end end end return dat end
     
     

    Go/Back Pokeball System


     

    By: MatheusMkalo


     
    Vá em data/actions/scripts e adicione um arquivo.lua com o nome de goback.lua
    Depois de ter feito isso, adicione o seguinte script no arquivo goback.lua:

    --[[ This file is part of Pokemon Systems by Mkalo. Pokemon Systems by Mkalo is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Pokemon System By Mkalo is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Pokemon System By Mkalo. If not, see <http://www.gnu.org/licenses/>. ]]-- local pokes = { ["Dragon"] = {level = 1, go = "Vai Dragon", back = "Volte Dragon."}, ["Demon"] = {level = 8, go = "Vai Demon", back = "Volte Demon."}, ["Dragon Lord"] = {level = 8, go = "Vai Dragon Lord", back = "Volte Dragon Lord."}, ["Rat"] = {level = 8, go = "Vai Rat", back = "Volte Rat."}, } local msgunica = false function onUse(cid, item, frompos, item2, topos) local maxh = tonumber(getItemAttribute(item.uid, "poke"):match("/(.+)]")) local health = tonumber(getItemAttribute(item.uid, "poke"):match("%[(.-)/")) if item.itemid == pokeout then if health ~= nil and health <= 0 then return doPlayerSendCancel(cid, "This pokemon is dead.") end if #getCreatureSummons(cid) >= 1 then for _,z in pairs(getCreatureSummons(cid)) do if getItemAttribute(item.uid, "poke"):find(getCreatureName(z)) then doTransformItem(item.uid, pokein) if msgunica then doCreatureSay(cid, "Back, " .. getCreatureName(z), TALKTYPE_SAY) else doCreatureSay(cid, pokes[getCreatureName(z)].back, TALKTYPE_SAY) end doItemSetAttribute(item.uid, "poke", getItemAttribute(item.uid, "poke"):sub(1, findLetter(getItemAttribute(item.uid, "poke"), ".")) .. " HP = ["..getCreatureHealth(z).."/"..getCreatureMaxHealth(z).."]") setPlayerStorageValue(cid, 61204, 0) doSendMagicEffect(getCreaturePosition(z), 10) return doRemoveCreature(z) end end end elseif item.itemid == pokein then if getTilePzInfo(getCreaturePosition(cid)) then return doPlayerSendCancel(cid, "You can't use pokeball in Protection Zones.") end if not canSummon(cid) then return doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTENOUGHROOM) end if getPlayerStorageValue(cid, 63215) >= 1 then return doPlayerSendCancel(cid, "You can't use pokeball while surfing.") end if getPlayerStorageValue(cid, 62314) >= 1 then return doPlayerSendCancel(cid, "You can't use pokeball while flying.") end if getPlayerStorageValue(cid, 59987) >= 1 then return doPlayerSendCancel(cid, "You can't use pokeball while riding.") end for i,x in pairs(pokes) do if #getCreatureSummons(cid) >= 1 then return doPlayerSendCancel(cid, "You already summoned a pokemon.") end if i == getItemAttribute(item.uid, "poke"):sub(9, findLetter(getItemAttribute(item.uid, "poke"), "'")-1) then if getPlayerLevel(cid) >= x.level then pk = doSummonCreature(i, getThingPosition(cid)) doConvinceCreature(cid, pk) setCreatureMaxHealth(pk, tonumber(getItemAttribute(item.uid, "poke"):match("/(.+)]"))) doCreatureAddHealth(pk, maxh) doCreatureAddHealth(pk, health-maxh) doTransformItem(item.uid, pokeout) if msgunica then doCreatureSay(cid, "Go, " .. i, TALKTYPE_SAY) else doCreatureSay(cid, x.go, TALKTYPE_SAY) end doItemSetAttribute(item.uid, "poke", getItemAttribute(item.uid, "poke"):sub(1, findLetter(getItemAttribute(item.uid, "poke"), "."))) doSendMagicEffect(getCreaturePosition(pk), 10) setPlayerStorageValue(cid, 61204, 1) registerCreatureEvent(pk, "DiePoke") registerCreatureEvent(cid, "PlayerPokeDeath") registerCreatureEvent(cid, "LogoutPoke") break else doPlayerSendCancel(cid, "Only players level "..x.level.." or higher can use this pokemon.") end end end end return TRUE end
    Depois, va em actions.xml e adicione a seguinte tag:

    <action itemid="2222;2223" event="script" value="goback.lua"/>
    Sendo que 2222 e 2223 são, respectivamente, o id da pokeball que ira "chamar" o pokemon, e o outro o id da pokeball que ira retirar o pokemon. (Seriam as pokebolas acesas e apagadas do PO)
     
    Agora, para evitar alguns bugs, va em data/creaturescripts/scripts e crie um arquivo.lua com o nome goback.lua e bote o seguinte script dentro:

    --[[ This file is part of Pokemon Systems by Mkalo. Pokemon Systems by Mkalo is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Pokemon System By Mkalo is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Pokemon System By Mkalo. If not, see <http://www.gnu.org/licenses/>. ]]-- function onLogout(cid) local health,maxhealth = getSummonLifes(cid) if getPlayerStorageValue(cid, 61204) >= 1 and getPlayerStorageValue(cid, 63215) <= 0 and getPlayerStorageValue(cid, 62314) <= 0 and getPlayerStorageValue(cid, 59987) <= 0 then setPlayerStorageValue(cid, 61205, health) setPlayerStorageValue(cid, 61206, maxhealth) setPlayerStorageValue(cid, 61204, 0) setPlayerStorageValue(cid, 61207, 1) end if getPlayerStorageValue(cid, 62314) >= 1 then pos = getCreaturePosition(cid) for i = 1,8 do doRemoveTile(getPosDirs(getCreaturePosition(cid), i)) end doRemoveTile(getCreaturePosition(cid)) setPlayerStorageValue(cid, 61941, pos.x) setPlayerStorageValue(cid, 61942, pos.y) setPlayerStorageValue(cid, 61943, pos.z) end return TRUE end function onLogin(cid) local pokes = { ["Dragon"] = {lookType=267, speed = 1500}, ["Rat"] = {lookType=267, speed = 500}, } local pokesfly = { ["Dragon"] = {lookType = 216, speed = 500}, } local pokesride = { ["Dragon Lord"] = {lookType=4, speed = 3000}, ["Dragon"] = {lookType=4, speed = 500}, } if getPlayerStorageValue(cid, 62314) >= 1 then doCreateTile(460, {x=getPlayerStorageValue(cid, 61941), y=getPlayerStorageValue(cid, 61942), z=getPlayerStorageValue(cid, 61943)}) doTeleportThing(cid, {x=getPlayerStorageValue(cid, 61941), y=getPlayerStorageValue(cid, 61942), z=getPlayerStorageValue(cid, 61943)}) for i = 1,8 do doItem(getPosDirs(getCreaturePosition(cid), i), 65119+i) end local item = getPokeOutLive(cid)[1] local a = getItemAttribute(item, "poke"):match("This is (.-)'s pokeball.") doSetCreatureOutfit(cid, pokesfly[tostring(a)], -1) doChangeSpeed(cid, pokesfly[tostring(a)].speed) registerCreatureEvent(cid, "PlayerPokeDeath") end if getPlayerStorageValue(cid, 63215) >= 1 then local item = getPokeOutLive(cid)[1] local a = getItemAttribute(item, "poke"):match("This is (.-)'s pokeball.") doSetCreatureOutfit(cid, pokes[tostring(a)], -1) doChangeSpeed(cid, pokes[tostring(a)].speed) registerCreatureEvent(cid, "PlayerPokeDeath") end if getPlayerStorageValue(cid, 59987) >= 1 then local item = getPokeOutLive(cid)[1] local a = getItemAttribute(item, "poke"):match("This is (.-)'s pokeball.") doSetCreatureOutfit(cid, pokesride[tostring(a)], -1) doChangeSpeed(cid, pokesride[tostring(a)].speed) registerCreatureEvent(cid, "PlayerPokeDeath") end if getPlayerStorageValue(cid, 61207) >= 1 then local item = getPokeOutLive(cid)[1] doTransformItem(item, pokein) doRemoveCondition(cid, CONDITION_OUTFIT) doItemSetAttribute(item, "poke", getItemAttribute(item, "poke"):sub(#getItemAttribute(item, "poke")) ~= "]" and getItemAttribute(item, "poke") .. " HP = ["..getPlayerStorageValue(cid, 61205).."/"..getPlayerStorageValue(cid, 61206).."]" or getItemAttribute(item, "poke")) setPlayerStorageValue(cid, 61207, 0) end return TRUE end function onDeath(cid, deathList) local owner = getCreatureMaster(cid) doPlayerSendTextMessage(owner, 22, "Your pokemon died.") for slot = CONST_SLOT_FIRST, CONST_SLOT_LAST do local item = getPlayerSlotItem(owner, slot) if isContainer(item.uid) then local items = getItemsInContainerById(item.uid, pokeout) for _, ui in pairs(items) do if getItemAttribute(ui, "poke"):sub(#getItemAttribute(ui, "poke")) == "." then local maxh = tonumber(getItemAttribute(ui, "poke"):match("/(.+)]")) doItemSetAttribute(ui, "poke", getItemAttribute(ui, "poke"):sub(1, findLetter(getItemAttribute(ui, "poke"), ".")) .. " HP = [0/"..getCreatureMaxHealth(cid).."]") end end end if item.itemid == pokeout then if getItemAttribute(item.uid, "poke"):sub(#getItemAttribute(item.uid, "poke")) == "." then local maxh = tonumber(getItemAttribute(item.uid, "poke"):match("/(.+)]")) doItemSetAttribute(item.uid, "poke", getItemAttribute(item.uid, "poke"):sub(1, findLetter(getItemAttribute(item.uid, "poke"), ".")) .. " HP = [0/"..getCreatureMaxHealth(cid).."]") end end end doRemoveCreature(cid) setPlayerStorageValue(owner, 61207, 0) setPlayerStorageValue(owner, 61204, 0) return FALSE end
     
    Agora adicione outro arquivo.lua na pasta data/creaturescripts/scripts com o nome de playerpdeath e bote esse script:

    --[[ This file is part of Pokemon Systems by Mkalo. Pokemon Systems by Mkalo is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Pokemon System By Mkalo is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Pokemon System By Mkalo. If not, see <http://www.gnu.org/licenses/>. ]]-- function onDeath(cid) local health,maxhealth = getSummonLifes(cid) if #getCreatureSummons(cid) >= 1 then setPlayerStorageValue(cid, 61205, health) setPlayerStorageValue(cid, 61206, maxhealth) setPlayerStorageValue(cid, 61204, 0) setPlayerStorageValue(cid, 61207, 1) end if getPlayerStorageValue(cid, 63215) >= 1 then setPlayerStorageValue(cid, 61205, getPlayerStorageValue(cid, 61210)) setPlayerStorageValue(cid, 61206, getPlayerStorageValue(cid, 61209)) setPlayerStorageValue(cid, 61204, 0) setPlayerStorageValue(cid, 63215, 0) setPlayerStorageValue(cid, 61207, 1) end if getPlayerStorageValue(cid, 62314) >= 1 then setPlayerStorageValue(cid, 61205, getPlayerStorageValue(cid, 61262)) setPlayerStorageValue(cid, 61206, getPlayerStorageValue(cid, 61263)) setPlayerStorageValue(cid, 61204, 0) setPlayerStorageValue(cid, 62314, 0) setPlayerStorageValue(cid, 61207, 1) end if getPlayerStorageValue(cid, 59987) >=1 then setPlayerStorageValue(cid, 61205, getPlayerStorageValue(cid, 59988)) setPlayerStorageValue(cid, 61206, getPlayerStorageValue(cid, 59989)) setPlayerStorageValue(cid, 61204, 0) setPlayerStorageValue(cid, 59987, 0) setPlayerStorageValue(cid, 61207, 1) end return TRUE end
     
    Depois va em creaturescripts.xml e adicione as seguintes TAGS:

    <event type="death" name="PlayerPokeDeath" event="script" value="playerpdeath.lua"/> <event type="death" name="DiePoke" event="script" value="goback.lua"/> <event type="logout" name="LogoutPoke" event="script" value="goback.lua"/> <event type="login" name="LoginPoke" event="script" value="goback.lua"/>
     
     

    Catch Pokemon System


     

    By: MatheusMkalo


     
     
    Vá em data/actions/scripts e adicione um arquivo.lua com o nome de catch.lua
    Depois adicione o seguinte script dentro dele:

    --[[ This file is part of Pokemon Systems by Mkalo. Pokemon Systems by Mkalo is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Pokemon System By Mkalo is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Pokemon System By Mkalo. If not, see <http://www.gnu.org/licenses/>. ]]-- local pokes = { ["Dragon"] = {corpseid = 5973, chance = 100, health = 12200, maxhealth = 12200}, ["Dragon Lord"] = {corpseid = 5984, chance = 100, health = 12200, maxhealth = 12200}, ["Demon"] = {corpseid = 5995, chance = 100, health = 12200, maxhealth = 12200}, } local time = 4 -- Tempo para mandar as mensagens e adiciona item function onUse(cid, item, frompos, item2, topos) for i,x in pairs(pokes) do if item2.itemid == x.corpseid then doRemoveItem(item.uid, 1) doRemoveItem(item2.uid, 1) if math.random(1,100) <= x.chance then function add() local s = doPlayerAddItem(cid, pokein) doItemSetAttribute(s, "poke", "This is "..i.."'s pokeball. HP = ["..x.health.."/"..x.maxhealth.."]") doItemSetAttribute(s, "description", "Contains a " .. i) end doSendMagicEffect(topos, 24) addEvent(add, time*1000) return addEvent(doPlayerSendTextMessage, time*1000, cid, 27, "You catch a " .. i .. ".") else addEvent(doPlayerSendTextMessage, time*1000, cid, 27, "Your pokeball broke.") return doSendMagicEffect(topos, 23) end end end return TRUE end
     
    Depois adicione a seguinte TAG no actions.xml:

    <action itemid="2147" event="script" value="catch.lua"/>
     
    Sendo 2147, o id da sua pokebola para capturar pokemons (NAO A DE CHAMAR O POKEMON)
     
     

    Npc Healler


     

    By: MatheusMkalo


     
     
    Vá em data/npc/scripts e adicione um arquivo.lua com o seguinte script:

    --[[ This file is part of Pokemon Systems by Mkalo. Pokemon Systems by Mkalo is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Pokemon System By Mkalo is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Pokemon System By Mkalo. If not, see <http://www.gnu.org/licenses/>. ]]-- local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end function creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end if msgcontains(msg, 'heal') then if #getCreatureSummons(cid) >= 1 then return selfSay('Voce precisa botar seus pokemons dentro da pokebola.', cid) end for slo = CONST_SLOT_FIRST, CONST_SLOT_LAST do local item = getPlayerSlotItem(cid, slo) if isContainer(item.uid) then local items = getItemsInContainerById(item.uid, pokeout) for i,x in pairs(items) do local maxh = tonumber(getItemAttribute(x, "poke"):match("/(.+)]")) doItemSetAttribute(x, "poke", getItemAttribute(x, "poke"):sub(1, findLetter(getItemAttribute(x, "poke"), ".")) .. " HP = ["..maxh.."/"..maxh.."]") doTransformItem(x, pokein) end local items2 = getItemsInContainerById(item.uid, pokein) for i,x in pairs(items2) do local maxh = tonumber(getItemAttribute(x, "poke"):match("/(.+)]")) doItemSetAttribute(x, "poke", getItemAttribute(x, "poke"):sub(1, findLetter(getItemAttribute(x, "poke"), ".")) .. " HP = ["..maxh.."/"..maxh.."]") end elseif item.itemid == pokeout or item.itemid == pokein then local maxh = tonumber(getItemAttribute(item.uid, "poke"):match("/(.+)]")) doItemSetAttribute(item.uid, "poke", getItemAttribute(item.uid, "poke"):sub(1, findLetter(getItemAttribute(item.uid, "poke"), ".")) .. " HP = ["..maxh.."/"..maxh.."]") doTransformItem(item.uid, pokein) end end selfSay('Pronto, voce e seus pokemons estao com a life maxima.', cid) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
     
    Depois va ate a pasta data/npc e adicione um arquivo.xml e bote isso dentro:

    <?xml version="1.0" encoding="UTF-8"?> <npc name="Pokemon Healer" script="pokehealer.lua" walkinterval="2000" floorchange="0"> <health now="100" max="100"/> <look type="128" head="17" body="54" legs="114" feet="0" addons="2"/> <parameters> <parameter key="message_greet" value="Ola, diga {heal} para recuperar sua vida e a vida dos seus pokemons."/> </parameters> </npc>
     
     

    Surf System


     

    By: MatheusMkalo


     
    Vá em data/actions/scripts e crie um arquivo.lua com o nome de surf e bote esse script dentro:

    --[[ This file is part of Pokemon Systems by Mkalo. Pokemon Systems by Mkalo is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Pokemon System By Mkalo is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Pokemon System By Mkalo. If not, see <http://www.gnu.org/licenses/>. ]]-- function onUse(cid, item, frompos, item2, topos) local configs = { [4647] = {x = -2, y = 0}, -- 4647 é o id da borda oeste (lado esquerdo do player) [4645] = {x = 2, y = 0}, -- 4645 é o id da borda leste (lado direito do player) [4646] = {x = 0, y = 2}, -- 4646 é o id da borda sul (abaixo do player) [4644] = {x = 0, y = -2}, -- 4644 é o id da borda norte (acima do player) } local playerpos = getCreaturePosition(cid) local pokes = { ["Dragon"] = {lookType=267, speed = 1500}, ["Rat"] = {lookType=267, speed = 500}, } if #getCreatureSummons(cid) <= 0 and getPlayerStorageValue(cid, 63215) <= 0 then return doPlayerSendCancel(cid, "You need a pokemon to surf.") end l = false for i,x in pairs(pokes) do if getPlayerStorageValue(cid, 63215) <= 0 and i:lower() == getCreatureName(getCreatureSummons(cid)[1]):lower() then l = true end end if not l and getPlayerStorageValue(cid, 63215) <= 0 then return doPlayerSendCancel(cid, "This pokemon can't surf.") end if getPlayerStorageValue(cid, 63215) <= 0 then doTeleportThing(cid, {x=playerpos.x+configs[item2.itemid].x, y=playerpos.y+configs[item2.itemid].y, z=playerpos.z}) setPlayerStorageValue(cid, 63215, 1) doSetCreatureOutfit(cid, pokes[getCreatureName(getCreatureSummons(cid)[1])], -1) doCreatureSay(cid, "Let's surf, "..getCreatureName(getCreatureSummons(cid)[1]), 1) setPlayerStorageValue(cid, 61209, getCreatureMaxHealth(getCreatureSummons(cid)[1])) setPlayerStorageValue(cid, 61210, getCreatureHealth(getCreatureSummons(cid)[1])) doChangeSpeed(cid, pokes[getCreatureName(getCreatureSummons(cid)[1])].speed) doRemoveCreature(getCreatureSummons(cid)[1]) else doTeleportThing(cid, {x=playerpos.x-configs[item2.itemid].x, y=playerpos.y-configs[item2.itemid].y, z=playerpos.z}) setPlayerStorageValue(cid, 63215, 0) doRemoveCondition(cid, CONDITION_OUTFIT) local item = getPokeOutLive(cid)[1] doCreatureSay(cid, "Im tired of surf, " .. getItemAttribute(item, "poke"):match("This is (.-)'s pokeball."), 1) pk = doSummonCreature(getItemAttribute(item, "poke"):match("This is (.-)'s pokeball."), getThingPosition(cid)) doConvinceCreature(cid, pk) registerCreatureEvent(pk, "DiePoke") registerCreatureEvent(cid, "PlayerPokeDeath") registerCreatureEvent(cid, "LogoutPoke") setCreatureMaxHealth(pk, getPlayerStorageValue(cid, 61209)) doCreatureAddHealth(pk, getPlayerStorageValue(cid, 61209)) doCreatureAddHealth(pk, getPlayerStorageValue(cid, 61210)-getPlayerStorageValue(cid, 61209)) doChangeSpeed(cid, getCreatureBaseSpeed(cid)-getCreatureSpeed(cid)) end return TRUE end
     
    Depois va em actions.xml e adicione essa tag:

    <action itemid="4647;4645;4646;4644" event="script" value="surf.lua"/>
     
    Ensinarei nos tutorias como adicionar novas bordas e botar cada pokemon com seu proprio outfit na agua.
     
    OBS:Todos os scripts mudaram para implementar o surf, atualize-os
    OBS2: Para funcionar o id da agua tem que ser 4820.
     
    Para usar basta clicar na borda da agua.
     

    Evolution System


     

    By: MatheusMkalo


     
     
    Vá em data/actions/scripts e adicione um script.lua com o nome de evolution.lua e bote esse script:

    --[[ This file is part of Pokemon Systems by Mkalo. Pokemon Systems by Mkalo is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Pokemon System By Mkalo is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Pokemon System By Mkalo. If not, see <http://www.gnu.org/licenses/>. ]]-- local pokes = { ["Dragon"] = {level = 1, evolution = "Dragon Lord", maxh = 2000}, } local types = { ["Water"] = {itemid = 2277, "Horsea", "Goldeen", "Magikarp"}, ["Venom"] = {itemid = 2278, "Zubat", "Ekans"}, ["Thunder"] = {itemid = 2279, "Magnemite", "Pikachu"}, ["Rock"] = {itemid = 2280, "Geodude", "Graveler"}, ["Punch"] = {itemid = 2281, "Machop", "Machoke"}, ["Leaf"] = {itemid = 2276, "Ivysaur"}, ["Fire"] = {itemid = 2283, "Charmander", "Charmeleon", "Dragon"}, ["Coccon"] = {itemid = 2284, "Caterpie", "Metapod"}, ["Crystal"] = {itemid = 2285, "Dratini", "Dragonair"}, ["Darkness"] = {itemid = 2286, "Gastly", "Haunter"}, ["Earth"] = {itemid = 2287, "Cubone"}, ["Enigma"] = {itemid = 2288, "Abra", "Kadabra"}, ["Heart"] = {itemid = 2289, "Rattata", "Pidgey"}, ["Ice"] = {itemid = 2290, "Seel"}, } function onUse(cid, item, frompos, item2, topos) for i,x in pairs(types) do if item.itemid == x.itemid then if isCreature(item2.uid) then if isPlayerSummon(cid, item2.uid) then if table.find(x, getCreatureName(item2.uid)) then if getPlayerLevel(cid) >= pokes[getCreatureName(item2.uid)].level then local pokeball = getPokeOutLive(cid)[1] local slo = pokes[getCreatureName(item2.uid)].maxh local sle = pokes[getCreatureName(item2.uid)].evolution doItemSetAttribute(pokeball, "description", "Contains a " .. pokes[getCreatureName(item2.uid)].evolution) doPlayerSendTextMessage(cid, 27, "Your "..getCreatureName(item2.uid).." evolued to a "..pokes[getCreatureName(item2.uid)].evolution) doSendMagicEffect(topos, 18) doItemSetAttribute(pokeball, "poke", "") doItemSetAttribute(pokeball, "poke", "This is "..pokes[getCreatureName(item2.uid)].evolution.."'s pokeball. HP = ["..pokes[getCreatureName(item2.uid)].maxh.."/"..pokes[getCreatureName(item2.uid)].maxh.."]") doRemoveCreature(item2.uid) local pk = doSummonCreature(sle, topos) registerCreatureEvent(pk, "DiePoke") registerCreatureEvent(cid, "PlayerPokeDeath") registerCreatureEvent(cid, "LogoutPoke") doConvinceCreature(cid, pk) setCreatureMaxHealth(pk, slo) setPlayerStorageValue(cid, 61204, 1) doCreatureAddHealth(pk, slo) doRemoveItem(item.uid, 1) break else return doPlayerSendCancel(cid, "You need to be level "..pokes[getCreatureName(item2.uid)].level.." or higher to use this stone in this pokemon.") end end end end end end return TRUE end
     
    Depois vá em actions.xml e adicione esta tag:

    <action itemid="2276;2277;2278;2279;2280;2281;2283;2284;2285;2286;2287;2288;2289;2290" event="script" value="evolution.lua" allowfaruse="1"/>
     
     

    Fly System


     

    By: MatheusMkalo, Credits: Mock


     
     
    Vá em data/talkactions/scripts e adicione um arquivo.lua com o nome de fly e bote esse script:

    --[[ This file is part of Pokemon Systems by Mkalo. Pokemon Systems by Mkalo is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Pokemon Systems by Mkalo is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Pokemon Systems by Mkalo. If not, see <http://www.gnu.org/licenses/>. ]]-- function onSay(cid, words, param) local pokes = { ["Dragon"] = {lookType = 216, speed = 500}, } if #getCreatureSummons(cid) <= 0 and getPlayerStorageValue(cid, 62314) <= 0 then doPlayerSendCancel(cid, "You need a pokemon to fly.") end if getPlayerStorageValue(cid, 62314) <= 0 and not pokes[getCreatureName(getCreatureSummons(cid)[1])] then return doPlayerSendCancel(cid, "This pokemon can't fly.") end if getPlayerStorageValue(cid, 62314) <= 0 then doSetCreatureOutfit(cid, pokes[getCreatureName(getCreatureSummons(cid)[1])], -1) doChangeSpeed(cid, pokes[getCreatureName(getCreatureSummons(cid)[1])].speed) setPlayerStorageValue(cid, 61263, getCreatureMaxHealth(getCreatureSummons(cid)[1])) setPlayerStorageValue(cid, 61262, getCreatureHealth(getCreatureSummons(cid)[1])) setPlayerStorageValue(cid, 62314, 1) registerCreatureEvent(cid, "LogoutPoke") doCreatureSay(cid, "Let's fly, "..getCreatureName(getCreatureSummons(cid)[1]), 1) doRemoveCreature(getCreatureSummons(cid)[1]) local ppos = getCreaturePos(cid) local newpos = {x=ppos.x, y=ppos.y, z = 0} doCreateTile(460, newpos) doTeleportThing(cid, newpos) for i = 1,8 do doItem(getPosDirs(getCreaturePosition(cid), i), 65119+i) end elseif getPlayerStorageValue(cid, 62314) >= 1 then local ppos = getCreaturePosition(cid) p = true for i = 1,17 do if getTileThingByPos({x=ppos.x, y=ppos.y, z=ppos.z+i}).itemid ~= 0 and not isWalkable({x=ppos.x, y=ppos.y, z=ppos.z+i}) then p = false break end if isWalkable({x=ppos.x, y=ppos.y, z=ppos.z+i}) then l = ppos.z + i break end end if not p or getTileThingByPos({x=ppos.x, y=ppos.y, z=l}).itemid == 4820 then return doPlayerSendCancel(cid, "You can't down in there.") end for i = 1,8 do doRemoveTile(getPosDirs(getCreaturePosition(cid), i)) end setPlayerStorageValue(cid, 62314, 0) doTeleportThing(cid, {x=ppos.x, y=ppos.y, z=l}) doRemoveTile(ppos) local item = getPokeOutLive(cid)[1] pk = doSummonCreature(getItemAttribute(item, "poke"):match("This is (.-)'s pokeball."), getThingPosition(cid)) doConvinceCreature(cid, pk) doCreatureSay(cid, "I'm tired of fly, "..getItemAttribute(item, "poke"):match("This is (.-)'s pokeball."), 1) registerCreatureEvent(pk, "DiePoke") registerCreatureEvent(cid, "PlayerPokeDeath") setCreatureMaxHealth(pk, getPlayerStorageValue(cid, 61263)) doCreatureAddHealth(pk, getPlayerStorageValue(cid, 61263)) doCreatureAddHealth(pk, getPlayerStorageValue(cid, 61262)-getPlayerStorageValue(cid, 61263)) doChangeSpeed(cid, getCreatureBaseSpeed(cid)-getCreatureSpeed(cid)) doRemoveCondition(cid, CONDITION_OUTFIT) end return TRUE end
     
    Depois bote essa tag no talkaction.xml:

    <talkaction words="!fly" event="script" value="fly.lua"/>
     
    Va em data/movements/scripts e crie um arquivo.lua com o nome de fly.lua e bote:

    --[[ This file is part of Pokemon Systems by Mkalo. Pokemon Systems by Mkalo is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Pokemon Systems by Mkalo is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Pokemon Systems by Mkalo. If not, see <http://www.gnu.org/licenses/>. ]]-- function onStepIn(cid, item, position, fromPosition) local actions = { [65120] = {del = {4,5,6}, add = {1,2,8}}, [65121] = {del = {8,7,6,5,4}, add = {8,1,2,3,4}}, [65122] = {del = {8,7,6}, add = {2,3,4}}, [65123] = {del = {2,1,8,7,6}, add = {6,5,4,3,2}}, [65124] = {del = {2,1,8}, add = {4,5,6}}, [65125] = {del = {8,1,2,3,4}, add = {8,7,6,5,4}}, [65126] = {del = {2,3,4}, add = {8,7,6}}, [65127] = {del = {6,5,4,3,2}, add = {6,7,8,1,2}}, } local configs = actions[item.actionid] for i = 1,8 do if table.find(configs.del, i) then doRemoveTile(getPosDirs(fromPosition, i)) end doItem(getPosDirs(getCreaturePosition(cid), i), 65119+i) end return TRUE end
     
    Depois va em movements.xml e adicione essa tag:

    <movevent type="StepIn" actionid="65120;65121;65122;65123;65124;65125;65126;65127" event="script" value="fly.lua"/>
     
    Para usar o fly diga !fly para descer e subir
     
     

    Ride System


     

    By: MatheusMkalo


     
     
    Vá em talkactions/scripts e crie um arquivo.lua com o nome de ride e bote esse script:

    --[[ This file is part of Pokemon Systems by Mkalo. Pokemon Systems by Mkalo is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Pokemon Systems by Mkalo is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Pokemon Systems by Mkalo. If not, see <http://www.gnu.org/licenses/>. ]]-- function onSay(cid, words) local pokesride = { ["Dragon Lord"] = {lookType=4, speed = 3000}, ["Dragon"] = {lookType=4, speed = 500}, } if #getCreatureSummons(cid) <= 0 and getPlayerStorageValue(cid, 59987) <= 0 then return doPlayerSendCancel(cid, "You need a pokemon to ride.") end if not canSummon(cid) and getPlayerStorageValue(cid, 59987) >= 1 then return doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTENOUGHROOM) end local sname = #getCreatureSummons(cid) >= 1 and getCreatureName(getCreatureSummons(cid)[1]) or nil if sname ~= nil and pokesride[sname] and getPlayerStorageValue(cid, 59987) <= 0 then doSetCreatureOutfit(cid, pokesride[sname], -1) doChangeSpeed(cid, pokesride[sname].speed) doCreatureSay(cid, "Let's ride, " .. sname, 1) setPlayerStorageValue(cid, 59987, 1) setPlayerStorageValue(cid, 59988, getCreatureHealth(getCreatureSummons(cid)[1])) setPlayerStorageValue(cid, 59989, getCreatureMaxHealth(getCreatureSummons(cid)[1])) doRemoveCreature(getCreatureSummons(cid)[1]) elseif getPlayerStorageValue(cid, 59987) >= 1 then setPlayerStorageValue(cid, 59987, 0) doRemoveCondition(cid, CONDITION_OUTFIT) local item = getPokeOutLive(cid)[1] doCreatureSay(cid, "Im tired of ride, " .. getItemAttribute(item, "poke"):match("This is (.-)'s pokeball."), 1) pk = doSummonCreature(getItemAttribute(item, "poke"):match("This is (.-)'s pokeball."), getThingPosition(cid)) doConvinceCreature(cid, pk) registerCreatureEvent(pk, "DiePoke") registerCreatureEvent(cid, "PlayerPokeDeath") registerCreatureEvent(cid, "LogoutPoke") setCreatureMaxHealth(pk, getPlayerStorageValue(cid, 59989)) doCreatureAddHealth(pk, getPlayerStorageValue(cid, 59989)) doCreatureAddHealth(pk, getPlayerStorageValue(cid, 59988)-getPlayerStorageValue(cid, 59989)) doChangeSpeed(cid, getCreatureBaseSpeed(cid)-getCreatureSpeed(cid)) end return TRUE end
     
    Agora bote essa tag em talkactions.xml:

    <talkaction words="!ride" event="script" value="ride.lua"/>
     
    Pra usar o ride é so falar !ride. Para configurar os pokemons é praticamente igual ao surf.
     
     

    Configurando os scripts


     
     
     
    Como adicionar mais pokemons no go/back:
     
    No inicio do script, tem essa tabela com as informaçoes:
     
    Copie a ultima linha (vermelha) e cole logo abaixo, editando os nomes e as mensagens ficando assim:
     
    Voce pode configurar o level para usar o poke mudando o valor de level.
     
    Configurando pokemons para o catch:[/b]
     
    Olhe a tabela no inicio do script:
    Faça o mesmo processo do acima de copiar e colar embaixo e editar:
     
    Aonde as informaçoes corpseid, chance, health, maxhealth serao, respectivamente: Id do corpo do monstro, Chance de capturar em %, health que o pokemon iria ir pro player, e health maxima que o poke iria ir para o player.
     
     
    Como trocar os ids das pokebolas, acesas e apagadas.
    Para trocar o id da pokebola "acesa" e "apagada" basta mudar os ids 2222,2223 na lib sendo que 2222 eh o da acesa e o 2223 eh o id da apagada
     
    Mude tambem na tag do action.xml que seu script ira funcionar perfeitamente.
     
    Como adicionar mais bordas ao surf.
    Primeiramente va em actions.xml e adicione os ids das bordas na tag do surf: (Eu fiz com a borda de areia)
     
    Depois va no script surf.lua em actions e repare nessa parte:
     
    Copie todas as 4 bordas e cole abaixo ficando:
     
    Depois mude os ids das bordas do lado << conforme as informaçoes do lado >>, ficando:
     
     
    Como adicionar mais pokes ao surf:
    Va no script surf.lua em actions e repare nessa parte:
    Ai voce pode adicionar o pokemon pra surf e o outfit que ele vai te dar na agua copiando o de cima e colando logo abaixo e editando algumas coisas:
     
    Lembre-se de depois que acabar de editar toda a tabela no surf.lua, va no goback.lua em creaturescripts e substitua a tabela pokes, pela que esta na actions surf.lua:
     
     
     
    Como adicionar mais pokes no evolution:
    Repare nessa parte do script evolution.lua em actions:
     
    Bem voce deve copiar o primeiro monstro da tabela "pokes", e adicionar no final e mudar as configuraçoes:
     
    Sendo level,evolution,maxh respectivamente, o level pra evoluir o poke, o nome da evoluçao, e a health maxima do pokemon evoluido.
     
    Depois eh so adicionar o Nome do monstro que foi adicionado a tabela "pokes" na tabela "types", no lugar do type dele:
     
    Como adicionar mais pokes no fly:
    Repare nas partes iguais no fly.lua (talkaction) e no goback.lua(creaturescripts):
     
    fly.lua:
     
    goback.lua:
     
    A unica coisa que mudou foi o nome da tabela, "pokes" e "pokesfly", para adicionar mais pokes no fly basta adicionar no fly.lua e botar igual no goback.lua.
     
     
     
     

    Informaçoes Importantes!!!


     
     
    Para testar o script de catch que esta no topico, voce deve deletar as tags de encantamento de armas.
     
    Para poder summonar os pokemons com o go/back, voce precisa ir no arquivo.xml do monstro e editar essa linha:
    Se estiver convinceable="0", mude para convinceable="1" ficando:
     
    Creditos Especiais:
    Kydrai pela funçao "getItemsInContainerById"
    MarcelloMkez
    Mock por algumas funçoes do fly system dele.
     
    Agradecimentos:
    D3rs00n (Me ajudou a fazer sumir o corpo do pokemon)
    Julio Cezar (Ajudou reportando bugs e testando scripts)
    Miih (Ajudou reportando bugs e testando scripts)
    Arth3miS (Ajudou reportando bugs e testando scripts)
     
    E para todos que reportaram bugs.
     
     
     
    Bugs, erros, duvidas, elogios no topico[/b]
  5. Upvote
    MatheusGlad recebeu reputação de brendoonh em Bug Cassino   
    --[ Script written and published by Orzeleagle/Collocorpus ]--
    function addPlayerItem(itemid, amount, cid)
    if amount%100 > 0 then
    local iuid = doCreateItemEx(itemid, amount%100)
    doPlayerAddItemEx(cid, iuid)
    end
    for i = 1, math.floor(amount/100) do
    iuid = doCreateItemEx(itemid, 100)
    doPlayerAddItemEx(cid, iuid)
    end
    return true
    end
    function onUse(cid, item, fromPosition, itemEx, toPosition)
    local config = {
    chance = math.random(1, 100), --losowanie
    win_chance = 80, --chance to win a percentage of
    multi = 3, --how many times you win more (eg 2 or 1cc bet, win and get 2cc)
    items = {2160, 2152}, --id items whom you can play
    min_count = 1, --Minimum Number of items (1 = least 1cc)
    max_count = 100 --maximum number of objects (10 = maximum 10cc)
    }
    local positions = {
    [7010] = {x=fromPosition.x-1, y=(fromPosition.y), z=fromPosition.z, stackpos=255},
    [7011] = {x=fromPosition.x-1, y=(fromPosition.y), z=fromPosition.z, stackpos=255},
    [7012] = {x=fromPosition.x-1, y=(fromPosition.y), z=fromPosition.z, stackpos=255},
    [7013] = {x=fromPosition.x-1, y=(fromPosition.y), z=fromPosition.z, stackpos=255},
    [7014] = {x=fromPosition.x-1, y=(fromPosition.y), z=fromPosition.z, stackpos=255},
    [7015] = {x=fromPosition.x-1, y=(fromPosition.y), z=fromPosition.z, stackpos=255},
    [7016] = {x=fromPosition.x-1, y=(fromPosition.y), z=fromPosition.z, stackpos=255},
    [7017] = {x=fromPosition.x-1, y=(fromPosition.y), z=fromPosition.z, stackpos=255},
    [7018] = {x=fromPosition.x-1, y=(fromPosition.y), z=fromPosition.z, stackpos=255},
    [7019] = {x=fromPosition.x-1, y=(fromPosition.y), z=fromPosition.z, stackpos=255}
    }
    local itemplay = getThingfromPos(positions[item.actionid])
    local storage, exh = 56500, 5 --storage id, time exh
    if (item.itemid == 1945) then
    doTransformItem(item.uid, 1946)
    if (getPlayerStorageValue(cid, storage)-os.time(t) < 1) then
    doPlayerSetStorageValue(cid, storage, os.time(t)+exh)
    if (isInArray(config.items, itemplay.itemid)) then
    if (itemplay.type >= config.min_count) and (itemplay.type <= config.max_count) then
    if (config.chance <= config.win_chance) then
    doRemoveItem(itemplay.uid, itemplay.type)
    positions[item.actionid].stackpos = nil
    addPlayerItem(itemplay.itemid, (itemplay.type*config.multi), cid)
    doSendMagicEffect(positions[item.actionid], 31)
    doSendMagicEffect(getCreaturePosition(cid), 27)
    doPlayerSendCancel(cid, "Parabéns, você acaba de ganhar em nosso cassino!")
    doSendAnimatedText(getCreaturePosition(cid), "~!Winner!~", TEXTCOLOR_YELLOW)
    return true
    else
    doRemoveItem(itemplay.uid, itemplay.type)
    doSendMagicEffect(positions[item.actionid], 31)
    doSendMagicEffect(getCreaturePosition(cid), 13)
    doPlayerSendCancel(cid, "É o seu dia de azar! você perdeu.")
    doSendAnimatedText(getCreaturePosition(cid), "~!Loser!~", TEXTCOLOR_LIGHTBLUE)
    return true
    end
    else
    doPlayerSendCancel(cid, "You can play only with amount from ".. config.min_count .." to ".. config.max_count ..".")
    doSendMagicEffect(fromPosition, 2)
    return true
    end
    else
    doPlayerSendCancel(cid, "You cannot play with this item.")
    doSendMagicEffect(fromPosition, 2)
    return true
    end
    else
    doPlayerSendCancel(cid, "You must wait another ".. getPlayerStorageValue(cid, storage)-os.time(t) .." seconds.")
    doSendMagicEffect(fromPosition, 2)
    return true
    end
    else
    doTransformItem(item.uid, 1945)
    doSendMagicEffect(fromPosition, 2)
    return true
    end
    end
     

     
  6. Upvote
    MatheusGlad recebeu reputação de felzan em Me indique sites: Estudando LUA   
    O certo é Lua não LUA.
    http://www.lua.org/about.html#name
     
    Links:
    http://lua-users.org/wiki/TutorialDirectory
    http://www.lua.org/manual/5.1/pt/manual.html
     
     
     
     
     
  7. Upvote
    MatheusGlad recebeu reputação de Incur em Monsters Default Events   
    FAÇA BACKUP DA PASTA MONSTERS E CREATURESCRIPTS ANTES DE UTILIZAR!
     
    Funciona para todas as versões TFS 0.3.6+ ate TFS 1.2 (Provavelmente funciona para outras tambem mas não me dei o trabalho de testar)
     
    Introdução:
    Bem, como o titulo mesmo diz, o script vai criar e modificar todos os monstros para terem scripts default (Caso o monstro não tenha script) e tambem pode adicionar creaturescripts default, exemplo o onDeath.
     
    Code:
     
    monsterevent.lua
    local dir = "./data/monster/" local csdir = "./data/creaturescripts/" local monstersXML = "monsters.xml" local csXML = "creaturescripts.xml" local csTag = '\n <event type="%t" name="%n" script="%s"/>' -- Tag format on creaturescripts.xml (%t = type, %n = name, %s = script) local defaultText = [[function onCreatureAppear(self, creature) return false end function onCreatureDisappear(self, creature) return false end function onCreatureMove(self, creature, oldPosition, newPosition) return false end function onCreatureSay(self, creature, type, message) return false end function onThink(self, interval) return false end]] local events = { ["monsterdeath"] = {type = "death", file="monsterdeath.lua", defaultText=[[ function onDeath(cid, corpse, lasthitkiller, mostdamagekiller, lasthitunjustified, mostdamageunjustified) return true end]]}, } ------- Não edite a partir dessa linha se nao souber o que esta fazendo. function parseXML(file) local ret = {["monster"] = {}, ["event"] = {}} local data = "" for line in file:lines() do data = data .. line .. "\n" line = line:match("<(.-)/>") if line then local element = line:match("^%s*(.-)%s") if element == "monster" or element == "event" then local t = {} for i, x in line:gmatch('%s+(.-)="(.-)"') do t[i] = x end table.insert(ret[element], t) end end end return ret, data:sub(1, #data-1) end function init() ----- Parsing monsters.xml ----- local monstersfile = io.open(dir .. monstersXML, "r") print("Parsing XML " .. dir .. monstersXML .. "...") local xmltable = parseXML(monstersfile) monstersfile:close() -------------------------------- -- Creating scripts directory -- local testfile = io.open(dir .. "scripts/test", "w") if not testfile then os.execute("mkdir data\\monster\\scripts") print("Directory " .. dir .. "scripts has been created.") else testfile:close() end os.remove(dir .. "scripts/test") --------------------------------- ------ Creating default.lua ------- local defaultlua = io.open(dir .. "scripts/default.lua", "w") defaultlua:write(defaultText) defaultlua:close() print("File " .. dir .. "scripts/default.lua has been created.") --------------------------------- ---- Modify all monsters XML! ---- local modified = 0 for i, contents in ipairs(xmltable["monster"]) do local monsterxml = io.open(dir .. contents.file, "r") if monsterxml then local xmldata = monsterxml:read("*a") local _mod = false local s, f, content = xmldata:find("<monster%s(.-)>") local r, p, cs = content:find('script="(.-)"') monsterxml:close() newc = content if not cs then xmldata = xmldata:gsub(content, newc .. ' script="default.lua"') _mod = true elseif cs ~= "default.lua" then print('Warning: The file "' .. contents.file .. '" already has a script.') end local s, f, content = xmldata:find("<monster%s(.-)>") local x, q, scriptcontent = xmldata:find("<script>(.-)</script>") local readyevents = {} local addevents = "" if scriptcontent then for line in scriptcontent:gmatch("(.-)\n") do local event = line:match('<event%s-name="(.-)"') if event then readyevents[event] = true end end end for event, _c in pairs(events) do if not readyevents[event] then addevents = addevents .. '<event name="' .. event .. '"/>\n' end end if addevents ~= "" then _mod = true if scriptcontent and scriptcontent:find("event") then xmldata = xmldata:gsub(scriptcontent, scriptcontent .. addevents) elseif x and q then xmldata = xmldata:sub(1, x-1) .. xmldata:sub(q+1) xmldata = xmldata:sub(1, f) .. "\n<script>\n" .. addevents .. "\n</script>" .. xmldata:sub(f+1) else xmldata = xmldata:sub(1, f) .. "\n<script>\n" .. addevents .. "\n</script>" .. xmldata:sub(f+1) end end if xmldata then if _mod then modified = modified+1 end local monsterxmlwrite = io.open(dir .. contents.file, "w") monsterxmlwrite:write(xmldata) monsterxmlwrite:close() else print("Error in: " .. contents.name) end else print("Warning: Error opening file " .. contents.file) end end print("Total monsters XML modified: " .. modified) ---------------------------------- --- Parsing creaturescripts.xml -- local csfile = io.open(csdir .. csXML, "r") print("Parsing XML " .. csdir .. csXML .. "...") local csxmltable, xmldata = parseXML(csfile) csfile:close() ---------------------------------- --- Modify creaturescripts.xml --- local _mod = false local readytags = {} for i, contents in ipairs(csxmltable["event"]) do if events[contents.name] then readytags[contents.name] = true end end for event, contents in pairs(events) do if not readytags[event] then _mod = true local currenttag = csTag currenttag = currenttag:gsub("%%t", contents.type) currenttag = currenttag:gsub("%%n", event) currenttag = currenttag:gsub("%%s", contents.file) local r, w = xmldata:find("<creaturescripts>") xmldata = xmldata:sub(1, w) .. currenttag .. xmldata:sub(w+1) end end if _mod then local csfilewrite = io.open(csdir .. csXML, "w") csfilewrite:write(xmldata) csfilewrite:close() print("Modified " .. csdir .. csXML) end ---------------------------------- ----- Creating event scripts ----- print("Creating lua creaturescripts...") for event, contents in pairs(events) do local luafile = io.open(csdir .. "scripts/" .. contents.file, "w") luafile:write(contents.defaultText) luafile:close() end ---------------------------------- print("All the modifications were done.") return true end local check = io.open("meventsinstall.lua", "r") if not check then local ret = init() if ret then local file = io.open("meventsinstall.lua", "w") file:write("true") file:close() end else check:close() end Explicando o que o code realmente faz:
    O code vai ser executado somente uma vez e vai editar todos os monstros do seu OTServer presentes no monsters.xml adicionando um script default, que seria o defaultText presente no inicio do code (So funciona em TFS 1.0+) e tambem ira adicionar eventos ao XML do monstro sem remover os que ja existem (se existirem).
    Depois disso ele ira editar o creaturescripts.xml para criar a tag do evento e tambem criar o script que esta na tabela events.
     
    Como instalar:
     
    TFS 0.3.6:
    Só botar ele na pasta lib do seu OT que ele ja vai executar quando voce abrir o executavel.
     
    TFS 1.x:
    Bote o code na pasta "lib\core" e edite o core.lua nessa pasta adicionando essa linha:
    dofile('data/lib/core/monstersevent.lua') Se voce fizer tudo certo deve aparecer isso quando voce abrir o server:

     
     
    Você pode rodar o script novamente deletando o arquivo "meventsinstall.lua" que sera criado na pasta do server, ele soh ira adicionar algo se voce mudar alguma coisa no code.
     
    Porque usar esse code:
    Não usar funçoes como onAttack, onSpawn entre outras para registrar eventos em monstros.
    Usar as funçoes onCreatureAppear, onCreatureDisappear, onCreatureMove, onCreatureSay e onThink em todos os monstros do server (TFS 1.0+)
     
     
  8. Upvote
    MatheusGlad recebeu reputação de TioItachi em [elf bot] Hotkey Para Resetar   
    auto 200 if [$level >= 717217] say '!reborn'
  9. Upvote
    MatheusGlad recebeu reputação de Dennyz Dias em Action que teleporta para lugar X, porem precisa ter 10 resets para ir,so pode ir denovo após 1 Hora   
    function getPlayerReset(cid)
    local pid = getPlayerGUID(cid)
    local qr = db.getResult("SELECT `reset` FROM `players` WHERE `id`= ".. pid..";")
    rss = qr:getDataInt("reset", pid)
    if not rss or not tonumber(rss) then
    rss = 0
    end
    return rss
    end
     
    local hours = 1 -- tempo em horas
    local position = {x = 123, y = 456, z = 7}
     
    function onUse(cid, item)
    if getPlayerReset(cid) >= 10 then
    if getPlayerStorageValue(cid, 4954)-os.time() <= 0 then
    doTeleportThing(cid, position)
    setPlayerStorageValue(cid, 4954, os.time() + hours * 60 * 60)
    else
    doPlayerSendCancel(cid, "You need to wait: ".. getPlayerStorageValue(cid, 4954) - os.time() .."s to use this again.")
    doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
    end
    else
    doPlayerSendCancel(cid, "You need 10 resets to do this")
    doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
    end
    return true
    end
     

  10. Upvote
    MatheusGlad recebeu reputação de Mendiguinho91 em Monsters Default Events   
    FAÇA BACKUP DA PASTA MONSTERS E CREATURESCRIPTS ANTES DE UTILIZAR!
     
    Funciona para todas as versões TFS 0.3.6+ ate TFS 1.2 (Provavelmente funciona para outras tambem mas não me dei o trabalho de testar)
     
    Introdução:
    Bem, como o titulo mesmo diz, o script vai criar e modificar todos os monstros para terem scripts default (Caso o monstro não tenha script) e tambem pode adicionar creaturescripts default, exemplo o onDeath.
     
    Code:
     
    monsterevent.lua
    local dir = "./data/monster/" local csdir = "./data/creaturescripts/" local monstersXML = "monsters.xml" local csXML = "creaturescripts.xml" local csTag = '\n <event type="%t" name="%n" script="%s"/>' -- Tag format on creaturescripts.xml (%t = type, %n = name, %s = script) local defaultText = [[function onCreatureAppear(self, creature) return false end function onCreatureDisappear(self, creature) return false end function onCreatureMove(self, creature, oldPosition, newPosition) return false end function onCreatureSay(self, creature, type, message) return false end function onThink(self, interval) return false end]] local events = { ["monsterdeath"] = {type = "death", file="monsterdeath.lua", defaultText=[[ function onDeath(cid, corpse, lasthitkiller, mostdamagekiller, lasthitunjustified, mostdamageunjustified) return true end]]}, } ------- Não edite a partir dessa linha se nao souber o que esta fazendo. function parseXML(file) local ret = {["monster"] = {}, ["event"] = {}} local data = "" for line in file:lines() do data = data .. line .. "\n" line = line:match("<(.-)/>") if line then local element = line:match("^%s*(.-)%s") if element == "monster" or element == "event" then local t = {} for i, x in line:gmatch('%s+(.-)="(.-)"') do t[i] = x end table.insert(ret[element], t) end end end return ret, data:sub(1, #data-1) end function init() ----- Parsing monsters.xml ----- local monstersfile = io.open(dir .. monstersXML, "r") print("Parsing XML " .. dir .. monstersXML .. "...") local xmltable = parseXML(monstersfile) monstersfile:close() -------------------------------- -- Creating scripts directory -- local testfile = io.open(dir .. "scripts/test", "w") if not testfile then os.execute("mkdir data\\monster\\scripts") print("Directory " .. dir .. "scripts has been created.") else testfile:close() end os.remove(dir .. "scripts/test") --------------------------------- ------ Creating default.lua ------- local defaultlua = io.open(dir .. "scripts/default.lua", "w") defaultlua:write(defaultText) defaultlua:close() print("File " .. dir .. "scripts/default.lua has been created.") --------------------------------- ---- Modify all monsters XML! ---- local modified = 0 for i, contents in ipairs(xmltable["monster"]) do local monsterxml = io.open(dir .. contents.file, "r") if monsterxml then local xmldata = monsterxml:read("*a") local _mod = false local s, f, content = xmldata:find("<monster%s(.-)>") local r, p, cs = content:find('script="(.-)"') monsterxml:close() newc = content if not cs then xmldata = xmldata:gsub(content, newc .. ' script="default.lua"') _mod = true elseif cs ~= "default.lua" then print('Warning: The file "' .. contents.file .. '" already has a script.') end local s, f, content = xmldata:find("<monster%s(.-)>") local x, q, scriptcontent = xmldata:find("<script>(.-)</script>") local readyevents = {} local addevents = "" if scriptcontent then for line in scriptcontent:gmatch("(.-)\n") do local event = line:match('<event%s-name="(.-)"') if event then readyevents[event] = true end end end for event, _c in pairs(events) do if not readyevents[event] then addevents = addevents .. '<event name="' .. event .. '"/>\n' end end if addevents ~= "" then _mod = true if scriptcontent and scriptcontent:find("event") then xmldata = xmldata:gsub(scriptcontent, scriptcontent .. addevents) elseif x and q then xmldata = xmldata:sub(1, x-1) .. xmldata:sub(q+1) xmldata = xmldata:sub(1, f) .. "\n<script>\n" .. addevents .. "\n</script>" .. xmldata:sub(f+1) else xmldata = xmldata:sub(1, f) .. "\n<script>\n" .. addevents .. "\n</script>" .. xmldata:sub(f+1) end end if xmldata then if _mod then modified = modified+1 end local monsterxmlwrite = io.open(dir .. contents.file, "w") monsterxmlwrite:write(xmldata) monsterxmlwrite:close() else print("Error in: " .. contents.name) end else print("Warning: Error opening file " .. contents.file) end end print("Total monsters XML modified: " .. modified) ---------------------------------- --- Parsing creaturescripts.xml -- local csfile = io.open(csdir .. csXML, "r") print("Parsing XML " .. csdir .. csXML .. "...") local csxmltable, xmldata = parseXML(csfile) csfile:close() ---------------------------------- --- Modify creaturescripts.xml --- local _mod = false local readytags = {} for i, contents in ipairs(csxmltable["event"]) do if events[contents.name] then readytags[contents.name] = true end end for event, contents in pairs(events) do if not readytags[event] then _mod = true local currenttag = csTag currenttag = currenttag:gsub("%%t", contents.type) currenttag = currenttag:gsub("%%n", event) currenttag = currenttag:gsub("%%s", contents.file) local r, w = xmldata:find("<creaturescripts>") xmldata = xmldata:sub(1, w) .. currenttag .. xmldata:sub(w+1) end end if _mod then local csfilewrite = io.open(csdir .. csXML, "w") csfilewrite:write(xmldata) csfilewrite:close() print("Modified " .. csdir .. csXML) end ---------------------------------- ----- Creating event scripts ----- print("Creating lua creaturescripts...") for event, contents in pairs(events) do local luafile = io.open(csdir .. "scripts/" .. contents.file, "w") luafile:write(contents.defaultText) luafile:close() end ---------------------------------- print("All the modifications were done.") return true end local check = io.open("meventsinstall.lua", "r") if not check then local ret = init() if ret then local file = io.open("meventsinstall.lua", "w") file:write("true") file:close() end else check:close() end Explicando o que o code realmente faz:
    O code vai ser executado somente uma vez e vai editar todos os monstros do seu OTServer presentes no monsters.xml adicionando um script default, que seria o defaultText presente no inicio do code (So funciona em TFS 1.0+) e tambem ira adicionar eventos ao XML do monstro sem remover os que ja existem (se existirem).
    Depois disso ele ira editar o creaturescripts.xml para criar a tag do evento e tambem criar o script que esta na tabela events.
     
    Como instalar:
     
    TFS 0.3.6:
    Só botar ele na pasta lib do seu OT que ele ja vai executar quando voce abrir o executavel.
     
    TFS 1.x:
    Bote o code na pasta "lib\core" e edite o core.lua nessa pasta adicionando essa linha:
    dofile('data/lib/core/monstersevent.lua') Se voce fizer tudo certo deve aparecer isso quando voce abrir o server:

     
     
    Você pode rodar o script novamente deletando o arquivo "meventsinstall.lua" que sera criado na pasta do server, ele soh ira adicionar algo se voce mudar alguma coisa no code.
     
    Porque usar esse code:
    Não usar funçoes como onAttack, onSpawn entre outras para registrar eventos em monstros.
    Usar as funçoes onCreatureAppear, onCreatureDisappear, onCreatureMove, onCreatureSay e onThink em todos os monstros do server (TFS 1.0+)
     
     
  11. Upvote
    MatheusGlad recebeu reputação de Nosifero em Ajuda characters.php ( Reset)   
    <?PHP $name = stripslashes(ucwords(strtolower(trim($_REQUEST['name'])))); if(empty($name)) { $main_content .= 'Here you can get detailed information about a certain player on '.$config['server']['serverName'].'.<BR> <FORM ACTION="?subtopic=characters" METHOD=post><TABLE WIDTH=100% BORDER=0 CELLSPACING=1 CELLPADDING=4><TR><TD BGCOLOR="'.$config['site']['vdarkborder'].'" CLASS=white><B>Search Character</B></TD></TR><TR><TD BGCOLOR="'.$config['site']['darkborder'].'"><TABLE BORDER=0 CELLPADDING=1><TR><TD>Name:</TD><TD><INPUT NAME="name" VALUE=""SIZE=29 MAXLENGTH=29></TD><TD><INPUT TYPE=image NAME="Submit" SRC="'.$layout_name.'/images/buttons/sbutton_submit.gif" BORDER=0 WIDTH=120 HEIGHT=18></TD></TR></TABLE></TD></TR></TABLE></FORM>'; } else { if(check_name($name)) { $player = $ots->createObject('Player'); $player->find($name); if($player->isLoaded()) { $account = $player->getAccount(); $main_content .= '<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%><TR><TD><IMG SRC="'.$layout_name.'/images/general/blank.gif" WIDTH=10 HEIGHT=1 BORDER=0></TD><TD><TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR='.$config['site']['vdarkborder'].'><TD COLSPAN=2 CLASS=white><B>Character Information</B></TD></TR>'; if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++; $main_content .= '<TR BGCOLOR="'.$bgcolor.'"><TD WIDTH=20%>Name:</TD><TD><font color="'; $main_content .= ($player->isOnline()) ? 'green' : 'red'; $main_content .= '"><b>'.$player->getName().'</b></font>'; if($player->isDeleted()) $main_content .= '<font color="red"> [DELETED]</font>'; if($player->isNameLocked()) $main_content .= '<font color="red"> [NAMELOCK]</font>'; $main_content .= '</TD></TR>'; if($player->getOldName()) { if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++; if($player->isNameLocked()) $main_content .= '<TR BGCOLOR="'.$bgcolor.'"><TD>Proposition:</TD><TD>'.$player->getOldName().'</TD></TR>'; else $main_content .= '<TR BGCOLOR="'.$bgcolor.'"><TD>Old name:</TD><TD>'.$player->getOldName().'</TD></TR>'; } // BEGIN Position Showing *** Fixed by jerryb1988 from otfans.net $group = $player->getGroup(); if ($group == 2){$group_name = 'Tutor';} if ($group == 3){$group_name = 'Senior Tutor';} if ($group == 4){$group_name = 'Gamemaster';} if ($group == 5){$group_name = 'Community Manager';} if ($group == 6){$group_name = 'GOD';} if($group != 1) { if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++; $main_content .= '<TR BGCOLOR="'.$bgcolor.'"><TD>Position:</TD><TD>'.$group_name.'</TD></TR>'; } // END Position Showing if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++; $main_content .= '<TR BGCOLOR="'.$bgcolor.'"><TD>Sex:</TD><TD>'; $main_content .= ($player->getSex() == 0) ? 'female' : 'male'; $main_content .= '</TD></TR>'; if($config['site']['show_marriage_info']) { if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++; $main_content .= '<TR BGCOLOR="'.$bgcolor.'"><TD>Marital status:</TD><TD>'; $marriage = new OTS_Player(); $marriage->load($player->getMarriage()); if($marriage->isLoaded()) $main_content .= 'married to <a href="?subtopic=characters&name='.urlencode($marriage->getName()).'"><b>'.$marriage->getName().'</b></a></TD></TR>'; else $main_content .= 'single</TD></TR>'; } if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++; $main_content .= '<TR BGCOLOR="'.$bgcolor.'"><TD>Profession:</TD><TD>'.$vocation_name[$player->getWorld()][$player->getPromotion()][$player->getVocation()].'</TD></TR>'; if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++; $main_content .= '<TR BGCOLOR="'.$bgcolor.'"><TD>Level:</TD><TD>'.$player->getLevel().'</TD></TR>'; if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++; $main_content .= '<TR BGCOLOR="'.$bgcolor.'"><TD>World:</TD><TD>'.$config['site']['worlds'][$player->getWorld()].'</TD></TR>'; if(!empty($towns_list[$player->getWorld()][$player->getTownId()])) { if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++; $main_content .= '<TR BGCOLOR="'.$bgcolor.'"><TD>Residence:</TD><TD>'.$towns_list[$player->getWorld()][$player->getTownId()].'</TD></TR>'; if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++; $main_content .= '<TR BGCOLOR="'.$bgcolor.'"><TD>Balance:</TD><TD>'.$player->getBalance().' Gold Coins.</TD></TR>'; } $rank_of_player = $player->getRank(); if(!empty($rank_of_player)) { { $guild_id = $rank_of_player->getGuild()->getId(); $guild_name = $rank_of_player->getGuild()->getName(); if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++; $main_content .= '<TR BGCOLOR="'.$bgcolor.'"><TD>Guild Membership:</TD><TD>'.$rank_of_player->getName().' of the <a href="?subtopic=guilds&action=show&guild='.$guild_id.'">'.$guild_name.'</a></TD></TR>'; } } if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++; $lastlogin = $player->getLastLogin(); if(empty($lastlogin)) $main_content .= '<TR BGCOLOR="'.$bgcolor.'"><TD>Last login:</TD><TD>Never logged in.</TD></TR>'; else $main_content .= '<TR BGCOLOR="'.$bgcolor.'"><TD>Last login:</TD><TD>'.date("j F Y, g:i a", $lastlogin).'</TD></TR>'; if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++; if($config['site']['show_creationdate'] && $player->getCreated()) { $main_content .= '<TR BGCOLOR="'.$bgcolor.'"><TD>Created:</TD><TD>'.date("j F Y, g:i a", $player->getCreated()).'</TD></TR>'; } /*Vip Status*/ if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++; $main_content .= '<TR BGCOLOR="'.$bgcolor.'"><TD>Vip Status:</TD><TD>'; $main_content .= ($account->getPlayerVipTime()) ? '<b><font color="green">Vip Account</font></b>' : '<b><font color="red">Not Vip Account</font></b>'; if($config['site']['show_vip_status']) { $id = $player->getCustomField("id"); if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++; $main_content .= '<TR BGCOLOR="'.$bgcolor.'"><TD WIDTH=10%>Vip Status:</TD>'; $vip = $SQL->query('SELECT * FROM player_storage WHERE player_id = '.$id.' AND `key` = '.$config['site']['show_vip_storage'].';')->fetch(); if($vip == false) { $main_content .= '<TD><span class="red"><B>NOT VIP</B></TD></TR>'; } else { $main_content .= '<TD><span class="green"><B>VIP</B></TD></TR>'; } $comment = $player->getComment(); $newlines = array("\r\n", "\n", "\r"); $comment_with_lines = str_replace($newlines, '<br />', $comment, $count); if($count < 50) $comment = $comment_with_lines; if(!empty($comment)) { if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++; $main_content .= '<TR BGCOLOR="'.$bgcolor.'"><TD VALIGN=top>Comment:</TD><TD>'.$comment.'</TD></TR>'; } } //Outfit shower by Pening edited by loleslav if($config['site']['show_outfit']) { $id = $player->getCustomField("id"); $main_content .= '<TD BGCOLOR="'.$config['site']['darkborder'].'">Outfit:'; $listaddon = array('128','129','130','131','132','133','134','135','136','137','138','139','140','141','142','143','144','145','146','147','148','149','150','151','152','153','154','155','158','159','251','252','268','269','270','273','278','279','288','289','302','324','325'); $lookadd = array('0','1','2','3'); foreach ($listaddon as $pid => $name) foreach ($lookadd as $addo => $name) { $addon1 = $SQL->query('SELECT * FROM players WHERE id = '.$id.' AND looktype = '.$listaddon[$pid].' AND lookaddons = '.$lookadd[$addo].';')->fetch(); if($addon1[looktype] == true ) { $finaddon = $addon1[looktype] + $addon1[lookaddons] * 300; $main_content .= '<TD with=50% style="background-color: '.$config['site']['darkborder'].'"><center><img src="images/addons/'.$finaddon.'.gif"/></center></TD></TD>'; } } } $main_content .= '</td>'; //end Outfit shower by Pening edited by loleslav if($config['site']['show_signature']) { // Signature by makr0mango. function randomSignature( $folder ) { $files = scandir ( "./$folder/" ); $signature = array(); foreach ( $files as $file ): if ( substr ( strtolower ( $file ) , -4 ) == ".png" ) $signature[] = $file; endforeach; return rand(0,count($signature)-1); } $random = randomSignature("signatures"); $main_content .= '<br><tr></tr><tr></tr><tr></tr><TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR='.$config['site']['vdarkborder'].'><TD COLSPAN=2 CLASS=white><B>Signature</B></TD></TR>'; $main_content .= "<TR BGCOLOR=".$config['site']['darkborder']."><TD WIDTH=20%>Forum Link:</TD><TD><input type='text' size='75' onclick='this.select();' value='[url=\"http://" . $_SERVER['HTTP_HOST'] . "\"][IMG=http://" . $_SERVER['HTTP_HOST'] . "/signature.php?character=" .$player->getName(). "ℑ=" . $random . "][/url]' /></TD></TR>"; $main_content .= "<TR BGCOLOR=".$config['site']['lightborder']."><TD WIDTH=20%>Direct Link:</TD><TD><input type='text' size='75' onclick='this.select();' value='http://" . $_SERVER['HTTP_HOST'] . "/signature.php?character=" .$player->getName(). "ℑ=" . $random . "' /></TD></TR>"; $main_content .= "<TR BGCOLOR=".$config['site']['darkborder']."><TD COLSPAN='2' style='text-align: center;'><img src='signature.php?character=" .$player->getName(). "ℑ=" . $random . "' /></TD></TR>"; $main_content .= '</TD></TR></TABLE>'; // Signature by makr0mango. } //modified status scripts by ballack13 $main_content .= '<table width=100%><tr>'; //equipment shower by ballack13 $id = $player->getCustomField("id"); $number_of_items = 1; $main_content .= '<td align=center><table with=100% style="border: solid 1px #888888;" CELLSPACING="1"><TR>'; $list = array('2','1','3','6','4','5','9','7','10','8'); foreach ($list as $pid => $name) { $top = $SQL->query('SELECT * FROM player_items WHERE player_id = '.$id.' AND pid = '.$list[$pid].';')->fetch(); if($top[itemtype] == false) { if($list[$pid] == '8') { $main_content .= '<td style="background-color: '.$config['site']['darkborder'].'; text-align: center;">Soul:<br/>'.$player->getSoul().'</td>'; } if(is_int($number_of_items / 3)){ $main_content .= '<TD style="background-color: '.$config['site']['darkborder'].'; text-align: center;"><img src="images/items/'.$list[$pid].'.gif"/></TD></tr><tr>'; } else { $main_content .= '<TD style="background-color: '.$config['site']['darkborder'].'; text-align: center;"><img src="images/items/'.$list[$pid].'.gif"/></TD>'; } $number_of_items++; } else { if($list[$pid] == '8') { $main_content .= '<td style="background-color: '.$config['site']['darkborder'].'; text-align: center;">Soul:<br/>'.$player->getSoul().'</td>'; } if(is_int($number_of_items / 3)) $main_content .= '<TD style="background-color: '.$config['site']['darkborder'].'; text-align: center;"><img src="images/items/'.$top[itemtype].'.gif" width="45"/></TD></tr><tr>'; else $main_content .= '<TD style="background-color: '.$config['site']['darkborder'].'; text-align: center;"><img src="images/items/'.$top[itemtype].'.gif" width="45"/></TD>'; $number_of_items++; } if($list[$pid] == '8') { $main_content .= '<td style="background-color: '.$config['site']['darkborder'].'; text-align: center;">Cap:<br/>'.$player->getCap().'</td>'; } } $main_content .= '</tr></TABLE></td>'; //Hp/Mana/Exp Status by ballack13 $hp = ($player->getHealth() / $player->getHealthMax() * 100); $main_content .= '<td align=center ><table width=100%><tr><td align=center><table CELLSPACING="1" CELLPADDING="4"><tr><td BGCOLOR="#D4C0A1" align="left" width="20%"><b>Player Health:</b></td> <td BGCOLOR="#D4C0A1" align="left">'.$player->getHealth().'/'.$player->getHealthMax().'<div style="width: 100%; height: 3px; border: 1px solid #000;"><div style="background: red; width: '.$hp.'%; height: 3px;"></td></tr>'; if ($player->getManaMax() > 0) { $mana = ($player->getMana() / $player->getManaMax() * 100); $main_content .= '<tr><td BGCOLOR="#F1E0C6" align="left"><b>Player Mana:</b></td><td BGCOLOR="#F1E0C6" align="left">'.$player->getMana().'/'.$player->getManaMax().'<div style="width: 100%; height: 3px; border: 1px solid #000;"><div style="background: blue; width: '.$mana.'%; height: 3px;"></td>'; } else { $main_content .= '<tr><td BGCOLOR="#F1E0C6" align="left"><b>Player Mana:</b></td><td BGCOLOR="#F1E0C6" align="left">0/0<div style="width: 100%; height: 3px; border: 1px solid #000;"><div style="background: blue; width: 100%; height: 3px;"></td>'; } $main_content .= '</tr></table><tr>'; $next = ($player->getLevel() + 1); $id = $player->getCustomField("id"); $resets = $SQL->query('SELECT `reset` FROM `players` WHERE `id`= ' . $id . ';')->fetch(); $exp = ((50 / 3) * ($player->getLevel() * $player->getLevel() * $player->getLevel()) - (100 * ($player->getLevel() * $player->getLevel())) + ((850/3) * $player->getLevel()) - 200); $expnext = ((50 / 3) * ($next * $next * $next) - (100 * ($next * $next)) + ((850/3) * $next) - 200 - $player->getExperience()); $expresult = ($expnext / (($expnext + $player->getExperience()) - $exp) * 100); $main_content .= '<tr><table CELLSPACING="1" CELLPADDING="4"><tr><td BGCOLOR="'.$config['site']['lightborder'].'" align="left" width="20%"><b>Player Level:</b></td><td BGCOLOR="'.$config['site']['lightborder'].'" align="left">'.$player->getLevel().'</td></tr><tr><td BGCOLOR="'.$config['site']['lightborder'].'" align="left" width="20%"><b>Resets:</b></td><td BGCOLOR="'.$config['site']['lightborder'].'" align="left">' . $resets[reset] . '</td></tr> <tr><td BGCOLOR="'.$config['site']['darkborder'].'" align="left"><b>Player Experience:</b></td><td BGCOLOR="'.$config['site']['darkborder'].'" align="left">'.$player->getExperience().' EXP.</td></tr> <tr><td BGCOLOR="'.$config['site']['lightborder'].'" align="left"><b>To Next Level:</b></td><td BGCOLOR="'.$config['site']['lightborder'].'" align="left">You need <b>'.$exp.' EXP</b> to Level <b>'.$next.'</b>.<div title="99.320604545 %" style="width: 100%; height: 3px; border: 1px solid #000;"><div style="background: red; width: '.$expresult.'%; height: 3px;"></td></tr></table></td></tr></table></tr></TABLE></td>'; if($config['site']['show_skills_info']) { //Skills Pics v2. Table borders optimized by Absolute Mango $main_content .= '<br/><table cellspacing="0" cellpadding="0" border="0" width="200" align="center"><caption><strong>Skills</strong></caption><tbody><tr> <td align="center"><a href="?subtopic=highscores&list=experience"><img src="images/skills/level.png" style="border: none;"/></a></td> <td align="center"><a href="?subtopic=highscores&list=magic"><img src="images/skills/ml.png" style="border: none;"/></a></td> <td align="center"><a href="?subtopic=highscores&list=fist"><img src="images/skills/fist.png" style="border: none;"/></a></td> <td align="center"><a href="?subtopic=highscores&list=club"><img src="images/skills/club.png" style="border: none;"/></a></td> <td align="center"><a href="?subtopic=highscores&list=sword"><img src="images/skills/sword.png" style="border: none;"/></a></td> <td align="center"><a href="?subtopic=highscores&list=axe"><img src="images/skills/axe.png" style="border: none;"/></a></td> <td align="center"><a href="?subtopic=highscores&list=distance"><img src="images/skills/dist.png" style="border: none;"/></a></td> <td align="center"><a href="?subtopic=highscores&list=shield"><img src="images/skills/def.png" style="border: none;"/></a></td> <td align="center"><a href="?subtopic=highscores&list=fishing"><img src="images/skills/fish.png" style="border: none;"/></a></td> </tr></tbody></table> <table cellspacing="0" cellpadding="0" border="1" width="360" align="center"><tbody><tr><tr bgcolor="'.$config['site']['darkborder'].'"> <td align="center" width="38"><strong>Level</strong></td> <td align="center" width="38"><strong>ML</strong></td> <td align="center" width="42"><strong>Fist</strong></td> <td align="center" width="40"><strong>Club</strong></td> <td align="center" width="38"><strong>Swrd</strong></td> <td align="center" width="38"><strong>Axe</strong></td> <td align="center" width="38"><strong>Dist</strong></td> <td align="center" width="38"><strong>Shield</strong></td> <td align="center" width="38"><strong>Fish</strong></td></font> </tr> <tr bgcolor="'.$config['site']['lightborder'].'"> <td align="center" width="38">'.$player->getLevel().'</td> <td align="center" width="38">'.$player->getMagLevel().'</td> <td align="center" width="38">'.$player->getSkill(0).'</td> <td align="center" width="38">'.$player->getSkill(1).'</td> <td align="center" width="38">'.$player->getSkill(2).'</td> <td align="center" width="38">'.$player->getSkill(3).'</td> <td align="center" width="38">'.$player->getSkill(4).'</td> <td align="center" width="38">'.$player->getSkill(5).'</td> <td align="center" width="38">'.$player->getSkill(6).'</td> </tr></tbody></table><div table align="center"> <br /> </div>'; //skill script end } //quest status by ballack13 $id = $player->getCustomField("id"); $number_of_quests = 0; $main_content .= '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR='.$config['site']['vdarkborder'].'><TD align="left" COLSPAN=2 CLASS=white><B>Quests</B></TD></TD align="right"></TD></TR>'; $quests = $config['site']['quests']; foreach ($quests as $storage => $name) { if(is_int($number_of_quests / 2)) $bgcolor = $config['site']['darkborder']; else $bgcolor = $config['site']['lightborder']; $number_of_quests++; $main_content .= '<TR BGCOLOR="'.$bgcolor.'"><TD WIDTH=95%>'.$storage.'</TD>'; $quest = $SQL->query('SELECT * FROM player_storage WHERE player_id = '.$id.' AND `key` = '.$quests[$storage].';')->fetch(); if($quest == false) { $main_content .= '<TD><img src="images/false.png"/></TD></TR>'; } else { $main_content .= '<TD><img src="images/true.png"/></TD></TR>'; } } $main_content .= '</TABLE></td></tr></table><br />'; $deads = 0; //deaths list $player_deaths = $SQL->query('SELECT `id`, `date`, `level` FROM `player_deaths` WHERE `player_id` = '.$player->getId().' ORDER BY `date` DESC LIMIT 0,10;'); foreach($player_deaths as $death) { if(is_int($number_of_rows / 2)) $bgcolor = $config['site']['darkborder']; else $bgcolor = $config['site']['lightborder']; $number_of_rows++; $deads++; $dead_add_content .= "<tr bgcolor=\"".$bgcolor."\"> <td width=\"20%\" align=\"center\">".date("j M Y, H:i", $death['date'])."</td> <td>"; $killers = $SQL->query("SELECT environment_killers.name AS monster_name, players.name AS player_name, players.deleted AS player_exists FROM killers LEFT JOIN environment_killers ON killers.id = environment_killers.kill_id LEFT JOIN player_killers ON killers.id = player_killers.kill_id LEFT JOIN players ON players.id = player_killers.player_id WHERE killers.death_id = ".$SQL->quote($death['id'])." ORDER BY killers.final_hit DESC, killers.id ASC")->fetchAll(); $i = 0; $count = count($killers); foreach($killers as $killer) { $i++; if(in_array($i, array(1, $count))) $killer['monster_name'] = str_replace(array("an ", "a "), array("", ""), $killer['monster_name']); if($killer['player_name'] != "") { if($i == 1) $dead_add_content .= "Killed at level <b>".$death['level']."</b> by "; else if($i == $count) $dead_add_content .= " and by "; else $dead_add_content .= ", "; if($killer['monster_name'] != "") $dead_add_content .= $killer['monster_name']." summoned by "; if($killer['player_exists'] == 0) $dead_add_content .= "<a href=\"index.php?subtopic=characters&name=".urlencode($killer['player_name'])."\">"; $dead_add_content .= $killer['player_name']; if($killer['player_exists'] == 0) $dead_add_content .= "</a>"; } else { if($i == 1) $dead_add_content .= "Died at level <b>".$death['level']."</b> by "; else if($i == $count) $dead_add_content .= " and by "; else $dead_add_content .= ", "; $dead_add_content .= $killer['monster_name']; } if($i == $count) $dead_add_content .= "."; } $dead_add_content .= ".</td></tr>"; } if($deads > 0) $main_content .= '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR='.$config['site']['vdarkborder'].'><TD COLSPAN=2 CLASS=white><B>Deaths</B></TD></TR>' . $dead_add_content . '</TABLE><br />'; //end if(!$player->getHideChar()) { $main_content .= '<TABLE BORDER=0><TR><TD></TD></TR></TABLE><TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR='.$config['site']['vdarkborder'].'><TD COLSPAN=2 CLASS=white><B>Account Information</B></TD></TR>'; if($account->getRLName()) { if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++; $main_content .= '<TR BGCOLOR='.$config['site']['lightborder'].'><TD WIDTH=20%>Real name:</TD><TD>'.$account->getRLName().'</TD></TR>'; } if($account->getLocation()) { if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++; $main_content .= '<TR BGCOLOR='.$config['site']['darkborder'].'><TD WIDTH=20%>Location:</TD><TD>'.$account->getLocation().'</TD></TR>'; } if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++; if($account->getLastLogin()) $main_content .= '<TR BGCOLOR='.$config['site']['lightborder'].'><TD WIDTH=20%>Last login:</TD><TD>'.date("j F Y, g:i a", $account->getLastLogin()).'</TD></TR>'; else $main_content .= '<TR BGCOLOR='.$config['site']['lightborder'].'><TD WIDTH=20%>Last login:</TD><TD>Never logged in.</TD></TR>'; if($account->getCreated()) { if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++; $main_content .= '<TR BGCOLOR='.$config['site']['lightborder'].'><TD WIDTH=20%>Created:</TD><TD>'.date("j F Y, g:i a", $account->getCreated()).'</TD></TR>'; } if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++; $main_content .= '<TR BGCOLOR="'.$bgcolor.'"><TD>Account Status:</TD><TD>'; $main_content .= ($account->isPremium()) ? '<b><font color="green">Premium Account</font></b>' : '<b><font color="green">Gratis Premium Account</font></b>'; if($account->isBanned()) if($account->getBanTime() > 0) $main_content .= '<font color="red"> [Banished until '.date("j F Y, G:i", $account->getBanTime()).']</font>'; else $main_content .= '<font color="red"> [Banished FOREVER]</font>'; $main_content .= '</TD></TR></TABLE>'; $main_content .= '<br><TABLE BORDER=0><TR><TD></TD></TR></TABLE><TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR='.$config['site']['vdarkborder'].'><TD COLSPAN=5 CLASS=white><B>Characters</B></TD></TR> <TR BGCOLOR='.$config['site']['darkborder'].'><TD><B>Name</B></TD><TD><B>World</B></TD><TD><B>Level</B></TD><TD><b>Status</b></TD><TD><B> </B></TD></TR>'; $account_players = $account->getPlayersList(); $account_players->orderBy('name'); $player_number = 0; foreach($account_players as $player_list) { if(!$player_list->getHideChar()) { $player_number++; if(is_int($player_number / 2)) $bgcolor = $config['site']['darkborder']; else $bgcolor = $config['site']['lightborder']; if(!$player_list->isOnline()) $player_list_status = '<font color="red">Offline</font>'; else $player_list_status = '<font color="green">Online</font>'; $main_content .= '<TR BGCOLOR="'.$bgcolor.'"><TD WIDTH=52%><NOBR>'.$player_number.'. '.$player_list->getName(); $main_content .= ($player_list->isDeleted()) ? '<font color="red"> [DELETED]</font>' : ''; $main_content .= '</NOBR></TD><TD WIDTH=15%>'.$config['site']['worlds'][$player_list->getWorld()].'</TD><TD WIDTH=25%>'.$player_list->getLevel().' '.$vocation_name[$player_list->getWorld()][$player_list->getPromotion()][$player_list->getVocation()].'</TD><TD WIDTH="8%"><b>'.$player_list_status.'</b></TD><TD><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><FORM ACTION="?subtopic=characters" METHOD=post><TR><TD><INPUT TYPE=hidden NAME=name VALUE="'.$player_list->getName().'"><INPUT TYPE=image NAME="View '.$player_list->getName().'" ALT="View '.$player_list->getName().'" SRC="'.$layout_name.'/images/buttons/sbutton_view.gif" BORDER=0 WIDTH=120 HEIGHT=18></TD></TR></FORM></TABLE></TD></TR>'; } } $main_content .= '</TABLE></TD><TD><IMG SRC="'.$layout_name.'/images/general/blank.gif" WIDTH=10 HEIGHT=1 BORDER=0></TD></TR></TABLE>'; } $main_content .= '<BR><BR><FORM ACTION="?subtopic=characters" METHOD=post><TABLE WIDTH=100% BORDER=0 CELLSPACING=1 CELLPADDING=4><TR><TD BGCOLOR="'.$config['site']['vdarkborder'].'" CLASS=white><B>Search Character</B></TD></TR><TR><TD BGCOLOR="'.$config['site']['darkborder'].'"><TABLE BORDER=0 CELLPADDING=1><TR><TD>Name:</TD><TD><INPUT NAME="name" VALUE=""SIZE=29 MAXLENGTH=29></TD><TD><INPUT TYPE=image NAME="Submit" SRC="'.$layout_name.'/images/buttons/sbutton_submit.gif" BORDER=0 WIDTH=120 HEIGHT=18></TD></TR></TABLE></TD></TR></TABLE></FORM>'; $main_content .= '</TABLE>'; } else $search_errors[] = 'Character <b>'.$name.'</b> does not exist.'; } else $search_errors[] = 'This name contains invalid letters. Please use only A-Z, a-z and space.'; if(!empty($search_errors)) { $main_content .= '<div class="SmallBox" > <div class="MessageContainer" > <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div> <div class="BoxFrameEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div> <div class="BoxFrameEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div> <div class="ErrorMessage" > <div class="BoxFrameVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div> <div class="BoxFrameVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div> <div class="AttentionSign" style="background-image:url('.$layout_name.'/images/content/attentionsign.gif);" /></div><b>The Following Errors Have Occurred:</b><br/>'; foreach($search_errors as $search_error) $main_content .= '<li>'.$search_error; $main_content .= '</div> <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div> <div class="BoxFrameEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div> <div class="BoxFrameEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div> </div></div><br/>'; $main_content .= '<BR><FORM ACTION="?subtopic=characters" METHOD=post><TABLE WIDTH=100% BORDER=0 CELLSPACING=1 CELLPADDING=4><TR><TD BGCOLOR="'.$config['site']['vdarkborder'].'" CLASS=white><B>Search Character</B></TD></TR><TR><TD BGCOLOR="'.$config['site']['darkborder'].'"><TABLE BORDER=0 CELLPADDING=1><TR><TD>Name:</TD><TD><INPUT NAME="name" VALUE=""SIZE=29 MAXLENGTH=29></TD><TD><INPUT TYPE=image NAME="Submit" SRC="'.$layout_name.'/images/buttons/sbutton_submit.gif" BORDER=0 WIDTH=120 HEIGHT=18></TD></TR></TABLE></TD></TR></TABLE></FORM>'; } } ?> Tenta isso. Não garanto nada

    Deve aparecer em baixo do level do player se funcionar
  12. Upvote
    MatheusGlad recebeu reputação de Caronte em [ACTION] Summon Scroll   
    Muito bom o code, na parte de tirar os espaços eu nao usaria o %a, pq nomes de monstros não consistem exclusivamente de letras (os normais sim) e poderia bugar se eu tivesse um monstro com o nome "Mkalo'Boss" e usaria table.concat
     
    Eu faria assim:
    local name = " Mkalo's baby " function string.exp(e, sep) local result = {} e:gsub("[^".. sep .."]+", function(s) table.insert(result, s:match("^%s*(.-)%s*$")) end) return result end name = table.concat(name:exp("%s"), " ")
  13. Upvote
    MatheusGlad recebeu reputação de Administrador em [ACTION] Summon Scroll   
    Muito bom o code, na parte de tirar os espaços eu nao usaria o %a, pq nomes de monstros não consistem exclusivamente de letras (os normais sim) e poderia bugar se eu tivesse um monstro com o nome "Mkalo'Boss" e usaria table.concat
     
    Eu faria assim:
    local name = " Mkalo's baby " function string.exp(e, sep) local result = {} e:gsub("[^".. sep .."]+", function(s) table.insert(result, s:match("^%s*(.-)%s*$")) end) return result end name = table.concat(name:exp("%s"), " ")
  14. Upvote
    MatheusGlad recebeu reputação de fortation em [elf bot] Hotkey Para Resetar   
    auto 200 if [$level >= 717217] say '!reborn'
  15. Upvote
    MatheusGlad deu reputação a Caronte em [ACTION] Summon Scroll   
    Olá pessoal, venho lhes trazer hoje um script simples de manipulação de string.
    O Script: Trata-se de como o título já diz, de uma Summon Scroll, que ao digitar o nome do monstro nela e clicar em Ok, ela fica preparada para sumonar um monstro.
    ela pode ser usada tanto no inventário quanto no chão, e também tem uma lista de monstros que podem ser sumonados por ela.
     
     
     
    Vídeo demonstrativo:


    quaisquer dúvidas ou sugestões, só postar.
     
    Créditos:
    @Caronte
    -- Excelente manipulação de string, optimizou o script.
  16. Upvote
    MatheusGlad recebeu reputação de Administrador em [elf bot] Hotkey Para Resetar   
    auto 200 if [$level >= 717217] say '!reborn'
  17. Upvote
    MatheusGlad recebeu reputação de Nosifero em Fusion system ( 8.60)   
    Retire o == TRUE depois das funçoes isInArray:
    -------------------------------------- --------- FUSION SYSTEM -------------- -- Ideia Original por: Dias Otonwer -- ----- Melhorado por: Duduzz ---------- -------------------------------------- function onUse(cid,item,fromPosition,itemEx,toPosition) -------------------------------- -------- Configuração ---------- -------------------------------- -- Item 1 -> pedaco de ferro ; Item 2 -> gemas local steel = 5889 -- id do pedaço de ferro ou a materia prima pra fusao. obs: APENAS 1 ID local gems = {2154,2153,2155,2156,2158} -- id das gemas ou do segundo item para fusao. obs: 2 OU MAIS IDS -- Item 3 -> frozen starlight ou wooden trash (configuravel) local item3 = 2361 -- id do item para criar items raros (frozen starlight). obs: APENAS 1 ID local item4 = 2253-- id do item para criar items fracos (wooden trash). obs: APENAS 1 ID -- Premios local premios = {2542,11301,11302,2645,2124,2173,2195,2466,5803,2414,7402,2498,2498,2520} -- premios fracos. obs: 2 OU MAIS IDS local premiosraros = {6529,8851,8926,8924,2646,8928,2470,2502,2503,2504,2453,2453,7423,6391,2522,2342,2494,2494,11240,11240,2472,2472,2123,2123,2171,2171,2496,2469,2495,2495,8932,2415,2408,2390,8885,8886,8887,8877,8878,8879} -- premios raros. obs: 2 OU MAIS IDS -- Posicoes local pos1 = {x=186,y=39,z=8,stackpos=255} -- posicao do item 1 local pos2 = {x=187,y=39,z=8,stackpos=255} -- posicao do item 2 local pos3 = {x=188,y=39,z=8,stackpos=255} -- posicao do item 3 local pos4 = {x=187,y=39,z=8,stackpos=255} -- posicao do item criado -------------------------------- -- Não mexa em nada abaixo!!! -- -------------------------------- local getpos = {getThingFromPos(pos1),getThingFromPos(pos2),getThingFromPos(pos3)} local randfacil = math.random(1,table.getn(premios)) local resultado = premios[randfacil] local randdificil = math.random(1,table.getn(premiosraros)) local resultado1 = premiosraros[randdificil] if itemEx.itemid == 1945 then if getpos[1].itemid == steel then if isInArray(gems,getpos[2].itemid) and getpos[3].itemid == item4 then doCreateItem(resultado,1,pos4) doRemoveItem(getpos[1].uid,1) doRemoveItem(getpos[2].uid,1) doRemoveItem(getpos[3].uid,1) doSendMagicEffect(pos4,13) doSendMagicEffect(pos3,13) doSendMagicEffect(pos2,13) doSendMagicEffect(pos1,13) doPlayerSendTextMessage(cid,20,"Voce criou um Item!") doTransformItem(itemEx.uid,itemEx.itemid+1) elseif isInArray(gems,getpos[2].itemid) and getpos[3].itemid == item3 then doCreateItem(resultado1,1,pos4) doRemoveItem(getpos[1].uid,1) doRemoveItem(getpos[2].uid,1) doRemoveItem(getpos[3].uid,1) doSendMagicEffect(pos4,13) doSendMagicEffect(pos2,13) doSendMagicEffect(pos3,13) doSendMagicEffect(pos1,13) doPlayerSendTextMessage(cid,20,"Voce criou um Item Raro!") doTransformItem(itemEx.uid,itemEx.itemid+1) else doPlayerSendCancel(cid,"Os items estao errados ou sua ordem esta incorreta.") end else doPlayerSendCancel(cid,"Voce precisa primeiramente da materia prima.") end elseif itemEx.uid == 5396 and itemEx.itemid == 1946 then doTransformItem(itemEx.uid,1945) else doPlayerSendCancel(cid,"Impossivel") end return 1 end
  18. Upvote
    MatheusGlad recebeu reputação de Allencar em Monsters Default Events   
    FAÇA BACKUP DA PASTA MONSTERS E CREATURESCRIPTS ANTES DE UTILIZAR!
     
    Funciona para todas as versões TFS 0.3.6+ ate TFS 1.2 (Provavelmente funciona para outras tambem mas não me dei o trabalho de testar)
     
    Introdução:
    Bem, como o titulo mesmo diz, o script vai criar e modificar todos os monstros para terem scripts default (Caso o monstro não tenha script) e tambem pode adicionar creaturescripts default, exemplo o onDeath.
     
    Code:
     
    monsterevent.lua
    local dir = "./data/monster/" local csdir = "./data/creaturescripts/" local monstersXML = "monsters.xml" local csXML = "creaturescripts.xml" local csTag = '\n <event type="%t" name="%n" script="%s"/>' -- Tag format on creaturescripts.xml (%t = type, %n = name, %s = script) local defaultText = [[function onCreatureAppear(self, creature) return false end function onCreatureDisappear(self, creature) return false end function onCreatureMove(self, creature, oldPosition, newPosition) return false end function onCreatureSay(self, creature, type, message) return false end function onThink(self, interval) return false end]] local events = { ["monsterdeath"] = {type = "death", file="monsterdeath.lua", defaultText=[[ function onDeath(cid, corpse, lasthitkiller, mostdamagekiller, lasthitunjustified, mostdamageunjustified) return true end]]}, } ------- Não edite a partir dessa linha se nao souber o que esta fazendo. function parseXML(file) local ret = {["monster"] = {}, ["event"] = {}} local data = "" for line in file:lines() do data = data .. line .. "\n" line = line:match("<(.-)/>") if line then local element = line:match("^%s*(.-)%s") if element == "monster" or element == "event" then local t = {} for i, x in line:gmatch('%s+(.-)="(.-)"') do t[i] = x end table.insert(ret[element], t) end end end return ret, data:sub(1, #data-1) end function init() ----- Parsing monsters.xml ----- local monstersfile = io.open(dir .. monstersXML, "r") print("Parsing XML " .. dir .. monstersXML .. "...") local xmltable = parseXML(monstersfile) monstersfile:close() -------------------------------- -- Creating scripts directory -- local testfile = io.open(dir .. "scripts/test", "w") if not testfile then os.execute("mkdir data\\monster\\scripts") print("Directory " .. dir .. "scripts has been created.") else testfile:close() end os.remove(dir .. "scripts/test") --------------------------------- ------ Creating default.lua ------- local defaultlua = io.open(dir .. "scripts/default.lua", "w") defaultlua:write(defaultText) defaultlua:close() print("File " .. dir .. "scripts/default.lua has been created.") --------------------------------- ---- Modify all monsters XML! ---- local modified = 0 for i, contents in ipairs(xmltable["monster"]) do local monsterxml = io.open(dir .. contents.file, "r") if monsterxml then local xmldata = monsterxml:read("*a") local _mod = false local s, f, content = xmldata:find("<monster%s(.-)>") local r, p, cs = content:find('script="(.-)"') monsterxml:close() newc = content if not cs then xmldata = xmldata:gsub(content, newc .. ' script="default.lua"') _mod = true elseif cs ~= "default.lua" then print('Warning: The file "' .. contents.file .. '" already has a script.') end local s, f, content = xmldata:find("<monster%s(.-)>") local x, q, scriptcontent = xmldata:find("<script>(.-)</script>") local readyevents = {} local addevents = "" if scriptcontent then for line in scriptcontent:gmatch("(.-)\n") do local event = line:match('<event%s-name="(.-)"') if event then readyevents[event] = true end end end for event, _c in pairs(events) do if not readyevents[event] then addevents = addevents .. '<event name="' .. event .. '"/>\n' end end if addevents ~= "" then _mod = true if scriptcontent and scriptcontent:find("event") then xmldata = xmldata:gsub(scriptcontent, scriptcontent .. addevents) elseif x and q then xmldata = xmldata:sub(1, x-1) .. xmldata:sub(q+1) xmldata = xmldata:sub(1, f) .. "\n<script>\n" .. addevents .. "\n</script>" .. xmldata:sub(f+1) else xmldata = xmldata:sub(1, f) .. "\n<script>\n" .. addevents .. "\n</script>" .. xmldata:sub(f+1) end end if xmldata then if _mod then modified = modified+1 end local monsterxmlwrite = io.open(dir .. contents.file, "w") monsterxmlwrite:write(xmldata) monsterxmlwrite:close() else print("Error in: " .. contents.name) end else print("Warning: Error opening file " .. contents.file) end end print("Total monsters XML modified: " .. modified) ---------------------------------- --- Parsing creaturescripts.xml -- local csfile = io.open(csdir .. csXML, "r") print("Parsing XML " .. csdir .. csXML .. "...") local csxmltable, xmldata = parseXML(csfile) csfile:close() ---------------------------------- --- Modify creaturescripts.xml --- local _mod = false local readytags = {} for i, contents in ipairs(csxmltable["event"]) do if events[contents.name] then readytags[contents.name] = true end end for event, contents in pairs(events) do if not readytags[event] then _mod = true local currenttag = csTag currenttag = currenttag:gsub("%%t", contents.type) currenttag = currenttag:gsub("%%n", event) currenttag = currenttag:gsub("%%s", contents.file) local r, w = xmldata:find("<creaturescripts>") xmldata = xmldata:sub(1, w) .. currenttag .. xmldata:sub(w+1) end end if _mod then local csfilewrite = io.open(csdir .. csXML, "w") csfilewrite:write(xmldata) csfilewrite:close() print("Modified " .. csdir .. csXML) end ---------------------------------- ----- Creating event scripts ----- print("Creating lua creaturescripts...") for event, contents in pairs(events) do local luafile = io.open(csdir .. "scripts/" .. contents.file, "w") luafile:write(contents.defaultText) luafile:close() end ---------------------------------- print("All the modifications were done.") return true end local check = io.open("meventsinstall.lua", "r") if not check then local ret = init() if ret then local file = io.open("meventsinstall.lua", "w") file:write("true") file:close() end else check:close() end Explicando o que o code realmente faz:
    O code vai ser executado somente uma vez e vai editar todos os monstros do seu OTServer presentes no monsters.xml adicionando um script default, que seria o defaultText presente no inicio do code (So funciona em TFS 1.0+) e tambem ira adicionar eventos ao XML do monstro sem remover os que ja existem (se existirem).
    Depois disso ele ira editar o creaturescripts.xml para criar a tag do evento e tambem criar o script que esta na tabela events.
     
    Como instalar:
     
    TFS 0.3.6:
    Só botar ele na pasta lib do seu OT que ele ja vai executar quando voce abrir o executavel.
     
    TFS 1.x:
    Bote o code na pasta "lib\core" e edite o core.lua nessa pasta adicionando essa linha:
    dofile('data/lib/core/monstersevent.lua') Se voce fizer tudo certo deve aparecer isso quando voce abrir o server:

     
     
    Você pode rodar o script novamente deletando o arquivo "meventsinstall.lua" que sera criado na pasta do server, ele soh ira adicionar algo se voce mudar alguma coisa no code.
     
    Porque usar esse code:
    Não usar funçoes como onAttack, onSpawn entre outras para registrar eventos em monstros.
    Usar as funçoes onCreatureAppear, onCreatureDisappear, onCreatureMove, onCreatureSay e onThink em todos os monstros do server (TFS 1.0+)
     
     
  19. Upvote
    MatheusGlad recebeu reputação de Deadpool em Monsters Default Events   
    FAÇA BACKUP DA PASTA MONSTERS E CREATURESCRIPTS ANTES DE UTILIZAR!
     
    Funciona para todas as versões TFS 0.3.6+ ate TFS 1.2 (Provavelmente funciona para outras tambem mas não me dei o trabalho de testar)
     
    Introdução:
    Bem, como o titulo mesmo diz, o script vai criar e modificar todos os monstros para terem scripts default (Caso o monstro não tenha script) e tambem pode adicionar creaturescripts default, exemplo o onDeath.
     
    Code:
     
    monsterevent.lua
    local dir = "./data/monster/" local csdir = "./data/creaturescripts/" local monstersXML = "monsters.xml" local csXML = "creaturescripts.xml" local csTag = '\n <event type="%t" name="%n" script="%s"/>' -- Tag format on creaturescripts.xml (%t = type, %n = name, %s = script) local defaultText = [[function onCreatureAppear(self, creature) return false end function onCreatureDisappear(self, creature) return false end function onCreatureMove(self, creature, oldPosition, newPosition) return false end function onCreatureSay(self, creature, type, message) return false end function onThink(self, interval) return false end]] local events = { ["monsterdeath"] = {type = "death", file="monsterdeath.lua", defaultText=[[ function onDeath(cid, corpse, lasthitkiller, mostdamagekiller, lasthitunjustified, mostdamageunjustified) return true end]]}, } ------- Não edite a partir dessa linha se nao souber o que esta fazendo. function parseXML(file) local ret = {["monster"] = {}, ["event"] = {}} local data = "" for line in file:lines() do data = data .. line .. "\n" line = line:match("<(.-)/>") if line then local element = line:match("^%s*(.-)%s") if element == "monster" or element == "event" then local t = {} for i, x in line:gmatch('%s+(.-)="(.-)"') do t[i] = x end table.insert(ret[element], t) end end end return ret, data:sub(1, #data-1) end function init() ----- Parsing monsters.xml ----- local monstersfile = io.open(dir .. monstersXML, "r") print("Parsing XML " .. dir .. monstersXML .. "...") local xmltable = parseXML(monstersfile) monstersfile:close() -------------------------------- -- Creating scripts directory -- local testfile = io.open(dir .. "scripts/test", "w") if not testfile then os.execute("mkdir data\\monster\\scripts") print("Directory " .. dir .. "scripts has been created.") else testfile:close() end os.remove(dir .. "scripts/test") --------------------------------- ------ Creating default.lua ------- local defaultlua = io.open(dir .. "scripts/default.lua", "w") defaultlua:write(defaultText) defaultlua:close() print("File " .. dir .. "scripts/default.lua has been created.") --------------------------------- ---- Modify all monsters XML! ---- local modified = 0 for i, contents in ipairs(xmltable["monster"]) do local monsterxml = io.open(dir .. contents.file, "r") if monsterxml then local xmldata = monsterxml:read("*a") local _mod = false local s, f, content = xmldata:find("<monster%s(.-)>") local r, p, cs = content:find('script="(.-)"') monsterxml:close() newc = content if not cs then xmldata = xmldata:gsub(content, newc .. ' script="default.lua"') _mod = true elseif cs ~= "default.lua" then print('Warning: The file "' .. contents.file .. '" already has a script.') end local s, f, content = xmldata:find("<monster%s(.-)>") local x, q, scriptcontent = xmldata:find("<script>(.-)</script>") local readyevents = {} local addevents = "" if scriptcontent then for line in scriptcontent:gmatch("(.-)\n") do local event = line:match('<event%s-name="(.-)"') if event then readyevents[event] = true end end end for event, _c in pairs(events) do if not readyevents[event] then addevents = addevents .. '<event name="' .. event .. '"/>\n' end end if addevents ~= "" then _mod = true if scriptcontent and scriptcontent:find("event") then xmldata = xmldata:gsub(scriptcontent, scriptcontent .. addevents) elseif x and q then xmldata = xmldata:sub(1, x-1) .. xmldata:sub(q+1) xmldata = xmldata:sub(1, f) .. "\n<script>\n" .. addevents .. "\n</script>" .. xmldata:sub(f+1) else xmldata = xmldata:sub(1, f) .. "\n<script>\n" .. addevents .. "\n</script>" .. xmldata:sub(f+1) end end if xmldata then if _mod then modified = modified+1 end local monsterxmlwrite = io.open(dir .. contents.file, "w") monsterxmlwrite:write(xmldata) monsterxmlwrite:close() else print("Error in: " .. contents.name) end else print("Warning: Error opening file " .. contents.file) end end print("Total monsters XML modified: " .. modified) ---------------------------------- --- Parsing creaturescripts.xml -- local csfile = io.open(csdir .. csXML, "r") print("Parsing XML " .. csdir .. csXML .. "...") local csxmltable, xmldata = parseXML(csfile) csfile:close() ---------------------------------- --- Modify creaturescripts.xml --- local _mod = false local readytags = {} for i, contents in ipairs(csxmltable["event"]) do if events[contents.name] then readytags[contents.name] = true end end for event, contents in pairs(events) do if not readytags[event] then _mod = true local currenttag = csTag currenttag = currenttag:gsub("%%t", contents.type) currenttag = currenttag:gsub("%%n", event) currenttag = currenttag:gsub("%%s", contents.file) local r, w = xmldata:find("<creaturescripts>") xmldata = xmldata:sub(1, w) .. currenttag .. xmldata:sub(w+1) end end if _mod then local csfilewrite = io.open(csdir .. csXML, "w") csfilewrite:write(xmldata) csfilewrite:close() print("Modified " .. csdir .. csXML) end ---------------------------------- ----- Creating event scripts ----- print("Creating lua creaturescripts...") for event, contents in pairs(events) do local luafile = io.open(csdir .. "scripts/" .. contents.file, "w") luafile:write(contents.defaultText) luafile:close() end ---------------------------------- print("All the modifications were done.") return true end local check = io.open("meventsinstall.lua", "r") if not check then local ret = init() if ret then local file = io.open("meventsinstall.lua", "w") file:write("true") file:close() end else check:close() end Explicando o que o code realmente faz:
    O code vai ser executado somente uma vez e vai editar todos os monstros do seu OTServer presentes no monsters.xml adicionando um script default, que seria o defaultText presente no inicio do code (So funciona em TFS 1.0+) e tambem ira adicionar eventos ao XML do monstro sem remover os que ja existem (se existirem).
    Depois disso ele ira editar o creaturescripts.xml para criar a tag do evento e tambem criar o script que esta na tabela events.
     
    Como instalar:
     
    TFS 0.3.6:
    Só botar ele na pasta lib do seu OT que ele ja vai executar quando voce abrir o executavel.
     
    TFS 1.x:
    Bote o code na pasta "lib\core" e edite o core.lua nessa pasta adicionando essa linha:
    dofile('data/lib/core/monstersevent.lua') Se voce fizer tudo certo deve aparecer isso quando voce abrir o server:

     
     
    Você pode rodar o script novamente deletando o arquivo "meventsinstall.lua" que sera criado na pasta do server, ele soh ira adicionar algo se voce mudar alguma coisa no code.
     
    Porque usar esse code:
    Não usar funçoes como onAttack, onSpawn entre outras para registrar eventos em monstros.
    Usar as funçoes onCreatureAppear, onCreatureDisappear, onCreatureMove, onCreatureSay e onThink em todos os monstros do server (TFS 1.0+)
     
     
  20. Upvote
    MatheusGlad recebeu reputação de Caktchup em Error goback   
    local EFFECTS = { --[OutfitID] = {Effect} ["Magmar"] = 35, ["Magmortar"] = 35, ["Magby"] = 35, ["Smoochum"] = 17, ["Jynx"] = 17, ["Shiny Jynx"] = 17, } function onUse(cid, item, frompos, item2, topos) if exhaustion.get(cid, 6666) and exhaustion.get(cid, 6666) > 0 then return true end --alterado v1.6 sistema de firstpoke retirado if getPlayerStorageValue(cid, 17000) >= 1 or getPlayerStorageValue(cid, 17001) >= 1 or getPlayerStorageValue(cid, 63215) >= 1 then return true end ------------------------------------------------------- ballName = getItemAttribute(item.uid, "poke") btype = getPokeballType(item.itemid) usando = pokeballs[btype].use local effect = pokeballs[btype].effect if not effect then effect = 21 end ---------------------------------------------------------- if item.itemid == usando then if getPlayerStorageValue(cid, 990) == 1 then -- GYM doPlayerSendCancel(cid, "You can't return your pokemon during gym battles.") return true end --------------------------------------------------------------------------------------- if #getCreatureSummons(cid) > 1 and getPlayerStorageValue(cid, 212124) <= 0 then --alterado v1.6 if getPlayerStorageValue(cid, 637501) == -2 or getPlayerStorageValue(cid, 637501) >= 1 then BackTeam(cid) end end --------------------------------------------------------------------------------------- if #getCreatureSummons(cid) == 2 and getPlayerStorageValue(cid, 212124) >= 1 then doPlayerSendCancel(cid, "You can't do that while is controling a mind") return true --alterado v1.5 end --------------------------------------------------------------------------------------- if #getCreatureSummons(cid) <= 0 then if isInArray(pokeballs[btype].all, item.itemid) then doTransformItem(item.uid, pokeballs[btype].off) doItemSetAttribute(item.uid, "hp", 0) doPlayerSendCancel(cid, "This pokemon is fainted.") return true end end local cd = getCD(item.uid, "blink", 30) if cd > 0 then setCD(item.uid, "blink", 0) end local z = getCreatureSummons(cid)[1] if getCreatureCondition(z, CONDITION_INVISIBLE) and not isGhostPokemon(z) then return true end doReturnPokemon(cid, z, item, effect) elseif item.itemid == pokeballs[btype].on then if item.uid ~= getPlayerSlotItem(cid, CONST_SLOT_FEET).uid then doPlayerSendCancel(cid, "You must put your pokeball in the correct place!") return TRUE end local thishp = getItemAttribute(item.uid, "hp") if thishp <= 0 then if isInArray(pokeballs[btype].all, item.itemid) then doTransformItem(item.uid, pokeballs[btype].off) doItemSetAttribute(item.uid, "hp", 0) doPlayerSendCancel(cid, "This pokemon is fainted.") return true end end local pokemon = getItemAttribute(item.uid, "poke") if not pokes[pokemon] then return true end if isLegendaryPokemon(pokemon) and not isInArray({5, 6}, getPlayerGroupId(cid)) then doPlayerSendTextMessage(cid, 27, "You can't use a legendary pokemon.") doRemoveItem(item.uid) return true end ----------------------- Sistema de nao poder carregar mais que 3 pokes lvl baixo e + q 1 poke de lvl medio/alto --------------------------------- if not isInArray({5, 6}, getPlayerGroupId(cid)) then local bp = getPlayerSlotItem(cid, CONST_SLOT_BACKPACK) local lowPokes = {"Rattata", "Caterpie", "Weedle", "Oddish", "Pidgey", "Paras", "Poliwag", "Bellsprout", "Magikarp", "Hoppip", "Sunkern"} local low = {} local lw = 1 for e, f in pairs(pokeballs) do for times = 1, 3 do local items = getItemsInContainerById(bp.uid, pokeballs[e].all[times]) if #items >= 1 then --alterado v1.6 for _, uid in pairs(items) do local nome1 = getItemAttribute(uid, "poke") if pokes[pokemon].level > 10 and nome1 == pokemon then return doPlayerSendTextMessage(cid, 27, "Sorry, but you can't carry two pokemons equals!") elseif pokes[pokemon].level <= 10 then if nome1 == pokemon then table.insert(low, lw, nome1) lw = lw +1 end end end end end end if #low >= 3 then return doPlayerSendTextMessage(cid, 27, "Sorry, but you can't carry more than three pokemons equals of low level!") end end --------------------------------------------------------------------------------------------------------------------------------------------------- local x = pokes[pokemon] local boost = getItemAttribute(item.uid, "boost") or 0 if getPlayerLevel(cid) < (x.level+boost) then doPlayerSendCancel(cid, "You need level "..(x.level+boost).." to use this pokemon.") return true end -------------------------------------------------------------------------------------- shinysClan = { ["Shiny Flareon"] = {1, "Volcanic"}, ["Shiny Vaporeon"] = {2, "Seavel"}, ["Shiny Golem"] = {3, "Orebound"}, ["Shiny Fearow"] = {4, "Wingeon"}, ["Shiny Nidoking"] = {5, "Malefic"}, ["Shiny Hitmontop"] = {6, "Gardestrike"}, --alterado v1.4 ["Shiny Hypno"] = {7, "Psycraft"}, ["Shiny Vileplume"] = {8, "Naturia"}, ["Shiny Jolteon"] = {9, "Raibolt"}, } if shinysClan[pokemon] and (getPlayerGroupId(cid) < 3 or getPlayerGroupId(cid) > 6) then if getPlayerStorageValue(cid, 86228) ~= shinysClan[pokemon][1] then doPlayerSendCancel(cid, "You need be a member of the clan "..shinysClan[pokemon][2].." to use this pokemon!") return true elseif getPlayerStorageValue(cid, 862281) ~= 5 then doPlayerSendCancel(cid, "You need be atleast rank 5 to use this pokemon!") return true end end -------------------------------------------------------------------------------------- doSummonMonster(cid, pokemon) local pk = getCreatureSummons(cid)[1] if not isCreature(pk) then return true end ------------------------passiva hitmonchan------------------------------ if isSummon(pk) then local nameHIT = getItemAttribute(getPlayerSlotItem(cid, 8).uid, "poke") local hands = getItemAttribute(getPlayerSlotItem(cid, 8).uid, "hands") if nameHIT == "Shiny Hitmonchan" or nameHIT == "Hitmonchan" then if getItemAttribute(getPlayerSlotItem(cid, 8).uid, "hands") then doSetCreatureOutfit(pk, {lookType = hitmonchans[nameHIT][hands].out}, -1) else doPlayerSendTextMessage(cid, 27, "Contact a GameMaster! Error in passive system! Attribute \"hands\" missing") doSetItemAttribute(getPlayerSlotItem(cid, 8).uid, "hands", 0) end end end ------------------------------------------------------------------------- ---------movement magmar, jynx------------- if EFFECTS[getCreatureName(pk)] then --edited efeito magmar/jynx markPosEff(pk, getThingPos(pk)) sendMovementEffect(pk, EFFECTS[getCreatureName(pk)], getThingPos(pk)) --alterado v1.5 end -------------------------------------------------------------------------- if getCreatureName(pk) == "Ditto" or getCreatureName(pk) == "Shiny Ditto" then --edited local left = getItemAttribute(item.uid, "transLeft") local name = getItemAttribute(item.uid, "transName") if left and left > 0 then setPlayerStorageValue(pk, 1010, name) doSetCreatureOutfit(pk, {lookType = getItemAttribute(item.uid, "transOutfit")}, -1) addEvent(deTransform, left * 1000, pk, getItemAttribute(item.uid, "transTurn")) doItemSetAttribute(item.uid, "transBegin", os.clock()) else setPlayerStorageValue(pk, 1010, getCreatureName(pk) == "Ditto" and "Ditto" or "Shiny Ditto") --edited end if name == "Smeargle" then doPlayerSendCancel(cid, "Your ditto can't copy a smeargle.") return true end if isLegendaryPokemon(name) or name == "Smeargle" or isInArray(dittoShinyCopy, name) then deTransform(pk, getItemAttribute(item.uid, "transTurn")) markPos(pk, {x = 1, y = 1, z = 1}) doPlayerSay(cid, ""..getPokeName(pk)..", stop transformation!", 1) return true end end if isGhostPokemon(pk) then doTeleportThing(pk, getPosByDir(getThingPos(cid), math.random(0, 7)), false) end doCreatureSetLookDir(pk, 2) adjustStatus(pk, item.uid, true, true, true) doAddPokemonInOwnList(cid, pokemon) doTransformItem(item.uid, item.itemid+1) local pokename = getPokeName(pk) --alterado v1.7 local mgo = gobackmsgs[math.random(1, #gobackmsgs)].go:gsub("doka", pokename) doCreatureSay(cid, mgo, TALKTYPE_MONSTER) doSendMagicEffect(getCreaturePosition(pk), effect) if haveFirstTM(item) then if tmChange[getFirstTMName(item)] then doItemSetAttribute(item.uid, "tm1", tmChange[getFirstTMName(item)].new) end end if haveSecondTM(item) then if tmChange[getSecondTMName(item)] then doItemSetAttribute(item.uid, "tm2", tmChange[getSecondTMName(item)].new) end end if haveThirdTM(item) then if tmChange[getThirdTMName(item)] then doItemSetAttribute(item.uid, "tm3", tmChange[getThirdTMName(item)].new) end end if useOTClient then doPlayerSendCancel(cid, '12//,show') --alterado v1.7 end local pk = getCreatureSummons(cid)[1] local pb = getPlayerSlotItem(cid, 8).uid local look = getItemAttribute(pb,"addon") if not look then doSetItemAttribute(pb,"addon",0) elseif look > 0 then doSetCreatureOutfit(pk, {lookType = look}, -1) end else doPlayerSendCancel(cid, "This pokemon is fainted.") end if useKpdoDlls then doUpdateMoves(cid) end return true end Tenta isso.
  21. Upvote
    MatheusGlad recebeu reputação de Holly Angel em Erro com Database   
    O nome da sua database é "newdb"? Se nao for muda nas configs porque ta usando essa. Se for essa mesmo executa isso:
    CREATE TABLE `player_viplist` ( `player_id` INT NOT NULL, `vip_id` INT NOT NULL, `description` VARCHAR( 128 ) NOT NULL, `icon` INT( 11 ) UNSIGNED NOT NULL, `notify` BOOLEAN NOT NULL, KEY (`player_id`), KEY (`vip_id`), UNIQUE (`player_id`, `vip_id`), FOREIGN KEY (`player_id`) REFERENCES `players`(`id`) ON DELETE CASCADE, FOREIGN KEY (`vip_id`) REFERENCES `players`(`id`) ON DELETE CASCADE ) ENGINE = InnoDB;
  22. Upvote
    MatheusGlad recebeu reputação de EvertonDemolay em GetResult Erro Database   
    O parametro "cid" não estava sendo passado como player userdata ainda, e sim como numero, e se voce tentar chamar um numero usando o colon operator ":" ele vai tentar indexar um number value e vai dar error.
    http://www.lua.org/pil/5.html
     
    Exemplo
    local n = 10 print(n.bla) Isso vai dar erro, e quando voce faz n:bla() ele tenta fazer n.bla(n) que vai dar o mesmo erro.
     
     
    Nas versões mais novas do TFS o cid é passado como userdata e nao como numero.
  23. Upvote
    MatheusGlad recebeu reputação de valakas em erro no sql ao add query   
    ALTER TABLE `players` ADD `cast` TINYINT NOT NULL DEFAULT '0'; ALTER TABLE `players` ADD `castViewers` INT( 11 ) NOT NULL DEFAULT '0'; ALTER TABLE `players` ADD `castDescription` VARCHAR( 255 ) NOT NULL; Tenta assim.
  24. Upvote
    MatheusGlad recebeu reputação de EvertonDemolay em GetResult Erro Database   
    Versão do seu tfs ainda nao ta mandando o cid como player userdata entao voce vai ter que iniciar ele assim
    local player = Player(cid) Assim:
    function onSay(cid, words, param) local player = Player(cid) local coisas = db.storeQuery("SELECT `level` FROM `global`.`players` WHERE `name` = 'Master Pig';") if coisas then player_level = result.getDataInt(coisas, "level") player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Name: " .. player_level) end end
  25. Upvote
    MatheusGlad recebeu reputação de Caktchup em Erro ao dar look   
    Ta dando problema pra pra achar o nome da cidade do player, retira os prints agora e bota troca:
    table.insert(str, (ocup).." and "..rank.." from ".. getTownName(getPlayerTown(thing))..".") por isso:
    table.insert(str, (ocup).." and "..rank..".") Isso vai remover o bug porem nao vai mostrar o nome da cidade ao dar look, o problema é que provavelmente o ID da cidade nao foi configurado direito.
  • Quem Está Navegando   0 membros estão online

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