target = 0
focus = 0
talk_start = 0
function onThingMove(creature, thing, oldpos, oldstackpos)
end
function onCreatureAppear(creature)
end
function onCreatureDisappear(cid, pos)
end
function onCreatureTurn(creature)
end
function onCreatureSay(cid, type, msg)
msg = string.lower(msg)
if ((string.find(msg, '(%a*)hi(%a*)')) and (focus == 0)) and getDistanceToCreature(cid) < 5 then
selfSay('hi ' .. 'Olá, fale com que pokemon meu você quer batalhar e iremos à luta!')
focus = cid
talk_start = os.clock()
elseif (string.find(msg, '(%a*)graveler(%a*)') and focus ~= 0) then
selfSay('Go, Graveler', cid)
doCreateMonster("brock graveler", getCreaturePosition(getNpcId()))
focus = 0
talk_start = 0
elseif (string.find(msg, '(%a*)geodude(%a*)') and focus ~= 0) then
selfSay('Go, Geodude', cid)
doCreateMonster("brock geodude", getCreaturePosition(getNpcId()))
focus = 0
talk_start = 0
elseif (string.find(msg, '(%a*)onix(%a*)') and focus ~= 0) then
selfSay('Go, Onix', cid)
doCreateMonster("brock Onix", getCreaturePosition(getNpcId()))
focus = 0
talk_start = 0
elseif (string.find(msg, '(%a*)golem(%a*)') and focus ~= 0) then
selfSay('Go, Golem', cid)
doCreateMonster("brock golem", getCreaturePosition(getNpcId()))
focus = 0
talk_start = 0
elseif (string.find(msg, '(%a*)rhydon(%a*)') and focus ~= 0) then
selfSay('Go, Rhydon', cid)
doCreateMonster("brock rhydon", getCreaturePosition(getNpcId()))
focus = 0
talk_start = 0
elseif (string.find(msg, '(%a*)rhyhorn(%a*)') and focus ~= 0) then
selfSay('Go, Rhyhorn', cid)
doCreateMonster("brock Rhyhorn", getCreaturePosition(getNpcId()))
focus = 0
talk_start = 0
end
end
function onCreatureChangeOutfit(creature)
end
function onThink()
if focus > 0 then
x, y, z = creatureGetPosition(focus)
myx, myy, myz = selfGetPosition()
if ((myy-y==0) and (myx-x<=0 and myx-x>=-4)) then
selfTurn(0)
end
if ((myy-y==0) and (myx-x>=0 and myx-x<=4)) then
selfTurn(2)
end
if ((myx-x==0) and (myy-y<=0 and myy-y>=-4)) then
selfTurn(1)
end
if ((myx-x==0) and (myy-y>=0 and myy-y<=4)) then
selfTurn(3)
end
if ((myy-y==-2) and (myx-x>=-1 and myx-x<=1)) then
selfTurn(1)
end
if ((myy-y==2) and (myx-x>=-1 and myx-x<=1)) then
selfTurn(3)
end
if ((myx-x==2) and (myy-y>=-1 and myy-y<=1)) then
selfTurn(2)
end
if ((myx-x==-2) and (myy-y>=-1 and myy-y<=1)) then
selfTurn(0)
end
if ((myy-y==-3) and (myx-x>=-2 and myx-x<=2)) then
selfTurn(1)
end
if ((myy-y==3) and (myx-x>=-2 and myx-x<=2)) then
selfTurn(3)
end
if ((myx-x==3) and (myy-y>=-2 and myy-y<=2)) then
selfTurn(2)
end
if ((myx-x==-3) and (myy-y>=-2 and myy-y<=2)) then
selfTurn(0)
end
if ((myy-y==-4) and (myx-x>=-3 and myx-x<=3)) then
selfTurn(1)
end
if ((myy-y==4) and (myx-x>=-3 and myx-x<=3)) then
selfTurn(3)
end
if ((myx-x==4) and (myy-y>=-3 and myy-y<=3)) then
selfTurn(2)
end
if ((myx-x==-4) and (myy-y>=-3 and myy-y<=3)) then
selfTurn(0)
end
end
if (os.clock() - talk_start) > 30 then
if focus > 0 then
selfSay('Va embor se vc nao pediu nada!Dexa o otro treinar!Se ja pediu ignore!')
end
focus = 0
end
if focus ~= 0 then
if getDistanceToCreature(focus) > 5 then
selfSay('Tiau!Volte sempre que quiser matar monstros!.')
focus = 0
end
end
end
desse geito o npc brock vai sumonar os pokes quando falar nome dele
tava pensando um geito de fazer melhor quando consiguir passo ae