Ir para conteúdo

[Action] Ride System, Pokemon Ots


thalia

Posts Recomendados

Fala Galera do XTibia ~~

 

Meu script era em action..

Agora é talkaction :D

 

 

VIDEO DE DEMONSTRADÂO:

 

-> Crie um arquivo ride.lua em talkaction/scripts , e cole isso dentro:

function onSay(cid, words, param, channel)

local pokes = {
['Tauros'] = {128, 200},
['Ninetales'] = {129, 300},
['Rapidash'] = {130, 350},
}

local old_speed = getCreatureBaseSpeed(cid)
local summons = getCreatureSummons(cid)
if getPlayerStorageValue(cid, 20000) == 10 then
local nome = getItemName(getPlayerSlotItem(cid, CONST_SLOT_FEET).uid)
local poke_name = nome:match('(.-) Pokeball')
local action_id = getItemAttribute(getPlayerSlotItem(cid, CONST_SLOT_FEET).uid, "aid")
       doChangeSpeed(cid, -(getCreatureSpeed(cid) - getCreatureBaseSpeed(cid)))
       doRemoveCondition(cid, CONDITION_OUTFIT)
       setPlayerStorageValue(cid, 20000, 7)
       setPlayerStorageValue(cid, 26000, 6)
       local monster = doCreateMonster(poke_name, getCreaturePosition(cid))
       doConvinceCreature(cid, monster)
   doPlayerSay(cid, poke_name .. ", Stop Ride!", TALKTYPE_SAY)
       return true
end
if #getCreatureSummons(cid) < 1 then
return doPlayerSendCancel(cid, "You dont have pokemon")
end
local pokemon = pokes[getCreatureName(getCreatureSummons(cid)[1])]
local name = getCreatureName(getCreatureSummons(cid)[1])
if not pokes[name] then
return doPlayerSendCancel(cid, "Pokemon not allowed.")
end
doChangeSpeed(cid, pokemon[2])
setPlayerStorageValue(cid, 20000, 10)
setPlayerStorageValue(cid, 26000, 5)
doSetCreatureOutfit(cid, {lookType = pokemon[1], lookHead = 0, lookAddons = 0, lookLegs = 0, lookBody = 0, lookFeet = 0}, -1)
       doItemSetAttribute(getPlayerSlotItem(cid, CONST_SLOT_FEET).uid, "aid", getCreatureHealth(getCreatureSummons(cid)[1]))
       function getPokemonId(summons)
for _, pid in ipairs(summons) do
       return pid
       end
       end
       doRemoveCreature(getPokemonId(summons))
       doPlayerSay(cid, name .. ", Let's go Ride!", TALKTYPE_SAY)
end

 

E em talkaction.xml, add essa tag:

<talkaction words="/ride" hide="yes" event="script" value="ride.lua"/>

 

Explicando :

 

['Rapidash'] = {130, 350},

 

Vermelho: Nome do Pokemon que podera dar ride

Azul: ID da outfit da montaria

Verde: Velocidade que o player ganhará ao montar

 

Espero que tenham gostado =D

 

Ride System 1.0

Editado por thalia
Link para o comentário
Compartilhar em outros sites

Tipo, voce sumona o tauros,

ai vc usa o item ..

ai vai remove a criatura,

ai vai troca sua outfit pra do tauros com ride...

e qndo quiser sair do ride é só usar o item novamente

 

E pode add mais pokemons,

só add essas linhas

['Tauros'] = {128, 500},

['Venusaur'] = {134, 500},

 

134 = id da outfit

500 = velocidade

Editado por thalia
Link para o comentário
Compartilhar em outros sites

Pelo que ta explicando!

Nessa linha se poem o ID q vai usa pra da rider

~~> <action itemid="xxxx" event="script" value="ride.lua"/> <~~

dae poem a poke ball q tem o pokemon q você boto no script

e usa ele e clica no iten q clica em você pra fa rider!

 

mas aqui nao funciono :S

Link para o comentário
Compartilhar em outros sites

ele nao fala "stop rider" o pokemon some dps q tu sai de cima dele!

se pode ajuda com o problema ta ae o erro!

[13/10/2010 13:31:55] [Error - TalkAction Interface]

[13/10/2010 13:31:55] data/talkactions/scripts/ride.lua:onSay

[13/10/2010 13:31:55] Description:

[13/10/2010 13:31:55] (luaGetCreatureName) Creature not found

Link para o comentário
Compartilhar em outros sites

meu goback é esse :

 

local pokein, pokeout = 2222,2223

 

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(cid, dir)

local p = getCreaturePosition(cid)

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(cid, i)) then

state = true

end

end

return state

end

 

local pokes = {

["Dragon"] = {level = 150, go = "Vai Dragon", back = "Volte Dragon."},

["Demon"] = {level = 500, go = "Vai Demon", back = "Volte Demon."},

["Dragon Lord"] = {level = 300, go = "Vai Dragon Lord", back = "Volte Dragon Lord."},

}

 

function onUse(cid, item, frompos, item2, topos)

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

 

local maxh = tonumber(getDescription(item.uid):match("/(.+)]"))

local health = tonumber(getDescription(item.uid):match("%[(.-)/"))

 

if item.itemid == pokeout then

 

if #getCreatureSummons(cid) >= 1 then

for _,z in pairs(getCreatureSummons(cid)) do

if getDescription(item.uid):find(getCreatureName(z)) then

doTransformItem(item.uid, pokein)

doCreatureSay(cid, pokes[getCreatureName(z)].back, TALKTYPE_SAY)

doItemSetAttribute(item.uid, "description", getDescription(item.uid):sub(1, findLetter(getDescription(item.uid), ".")) .. " 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 health <= 0 then

return doPlayerSendCancel(cid, "This pokemon is dead.")

end

 

for i,x in pairs(pokes) do

if #getCreatureSummons(cid) >= 1 then

return doPlayerSendCancel(cid, "You already summoned a pokemon.")

end

 

if i == getDescription(item.uid):sub(9, findLetter(getDescription(item.uid), "'")-1) then

if getPlayerLevel(cid) >= x.level then

pk = doSummonCreature(i, getThingPosition(cid))

doConvinceCreature(cid, pk)

setCreatureMaxHealth(pk, tonumber(getDescription(item.uid):match("/(.+)]")))

doCreatureAddHealth(pk, maxh)

doCreatureAddHealth(pk, health-maxh)

doTransformItem(item.uid, pokeout)

doCreatureSay(cid, x.go, TALKTYPE_SAY)

doItemSetAttribute(item.uid, "description", getDescription(item.uid):sub(1, findLetter(getDescription(item.uid), ".")))

doSendMagicEffect(getCreaturePosition(pk), 10)

setPlayerStorageValue(cid, 61204, 1)

registerCreatureEvent(pk, "DiePoke")

registerCreatureEvent(cid, "PlayerPokeDeath")

break

else

doPlayerSendCancel(cid, "Only players level "..x.level.." or higher can use this pokemon.")

end

end

end

end

return TRUE

end

 

 

e meu catch é esse :

 

local pokein, pokeout = 2222,2223

 

local pokes = {

["Dragon"] = {chance = 40, health = 100, maxhealth = 100},

["Demon"] = {chance = 20, health = 1000, maxhealth = 1000},

}

 

function onUse(cid, item, frompos, item2, topos)

for i,x in pairs(pokes) do

if getItemNameById(item2.itemid):find(i:lower()) then

doRemoveItem(item.uid, 1)

doRemoveItem(item2.uid, 1)

if math.random(1,100) <= x.chance then

local s = doPlayerAddItem(cid, pokein)

doSendMagicEffect(topos, 29)

addEvent(doSendMagicEffect, 300, topos, 30)

doItemSetAttribute(s, "description", "This is "..i.."'s pokeball. HP = ["..x.health.."/"..x.maxhealth.."]")

doPlayerSendTextMessage(cid, 27, "You catch a "..i..".")

else

doPlayerSendTextMessage(cid, 27, "Your pokeball broke.")

doSendMagicEffect(topos, 2)

end

end

end

return TRUE

end

 

 

 

ja tentei ver o erro mais nao consigo mudar , pelo poke ter o nome só na description do item que está sendo usado...

Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...