Ir para conteúdo

[Encerrado] NPC HALLOWEEN TFS 0.4


Animal Pak

Posts Recomendados

Boa tarde, alguém conseguiria fazer esse npc funcionar no tfs 0.4:

local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN)

local condition = createConditionObject(CONDITION_OUTFIT)
setConditionParam(condition, CONDITION_PARAM_TICKS, 3 * 24 * 3600 * 1000) -- here time in miliseconds, default 3 days
addOutfitCondition(condition, 0, 857, 0, 0, 0, 0)
addOutfitCondition(condition, 0, 853, 0, 0, 0, 0)
addOutfitCondition(condition, 0, 852, 0, 0, 0, 0)
addOutfitCondition(condition, 0, 851, 0, 0, 0, 0)
addOutfitCondition(condition, 0, 843, 0, 0, 0, 0)
addOutfitCondition(condition, 0, 837, 0, 0, 0, 0)
addOutfitCondition(condition, 0, 833, 0, 0, 0, 0)
addOutfitCondition(condition, 0, 785, 0, 0, 0, 0)
addOutfitCondition(condition, 0, 720, 0, 0, 0, 0)
addOutfitCondition(condition, 0, 659, 0, 0, 0, 0)
addOutfitCondition(condition, 0, 597, 0, 0, 0, 0)
addOutfitCondition(condition, 0, 549, 0, 0, 0, 0)
addOutfitCondition(condition, 0, 544, 0, 0, 0, 0)
addOutfitCondition(condition, 0, 523, 0, 0, 0, 0)
addOutfitCondition(condition, 0, 510, 0, 0, 0, 0)
addOutfitCondition(condition, 0, 878, 0, 0, 0, 0)
addOutfitCondition(condition, 0, 877, 0, 0, 0, 0)
addOutfitCondition(condition, 0, 890, 0, 0, 0, 0)
setCombatCondition(combat, condition)

local area = createCombatArea( { {1,1,1,1,1}, {1,1,1,1,1}, {1,1,3,1,1}, {1,1,1,1,1}, {1,1,1,1,1} } )
setCombatArea(combat, area)

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

-- OTServ event handling functions start
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() end
-- OTServ event handling functions end
npcHandler:setMessage(MESSAGE_GREET, "Hello |PLAYERNAME|. Say halloween.")

function halloweenNPC(cid, message, keywords, parameters, node)
doCombat(getNpcCid(), combat, numberToVariant(getNpcCid()))
npcHandler:say('You are Dead, Suprise!', cid)
return true
end
keywordHandler:addKeyword({'halloween'}, halloweenNPC, {})
npcHandler:addModule(FocusModule:new())

OBS: NÃO CONSIGO CRIAR TÓPICO NA ÁREA CORRETA SUPORTE DE SCRIPTING!

 


@up

Link para o comentário
Compartilhar em outros sites

 

 

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
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() end

npcHandler:setMessage(MESSAGE_GREET, "Hello |PLAYERNAME|. Say {halloween}.")

local outfits = {857,853,852,851,843,837,833,785,720,659,597,549,544,523,510,878,877,890}
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN)

function onTargetCreature(cid, target)
	doSetCreatureOutfit(target, math.random(#outfits), 3 * 24 * 3600 * 1000)
end
setCombatCallBack(combat, CALLBACK_PARAM_TARGETCREATURE, "onTargetCreature")

setCombatArea(combat, createCombatArea({
	{1,1,1,1,1},
	{1,1,1,1,1},
	{1,1,3,1,1},
	{1,1,1,1,1},
	{1,1,1,1,1}
}))

function creatureSayCallback(cid, type, msg)
	local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
	if(not npcHandler:isFocused(cid)) then
		return false
	end
	
	if(msg:lower() == "halloween") then
		doCombat(getNpcId(), combat, positionToVariant(getThingPos(getNpcId())))
		npcHandler:say('You are Dead, Suprise!', talkUser)
	end
	return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

 

 

 

Não testado.

Link para o comentário
Compartilhar em outros sites

 

 

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
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() end

npcHandler:setMessage(MESSAGE_GREET, "Hello |PLAYERNAME|. Say {halloween}.")

local outfits = {857,853,852,851,843,837,833,785,720,659,597,549,544,523,510,878,877,890}
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN)

function onTargetCreature(cid, target)
	doSetCreatureOutfit(target, math.random(#outfits), 3 * 24 * 3600 * 1000)
end
setCombatCallBack(combat, CALLBACK_PARAM_TARGETCREATURE, "onTargetCreature")

setCombatArea(combat, createCombatArea({
	{1,1,1,1,1},
	{1,1,1,1,1},
	{1,1,3,1,1},
	{1,1,1,1,1},
	{1,1,1,1,1}
}))

function creatureSayCallback(cid, type, msg)
	local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
	if(not npcHandler:isFocused(cid)) then
		return false
	end
	
	if(msg:lower() == "halloween") then
		doCombat(getNpcId(), combat, positionToVariant(getThingPos(getNpcId())))
		npcHandler:say('You are Dead, Suprise!', talkUser)
	end
	return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

 

 

 

Não testado.

 

Obrigado, mais deu erro na linha 18 SetCombatCallBack a nill value

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

  • 2 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.
  • Quem Está Navegando   0 membros estão online

    • Nenhum usuário registrado visualizando esta página.
×
×
  • Criar Novo...