- 0
suporte scripts [Resolvido] ajuda a terminar esse script (actions)
-
Quem Está Navegando 0 membros estão online
- Nenhum usuário registrado visualizando esta página.
-
Conteúdo Similar
-
- 0 respostas
- 943 visualizações
-
- 4 respostas
- 1496 visualizações
-
- 3 respostas
- 1332 visualizações
-
- 0 respostas
- 1183 visualizações
-
- 3 respostas
- 1289 visualizações
-
Pergunta
wevertonvrb 25
boa noite gente o meu script deve adicionar um atributo na pokeball do pokemon que esta sumonado logo apos usar um item nele
para os que so entendem de tibia (o meu script deve adicionar um atributo na bota do player logo apos usar um item no seu próprio summon)
E MEU SCRIPT JA ESTA FAZENDO ISSO, ESSA PARTE JA FUNCIONA
porem eu quero que esse atributo seja adicionado na pokeball (bota) apenas se o pokemon (summon) não tenha uma spell especifica
que seria a spell "Psychic"
então eu consegui também fazer ele não adicionar o atributo nos pokemons que tenha essa spell
POREM OS POKEMON QUE NÃO TEM A SPELL E QUE DEVIA ADICIONAR O ATRIBUTO TA GERANDO ERRO
QUERO ARRUMAR ESSE ERRO E PESSO AJUDA NISSO, POR FAVOR
SCRIPT ATUAL
function onUse(cid, item, frompos, item2, topos)
local pb = getPlayerSlotItem(getCreatureMaster(item2.uid), 8)
local ball = getPlayerSlotItem(cid, CONST_SLOT_FEET).uid
local tocopy = item2.uid
local lockedcds = {"Psychic"}
if not isCreature(item2.uid) or item2.uid == cid or not isSummon(item2.uid) or (item2.uid) == ball then
return doPlayerSendCancel(cid, "Voce deve usar o item em seu pokemon!")
end
if not pb then
return true end
if isMonster(item2.uid) then
if not isInArray(lockedcds, movestable[getCreatureName(tocopy)].move1.name) and
not isInArray(lockedcds, movestable[getCreatureName(tocopy)].move2.name) and
not isInArray(lockedcds, movestable[getCreatureName(tocopy)].move3.name) and
not isInArray(lockedcds, movestable[getCreatureName(tocopy)].move4.name) and
not isInArray(lockedcds, movestable[getCreatureName(tocopy)].move5.name) and
not isInArray(lockedcds, movestable[getCreatureName(tocopy)].move6.name) and
not isInArray(lockedcds, movestable[getCreatureName(tocopy)].move7.name) and
not isInArray(lockedcds, movestable[getCreatureName(tocopy)].move8.name) and
not isInArray(lockedcds, movestable[getCreatureName(tocopy)].move9.name) and
not isInArray(lockedcds, movestable[getCreatureName(tocopy)].move10.name) and
not isInArray(lockedcds, movestable[getCreatureName(tocopy)].move11.name) and
not isInArray(lockedcds, movestable[getCreatureName(tocopy)].move12.name) then
doSendFlareEffect(getThingPos(item2.uid))
doItemSetAttribute(pb.uid, "megaspell1", 1)
doRemoveItem(item.uid, 1)
else
doPlayerSendCancel(cid, "seu pokemon possui o movimento Psychic .")
end
end
return true
end
---- pokemon q usei pra teste venonat que possui o psychic no m5 e possui ate o m8 total de 8 moves(spells) usei para demonstar --http://prntscr.com/g435tc
---- usando o item nele para demonstar --http://prntscr.com/g4388z -- podem ver que apareceu a mensagem (seu pokemon possui o movimento Psychic)
----o segundo pokemon q usei é o Blastoise que possui um total de 10 moves(spells)e nenhuma delas é o psychic --http://prntscr.com/g43913
----quando eu uso o item nele aparece a mensaguem (you cannot use this object) e gera erro na distro
[03/08/2017 20:02:44] [Error - Action Interface]
[03/08/2017 20:02:44] data/actions/scripts/megaspell1.lua:onUse
[03/08/2017 20:02:44] Description:
[03/08/2017 20:02:44] ...ta/actions/scripts/megaspell1.lua:23: attempt to index field 'move11' (a nil value)
[03/08/2017 20:02:44] stack traceback:
[03/08/2017 20:02:44] ...ta/actions/scripts/megaspell1.lua:23: in function <...ta/actions/scripts/megaspell1.lua:1>
e devia adicionar o atributo -- --http://prntscr.com/g439ng
lembrando tambem que o blastoise possui ate o m10 e o erro acontece no m11, um movimento que ele não tem,
acredito que o erro acontece ao verificar um movimento inexistente
caso eu teste em outro pokemon que possua 5 moves ou seja, ate o m5 e ele tambem não tenha o movimento Psychic o erro sera gerado no m6, ou seja em um poder inesistente, novamente
acredito que tem que adicionar algo que pare a verificação no m10 caso o pokemon tenha apenas ate o m10
ultima observação isso de verificar eu tirei do (smeargle system)
e vou postar a parte que lhe cabe abaixo para analise
local lockedpokes = {"Mew", "Mewtwo", "Unown Legion", "Entei", "Raikou", "Suicune", "Zapdos", "Moltres", "Articuno", "Rocket Team", "Unown", "Lugia", "Celebi", "Ho-oh", "Mew_", "Mewtwo_"}
if (isPlayer(cid) and #getCreatureSummons(cid) > 0 and getCreatureName(getCreatureSummons(cid)[1]) == "Smeargle" and getPlayerStorageValue(getCreatureSummons(cid)[1], 18554) > 0) or (isPlayer(cid) and #getCreatureSummons(cid) > 0 and getCreatureName(getCreatureSummons(cid)[1]) == "Shiny Smeargle" and getPlayerStorageValue(getCreatureSummons(cid)[1], 18554) > 0) then
if isMonster(item2.uid) and isInArray(lockedpokes, getCreatureName(item2.uid)) then
doPlayerSendTextMessage(cid, 20, "You can't copy this move.")
return true
end
local lockedcds = {"Divine Punishment", "Unown Rush", "Sing", "Unown Help", "Sleep Powder", "Volcano Burst", "Selfdestruct", "Protection", "Mysterious Power", "Power Wave", "Shredder Team", "Double Team", "Team Slice", "Ancient Fury", "Camouflage", "Future Sight", "Acid Armor", "Rollout", "Flame Wheel", "Elemental Hands", "Super Vines", "ExplodeAll", "Stampage", "Iron Defense", "Minimize", "Team Claw", ""}
for x=1, 8 do
table.insert(lockedcds, "Sketch "..x)
end
local canShiny = true
local smeargle = getCreatureSummons(cid)[1]
local shinysmeargle = getCreatureSummons(cid)[1]
local tocopy = item2.uid
local selfball = getPlayerSlotItem(cid, 8).uid
if (isShinyName(getCreatureName(item2.uid)) and canShiny) or not isShinyName(getCreatureName(item2.uid)) then
if (getPlayerStorageValue(smeargle, 18554)) or (getPlayerStorageValue(shinysmeargle, 18554))then
if (getPlayerStorageValue(smeargle, 18554) == 1 and movestable[getCreatureName(tocopy)].move1 and not isInArray(lockedcds, movestable[getCreatureName(tocopy)].move1.name)) or (getPlayerStorageValue(shynysmeargle, 18554) == 1 and movestable[getCreatureName(tocopy)].move1 and not isInArray(lockedcds, movestable[getCreatureName(tocopy)].move1.name)) then
if (not smeargleHaveSpell(cid, movestable[getCreatureName(tocopy)].move1.name)) or (not shinysmeargleHaveSpell(cid, movestable[getCreatureName(tocopy)].move1.name)) then
doItemSetAttribute(selfball, "skt1", getCreatureName(tocopy))
else
doPlayerSendTextMessage(cid, 20, "You smeargle already have this move.")
end
elseif getPlayerStorageValue(smeargle, 18554) == 2 and movestable[getCreatureName(tocopy)].move2 and not isInArray(lockedcds, movestable[getCreatureName(tocopy)].move2.name) then
if not smeargleHaveSpell(cid, movestable[getCreatureName(tocopy)].move2.name) then
doItemSetAttribute(selfball, "skt2", getCreatureName(tocopy))
else
doPlayerSendTextMessage(cid, 20, "You smeargle already have this move.")
end
elseif getPlayerStorageValue(smeargle, 18554) == 3 and movestable[getCreatureName(tocopy)].move3 and not isInArray(lockedcds, movestable[getCreatureName(tocopy)].move3.name) then
if not smeargleHaveSpell(cid, movestable[getCreatureName(tocopy)].move3.name) then
doItemSetAttribute(selfball, "skt3", getCreatureName(tocopy))
else
doPlayerSendTextMessage(cid, 20, "You smeargle already have this move.")
end
elseif getPlayerStorageValue(smeargle, 18554) == 4 and movestable[getCreatureName(tocopy)].move4 and not isInArray(lockedcds, movestable[getCreatureName(tocopy)].move4.name) then
if not smeargleHaveSpell(cid, movestable[getCreatureName(tocopy)].move4.name) then
doItemSetAttribute(selfball, "skt4", getCreatureName(tocopy))
else
doPlayerSendTextMessage(cid, 20, "You smeargle already have this move.")
end
elseif getPlayerStorageValue(smeargle, 18554) == 5 and movestable[getCreatureName(tocopy)].move5 and not isInArray(lockedcds, movestable[getCreatureName(tocopy)].move5.name) then
if not smeargleHaveSpell(cid, movestable[getCreatureName(tocopy)].move5.name) then
doItemSetAttribute(selfball, "skt5", getCreatureName(tocopy))
else
doPlayerSendTextMessage(cid, 20, "You smeargle already have this move.")
end
elseif getPlayerStorageValue(smeargle, 18554) == 6 and movestable[getCreatureName(tocopy)].move6 and not isInArray(lockedcds, movestable[getCreatureName(tocopy)].move6.name) then
if not smeargleHaveSpell(cid, movestable[getCreatureName(tocopy)].move6.name) then
doItemSetAttribute(selfball, "skt6", getCreatureName(tocopy))
else
doPlayerSendTextMessage(cid, 20, "You smeargle already have this move.")
end
elseif getPlayerStorageValue(smeargle, 18554) == 7 and movestable[getCreatureName(tocopy)].move7 and not isInArray(lockedcds, movestable[getCreatureName(tocopy)].move7.name) then
if not smeargleHaveSpell(cid, movestable[getCreatureName(tocopy)].move7.name) then
doItemSetAttribute(selfball, "skt7", getCreatureName(tocopy))
else
doPlayerSendTextMessage(cid, 20, "You smeargle already have this move.")
end
elseif getPlayerStorageValue(smeargle, 18554) == 8 and movestable[getCreatureName(tocopy)].move8 and not isInArray(lockedcds, movestable[getCreatureName(tocopy)].move8.name) then
if not smeargleHaveSpell(cid, movestable[getCreatureName(tocopy)].move8.name) then
doItemSetAttribute(selfball, "skt8", getCreatureName(tocopy))
else
doPlayerSendTextMessage(cid, 20, "You smeargle already have this move.")
end
end
setPlayerStorageValue(smeargle, 18554, -1)
setPlayerStorageValue(shinysmeargle, 18554, -1)
end
doUpdateMoves(cid)
return true
else
doPlayerSendTextMessage(cid, 20, "You can't copy moves of shinyes pokemons.")
end
end
funções sitadas
function getSmeargleMoveTable(master)
local ball = getPlayerSlotItem(master, 8).uid
local moves = {}
local skts = {"skt1", "skt2", "skt3", "skt4", "skt5", "skt6", "skt7", "skt8"}
for x=1, #skts do
moves["move"..x] = getItemAttribute(ball, skts[x]) and movestable[getItemAttribute(ball, skts[x])]["move"..x] and movestable[getItemAttribute(ball, skts[x])]["move"..x] ~= -1 and movestable[getItemAttribute(ball, skts[x])]["move"..x] or movestable["Smeargle"]["move"..x] or movestable["Shiny Smeargle"]["move"..x]
end
return moves
end
function smeargleHaveSpell(cid, spellname)
local has = false
local moves = getSmeargleMoveTable(cid)
local ball = getPlayerSlotItem(cid, 8).uid
local skts = {"skt1", "skt2", "skt3", "skt4", "skt5", "skt6", "skt7", "skt8"}
for x=1, #skts do
if getItemAttribute(ball, skts[x]) and moves["move"..x].name == spellname then
has = true
break
end
end
return has
end
ESPERO QUE POSSAM ME AJUDAR
@Poccnn
@Nogard
@Leoxtibia
Editado por wevertonvrbLink para o comentário
Compartilhar em outros sites
9 respostass a esta questão
Posts Recomendados