poste o script do npc.
- Fórum
- OTServ
- Suporte
- Tópicos Sem Resposta
- [Encerrado] Pedido Npc rocket e police '-'
[Encerrado] Pedido Npc rocket e police '-'
Por hakkan224, 23 de dez. de 2012 em Tópicos Sem Resposta
info
Grupo: Conde
Registrado: 27/07/12
Posts: 757
Reputação: +57
Char no Tibia: [ADM] Bhoris

<?xml version="1.0" encoding="UTF-8"?>
<monster name="Commander Rocket" nameDescription="a Commander Rocket" race="normal" experience="0" speed="180" manacost="0">
<health now="1500" max="1500"/>
<look type="604" head="114" body="119" legs="114" feet="114" corpse="12584"/>
<targetchange interval="1000" chance="0"/>
<strategy attack="100" defense="0"/>
<flags>
<flag summonable="1"/>
<flag attackable="1"/>
<flag hostile="0"/>
<flag illusionable="1"/>
<flag convinceable="1"/>
<flag pushable="0"/>
<flag canpushitems="0"/>
<flag canpushcreatures="0"/>
<flag targetdistance="1"/>
<flag staticattack="97"/>
<flag runonhealth="0"/>
</flags>
<attacks>
</attacks>
<defenses armor="0" defense="0">
</defenses>
<loot>
<item id="2393" chance="3333" countmax="15"/>
<item id="2392" chance="1111" countmax="10"/>
<item id="2152" chance="100000" countmax="10"/>
</loot>
<script>
<event name="Spawn"/>
</script>
</monster>
e ai esta a lib não se se falta mais algo deste npc é um script mto tenso de mexer..
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 = 20, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Squirtle", optionalLevel = 15, sex = SEX_MALE, nick = "", ball = "normal"},
{name = "Charmander", optionalLevel = 25, sex = SEX_MALE, nick = "", ball = "super"},
{name = "Raticate", optionalLevel = 15, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Gloom", optionalLevel = 28, sex = SEX_MALE, nick = "", ball = "ultra"},
},
[2] = {{name = "Chikorita", optionalLevel = 25, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Totodile", optionalLevel = 10, sex = SEX_MALE, nick = "", ball = "normal"},
{name = "Cyndaquil", optionalLevel = 20, sex = SEX_MALE, nick = "", ball = "super"},
{name = "Natu", optionalLevel = 26, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Pidgeotto", optionalLevel = 28, sex = SEX_MALE, nick = "", ball = "ultra"},
},
[3] = {{name = "Muk", optionalLevel = 35, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Ivysaur", optionalLevel = 40, sex = SEX_MALE, nick = "", ball = "normal"},
{name = "Ledian", optionalLevel = 43, sex = SEX_MALE, nick = "", ball = "super"},
{name = "Venonat", optionalLevel = 25, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Ariados", optionalLevel = 40, sex = SEX_MALE, nick = "", ball = "ultra"},
},
[4] = {{name = "Pichu", optionalLevel = 20, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Flaaffy", optionalLevel = 35, sex = SEX_MALE, nick = "", ball = "normal"},
{name = "Seadra", optionalLevel = 45, sex = SEX_MALE, nick = "", ball = "super"},
{name = "Koffing", optionalLevel = 25, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Cubone", optionalLevel = 30, sex = SEX_MALE, nick = "", ball = "ultra"},
},
[5] = {{name = "Haunter", optionalLevel = 40, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Furret", optionalLevel = 30, sex = SEX_MALE, nick = "", ball = "normal"},
{name = "Marill", optionalLevel = 25, sex = SEX_MALE, nick = "", ball = "super"},
{name = "Charmeleon", optionalLevel = 50, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Yanma", optionalLevel = 50, sex = SEX_MALE, nick = "", ball = "ultra"},
},
}
--/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////--
wildPolice = {
[1] = {{name = "Golbat", optionalLevel = 20, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Hoothoot", optionalLevel = 15, sex = SEX_MALE, nick = "", ball = "normal"},
{name = "Magnemite", optionalLevel = 25, sex = SEX_MALE, nick = "", ball = "super"},
{name = "Doduo", optionalLevel = 15, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Kingler", optionalLevel = 28, sex = SEX_MALE, nick = "", ball = "ultra"},
},
[2] = {{name = "Aipom", optionalLevel = 25, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Murkrow", optionalLevel = 10, sex = SEX_MALE, nick = "", ball = "normal"},
{name = "Pineco", optionalLevel = 20, sex = SEX_MALE, nick = "", ball = "super"},
{name = "Swinub", optionalLevel = 26, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Bulbasaur", optionalLevel = 28, sex = SEX_MALE, nick = "", ball = "ultra"},
},
[3] = {{name = "Croconaw", optionalLevel = 35, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Kadabra", optionalLevel = 40, sex = SEX_MALE, nick = "", ball = "normal"},
{name = "Weepinbell", optionalLevel = 43, sex = SEX_MALE, nick = "", ball = "super"},
{name = "Graveler", optionalLevel = 25, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Houndour", optionalLevel = 40, sex = SEX_MALE, nick = "", ball = "ultra"},
},
[4] = {{name = "Magby", optionalLevel = 20, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Shuckle", optionalLevel = 35, sex = SEX_MALE, nick = "", ball = "normal"},
{name = "Seaking", optionalLevel = 45, sex = SEX_MALE, nick = "", ball = "super"},
{name = "Seel", optionalLevel = 25, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Machoke", optionalLevel = 35, sex = SEX_MALE, nick = "", ball = "ultra"},
},
[5] = {{name = "Slowpoke", optionalLevel = 40, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Wartortle", optionalLevel = 30, sex = SEX_MALE, nick = "", ball = "normal"},
{name = "Bayleef", optionalLevel = 25, sex = SEX_MALE, nick = "", ball = "super"},
{name = "Dugtrio", optionalLevel = 50, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Hypno", optionalLevel = 50, sex = SEX_MALE, nick = "", ball = "ultra"},
},
}
--/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////--
wildCommanderOfficer = {
[1] = {{name = "Donphan", optionalLevel = 70, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Porygon2", optionalLevel = 65, sex = SEX_MALE, nick = "", ball = "normal"},
{name = "Octillery", optionalLevel = 60, sex = SEX_MALE, nick = "", ball = "super"},
{name = "Bellossom", optionalLevel = 70, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Nidoking", optionalLevel = 55, sex = SEX_MALE, nick = "", ball = "ultra"},
},
[2] = {{name = "Sandslash", optionalLevel = 55, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Electabuzz", optionalLevel = 60, sex = SEX_MALE, nick = "", ball = "normal"},
{name = "Jynx", optionalLevel = 80, sex = SEX_MALE, nick = "", ball = "super"},
{name = "Tauros", optionalLevel = 70, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Venomoth", optionalLevel = 80, sex = SEX_MALE, nick = "", ball = "ultra"},
},
[3] = {{name = "Lanturn", optionalLevel = 55, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Umbreon", optionalLevel = 69, sex = SEX_MALE, nick = "", ball = "normal"},
{name = "Magcargo", optionalLevel = 60, sex = SEX_MALE, nick = "", ball = "super"},
{name = "Ninetales", optionalLevel = 70, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Primeape", optionalLevel = 75, sex = SEX_MALE, nick = "", ball = "ultra"},
},
[4] = {{name = "Machamp", optionalLevel = 80, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Snorlax", optionalLevel = 80, sex = SEX_MALE, nick = "", ball = "normal"},
{name = "Magneton", optionalLevel = 70, sex = SEX_MALE, nick = "", ball = "super"},
{name = "Mantine", optionalLevel = 75, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Exeggutor", optionalLevel = 65, sex = SEX_MALE, nick = "", ball = "ultra"},
},
[5] = {{name = "Dewgong", optionalLevel = 45, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Xatu", optionalLevel = 55, sex = SEX_MALE, nick = "", ball = "normal"},
{name = "Skarmory", optionalLevel = 60, sex = SEX_MALE, nick = "", ball = "super"},
{name = "Hitmonlee", optionalLevel = 70, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Hitmonchan", optionalLevel = 80, sex = SEX_MALE, nick = "", ball = "ultra"},
},
}
--/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////--
wildCommanderRocket = {
[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 = "Vileplume", optionalLevel = 55, 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 = "Togetic", optionalLevel = 60, 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 = "Wigglytuff", 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 = "Farfetch'd", optionalLevel = 60, 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"},
},
}
--/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////--
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"},
},
}
Bem eu queria recria-lo ou entao poder editar "NOME, Força dos pokemons pq ta um lixo mesmo ;s quero deichar mt mt mt forte '-' se possivel tbm colocar loot obg +rep se ajudar '-'
Editado Dezembro 23 por hakkan224
info
Grupo: Príncipe
Registrado: 19/08/10
Posts: 4k
Reputação: +1.1k
Gênero: Masculino

mano vo explicar uma coisa.. ta vendo essa parte da lib..
wildRocket = {
[1] = {{name = "Bulbasaur", optionalLevel = 20, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Squirtle", optionalLevel = 15, sex = SEX_MALE, nick = "", ball = "normal"},
{name = "Charmander", optionalLevel = 25, sex = SEX_MALE, nick = "", ball = "super"},
{name = "Raticate", optionalLevel = 15, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Gloom", optionalLevel = 28, sex = SEX_MALE, nick = "", ball = "ultra"},
},
[2] = {{name = "Chikorita", optionalLevel = 25, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Totodile", optionalLevel = 10, sex = SEX_MALE, nick = "", ball = "normal"},
{name = "Cyndaquil", optionalLevel = 20, sex = SEX_MALE, nick = "", ball = "super"},
{name = "Natu", optionalLevel = 26, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Pidgeotto", optionalLevel = 28, sex = SEX_MALE, nick = "", ball = "ultra"},
},
[3] = {{name = "Muk", optionalLevel = 35, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Ivysaur", optionalLevel = 40, sex = SEX_MALE, nick = "", ball = "normal"},
{name = "Ledian", optionalLevel = 43, sex = SEX_MALE, nick = "", ball = "super"},
{name = "Venonat", optionalLevel = 25, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Ariados", optionalLevel = 40, sex = SEX_MALE, nick = "", ball = "ultra"},
},
[4] = {{name = "Pichu", optionalLevel = 20, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Flaaffy", optionalLevel = 35, sex = SEX_MALE, nick = "", ball = "normal"},
{name = "Seadra", optionalLevel = 45, sex = SEX_MALE, nick = "", ball = "super"},
{name = "Koffing", optionalLevel = 25, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Cubone", optionalLevel = 30, sex = SEX_MALE, nick = "", ball = "ultra"},
},
[5] = {{name = "Haunter", optionalLevel = 40, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Furret", optionalLevel = 30, sex = SEX_MALE, nick = "", ball = "normal"},
{name = "Marill", optionalLevel = 25, sex = SEX_MALE, nick = "", ball = "super"},
{name = "Charmeleon", optionalLevel = 50, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Yanma", optionalLevel = 50, sex = SEX_MALE, nick = "", ball = "ultra"},
},
}
essa parte controla os pokes do npc Rocket normal...
sempre q um npc rock nasce no resp, roda um numero aleatorio de 1 a 5.. e dai qual numero sair vai determinar quais pokes esse rocket em particular vai ter...
por exemplo.. se der '4', o rocket vai ter esses pokes..
[4] = {{name = "Pichu", optionalLevel = 20, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Flaaffy", optionalLevel = 35, sex = SEX_MALE, nick = "", ball = "normal"},
{name = "Seadra", optionalLevel = 45, sex = SEX_MALE, nick = "", ball = "super"},
{name = "Koffing", optionalLevel = 25, sex = SEX_FEMALE, nick = "", ball = "normal"},
{name = "Cubone", optionalLevel = 30, sex = SEX_MALE, nick = "", ball = "ultra"},
},
o unico jeito de mexer na força deles eh mudar o optionalLevel... coloque 1000 em todos os pokes do rocket e veja oq acontece...
Slicer , e tipo eu estou querendo recriar estes npc's como se fossem aqueles da pxg de clan, como faço pra mudar a sprite e o nome?
poderia editar 1 pra mim?
Hakkan, pode deixar que a sprite eu já sei mudar... E o nome também!!!
Isto tudo ai é no NPC.lua!! =]
Slicer, olha aqui o script do NPC que eu fiz:
NPC.xml
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Testando" script="testando.lua" walkinterval="0" floorchange="0" access="5" level="100" maglevel="1">
<health now="15" max="15"/>
<look type="604" head="114" body="119" legs="114" feet="114" corpse="3058"/>
<parameters>
</parameters>
</npc>
NPC.lua
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 = wildTestando[getPlayerStorageValue(this, 665451)][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) == TRUE and isOfficer(_target)) then
selfSay(rocketTalks[math.random(#rocketTalks)])
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(), 665451) <= 0 then
setPlayerStorageValue(getNpcCid(), 665451, math.random(1, 5))
randOutfit(getNpcCid())
end
updateTarget()
------------------------------------------------------
if getDistanceBetween(getNpcPos(), origPos) >= max_distance then
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), target)
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), target)
end
end
------------------------------------------------------
if getDistanceBetween(playerPos, myPos) <= 5 then
challenger = target
addEvent(doSummonGymPokemon, 850, 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 > #wildTestando[getPlayerStorageValue(getNpcCid(), 665451)] then
addEvent(doCreateNpc, 300000, "Testando", myPos) --alterado v1.5
local outfit = getCreatureOutfit(getNpcCid())
doRemoveCreature(getNpcCid())
----------------------------------------
if outfit.lookType == 605 then --verifica se o npc eh female.. ;p
monster = doCreateMonster("aTestandoFemale", myPos)
else
monster = doCreateMonster("aTestando", 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
Lib
--/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////--
wildTestando = {
[1] = {{name = "Entei", optionalLevel = 100, sex = SEX_MALE, nick = "", ball = "normal"},
{name = "Raikou", optionalLevel = 100, sex = SEX_MALE, nick = "", ball = "normal"},
{name = "Suicune", optionalLevel = 100, sex = SEX_MALE, nick = "", ball = "super"},
{name = "Articuno", optionalLevel = 100, sex = SEX_MALE, nick = "", ball = "normal"},
{name = "Moltres", optionalLevel = 100, sex = SEX_MALE, nick = "", ball = "ultra"},
{name = "Zapdos", optionalLevel = 100, sex = SEX_MALE, nick = "", ball = "ultra"},
},
[2] = {{name = "Entei", optionalLevel = 100, sex = SEX_MALE, nick = "", ball = "normal"},
{name = "Raikou", optionalLevel = 100, sex = SEX_MALE, nick = "", ball = "normal"},
{name = "Suicune", optionalLevel = 100, sex = SEX_MALE, nick = "", ball = "super"},
{name = "Articuno", optionalLevel = 100, sex = SEX_MALE, nick = "", ball = "normal"},
{name = "Moltres", optionalLevel = 100, sex = SEX_MALE, nick = "", ball = "ultra"},
{name = "Zapdos", optionalLevel = 100, sex = SEX_MALE, nick = "", ball = "ultra"},
},
}
Aqui está dando um erro, e tipo...
Eu mato o npc 1 vez, ai ele invoca todos os pokemon's... Mas quando acaba os pokemon's, ele some!
E então o proximo npc não invoca nada!
Erro:
[23/12/2012 22:07:35] [Error - Npc interface]
[23/12/2012 22:07:35] In a timer event called from:
[23/12/2012 22:07:35] data/npc/scripts/testando.lua:onThink
[23/12/2012 22:07:35] Description:
[23/12/2012 22:07:35] data/npc/scripts/testando.lua:15: attempt to index field '?' (a nil value)
[23/12/2012 22:07:35] stack traceback:
[23/12/2012 22:07:35] data/npc/scripts/testando.lua:15: in function <data/npc/scripts/testando.lua:11>
info
Grupo: Herói
Registrado: 28/11/10
Posts: 3.4k
Reputação: +585
Gênero: Masculino

+ 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.






info
Grupo: Campones
Registrado: 21/06/12
Posts: 74
Reputação: +1
Char no Tibia: Myuxa
Galera alguem pode me falar como edito estes npc's? do pda sem lvl
ou entao alguem pode postar um npc editado como se fosse lvl 1000? ou seja extremamente forte