FL
action

Tile Que Dá Pokémon

Por FlamesAdmin, 14 de jun. de 2015 em Scripts

resolvido
script
8
1.4k
14 de junho de 2015 às 17:59

Peço ajuda a vocês com esse script movement.

O script é como se fosse o starter.lua por action, pois esse o player passa no tile e ganha tal Pokémon.

Se o player não tiver falado com Npc antes, aparecerá essa mensagem com a storage

if getPlayerStorageValue(cid, 9658754) ~= 1 then              
      sendMsgToPlayer(cid, 27, "Talk to Prof. Robert for choose your city first!")
       return true
    end      

Rep+ pela ajuda.

HeelNoxH
14 de junho de 2015 às 18:08


 

local starterpokes = {

["Weedle"] = {x = 53, y = 70, z = 7},

["Rattata"] = {x = 51, y = 70, z = 7},

["Caterpie"] = {x = 49, y = 70, z = 7},

["Bellsprout"] = {x = 43, y = 70, z = 7},

["Oddish"] = {x = 45, y = 70, z = 7},

["Sunkern"] = {x = 47, y = 70, z = 7},

["Pidgey"] = {x = 55, y = 70, z = 7},

}

 

 

local btype = "normal"

 

 

function onStepIn(cid, item, position, fromPosition)

 

 

if getPlayerLevel(cid) > 5 then

return true

end

 

 

local pokemon = ""

 

 

for a, b in pairs (starterpokes) do

if isPosEqualPos(topos, b) then

pokemon = a

end

end

if pokemon == "" then return true end

 

 

if getPlayerStorageValue(cid, 9658754) ~= 1 then

sendMsgToPlayer(cid, 27, "Talk to the Prof. Robert to choose your beginner city first!")

return true

end --alterado v1.9 \/

 

 

doPlayerSendTextMessage(cid, 27, "You got your first pokemon! You also received some pokeballs to help you in your way.")

doPlayerSendTextMessage(cid, 27, "Don't forget to use your pokedex on every undiscovered pokemon!")

 

 

addPokeToPlayer(cid, pokemon, 0, nil, btype, true)

doPlayerAddItem(cid, 2394, 10)

 

 

doSendMagicEffect(getThingPos(cid), 29)

doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))

doSendMagicEffect(getThingPos(cid), 27)

doSendMagicEffect(getThingPos(cid), 29)

 

 

 

 

return TRUE

end

 

function onStepOut(cid, item, position, fromPosition)

return false

end

 

14 de junho de 2015 às 18:21

Quando eu coloco StepOut na tag do movements.xml, nada acontece, quando eu coloco StepIn da esse erro:

[14/06/2015 18:20:15] [Error - MoveEvents Interface] 
[14/06/2015 18:20:15] data/movements/scripts/Inicial.lua:onStepIn
[14/06/2015 18:20:15] Description: 
[14/06/2015 18:20:15] data/lib/some functions.lua:1224: attempt to index local 'pos1' (a nil value)
[14/06/2015 18:20:15] stack traceback:
[14/06/2015 18:20:15] 	data/lib/some functions.lua:1224: in function 'isPosEqualPos'
[14/06/2015 18:20:15] 	data/movements/scripts/Inicial.lua:26: in function <data/movements/scripts/Inicial.lua:14>

Poderia postar sua tag do movements.xml?

HeelNoxH
14 de junho de 2015 às 18:57

Você configurou as positions certinhas aonde se localizam os baús ?

15 de junho de 2015 às 20:02

Sim.


Up.

zipter98Z
16 de junho de 2015 às 15:07
Melhor resposta

 

local p = {
    --[actionid] = "pokemon_name",
    --Ex.:
    [9282] = "Charmander",
    --etc,
}
function onStepIn(cid, item, position, fromPosition)
    local poke = p[item.actionid]
    if poke then
        if not isPlayer(cid) then
            return true
        elseif getPlayerStorageValue(cid, 9658754) ~= 1 then              
            return sendMsgToPlayer(cid, 27, "Talk to Prof. Robert for choose your city first!") and doTeleportThing(cid, fromPosition)
        elseif getPlayerStorageValue(cid, 49191) > -1 then
            return doPlayerSendCancel(cid, "You already got your pokemon.") and doTeleportThing(cid, fromPosition)
        end      
        doPlayerSendTextMessage(cid, 27, "You got your first pokemon! You also received some pokeballs to help you in your way.")
        doPlayerSendTextMessage(cid, 27, "Don't forget to use your pokedex on every undiscovered pokemon!")
        addPokeToPlayer(cid, poke, 0, nil, "normal", true)
        doPlayerAddItem(cid, 2394, 10)
        doSendMagicEffect(getThingPos(cid), 29)
        doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
        doSendMagicEffect(getThingPos(cid), 27)
        doSendMagicEffect(getThingPos(cid), 29)
        setPlayerStorageValue(cid, 49191, 1)
    end
    return true
end
2 semanas depois...
24 de junho de 2015 às 16:41

Obrigado, funcionou perfeitamente.

1 mês depois...
BrunoB
01 de julho de 2015 às 21:08

Tópico movido para a seção de dúvidas e pedidos resolvidos.