- Fórum
- OTServ
- Recursos
- Scripting
- NPCs, monsters e raids
- NPC (Você precisa de uma storage para falar com ele)
LU
npc
NPC (Você precisa de uma storage para falar com ele)
Por LuckinhaSan, 07 de mai. de 2013 em NPCs, monsters e raids
script
1
971
Por LuckinhaSan, 07 de mai. de 2013 em NPCs, monsters e raids
info
Grupo: Conde
Registrado: 03/09/11
Posts: 703
Reputação: +191
Gênero: Masculino
Char no Tibia: Mirade
O título já diz.
Script -
local keywordHandler = KeywordHandler:new()local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} 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 local storage = 1234 function creatureSayCallback(cid, type, msg) if (msgcontains(msg, "hi") or msgcontains(msg, "hello")) and (not npcHandler:isFocused(cid)) then if getPlayerStorageValue(cid, storage) < 1 then npcHandler:say("How can I help you " .. getPlayerName(cid) .. "?", cid, TRUE) npcHandler:releaseFocus(cid) setPlayerStorageValue(cid, storage, 1) doPlayerAddMoney(cid, math.ceil(math.random(500, 5000))) elseif getPlayerStorageValue(cid, storage) == 1 then npcHandler:say("I got no time. Bye!", cid, TRUE) npcHandler:releaseFocus(cid) end elseif (not npcHandler:isFocused(cid)) then return false end return true end npcHandler:setCallback(CALLBACK_FAREWELL, creatureFarewell) npcHandler:setMessage(MESSAGE_WALKAWAY, "Good bye then.") npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)Pegue um arquivo qualquer de um npc em .xml para colocar na pasta NPC.
Créditos - StreamSide