addOutfitCondition(condition, 0, 857, 0, 0, 0, 0) ????? Isso não existe.
Explica melhor o que é que o npc ira fazer exatamente?
info
Grupo: Campones
Registrado: 02/04/13
Posts: 83
Reputação: +41

addOutfitCondition(condition, 0, 857, 0, 0, 0, 0) ????? Isso não existe.
Explica melhor o que é que o npc ira fazer exatamente?
info
Grupo: Visconde
Registrado: 11/11/08
Posts: 375
Reputação: +369
Gênero: Masculino
Char no Tibia: Sor Jaah

Bom Master, nesse caso é um npc especial para o halloween, eu gostaria que quando o jogador falasse com ele halloween o jogador ganhasse uma entre algumas outfits aleatórias.
info
Grupo: Campones
Registrado: 02/04/13
Posts: 83
Reputação: +41

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.
info
Grupo: Visconde
Registrado: 11/11/08
Posts: 375
Reputação: +369
Gênero: Masculino
Char no Tibia: Sor Jaah

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 Novembro 1 por Animal Pak
info
Grupo: Herói
Registrado: 28/11/10
Posts: 3.4k
Reputação: +585
Gênero: Masculino

info
Grupo: Visconde
Registrado: 11/11/08
Posts: 375
Reputação: +369
Gênero: Masculino
Char no Tibia: Sor Jaah
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