OL

[Resolvido] Pokemon não vem na cherish ball

Por Olan trein, 16 de out. de 2018 em Resolvidos

26
3.4k
Olan treinO
16 de outubro de 2018 às 15:59

Tenho um scrip aki,que quando o player clica no bau,recebe um pokemon,mas ele vem apenas na pokeball(Não vem nem na ultra,cherish,great...)

Alguem pode Me ajudar?

 

Script:

function onUse(cid,item,fropos,topos)

  storage = 31526 -- Storage da quest (troque quando for fezer outra quest)
  pokemon = "Gengar" -- Pokemon Que o player vai ganhar
  TypeBall = "Cherish"  -- type da ball
  level = 30 -- Level que precisa para completar a quest

  if getPlayerStorageValue(cid,storage) == -1 then
    if getPlayerLevel(cid) >= level then

      addPokeToPlayer(cid,pokemon,0 ,nil ,TypeBall)
      doPlayerSendTextMessage(cid,25, "Parabéns você ganhou um "..pokemon.." como premio! ") -- Msg ao completar a quest
      setPlayerStorageValue(cid,storage,1)
    else
      doPlayerSendTextMessage(cid, 26, "Desculpe, mais você precisa ter no minimo level "..level.." para completar a quest") --- Msg quando não tiver o level
    end
  else
    doPlayerSendTextMessage(cid, 26, "Você já fez essa quest") -- Msg quando tentar fazer novamente
  end

  return true
end

16 de outubro de 2018 às 18:35
local starterpokes = {
["Gengar"] = {x = XXX, y = YYY, z = ZZZ},
}

local btype = "cherish"

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

	if getPlayerLevel(cid) > 30 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

	doPlayerSendTextMessage(cid, 27, "Parabéns! Você ganhou um pokémon")

    addPokeToPlayer(cid, pokemon, 0, nil, btype, true)
	doSendMagicEffect(getThingPos(cid), 29)
	

return TRUE
end

Testa ai, não esquece de configurar a posição do baú 

Olan treinO
16 de outubro de 2018 às 20:41

Deu fail,quando clica no bau não acontece nada '-

17 de outubro de 2018 às 07:30
local btype = "cherish"
local pokemon = "Gengar"
 
local storage = 31526 --storage
 
 
function onUse(cid, item, frompos, item2, topos)
	if pokemon == "" then return true end
if getPlayerStorageValue(cid, storage) <= 0 then
	addPokeToPlayer(cid, pokemon, 0, nil, btype)
	doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Parabéns! Você ganhou um "..pokemon.."!!")
	doSendMagicEffect(getThingPos(cid), 29)
	doSendMagicEffect(getThingPos(cid), 27)
	doSendMagicEffect(getThingPos(cid), 29)
	setPlayerStorageValue(cid, storage, 1)
else
	doPlayerSendCancel(cid, "Você já pegou seu Pokémon")
end
return TRUE
end

Tenta assim

Olan treinO
17 de outubro de 2018 às 15:59

o pokemon vem,mas não na cherish,vem na normal.Tentei colocar outras balls no lugar,mas ainda assim vem na normal.

Da esse erro

Erro.jpg

17 de outubro de 2018 às 19:38
local starterpokes = {
["Gengar"] = {x = 900, y = 1472, z = 6},
}

local btype = "normal"

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

	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

	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)

	doSendMagicEffect(getThingPos(cid), 29)
	doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
	doSendMagicEffect(getThingPos(cid), 27)
	doSendMagicEffect(getThingPos(cid), 29)
	

return TRUE
end

Tenta ai

Olan treinO
17 de outubro de 2018 às 20:13

Agora quando clica no bau não vem nada '-'

não tem que adicionar uma função,ou talvez o id da ball? 

17 de outubro de 2018 às 20:20

Não vem nada ou não acontece nada?

Olan treinO
17 de outubro de 2018 às 20:22

não acontece nada.

17 de outubro de 2018 às 20:24

Precisa de level pra ganhar esse pokemon?

Olan treinO
17 de outubro de 2018 às 20:25

não necessariamente.

Mas tu diz no script?

e então,o que posso fazer?

17 de outubro de 2018 às 20:35
local btype = "normal"   ----Tipo de Pokeball 
local pokemon = "Gengar"  ----Pokémon que virá no bau

local storage = 90024 -- storage para nao pegar o premio + de 1 vez

function onUse(cid, item, frompos, item2, topos)
if pokemon == "" then return true end
if getPlayerStorageValue(cid, storage) <= 0 then
addPokeToPlayer(cid, pokemon, 0, nil, btype)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Voce pegou seu "..pokemon.."!!")    ----Mensagem que o player receberá
doSendMagicEffect(getThingPos(cid), 29)
doSendMagicEffect(getThingPos(cid), 27)
doSendMagicEffect(getThingPos(cid), 29)
--doPlayerAddItem(cid, 2160, 100)      -----CASO QUEIRA ADICIONAR ALGUMA RECOMPENSA A MAIS
setPlayerStorageValue(cid, storage, 1)
else
doPlayerSendCancel(cid, "Você já pegou seu Pokémon") ---Mensagem q sera enviada quando o player tentar fazer a quest + de 1 vez
end
return TRUE
end
<action actionid="11376" event="script" value="bau_Teste.lua"/>

Funcionando perfeitamente

Olan treinO
17 de outubro de 2018 às 20:38

voce testou com outras balls?vou testar esse agora rsrsrsrs

ta sempre dando o mesmo erro

[Error - Action Interface] 
[17/10/2018 20:40:37] data/actions/scripts/questy.lua:onUse
[17/10/2018 20:40:37] Description: 
[17/10/2018 20:40:37] (luaDoTransformItem) Item not found

17 de outubro de 2018 às 20:43

Estranho, da esse erro em todas balls?

Olan treinO
17 de outubro de 2018 às 20:48

pior que sim.

até mesmo se coloco normal la,ou seja,esta progamado para vir a pokeball