JU
dúvida

Como fazer para o Monstro/NPC ficar rodando?

Por juliok80, 10 de jan. de 2013 em Scripts

monstro
npc
rodar
4
1.2k
juliok80J
10 de janeiro de 2013 às 12:25

Galera, eu criei algumas quests de addons e para entrar na quest o player passa por uma sala onde existem os monstros vestidos com os addons. Gostaria de saber se é possível fazer o monstro ficar rodando no SQM.

 

Tentei utilizar o lookdir mas não consegui, alguém ai sabe como eu posso fazer isso?

 

lookdir 0 = /\ (para o norte)

lookdir 1 = > (para o leste)

lookdir 2 = \/ (para o sul)

lookdir 3 = < (para o oeste)

 

Queria que ele mudasse de posição a cada 2 segundos.

 

OBS: pode ser com monstro ou NPC, qualquer coisa eu altero os monstros para NPC, pois estes monstros só servem para indicar qual é o addon...

 

Obrigado!

Editado Janeiro 10 por juliok80

OneshotO
11 de janeiro de 2013 às 13:45
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
local think = os.clock()

function onCreatureAppear(cid)
       npcHandler:onCreatureAppear(cid)
end

function onCreatureDisappear(cid)
       npcHandler:onCreatureDisappear(cid)
end

function onCreatureSay(cid, type, msg)
       npcHandler:onCreatureSay(cid, type, msg)
end

function onThink()
       npcHandler:onThink()
       local direction = getCreatureLookDirection(getNpcId())
       if os.clock() > think then
               doCreatureSetLookDirection(getNpcId(), (direction == 3 and 0 or (direction + 1)))
               think = think + 2
       end
end

npcHandler:addModule(FocusModule:new())

juliok80J
11 de janeiro de 2013 às 21:45

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
local think = os.clock()

function onCreatureAppear(cid)
	npcHandler:onCreatureAppear(cid)
end

function onCreatureDisappear(cid)
	npcHandler:onCreatureDisappear(cid)
end

function onCreatureSay(cid, type, msg)
	npcHandler:onCreatureSay(cid, type, msg)
end

function onThink()
	npcHandler:onThink()
	local direction = getCreatureLookDirection(getNpcId())
	if os.clock() > think then
			doCreatureSetLookDirection(getNpcId(), (direction == 3 and 0 or (direction + 1)))
			think = think + 2
	end
end

npcHandler:addModule(FocusModule:new())

 

 

MUITISSIMO OBRIGADO ONESHOT!

 

Você é foda...

 

Te quiero! rolleyes.gif

 

Pode fechar o tópico!

SlicerS
11 de janeiro de 2013 às 22:04

sanado, movido