Ir para conteúdo

[Encerrado] npc battle


outbreaks

Posts Recomendados

Ow Preciso de Npc Battle que ele ataka o player

direto sem fala nd! " Base PDA"

 

esse e erro do meu >>

 

[07/11/2013 11:53:55] [Error - Npc interface]
[07/11/2013 11:53:55] In a timer event called from:
[07/11/2013 11:53:55] data/npc/scripts/.aHunter.lua:onThink
[07/11/2013 11:53:55] Description:
[07/11/2013 11:53:55] data/npc/scripts/.aHunter.lua:24: attempt to index field 'pokeball' (a nil value)
[07/11/2013 11:53:55] stack traceback:
[07/11/2013 11:53:55] data/npc/scripts/.aHunter.lua:24: in function

 

 

npc

 

local target = 0
local prevTarget = 0
local origPos = 0
local max_distance = 12
local fighting = false
local challenger = 0
local battle_turn = 1 -- don't change
local challenger_turn = 0 -- don't change
---
--/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////--
local function doSummonGymPokemon(npc)
local this = npc
if not isCreature(this) or not ehNPC(this) then return true end --alterado v1.6
if #getCreatureSummons(this) >= 1 or target == 0 then return true end
local it = wildHunter[getPlayerStorageValue(this, 665471)][battle_turn]
if not it then return true end
doSummonMonster(this, it.name)
local summon = getCreatureSummons(this)[1]
if not summon then --alterado v1.6
print("Error in npc: "..getCreatureName(this)..", tring to execute function 'doSummonGymPokemon', poke: "..it.name)
battle_turn = battle_turn+1
return true
end
local balleffect = pokeballs["pokeball"].effect
if it.ball and pokeballs[it.ball] then
balleffect = pokeballs[it.ball].effect
end
doSendMagicEffect(getThingPos(summon), balleffect)
setPlayerStorageValue(summon, 10000, balleffect)
setPlayerStorageValue(summon, 10001, gobackmsgs[math.random(#gobackmsgs)].back:gsub("doka", it.nick ~= "" and it.nick or it.name))
setPlayerStorageValue(summon, 1007, it.nick ~= "" and it.nick or it.name)
doSetMonsterGym(summon, target)
addEvent(adjustWildPoke, 15, summon, it.optionalLevel)
if it.nick ~= "" then doCreatureSetNick(summon, it.nick) end
local name = it.nick ~= "" and it.nick or getCreatureName(this).."s "..it.name --alterado v1.3
doCreatureSay(this, gobackmsgs[math.random(#gobackmsgs)].go:gsub("doka", getPlayerStorageValue(summon, 1007)), 1)
fighting = true
battle_turn = battle_turn + 1
end
--/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////--
local function goToOrigPos()
target = 0
selfFollow(0)
fighting = false
challenger = 0
challenger_turn = 0
if #getCreatureSummons(getNpcCid()) >= 1 then
setPlayerStorageValue(getCreatureSummons(getNpcCid())[1], 1006, 0)
doCreatureAddHealth(getCreatureSummons(getNpcCid())[1], -getCreatureMaxHealth(getCreatureSummons(getNpcCid())[1]))
end
doChangeSpeed(getNpcCid(), -getCreatureSpeed(getNpcCid()))
doTeleportThing(getNpcCid(), origPos)
end
--/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////--
local function updateTarget()
if(target == 0) then
local list = getSpectators(getNpcPos(), 9, 9, false)
for i = 1, table.getn(list) do
local _target = list
if(_target ~= 0) then
if isPlayer(_target) and not getTileInfo(getThingPos(_target)).protection then --alterado v1.8
selfSay(hunterTalks[math.random(#hunterTalks)])
doNpcSetCreatureFocus(_target)
target = _target
prevTarget = target
break
end
end
end
end
end
--/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////--
function onCreatureAppear(cid)
end

function onCreatureDisappear(cid)
end

function onCreatureMove(creature, oldPos, newPos)
--
end
--/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////--
function onThink()
if not isCreature(getNpcCid()) then return false end --alterado v1.6
if origPos == 0 then
origPos = getNpcPos()
end
if getPlayerStorageValue(getNpcCid(), 665471) <= 0 then
setPlayerStorageValue(getNpcCid(), 665471, math.random(1, 5))
randOutfit(getNpcCid())
end
updateTarget()
------------------------------------------------------
if getDistanceBetween(getNpcPos(), origPos) >= max_distance or (isCreature(target) and getTileInfo(getThingPos(target)).protection) then --alterado v1.8
goToOrigPos()
end
------------------------------------------------------
if(target == 0) then
if getPlayerStorageValue(getNpcCid(), 154788) <= 0 then
setPlayerStorageValue(getNpcCid(), 154788, 1)
doChangeSpeed(getNpcCid(), -getCreatureSpeed(getNpcCid()))
addEvent(randWalk, 2000, getNpcCid(), 1000, getPlayerStorageValue(getNpcCid(), 154788))
end
return true
end
------------------------------------------------------
local playerPos = getThingPosWithDebug(target) --alterado v1.6
local myPos = getNpcPos()
------------------------------------------------------
if(myPos.z ~= playerPos.z) then
goToOrigPos()
battle_turn = battle_turn == 1 and battle_turn or battle_turn-1
return true
end
------------------------------------------------------
if getDistanceBetween(playerPos, myPos) > max_distance then
goToOrigPos()
battle_turn = battle_turn == 1 and battle_turn or battle_turn-1
return true
end
------------------------------------------------------
if getDistanceBetween(playerPos, myPos) >= 5 then
if getPlayerStorageValue(getNpcCid(), 154788) >= 1 then
setPlayerStorageValue(getNpcCid(), 154788, -1)
doRegainSpeed(getNpcCid())
if isCreature(target) then
selfFollow(target)
end
end
end
------------------------------------------------------
if getDistanceBetween(playerPos, myPos) <= 3 then
if getPlayerStorageValue(getNpcCid(), 154788) <= 0 then
setPlayerStorageValue(getNpcCid(), 154788, 1)
doChangeSpeed(getNpcCid(), -getCreatureSpeed(getNpcCid()))
addEvent(randWalk, 2000, getNpcCid(), 1000, getPlayerStorageValue(getNpcCid(), 154788))
end
end
------------------------------------------------------
if getDistanceBetween(playerPos, myPos) <= 5 then
challenger = target
addEvent(doSummonGymPokemon, 1000, getNpcCid())

local change = false

if not isCreature(target) then
target = 0
battle_turn = battle_turn == 1 and battle_turn or battle_turn-1
return true
end

if fighting then

if not isCreature(getCreatureTarget(getNpcCid())) then
if #getCreatureSummons(challenger) >= 1 then
selfAttackCreature(getCreatureSummons(challenger)[1])
change = true
else
if change then
change = false
challenger_turn = challenger_turn + 1
end
end
end

if #getCreatureSummons(getNpcCid()) == 0 and isCreature(target) then
if battle_turn > #wildHunter[getPlayerStorageValue(getNpcCid(), 665471)] then
addEvent(doCreateNpc, 300000, ".aHunter", myPos) --alterado v1.5
local outfit = getCreatureOutfit(getNpcCid())
doRemoveCreature(getNpcCid())
----------------------------------------
if outfit.lookType == 1016 then --verifica se o npc eh female.. ;p
monster = doCreateMonster("aHunterFemale", myPos)
else
monster = doCreateMonster("aHunter", myPos)
end
----------------------------------------
doCloneOut(monster, outfit)
addEvent(beDrunk, 100, monster)
end
addEvent(doSummonGymPokemon, 1000, getNpcCid())
end

if #getCreatureSummons(challenger) <= 0 then
selfAttackCreature(challenger)
end
end
end
end

 

 

e lib/wild trainer se precisa

 

 

function isRocket(cid)
if not isCreature(cid) then return false end
if getPlayerStorageValue(cid, 665450) >= 1 then
return true
end
return false
end
--/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////--
function isOfficer(cid)
if not isCreature(cid) then return false end
if getPlayerStorageValue(cid, 665460) >= 1 then
return true
end
return false
end
--/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////--
function randOutfit(cid)
outfit = getCreatureOutfit(cid)
if getPlayerStorageValue(cid, 665451) >= 1 then
outfit = {lookType = choose(605, 604), lookHead = math.random(1, 250), lookBody = math.random(1, 250), lookLegs = math.random(1, 250), lookFeet = math.random(1, 250)}
elseif getPlayerStorageValue(cid, 665461) >= 1 then
outfit = {lookType = choose(1184, 1183), lookHead = math.random(1, 250), lookBody = math.random(1, 250), lookLegs = math.random(1, 250), lookFeet = math.random(1, 250)}
elseif getPlayerStorageValue(cid, 665471) >= 1 then
outfit = {lookType = choose(1016, 1015), lookHead = math.random(1, 250), lookBody = math.random(1, 250), lookLegs = math.random(1, 250), lookFeet = math.random(1, 250)}
end
doSetCreatureOutfit(cid, outfit, -1)
end
--/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////--
function doCloneOut(npc, outfit)
local o = outfit
local npcoutfit = {lookType = o.lookType, lookHead = o.lookHead, lookBody = o.lookBody, lookLegs = o.lookLegs, lookFeet = o.lookFeet}

doSetCreatureOutfit(npc, npcoutfit, -1)
end
--/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////--
function beDrunk(target)
if not isCreature(target) then return true end
doChangeSpeed(target, -getCreatureSpeed(target))
doChangeSpeed(target, 100)
if not isSleeping(target) and getPlayerStorageValue(target, 654878) <= 0 then
doPushCreature(target, math.random(0, 3), 1, 0)
end
doChangeSpeed(target, -100)
addEvent(beDrunk, 2000, target)
end
--/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////--
function randWalk(cid, cd, check, target)
if not isCreature(cid) then return true end
if check and check ~= getPlayerStorageValue(cid, 154788) then return true end
if getPlayerStorageValue(cid, 154788) >= 2 and cd ~= -1 then return true end
-------
local alvo = target
-------
setPlayerStorageValue(cid, 154788, getPlayerStorageValue(cid, 154788)+cd)
local a = getPlayerStorageValue(cid, 154788)
if a <= 0 then setPlayerStorageValue(cid, 154788, -1) return true end
-------
doChangeSpeed(cid, -getCreatureSpeed(cid))
doChangeSpeed(cid, 100)
-------
if not isSleeping(cid) and getPlayerStorageValue(cid, 654878) <= 0 then
doPushCreature(cid, math.random(0, 3), 1, 0)
end
-------
doChangeSpeed(cid, -100)
if isCreature(alvo) then
doCreatureSetLookDir(cid, getCreatureDirectionToTarget(cid, alvo))
end
-------
addEvent(randWalk, 5000, cid, -1, a, target)
end
--/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////--
rocketTalks = {"I will kill you, your pig!!", "HAHA you won't get me!!!", "I will win and disappear!!"}
policeTalks = {"I will get you, thief!!", "So you belong to the team rocket? Come here for i get you!!", "I will kill you, your little thief!!"}
hunterTalks = {"I will kill you!!", "Wasn't for you be here!", "This field is sacred! Get out of here!!"}
--/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////--
wildRocket = {
[1] = {{name = "Bulbasaur", optionalLevel = 100, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Squirtle", optionalLevel = 100, sex = SEX_MALE, nick = "", ball = "normal"},
{name = "Charmander", optionalLevel = 100, sex = SEX_MALE, nick = "", ball = "super"},
{name = "Raticate", optionalLevel = 100, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Gloom", optionalLevel = 100, sex = SEX_MALE, nick = "", ball = "ultra"},
},
[2] = {{name = "Chikorita", optionalLevel = 100, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Totodile", optionalLevel = 100, sex = SEX_MALE, nick = "", ball = "normal"},
{name = "Cyndaquil", optionalLevel = 100, sex = SEX_MALE, nick = "", ball = "super"},
{name = "Natu", optionalLevel = 100, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Pidgeotto", optionalLevel = 100, sex = SEX_MALE, nick = "", ball = "ultra"},
},
[3] = {{name = "Muk", optionalLevel = 100, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Ivysaur", optionalLevel = 100, sex = SEX_MALE, nick = "", ball = "normal"},
{name = "Ledian", optionalLevel = 100, sex = SEX_MALE, nick = "", ball = "super"},
{name = "Venonat", optionalLevel = 100, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Ariados", optionalLevel = 100, sex = SEX_MALE, nick = "", ball = "ultra"},
},
[4] = {{name = "Pichu", optionalLevel = 100, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Flaaffy", optionalLevel = 100, sex = SEX_MALE, nick = "", ball = "normal"},
{name = "Seadra", optionalLevel = 100, sex = SEX_MALE, nick = "", ball = "super"},
{name = "Koffing", optionalLevel = 100, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Cubone", optionalLevel = 100, sex = SEX_MALE, nick = "", ball = "ultra"},
},
[5] = {{name = "Haunter", optionalLevel = 100, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Furret", optionalLevel = 100, sex = SEX_MALE, nick = "", ball = "normal"},
{name = "Marill", optionalLevel = 100, sex = SEX_MALE, nick = "", ball = "super"},
{name = "Charmeleon", optionalLevel = 100, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Yanma", optionalLevel = 100, sex = SEX_MALE, nick = "", ball = "ultra"},
},
}
--/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////--
wildPolice = {
[1] = {{name = "Golbat", optionalLevel = 100, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Hoothoot", optionalLevel = 100, sex = SEX_MALE, nick = "", ball = "normal"},
{name = "Magnemite", optionalLevel = 100, sex = SEX_MALE, nick = "", ball = "super"},
{name = "Doduo", optionalLevel = 100, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Kingler", optionalLevel = 100, sex = SEX_MALE, nick = "", ball = "ultra"},
},
[2] = {{name = "Aipom", optionalLevel = 100, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Murkrow", optionalLevel = 100, sex = SEX_MALE, nick = "", ball = "normal"},
{name = "Pineco", optionalLevel = 100, sex = SEX_MALE, nick = "", ball = "super"},
{name = "Swinub", optionalLevel = 100, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Bulbasaur", optionalLevel = 100, sex = SEX_MALE, nick = "", ball = "ultra"},
},
[3] = {{name = "Croconaw", optionalLevel = 100, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Kadabra", optionalLevel = 100, sex = SEX_MALE, nick = "", ball = "normal"},
{name = "Weepinbell", optionalLevel = 100, sex = SEX_MALE, nick = "", ball = "super"},
{name = "Graveler", optionalLevel = 100, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Houndour", optionalLevel = 100, sex = SEX_MALE, nick = "", ball = "ultra"},
},
[4] = {{name = "Magby", optionalLevel = 100, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Shuckle", optionalLevel = 100, sex = SEX_MALE, nick = "", ball = "normal"},
{name = "Seaking", optionalLevel = 100, sex = SEX_MALE, nick = "", ball = "super"},
{name = "Seel", optionalLevel = 100, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Machoke", optionalLevel = 100, sex = SEX_MALE, nick = "", ball = "ultra"},
},
[5] = {{name = "Slowpoke", optionalLevel = 100, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Wartortle", optionalLevel = 100, sex = SEX_MALE, nick = "", ball = "normal"},
{name = "Bayleef", optionalLevel = 100, sex = SEX_MALE, nick = "", ball = "super"},
{name = "Dugtrio", optionalLevel = 100, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Hypno", optionalLevel = 100, sex = SEX_MALE, nick = "", ball = "ultra"},
},
}
--/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////--
wildCommanderOfficer = {
[1] = {{name = "Donphan", optionalLevel = 120, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Porygon2", optionalLevel = 120, sex = SEX_MALE, nick = "", ball = "normal"},
{name = "Octillery", optionalLevel = 120, sex = SEX_MALE, nick = "", ball = "super"},
{name = "Bellossom", optionalLevel = 120, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Nidoking", optionalLevel = 120, sex = SEX_MALE, nick = "", ball = "ultra"},
},
[2] = {{name = "Sandslash", optionalLevel = 120, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Electabuzz", optionalLevel = 120, sex = SEX_MALE, nick = "", ball = "normal"},
{name = "Jynx", optionalLevel = 120, sex = SEX_MALE, nick = "", ball = "super"},
{name = "Tauros", optionalLevel = 120, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Venomoth", optionalLevel = 120, sex = SEX_MALE, nick = "", ball = "ultra"},
},
[3] = {{name = "Lanturn", optionalLevel = 120, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Umbreon", optionalLevel = 120, sex = SEX_MALE, nick = "", ball = "normal"},
{name = "Magcargo", optionalLevel = 120, sex = SEX_MALE, nick = "", ball = "super"},
{name = "Ninetales", optionalLevel = 120, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Primeape", optionalLevel = 120, sex = SEX_MALE, nick = "", ball = "ultra"},
},
[4] = {{name = "Machamp", optionalLevel = 120, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Snorlax", optionalLevel = 120, sex = SEX_MALE, nick = "", ball = "normal"},
{name = "Magneton", optionalLevel = 120, sex = SEX_MALE, nick = "", ball = "super"},
{name = "Mantine", optionalLevel = 120, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Exeggutor", optionalLevel = 120, sex = SEX_MALE, nick = "", ball = "ultra"},
},
[5] = {{name = "Dewgong", optionalLevel = 120, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Xatu", optionalLevel = 120, sex = SEX_MALE, nick = "", ball = "normal"},
{name = "Skarmory", optionalLevel = 120, sex = SEX_MALE, nick = "", ball = "super"},
{name = "Hitmonlee", optionalLevel = 120, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Hitmonchan", optionalLevel = 120, sex = SEX_MALE, nick = "", ball = "ultra"},
},
}
--/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////--
wildCommanderRocket = {
[1] = {{name = "Raichu", optionalLevel = 120, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Pidgeot", optionalLevel = 120, sex = SEX_MALE, nick = "", ball = "normal"},
{name = "Politoed", optionalLevel = 120, sex = SEX_MALE, nick = "", ball = "super"},
{name = "Nidoqueen", optionalLevel = 120, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Vileplume", optionalLevel = 120, sex = SEX_MALE, nick = "", ball = "ultra"},
},
[2] = {{name = "Clefable", optionalLevel = 120, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Noctowl", optionalLevel = 120, sex = SEX_MALE, nick = "", ball = "normal"},
{name = "Forretress", optionalLevel = 120, sex = SEX_MALE, nick = "", ball = "super"},
{name = "Golduck", optionalLevel = 120, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Dragonair", optionalLevel = 120, sex = SEX_MALE, nick = "", ball = "ultra"},
},
[3] = {{name = "Victreebel", optionalLevel = 120, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Tentacruel", optionalLevel = 120, sex = SEX_MALE, nick = "", ball = "normal"},
{name = "Togetic", optionalLevel = 120, sex = SEX_MALE, nick = "", ball = "super"},
{name = "Espeon", optionalLevel = 120, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Heracross", optionalLevel = 120, sex = SEX_MALE, nick = "", ball = "ultra"},
},
[4] = {{name = "Girafarig", optionalLevel = 120, sex = SEX_FEMALE, nick = "", ball = "normal"}, --alterado v1.6
{name = "Ursaring", optionalLevel = 120, sex = SEX_MALE, nick = "", ball = "normal"},
{name = "Piloswine", optionalLevel = 120, sex = SEX_MALE, nick = "", ball = "super"},
{name = "Mantine", optionalLevel = 120, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Wigglytuff", optionalLevel = 120, sex = SEX_MALE, nick = "", ball = "ultra"},
},
[5] = {{name = "Slowpoke", optionalLevel = 120, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Poliwrath", optionalLevel = 120, sex = SEX_MALE, nick = "", ball = "normal"},
{name = "Farfetch'd", optionalLevel = 120, sex = SEX_MALE, nick = "", ball = "super"},
{name = "Cloyster", optionalLevel = 120, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Hitmontop", optionalLevel = 120, sex = SEX_MALE, nick = "", ball = "ultra"},
},
}
--/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////--
wildHunter = {
[1] = {{name = "Raichu", optionalLevel = 70, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Pidgeot", optionalLevel = 65, sex = SEX_MALE, nick = "", ball = "normal"},
{name = "Politoed", optionalLevel = 60, sex = SEX_MALE, nick = "", ball = "super"},
{name = "Nidoqueen", optionalLevel = 70, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Gengar", optionalLevel = 80, sex = SEX_MALE, nick = "", ball = "ultra"},
},
[2] = {{name = "Clefable", optionalLevel = 55, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Noctowl", optionalLevel = 60, sex = SEX_MALE, nick = "", ball = "normal"},
{name = "Forretress", optionalLevel = 80, sex = SEX_MALE, nick = "", ball = "super"},
{name = "Golduck", optionalLevel = 70, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Dragonair", optionalLevel = 80, sex = SEX_MALE, nick = "", ball = "ultra"},
},
[3] = {{name = "Victreebel", optionalLevel = 55, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Tentacruel", optionalLevel = 69, sex = SEX_MALE, nick = "", ball = "normal"},
{name = "Magmar", optionalLevel = 80, sex = SEX_MALE, nick = "", ball = "super"},
{name = "Espeon", optionalLevel = 70, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Heracross", optionalLevel = 75, sex = SEX_MALE, nick = "", ball = "ultra"},
},
[4] = {{name = "Girafarig", optionalLevel = 80, sex = SEX_FEMALE, nick = "", ball = "normal"}, --alterado v1.6
{name = "Ursaring", optionalLevel = 80, sex = SEX_MALE, nick = "", ball = "normal"},
{name = "Piloswine", optionalLevel = 70, sex = SEX_MALE, nick = "", ball = "super"},
{name = "Mantine", optionalLevel = 75, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Kangaskhan", optionalLevel = 65, sex = SEX_MALE, nick = "", ball = "ultra"},
},
[5] = {{name = "Slowpoke", optionalLevel = 45, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Poliwrath", optionalLevel = 55, sex = SEX_MALE, nick = "", ball = "normal"},
{name = "Scyther", optionalLevel = 85, sex = SEX_MALE, nick = "", ball = "super"},
{name = "Cloyster", optionalLevel = 70, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Hitmontop", optionalLevel = 80, sex = SEX_MALE, nick = "", ball = "ultra"},
},
}

 

 

 

 

se puderem me ajuda agradeço!

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

Veja se dá o mesmo erro. Se der, avise. Eu mudei o que, ao meu ver, estava dando erro. Como estou de saída, na volta dou uma olhada melhor.

 

local target = 0

local prevTarget = 0
local origPos = 0
local max_distance = 12
local fighting = false
local challenger = 0
local battle_turn = 1 -- don't change
local challenger_turn = 0 -- don't change
---
--/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////--
local function doSummonGymPokemon(npc)
local this = npc
if not isCreature(this) or not ehNPC(this) then return true end --alterado v1.6
if #getCreatureSummons(this) >= 1 or target == 0 then return true end
local it = wildHunter[getPlayerStorageValue(this, 665471)][battle_turn]
if not it then return true end
doSummonMonster(this, it.name)
local summon = getCreatureSummons(this)[1]
if not summon then --alterado v1.6
print("Error in npc: "..getCreatureName(this)..", tring to execute function 'doSummonGymPokemon', poke: "..it.name)
battle_turn = battle_turn+1
return true
end
local balleffect = pokeballs["normal"].effect
if it.ball and pokeballs[it.ball] then
balleffect = pokeballs[it.ball].effect
end
doSendMagicEffect(getThingPos(summon), balleffect)
setPlayerStorageValue(summon, 10000, balleffect)
setPlayerStorageValue(summon, 10001, gobackmsgs[math.random(#gobackmsgs)].back:gsub("doka", it.nick ~= "" and it.nick or it.name))
setPlayerStorageValue(summon, 1007, it.nick ~= "" and it.nick or it.name)
doSetMonsterGym(summon, target)
addEvent(adjustWildPoke, 15, summon, it.optionalLevel)
if it.nick ~= "" then doCreatureSetNick(summon, it.nick) end
local name = it.nick ~= "" and it.nick or getCreatureName(this).."s "..it.name --alterado v1.3
doCreatureSay(this, gobackmsgs[math.random(#gobackmsgs)].go:gsub("doka", getPlayerStorageValue(summon, 1007)), 1)
fighting = true
battle_turn = battle_turn + 1
end
--/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////--
local function goToOrigPos()
target = 0
selfFollow(0)
fighting = false
challenger = 0
challenger_turn = 0
if #getCreatureSummons(getNpcCid()) >= 1 then
setPlayerStorageValue(getCreatureSummons(getNpcCid())[1], 1006, 0)
doCreatureAddHealth(getCreatureSummons(getNpcCid())[1], -getCreatureMaxHealth(getCreatureSummons(getNpcCid())[1]))
end
doChangeSpeed(getNpcCid(), -getCreatureSpeed(getNpcCid()))
doTeleportThing(getNpcCid(), origPos)
end
--/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////--
local function updateTarget()
if(target == 0) then
local list = getSpectators(getNpcPos(), 9, 9, false)
for i = 1, table.getn(list) do
local _target = list
if(_target ~= 0) then
if isPlayer(_target) and not getTileInfo(getThingPos(_target)).protection then --alterado v1.8
selfSay(hunterTalks[math.random(#hunterTalks)])
doNpcSetCreatureFocus(_target)
target = _target
prevTarget = target
break
end
end
end
end
end
--/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////--
function onCreatureAppear(cid)
end

function onCreatureDisappear(cid)
end

function onCreatureMove(creature, oldPos, newPos)
--
end
--/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////--
function onThink()
if not isCreature(getNpcCid()) then return false end --alterado v1.6
if origPos == 0 then
origPos = getNpcPos()
end
if getPlayerStorageValue(getNpcCid(), 665471) <= 0 then
setPlayerStorageValue(getNpcCid(), 665471, math.random(1, 5))
randOutfit(getNpcCid())
end
updateTarget()
------------------------------------------------------
if getDistanceBetween(getNpcPos(), origPos) >= max_distance or (isCreature(target) and getTileInfo(getThingPos(target)).protection) then --alterado v1.8
goToOrigPos()
end
------------------------------------------------------
if(target == 0) then
if getPlayerStorageValue(getNpcCid(), 154788) <= 0 then
setPlayerStorageValue(getNpcCid(), 154788, 1)
doChangeSpeed(getNpcCid(), -getCreatureSpeed(getNpcCid()))
addEvent(randWalk, 2000, getNpcCid(), 1000, getPlayerStorageValue(getNpcCid(), 154788))
end
return true
end
------------------------------------------------------
local playerPos = getThingPosWithDebug(target) --alterado v1.6
local myPos = getNpcPos()
------------------------------------------------------
if(myPos.z ~= playerPos.z) then
goToOrigPos()
battle_turn = battle_turn == 1 and battle_turn or battle_turn-1
return true
end
------------------------------------------------------
if getDistanceBetween(playerPos, myPos) > max_distance then
goToOrigPos()
battle_turn = battle_turn == 1 and battle_turn or battle_turn-1
return true
end
------------------------------------------------------
if getDistanceBetween(playerPos, myPos) >= 5 then
if getPlayerStorageValue(getNpcCid(), 154788) >= 1 then
setPlayerStorageValue(getNpcCid(), 154788, -1)
doRegainSpeed(getNpcCid())
if isCreature(target) then
selfFollow(target)
end
end
end
------------------------------------------------------
if getDistanceBetween(playerPos, myPos) <= 3 then
if getPlayerStorageValue(getNpcCid(), 154788) <= 0 then
setPlayerStorageValue(getNpcCid(), 154788, 1)
doChangeSpeed(getNpcCid(), -getCreatureSpeed(getNpcCid()))
addEvent(randWalk, 2000, getNpcCid(), 1000, getPlayerStorageValue(getNpcCid(), 154788))
end
end
------------------------------------------------------
if getDistanceBetween(playerPos, myPos) <= 5 then
challenger = target
addEvent(doSummonGymPokemon, 1000, getNpcCid())

local change = false

if not isCreature(target) then
target = 0
battle_turn = battle_turn == 1 and battle_turn or battle_turn-1
return true
end

if fighting then

if not isCreature(getCreatureTarget(getNpcCid())) then
if #getCreatureSummons(challenger) >= 1 then
selfAttackCreature(getCreatureSummons(challenger)[1])
change = true
else
if change then
change = false
challenger_turn = challenger_turn + 1
end
end
end

if #getCreatureSummons(getNpcCid()) == 0 and isCreature(target) then
if battle_turn > #wildHunter[getPlayerStorageValue(getNpcCid(), 665471)] then
addEvent(doCreateNpc, 300000, ".aHunter", myPos) --alterado v1.5
local outfit = getCreatureOutfit(getNpcCid())
doRemoveCreature(getNpcCid())
----------------------------------------
if outfit.lookType == 1016 then --verifica se o npc eh female.. ;p
monster = doCreateMonster("aHunterFemale", myPos)
else
monster = doCreateMonster("aHunter", myPos)
end
----------------------------------------
doCloneOut(monster, outfit)
addEvent(beDrunk, 100, monster)
end
addEvent(doSummonGymPokemon, 1000, getNpcCid())
end

if #getCreatureSummons(challenger) <= 0 then
selfAttackCreature(challenger)
end
end
end
end

 

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

  • 4 years later...
A questão neste tópico de suporte foi encerrada por falta de respostas. Este tópico está fechado e foi movido para Suporte - Tópicos Sem Resposta.

+ Caso a dúvida não tenha sido resolvida você poderá criar outro tópico solicitando ajuda.
* Lembre-se que é permitido dar UP no tópico a cada 24 horas para assim o destacar e manter movimentado.
Link para o comentário
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novos posts.
×
×
  • Criar Novo...