Postado Setembro 8, 2016 8 anos Boa noite! Gostaria de um script de NPC no qual o NPC teria essa função: Você fala com ele, ele faz uma entrada explicando oque ele faz, ai você responde {pergunta} e te faz uma pergunta e te fala 3 Respostas, mas só uma é a certa. Se você acertar ganha um item X. Exemplo: Spoiler Ola, eu sou professor de Geografia. Irei te fazer pergunta de nivel facil. Responda {pergunta}. A China fica em que continente? {Asia}, {Africa} ou {America} Parabens! Voce acertou por tanto ira ganhar um ponto. ( esse 1 Ponto seria o item X) Desculpe, voce respondeu a errada. Tente novamente. TRABALHOS [iTEM.XML] Ancient Helmt dar HP e Duration: http://www.tibiaking.com/forum/topic/35010-itemxml-helmet-dar-vida-e-duration/ [CreatureScripts] OwNeD ao character morrer: http://www.tibiaking.com/forum/topic/35733-creaturescripta-owned-quando-morrer/
Postado Setembro 10, 2016 8 anos Algo assim? Spoiler 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 npcHandler:setMessage(MESSAGE_GREET, "Ola, eu sou professor de Geografia. Irei te fazer pergunta de nivel facil. Responda {pergunta}.") local xItem = 2392 -- fire sword function creatureSayCallback(cid, type, msg) if not npcHandler:isFocused(cid) then return false end local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid if msgcontains(msg, "pergunta") then selfSay("A China fica em que continente? {Asia}, {Africa} ou {America}", cid) talkState[talkUser] = 1 elseif msgcontains(msg, "Asia") and talkState[talkUser] == 1 then selfSay("Parabens! Voce acertou por tanto ira ganhar um item.", cid) doPlayerAddItem(cid, xItem) talkState[talkUser] = 0 elseif msgcontains(msg, "Africa") and talkState[talkUser] == 1 then selfSay("Desculpe, voce respondeu a errada. Tente novamente.", cid) talkState[talkUser] = 0 elseif msgcontains(msg, "America") and talkState[talkUser] == 1 then selfSay("Desculpe, voce respondeu a errada. Tente novamente.", cid) talkState[talkUser] = 0 end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
Postado Setembro 11, 2016 8 anos Autor @Zanrix PERFEITO! Tem como colocar que só da para falar 1x? Pois se o player quiser ele vai ficar falando para sempre e pegando item. TRABALHOS [iTEM.XML] Ancient Helmt dar HP e Duration: http://www.tibiaking.com/forum/topic/35010-itemxml-helmet-dar-vida-e-duration/ [CreatureScripts] OwNeD ao character morrer: http://www.tibiaking.com/forum/topic/35733-creaturescripta-owned-quando-morrer/
Postado Setembro 11, 2016 8 anos Não entendi se ele pode ficar perguntando até acertar ou se ele errar uma vez perde a chance, mas está aqui os dois jeitos: Pode tentar até acertar: Spoiler 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 npcHandler:setMessage(MESSAGE_GREET, "Ola, eu sou professor de Geografia. Irei te fazer pergunta de nivel facil. Responda {pergunta}.") local storage = 55300 -- storage pra saber se já pegou o item ou não local xItem = 2392 -- fire sword function creatureSayCallback(cid, type, msg) if not npcHandler:isFocused(cid) then return false end local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid if msgcontains(msg, "pergunta") then if getPlayerStorageValue(cid, storage) == -1 then selfSay("A China fica em que continente? {Asia}, {Africa} ou {America}", cid) talkState[talkUser] = 1 else selfSay("Voce ja respondeu a essa pergunta.", cid) end elseif msgcontains(msg, "Asia") and talkState[talkUser] == 1 then selfSay("Parabens! Voce acertou por tanto ira ganhar um item.", cid) doPlayerAddItem(cid, xItem) setPlayerStorageValue(cid, storage, 1) talkState[talkUser] = 0 elseif msgcontains(msg, "Africa") and talkState[talkUser] == 1 then selfSay("Desculpe, voce respondeu a errada. Tente novamente.", cid) talkState[talkUser] = 0 elseif msgcontains(msg, "America") and talkState[talkUser] == 1 then selfSay("Desculpe, voce respondeu a errada. Tente novamente.", cid) talkState[talkUser] = 0 end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Só uma chance de responder: Spoiler 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 npcHandler:setMessage(MESSAGE_GREET, "Ola, eu sou professor de Geografia. Irei te fazer pergunta de nivel facil. Responda {pergunta}.") local storage = 55300 -- storage pra saber se já pegou o item ou não local xItem = 2392 -- fire sword function creatureSayCallback(cid, type, msg) if not npcHandler:isFocused(cid) then return false end local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid if msgcontains(msg, "pergunta") then if getPlayerStorageValue(cid, storage) == -1 then selfSay("A China fica em que continente? {Asia}, {Africa} ou {America}", cid) talkState[talkUser] = 1 else selfSay("Voce ja respondeu a essa pergunta.", cid) end elseif msgcontains(msg, "Asia") and talkState[talkUser] == 1 then selfSay("Parabens! Voce acertou por tanto ira ganhar um item.", cid) doPlayerAddItem(cid, xItem) setPlayerStorageValue(cid, storage, 1) talkState[talkUser] = 0 elseif msgcontains(msg, "Africa") and talkState[talkUser] == 1 then selfSay("Desculpe, voce respondeu a errada. Tente novamente.", cid) setPlayerStorageValue(cid, storage, 1) talkState[talkUser] = 0 elseif msgcontains(msg, "America") and talkState[talkUser] == 1 then selfSay("Desculpe, voce respondeu a errada. Tente novamente.", cid) setPlayerStorageValue(cid, storage, 1) talkState[talkUser] = 0 end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
Postado Setembro 12, 2016 8 anos Autor O 1 jeito hahaha, vlw mesmo! REP+ TRABALHOS [iTEM.XML] Ancient Helmt dar HP e Duration: http://www.tibiaking.com/forum/topic/35010-itemxml-helmet-dar-vida-e-duration/ [CreatureScripts] OwNeD ao character morrer: http://www.tibiaking.com/forum/topic/35733-creaturescripta-owned-quando-morrer/
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.