[ Action ]Pokeball System

DevilMoon
em Actions e Talkactions

DevilMoon

@leonartei
avatar
Conde
Conde

INFOS

Grupo: CondeRegistrado: 30/01/10Posts: 706Gênero: MasculinoChar no Tibia: Bakwin

PokeBall System!

 

Ola Xtibianos, Vim hoje postar um Famoso Script de Pokeball System feito pelo Genioso Nahruto, claro pedi a autorização dele para postar.

A Todos que forem pegar Scripts de outras Pessoas, lembre-se de sempre pedir autorização e claro colocar os creditos.

 

Para Tfs: 0.34 , 0.35 e 0.36 Essas Forao Testadas E Funfo.

Versoes: 8.42 - 8.50 - 8.52 - 8.54 - 8.6.

Ots Testados: Snowz Yurots - Alissow Server - Styller Yurots

 

 

Primeiramente Vamos Fuçar em Function.lua, se voce nao Sabe onde fica vá em:

Data>Lib>Function.lua

 

Abra e Coloque Isto:

 

_warpzone = 2147483648 -- start storing strings here (THIS IS THE ABSOLUTE MAXIMUM VALUE FOR THIS)
_maxlength = 1024 -- multiply by 3 to get the true length.

setPlayerStorageInteger = setPlayerStorageValue
getPlayerStorageInteger = getPlayerStorageValue

function setPlayerStorageString(cid, key, value)
   if #value > (_maxlength-1) * 3 - 1 then -- Last word is reserved for 0 termination of the string.
       error("Storage string is too long")
   end
   if key > _warpzone / _maxlength then
       error("Storage string key is too large (" .. key .. ")")
   end
   key = _warpzone + key * _maxlength

   local word = 0
   local wordwrap = 0
   local wordcount = 0
   local i = 1
   while i <= #value do
       local byte = string.byte(string.sub(value, i, i))
       word = bit.bor(word, bit.lshift(byte, wordwrap))
       wordwrap = wordwrap + 8
       if wordwrap == 24 then
           --[[
               In the ideal world we would be able to store 4 characters per word,
               however, as the default return value for getPlayerStorageValue is
               -1, we cant use the last bit.
           ]]--
           setPlayerStorageInteger(cid, key + wordcount, word)
           word = 0
           wordwrap = 0
           wordcount = wordcount + 1
       end
       i = i + 1
   end
   -- store the last word
   setPlayerStorageInteger(cid, key + wordcount, word)
end

function getPlayerStorageString(cid, key)
   if key > _warpzone / _maxlength then
       error("Storage string key is too large (" .. key .. ")")
   end
   key = _warpzone + key * _maxlength

   local wordcount = 0
   local str = ""
   while true do
       if wordcount >= _maxlength then
           break
       end
       local word = getPlayerStorageInteger(cid, key + wordcount)
       if word == -1 then
           -- end of string
           break
       else 
           -- Extract the 3 characters from the value
           byte = bit.band(word, 255)
           if byte == 0 then break else str = str .. string.char(byte) end
           byte = bit.rshift(bit.band(word, 65280), 8)
           if byte == 0 then break else str = str .. string.char(byte) end
           byte = bit.rshift(bit.band(word, 16711680), 16)
           if byte == 0 then break else str = str .. string.char(byte) end
       end
       wordcount = wordcount + 1
   end
   return str
end

 

E Isso!

  function doConvinceSummon(cid, creature, amount, pos)
summonplayerpos = {x=pos.x, y=pos.y, z=pos.z, stackpos=253}
summonplayer = getThingfromPos(summonplayerpos)


   if(summonplayer ~= nil and summonplayer.itemid > 0) then    
       doPlayerSendCancel(cid,"There is not enough room to summon here.")
       ret = 0
   else
       convince = doSummonCreature(creature, pos)
       doConvinceCreature(cid, convince)
       ret = 1
end

       return ret
end  

 

Agora Vamos Fazer o Script Vá em Pasta do Seu Ot > Data > Actions > Scripts Crie uma Pasta chamada pokeball.lua

e bote isso dentro

 

local notAllowed = {"Ferumbras", "Demon"}
local storage = {
   status = 25650,
   pokeName = 25651
}
local actionid_used = 7510

function onUse(cid, item, fromPos, item2, toPos)
   local pokeballStatus = getPlayerStorageValue(cid, storage.status)
   local pokeName = getPlayerStorageString(cid, storage.pokeName)
   pos = getPlayerPosition(cid) pos.stackpos = 0
       if pokeballStatus == -1 then
           toPos.stackpos = 253
           local pokeThing = getThingfromPos(toPos)
           if isCreature(pokeThing.uid) == TRUE then
               if isPlayer(pokeThing.uid) == FALSE then
                   local pokename_ = getCreatureName(pokeThing.uid)
                   if item.actionid ~= actionid_used then
                   --    local maxHealth = 400
                   --    local creatureHealth = getCreatureHealth(pokeThing.uid)
                   --    local divNum = (string.len(maxHealth)-1)^2
                   --    local result = math.floor((creatureHealth/divNum)/10)
                   --    local chance = math.random(1, math.random(4, math.random(7, math.max(result, 7))))
                   --    if chance == result then
                           if isInTable(notAllowed, pokename_) == TRUE then
                               doPlayerSendCancel(cid, "You cannot catch this creature")
                           else
                               setPlayerStorageString(cid, storage.pokeName, pokename_)
                               doRemoveCreature(pokeThing.uid)
                               doSendDistanceShoot(fromPos, toPos, 37)
                               setPlayerStorageValue(cid, storage.status, 1)
                               doSetItemSpecialDescription(item.uid, "it contains a " .. pokename_ .. ".")
                               doSetItemActionId(item.uid, actionid_used)
                           end
                   --    else
                   --        doSendMagicEffect(fromPos, 2)
                   --        doPlayerSendCancel(cid, "The Pokemom Escaped")
                   --    end
                   elseif item.actionid == actionid_used and pokename_  == pokeName then
                       doPlayerSay(cid, pokeName .. " Back!!", TALKTYPE_SAY)
                       doRemoveCreature(pokeThing.uid)
                       doSetItemSpecialDescription(item.uid, "it contains a " .. pokename_ .. ".")
                       setPlayerStorageValue(cid, storage.status, 1)
                       doSendDistanceShoot(fromPos, toPos, 37)
                   else
                       doSendMagicEffect(fromPos, 2)
                       doPlayerSendCancel(cid, "This pokeball is already used")
                   end
               else
                   doPlayerSendCancel(cid, "You cannot catch this creature")
               end
           else
               doPlayerSendCancel(cid, "Creature not found")
           end
       elseif pokeballStatus == 1 then
           summons = getCreatureSummons(cid)
       --    if #summons >= 2 then
       --        doPlayerSendCancel(cid, "You cannot call more pokemons")
       --    else
               doConvinceSummon(cid, pokeName, 0, toPos)
               doSendDistanceShoot(fromPos, toPos, 37)
               doPlayerSay(cid, pokeName .. " Go!!", TALKTYPE_SAY)
               setPlayerStorageValue(cid, storage.status, -1)
               doSetItemSpecialDescription(item.uid, "it is empty.")
       --    end
       end
   else

   return 1
end 

function isInTable(t, val)
   for _, v in pairs(t) do
       if v == val then
           return TRUE
       end
   end
   return LUA_ERROR
end

 

para TFS

 

local notAllowed = {"Ferumbras", "Demon"}
local storage = {
   status = 15244,
   pokeName = 15212
}
local actionid_used = 7510

function onUse(cid, item, fromPos, item2, toPos)
   local pokeballStatus = getPlayerStorageValue(cid, storage.status)
   local pokeName = getPlayerStorageString(cid, storage.pokeName)
   pos = getPlayerPosition(cid) pos.stackpos = 0
       if pokeballStatus <= 0 then
           toPos.stackpos = 253
           local pokeThing = getThingfromPos(toPos)
           if isCreature(pokeThing.uid) == TRUE then
               if isPlayer(pokeThing.uid) == FALSE then
                   local pokename_ = getCreatureName(pokeThing.uid)
                   if item.actionid ~= actionid_used then
                   --    local maxHealth = 400
                   --    local creatureHealth = getCreatureHealth(pokeThing.uid)
                   --    local divNum = (string.len(maxHealth)-1)^2
                   --    local result = math.floor((creatureHealth/divNum)/10)
                   --    local chance = math.random(1, math.random(4, math.random(7, math.max(result, 7))))
                   --    if chance == result then
                           if isInTable(notAllowed, pokename_) == TRUE then
                               doPlayerSendCancel(cid, "You cannot catch this creature")
                           else
                               setPlayerStorageString(cid, storage.pokeName, pokename_)
                               doRemoveCreature(pokeThing.uid)
                               doSendDistanceShoot(fromPos, toPos, 37)
                               setPlayerStorageValue(cid, storage.status, 1)
                               doSetItemSpecialDescription(item.uid, "it contains a " .. pokename_ .. ".")
                               doSetItemActionId(item.uid, actionid_used)
                           end
                   --    else
                   --        doSendMagicEffect(fromPos, 2)
                   --        doPlayerSendCancel(cid, "The Pokemom Escaped")
                   --    end
                   elseif item.actionid == actionid_used and pokename_  == pokeName then
                       doCreatureSay(cid, pokeName .. " Back!!", TALKTYPE_SAY)
                       doRemoveCreature(pokeThing.uid)
                       doSetItemSpecialDescription(item.uid, "it contains a " .. pokename_ .. ".")
                       setPlayerStorageValue(cid, storage.status, 1)
                       doSendDistanceShoot(fromPos, toPos, 37)
                   else
                       doSendMagicEffect(fromPos, 2)
                       doPlayerSendCancel(cid, "This pokeball is already used")
                   end
               else
                   doPlayerSendCancel(cid, "You cannot catch this creature")
               end
           else
               doPlayerSendCancel(cid, "Creature not found")
           end
       elseif pokeballStatus == 1 then
       --    summons = doCreatureSummons(cid)
       --    if #summons >= 2 then
       --        doPlayerSendCancel(cid, "You cannot call more pokemons")
       --    else
               doConvinceSummon(cid, pokeName, 0, toPos)
               doSendDistanceShoot(fromPos, toPos, 37)
               doCreatureSay(cid, pokeName .. " Go!!", TALKTYPE_SAY)
               setPlayerStorageValue(cid, storage.status, 0)
               doSetItemSpecialDescription(item.uid, "it is empty.")
       --    end
       end

   return 1
end 

function isInTable(t, val)
   for _, v in pairs(t) do
       if v == val then
           return TRUE
       end
   end
   return LUA_ERROR
end

 

Agora Vamos Adicionar as Tags, vá em Data>Actions.xml e Adicione as Tags Corretas´

 

<action itemid="xxxx" script="pokeball.lua" allowfaruse="1" blockwalls="1" />

 

[font-"Georgia"]em <action itemid="xxxx" nos 4 X voce coloca o Number Id Do seu Item que Será como uma "Pokeball"[/font]

 

 

Oque o Script Faz Realmente:

 

- Guarda monstros dentro de objetos e salva seu status, você pode colocar pra salvar em qlqr objeto.. seria ótimo para projetos pokemons..

 

 

Creditos:

Nahruto

 

 

Print Screen's:

 

Snorlax Saindo da Pokeball:

 

snorlaxgo.png

 

Snorlax Voltando para a Pokeball

 

snorlaxback.png

 

Look da Pokeball ( o Player so Ve assim You See a Pokeball , Have Snorlax )]

 

snorlaxlook.png

 

 

Lembrando que eu nao Adicionei o Efeito da Pokeball Abrindo e Jogando o Monstro.

Para fazer este Tipo de efeito voce vai ter que saber direitinho o LookType da Pokeball Fechando e Saindo, e transformar para um efeito e depois modificar no Script, aqui no xtibia Existe varios Tutoriais explicando isto, é so procurar!

 

 

 

Gostou? Clica no

add.png Ali em Baicho para me Ajudar!

 

 

 

Abraços..

Contato: DevilMoon@Xtibia.com

luisfe23

avatar
Conde
Conde

INFOS

Grupo: CondeRegistrado: 31/10/08Posts: 871Char no Tibia: Luis Felipe Knight

Nossa cara, parabens ótimo script, ah muitos ots qe vao ser de pokemon e vai ajudar muito esse script, se eu fosse criar um ot eu usaria.

 

Parabens a vc e ao criador! Rep+ :button_ok:

luisfe23 here

Evil7

<//>*_Evil_*<//>
avatar
Visconde
Visconde

INFOS

Grupo: ViscondeRegistrado: 16/12/07Posts: 481Char no Tibia: Emotiicon

cara estava precisando, quero fazer um server estilo pokemon, estou decidido, mas essa parte de scripts tá osso =x

 

Ajudou muito, e gostei da humildade e ética :]

 

vou testar script!

 

EDIT:

pro TFS não precisa dos três primeiros? ou precisa dos 3 e mais os dois últimos? xD

 

Att. Evil

--> Evil de volta a ativa...



 

Entediado? Gosta de ler? se expressar? veja um blog diferente e comente !!

ExpressarOque.Blogspot.com

 

 

 

 

 

 

Meu Fan ou apenas achou a fan bar bonitinha? Use!

fan%20bar.jpg

NatsuMcDonald

avatar
Cavaleiro
Cavaleiro

INFOS

Grupo: CavaleiroRegistrado: 27/02/10Posts: 159Char no Tibia: Natsu McDonald

Explica ai a primeira parte, voce fala que tem que bota no global? Que porra de global? Qual arquivo. Explica melhor o topico pow

natsugc.jpg

 

<!-- S4 League Rul3z --!>

9baaf6d82a061f2b4893272a4c.png

PedrinhuHenrique

; Hail WARs! ;
avatar
Visconde
Visconde

INFOS

Grupo: ViscondeRegistrado: 05/10/06Posts: 381

Caramba meu, parabéns ao Narutoh por disponibilizar esse sistema para nós do Xtibia e por fazer também né?

Pois sei que não é fácil.

 

Ótimo script!

DevilMoon

@leonartei
avatar
Conde
Conde

INFOS

Grupo: CondeRegistrado: 30/01/10Posts: 706Gênero: MasculinoChar no Tibia: Bakwin

Vlw Luisfe +Rep Para Ti Tambem :D

 

@Evil

 

Sim Bota Tudu!

 

@Natsu

 

Todo Mundo Consiguiu Uns no Pvt me perguntarao e ta funfando eles intederao a maioria tbm :o

 

nao sabe onde fika Global Functions?

 

@Pedrinho

 

Vlw Ae Meo!

Contato: DevilMoon@Xtibia.com

NatsuMcDonald

avatar
Cavaleiro
Cavaleiro

INFOS

Grupo: CavaleiroRegistrado: 27/02/10Posts: 159Char no Tibia: Natsu McDonald

DevilMoon, se eu soubesse não teria perguntando, e mesmo assim voce não sanou minha pergunta... E todo mundo quem? Ninguem disse que conseguil, eles disseram que o script esta otimo e que vão usar...

natsugc.jpg

 

<!-- S4 League Rul3z --!>

9baaf6d82a061f2b4893272a4c.png

Deadlock

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 11/05/10Posts: 28Char no Tibia: Deadlock

Funfanfo 100% muito obrigado por postar aqui no Xtibia eu procuraa e nunca achava um que prestasse

matheus1000

avatar
Artesão
Artesão

INFOS

Grupo: ArtesãoRegistrado: 14/05/10Posts: 114

Estou com uma dúvida:

 

Onde eh global functions? (desculpe a pergunta de noob)

 

Ótimo script, está de parabens!

att,

MasterMathw

 

 

Voltando aos poucos.

valdemirot

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 29/09/08Posts: 1

Postou 14 maio 2010 - 12:44

Estou com uma dúvida:

 

Onde eh global functions? (desculpe a pergunta de noob)

 

Ótimo script, está de parabens! ²

M4TH3U5

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 24/05/10Posts: 31Char no Tibia: Omega Snap

Aki Dah Creature not found

PHjYGux.png

DevilMoon

@leonartei
avatar
Conde
Conde

INFOS

Grupo: CondeRegistrado: 30/01/10Posts: 706Gênero: MasculinoChar no Tibia: Bakwin

Ops Desculpa Galera :PPPP Nao Tinha Visto o Topico Ok Pera!

 

 

@All Que Elogirao!

 

 

Muintu Obrigado :D Ok Vlw ae Galera!

 

@Valdemiroth e Natsu

 

 

Se Seu Ot Nao Tem a Pasta GlobalFunctions Cria uma Pasta Chamada GlobalFunctions.xml na pasta Mods e coloka akilo dentro se teu ot tiver a pasta mods se nao nao precisa ok eu fis isso aki em casa e funfo!

 

 

Obs Natsu Desculpe :D !

 

 

 

@R1B31R0

 

Ve Corretamente se Botou Tudu Direitinho!

Contato: DevilMoon@Xtibia.com

matheus1000

avatar
Artesão
Artesão

INFOS

Grupo: ArtesãoRegistrado: 14/05/10Posts: 114

Consigui ;D.

Muito bom²

 

+REP

att,

MasterMathw

 

 

Voltando aos poucos.

M4TH3U5

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 24/05/10Posts: 31Char no Tibia: Omega Snap

[28/05/2010 15:05:16] [Error - LuaScriptInterface::loadFile] data/actions/scripts/pokeball.lua:67: 'end' expected (to close 'function' at line 8) near 'else'

[28/05/2010 15:05:16] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/pokeball.lua)

[28/05/2010 15:05:16] data/actions/scripts/pokeball.lua:67: 'end' expected (to close 'function' at line 8) near 'else'

[28/05/2010 15:05:16] [Warning - Actions::registerEvent] Duplicate registered item id: 5791

[28/05/2010 15:05:16] >> Loading chat channels

 

 

=/ Sabe Oq E Isso?

OBG

PHjYGux.png

brunin86

avatar
Artesão
Artesão

INFOS

Grupo: ArtesãoRegistrado: 30/05/10Posts: 101

Onde fica o Global Functions?

 

E tipo, esse Global Functions só tem em mapa 8.3 ? Se tiver em outros 8.4 + me passa o nome de um ?

 

 

Por acaso é o " Global Events ? "

MSN : brunin.1420@hotmail.com

 

 

Catch System + Go/Back ' (da época de 2010 que não tinha server de pokemon sem ser o da SVKE)

Pokedex System (Basico) (da época de 2010 que não tinha server de pokemon sem ser o da SVKE)

Saffari Zone (da época de 2010 que não tinha server de pokemon sem ser o da SVKE)

 

 

740733.png

Ajudei ? Quer me ajudar ? Upa meu pet pls :]

 

fbbc5e2.png