Postado Abril 17, 2015 10 anos Fala galera do TK.. Bom eu estou querendo um script de um npc que quando o player falar hi/boss/yes ele irá ser teletransportado para um certo lugar.E QUE POSSA FAZER SO UMA VEZ EM CADA CHAR ! Grato, desde já. Editado Abril 17, 2015 10 anos por Bagon (veja o histórico de edições) “Enquanto nos derem ao menos 1% de chance, seguiremos lutando. E venceremos! Esse é o verdadeiro e único Clube da Fé! Vai São Paulo!”
Postado Abril 17, 2015 10 anos Em "Data/npc/scripts" copie e cole um arquivo.lua e renomeie para npcboss.lua ( ou o nome desejado ), apague tudo e cole isso: local t = { topos = {x = 160, y = 54, z = 7}, -- Local para onde o NPC enviara o player. storage = 53244 -- Só altere caso essa esteja em uso. } 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 function creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end msg = msg:lower(); local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid if msgcontains(msg, 'boss') then if getPlayerStorageValue(cid, t.storage) <= 0 then selfSay('Tem certeza disso?', cid) talkState[talkUser] = 1 else selfSay('Você já desafiou o boss.', cid) talkState[talkUser] = 0 end elseif msgcontains(msg, 'yes') then if talkState[talkUser] == 1 then selfSay('Boa sorte!', cid) setPlayerStorageValue(cid, t.storage, 1) doTeleportThing(cid, t.topos) end elseif msgcontains(msg, 'no') then if talkState[talkUser] == 1 then selfSay('Ok...', cid) talkState[talkUser] = 0 end end end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Agora em "Data/npc" copie e cole um arquivo.xml, renomeie para npcboss.xml ( ou o nome desejado ), apague tudo e cole isso: <?xml version="1.0" encoding="UTF-8"?> <npc name="Bossing" script="data/npc/scripts/npcboss.lua" walkinterval="2000" floorchange="0"> <health now="100" max="100"/> <look type="138" head="57" body="59" legs="40" feet="76" addons="0"/> <parameters> <parameter key="message_greet" value="Olá |PLAYERNAME|. Deseja desafiar o {boss}?"/> </parameters> </npc> Caso coloque um nome diferente no script .LUA, não esqueça de alterar o diretório no arquivo .XML. ➥ Regras | Seções OTServ | Seções BOT
Postado Abril 17, 2015 10 anos Autor Em "Data/npc/scripts" copie e cole um arquivo.lua e renomeie para npcboss.lua ( ou o nome desejado ), apague tudo e cole isso: local t = { topos = {x = 160, y = 54, z = 7}, -- Local para onde o NPC enviara o player. storage = 53244 -- Só altere caso essa esteja em uso. } 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 function creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end msg = msg:lower(); local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid if msgcontains(msg, 'boss') then if getPlayerStorageValue(cid, t.storage) <= 0 then selfSay('Tem certeza disso?', cid) talkState[talkUser] = 1 else selfSay('Você já desafiou o boss.', cid) talkState[talkUser] = 0 end elseif msgcontains(msg, 'yes') then if talkState[talkUser] == 1 then selfSay('Boa sorte!', cid) setPlayerStorageValue(cid, t.storage, 1) doTeleportThing(cid, t.topos) end elseif msgcontains(msg, 'no') then if talkState[talkUser] == 1 then selfSay('Ok...', cid) talkState[talkUser] = 0 end end end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Agora em "Data/npc" copie e cole um arquivo.xml, renomeie para npcboss.xml ( ou o nome desejado ), apague tudo e cole isso: <?xml version="1.0" encoding="UTF-8"?> <npc name="Bossing" script="data/npc/scripts/npcboss.lua" walkinterval="2000" floorchange="0"> <health now="100" max="100"/> <look type="138" head="57" body="59" legs="40" feet="76" addons="0"/> <parameters> <parameter key="message_greet" value="Olá |PLAYERNAME|. Deseja desafiar o {boss}?"/> </parameters> </npc> Caso coloque um nome diferente no script .LUA, não esqueça de alterar o diretório no arquivo .XML. Outra duvida, vc sabe como adicionar um level para ser teletransportado. Exemplo: (Level 3500 “Enquanto nos derem ao menos 1% de chance, seguiremos lutando. E venceremos! Esse é o verdadeiro e único Clube da Fé! Vai São Paulo!”
Postado Abril 17, 2015 10 anos Testa ai: local t = { topos = {x = 160, y = 54, z = 7}, -- Local para onde o NPC enviara o player. level = 3500, -- Level necessário. storage = 53244 -- Só altere caso essa esteja em uso. } 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 function creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end msg = msg:lower(); local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid if msgcontains(msg, 'boss') then if getPlayerLevel(cid) >= t.level then if getPlayerStorageValue(cid, t.storage) <= 0 then selfSay('Tem certeza disso?', cid) talkState[talkUser] = 1 else selfSay('Você já desafiou o boss.', cid) talkState[talkUser] = 0 end else selfSay('Você precisa de level '..t.level..' para enfrentar o boss.', cid) end elseif msgcontains(msg, 'yes') then if talkState[talkUser] == 1 then selfSay('Boa sorte!', cid) setPlayerStorageValue(cid, t.storage, 1) doTeleportThing(cid, t.topos) end elseif msgcontains(msg, 'no') then if talkState[talkUser] == 1 then selfSay('Ok...', cid) talkState[talkUser] = 0 end end end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) ➥ Regras | Seções OTServ | Seções BOT
Postado Abril 17, 2015 10 anos Autor Testa ai: local t = { topos = {x = 160, y = 54, z = 7}, -- Local para onde o NPC enviara o player. level = 3500, -- Level necessário. storage = 53244 -- Só altere caso essa esteja em uso. } 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 function creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end msg = msg:lower(); local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid if msgcontains(msg, 'boss') then if getPlayerLevel(cid) >= t.level then if getPlayerStorageValue(cid, t.storage) <= 0 then selfSay('Tem certeza disso?', cid) talkState[talkUser] = 1 else selfSay('Você já desafiou o boss.', cid) talkState[talkUser] = 0 end else selfSay('Você precisa de level '..t.level..' para enfrentar o boss.', cid) end elseif msgcontains(msg, 'yes') then if talkState[talkUser] == 1 then selfSay('Boa sorte!', cid) setPlayerStorageValue(cid, t.storage, 1) doTeleportThing(cid, t.topos) end elseif msgcontains(msg, 'no') then if talkState[talkUser] == 1 then selfSay('Ok...', cid) talkState[talkUser] = 0 end end end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) ta dando erro no remeres. :/ “Enquanto nos derem ao menos 1% de chance, seguiremos lutando. E venceremos! Esse é o verdadeiro e único Clube da Fé! Vai São Paulo!”
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.