System de Pokemon Para Tibia
+2
Adm Eddie
Yerenix
6 participantes
- YerenixAportador
- Mensajes : 98
System de Pokemon Para Tibia
Sáb Sep 24, 2011 6:25 pm
Antes de todo, ve a data/lib y cree um script.lua con el nombre de pokeLib y adentro esto
aora el GO/Back
Ve a data/actions/scripts y cree un archivo.lua con el nombre goback.lua
y ponga esto adentro
aora en action.xml agregen esta fila
Para evitar algunos Bugs
ve a data/creaturescripts/scripts e cre un archivo.lua com o nombre goback.lua y ponga esto adentro:
Ahora adicione otro archivo.lua en data/creaturescripts/scripts con el nombre de playerpdeath y esto adentro:
Despuess va a creaturescripts.xml y adicione estos TAGS:
aora el catch
Ve a data/actions/scripts cree un archivo.lua con o nombre de catch.lua
y ponga esto adentro
El NPC Heala
Ve a data/npc/scripts e adicione um archivo.lua el nombre pokehealer.lua y esto adentro
Depues ve a data/npc y crea un archivo.xml de nombre Pokemon Healer y esto adentro
Creditos:
90% Xtibia
10% Yo por traducir y traer Proximamente el systema Surf Fly Ride
Dame REP si te sirvio
- Código:
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
aora el GO/Back
Ve a data/actions/scripts y cree un archivo.lua con el nombre goback.lua
y ponga esto adentro
- Código:
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
aora en action.xml agregen esta fila
- Código:
<action itemid="2222;2223" event="script" value="goback.lua"/>
el 2222;2223 son las id de las pokebolas
Para evitar algunos Bugs
ve a data/creaturescripts/scripts e cre un archivo.lua com o nombre goback.lua y ponga esto adentro:
- Código:
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
Ahora adicione otro archivo.lua en data/creaturescripts/scripts con el nombre de playerpdeath y esto adentro:
- Código:
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
Despuess va a creaturescripts.xml y adicione estos TAGS:
- Código:
<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"/>
aora el catch
Ve a data/actions/scripts cree un archivo.lua con o nombre de catch.lua
y ponga esto adentro
- Código:
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
El NPC Heala
Ve a data/npc/scripts e adicione um archivo.lua el nombre pokehealer.lua y esto adentro
- Código:
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())
Depues ve a data/npc y crea un archivo.xml de nombre Pokemon Healer y esto adentro
- Código:
<?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>
Creditos:
90% Xtibia
10% Yo por traducir y traer Proximamente el systema Surf Fly Ride
Dame REP si te sirvio
- Adm EddieAportador
- Mensajes : 134
Re: System de Pokemon Para Tibia
Sáb Sep 24, 2011 6:35 pm
Amigo no estarian mal unas imagenes de como funciona
Ya que se ve buenisimo por lo que leeo el script.
REP+
Te doy otra REP si pones imagenes n.n
10/10
Ya que se ve buenisimo por lo que leeo el script.
REP+
Te doy otra REP si pones imagenes n.n
10/10
- Carlos [Zipto]Aportador
- Mensajes : 233
Re: System de Pokemon Para Tibia
Miér Jun 20, 2012 3:05 pm
Am... Muy bueno
- By:GodManu:Miembro
- Mensajes : 4
Re: System de Pokemon Para Tibia
Lun Mayo 13, 2013 5:57 pm
perdon si es spam pero los links estan rotos .__. en esta pagina no hay un moderador global?? pff arreglen el link ..
alguien me puede pasar otro link eso agradeceria mucho
alguien me puede pasar otro link eso agradeceria mucho
Permisos de este foro:
No puedes responder a temas en este foro.