Postado Abril 19, 2022 3 anos .Qual servidor ou website você utiliza como base? TFS 0.4 860 Qual o motivo deste tópico? Gostaria de pedir um script de NPC de 3 etepas que funcionará da seguinte forma: Player entra na sala e fala, hi training 1, NPC vai teletransportar ele pra primeira era, ele percorre, vai até o final, pega o storage e volta no portal. Fala com NPC novamente, hi, training 2, NPC teletranspota ele para a segunda área, e mesma coisa, vai ate o final pega storage e volta no portal. E por fim a terceira vez, mesma coisa. Então vem o seguinte, caso o playerr morra, ele volta e vai continuar do ultimo storage, ja q ele por exemplo morreu na parte 3, o npc checa, storage 1 ok, 2 ok, 3 ainda nao tem, e manda para a area onde vai pegar o storage 3, Pegando storage 3 ele vai ser mandado para o final boss da quest, onde ao matar, vai ganhar o storage 4, se ele morrer nessa parte, e voltar no NPC ele vai entender q nao tem o storage 4 e vai mandar pra enfrentar o final boss novamente. Em resumo, NPC checa storage 1,se falso {nao tem o storage} executa, se verdadeiro, passa pra o proximo checa storage 1, se verdadeiro joga na area 2 onde o jogador pegara storage 2 checa storage 2 storage 2, se verdadeiro executa, joga na area 3 onde jogador pegará storage 3 checa storage 3, se verdadeiro executa, joga na area do final boss, Imagino que não seja necessário o NPC setar nenhum storage, ja que o jogador vai pegar o storage na área clicando num local. Eu poderia fazer isso com um NPC de saga, porem teria que fazer 3 npcs, e tres areas iguais, pra dar a sensação de ele voltar sempre para o mesmo lugar. no entanto se ele morrer, vai ficar bugado, pq ele vai ter que passar pelas areas anteriores, como ele ja passou, npc nao vai transportar ele. Dai se alguem conseguir fazer dessa forma que citei acima, ficaria muito grato. Editado Abril 19, 2022 3 anos por underpunk (veja o histórico de edições)
Postado Abril 21, 2022 3 anos @underpunk Boa tarde, seria isso? npc.xml <?xml version="1.0" encoding="UTF-8"?> <npc name="Stages" script="data/npc/scripts/stages.lua" walkinterval="2000" floorchange="0"> <health now="100" max="100"/> <look type="134" head="78" body="88" legs="0" feet="88" addons="3"/> </npc> data/npcs/scripts loadmodlib('npc_stages_config') local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} local stage = nil 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 local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid if (getPlayerStorageValue(cid, storage) == (#stages + 1)) then selfSay('Voce ja completou todos os estagios', cid) return end for storage, data in pairs(stages) do if (msg == data.msg) then data.storage = storage stage = data selfSay('Voce deseja ir para o ' ..data.msg.. ' ?', cid) talkState[talkUser] = 1 return end end if(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then if (getPlayerStorageValue(cid, storage) <= 0) then setPlayerStorageValue(cid, storage, 1) end if (getPlayerStorageValue(cid, storage) == stage.storage) then doTeleportThing(cid, stage.teleport) else selfSay('Voce nao tem permissao para ir no ' ..stage.msg, cid) end stage = nil talkState[talkUser] = 0 end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) criar um arquivo chamado npc_stages_config.lua na pasta LIB e adicionar isso nele, aqui ficará toda a configuração dos estágios caso você queira adicionar mais de 3 storage = 12000 bossName = "Demon" -- Seguir na sequencia entre cochetes 1, 2, 3, 4 ... stages = { [1] = { msg = 'training 1', teleport = { x=156,y=49,z=8 } }, [2] = { msg = 'training 2', teleport = { x=156,y=54,z=9 } }, [3] = { msg = 'training 3', teleport = { x=141,y=61,z=6 } } --[4] = { msg = 'training 4', teleport = { x=0,y=0,z=0 } } } data/actions/scripts loadmodlib('npc_stages_config') function onUse(cid, item, fromPosition, itemEx, toPosition) setPlayerStorageValue(cid, storage, getPlayerStorageValue(cid, storage) + 1) return true end actions.xml <action actionid="13000" script="stages.lua"/> data/creaturescripts/scripts loadmodlib('npc_stages_config') function onKill(cid, target) local monsterName = getCreatureName(target) if (string.lower(monsterName) == string.lower(bossName)) then setPlayerStorageValue(cid, storage, (#stages + 1)) end return true end creaturescripts.xml <event type="kill" name="BossStages" event="script" value="stages.lua"/> data/creaturescripts/scripts/login.lua registerCreatureEvent(cid, "BossStages")
Postado Abril 21, 2022 3 anos Autor valeu vou testar, eu tinha feito uma gambiarra com portais. bom, nao era exatamente assim, as alavancas seriam mais pra dar o storage pra poder ir pra proxima parte pq o npc iria checar o storage anterior, no caso eu posso por o storage no proprio mob, "como e fiz nos portais, mato o mob e o script ja me da o storage, pq em cada caminho, vai ter um tipo de monstro, mas gostei desse script, da pra usar em outras quests, e talvez ate sem precisar da action, dando o storage no proprio mob Editado Abril 21, 2022 3 anos por underpunk (veja o histórico de edições)
Postado Abril 22, 2022 3 anos @underpunk Npc Training 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 function creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid local era1 = {x=111, y=111, z=1} local era2 = {x=111, y=111, z=1} local era3 = {x=111, y=111, z=1} local boss = {x=111, y=111, z=1} local storage = 111 function Training(cid) if getPlayerStorageValue(cid,storage) == -1 then selfSay("FRASE SE QUISER ALGUMA", cid) doTeleportThing(cid,era1) talkState[talkUser] = 0 return false end if getPlayerStorageValue(cid,storage) == 1 then selfSay("FRASE SE QUISER ALGUMA", cid) doTeleportThing(cid,era1) talkState[talkUser] = 0 return false end if getPlayerStorageValue(cid,storage) == 2 then selfSay("FRASE SE QUISER ALGUMA", cid) doTeleportThing(cid,era3) talkState[talkUser] = 0 return false end if getPlayerStorageValue(cid,storage) == 3 then selfSay("FRASE SE QUISER ALGUMA", cid) doTeleportThing(cid,boss) talkState[talkUser] = 0 return false end end if getPlayerLevel(cid) < 1 then selfSay("") talkState[talkUser] = 0 elseif (msgcontains(msg, 'training') or msgcontains(msg, 'Training')) then selfSay("Entao vamos? ({yes})", cid) talkState[talkUser] = 1 elseif (msgcontains(msg, 'yes') and talkState[talkUser] == 1) then if Training(cid) then elseif msg == "no" and talkState[talkUser] >= 1 then selfSay("Adeus!!", cid) talkState[talkUser] = 0 npcHandler:releaseFocus(cid) end return TRUE end end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Alavanca1 Spoiler function onUse(cid, item, fromPosition, itemEx, toPosition) if getPlayerLevel(cid) < 1 then setPlayerStorageValue(cid, 111, 1) doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT) end return true end Alavanca2 Spoiler function onUse(cid, item, fromPosition, itemEx, toPosition) if getPlayerLevel(cid) < 1 then setPlayerStorageValue(cid, 111, 2) doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT) end return true end Alavanca 3 Spoiler function onUse(cid, item, fromPosition, itemEx, toPosition) if getPlayerLevel(cid) < 1 then setPlayerStorageValue(cid, 111, 3) doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT) end return true end Bem Pelo Que Entendi Hi, Training, Yes Teleportado Para Era 1 Clicou Na Alavanca E Voltou Hi, Training, Yes Teleportado Para Era 2 Clicou Na Alavanca E Voltou Hi, Training, Yes Teleportado Para Era 3 Clicou Na Ultima Alavanca. Hi, Training, Yes Teleportado Para Sala Do Boss -- Não Testei Ve Ai Se Funciona Editado Abril 24, 2022 3 anos por Thony D. Serv (veja o histórico de edições)
Postado Abril 24, 2022 3 anos Autor Em 22/04/2022 em 10:50, Thony D. Serv disse: @underpunk Npc Training Mostrar conteúdo oculto 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 local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid local era1 = {x=111, y=111, z=1} local era2 = {x=111, y=111, z=1} local era3 = {x=111, y=111, z=1} local boss = {x=111, y=111, z=1} local storage = 111 function Training(cid) if getPlayerStorageValue(cid,storage) == -1 then selfSay("FRASE SE QUISER ALGUMA", cid) doTeleportThing(cid,era1) talkState[talkUser] = 0 return false end if getPlayerStorageValue(cid,storage) == 1 then selfSay("FRASE SE QUISER ALGUMA", cid) doTeleportThing(cid,era1) talkState[talkUser] = 0 return false end if getPlayerStorageValue(cid,storage) == 2 then selfSay("FRASE SE QUISER ALGUMA", cid) doTeleportThing(cid,era3) talkState[talkUser] = 0 return false end if getPlayerStorageValue(cid,storage) == 3 then selfSay("FRASE SE QUISER ALGUMA", cid) doTeleportThing(cid,boss) talkState[talkUser] = 0 return false end end if getPlayerLevel(cid) < 1 then selfSay("") talkState[talkUser] = 0 elseif (msgcontains(msg, 'training') or msgcontains(msg, 'Training')) then selfSay("Entao vamos? ({yes})", cid) talkState[talkUser] = 1 elseif (msgcontains(msg, 'yes') and talkState[talkUser] == 1) then if Training(cid) then elseif msg == "no" and talkState[talkUser] >= 1 then selfSay("Adeus!!", cid) talkState[talkUser] = 0 npcHandler:releaseFocus(cid) end return TRUE end end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Alavanca1 Mostrar conteúdo oculto function onUse(cid, item, fromPosition, itemEx, toPosition) if getPlayerLevel(cid) < 1 then setPlayerStorageValue(cid, 111, 1) doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT) end return true end Alavanca2 Mostrar conteúdo oculto function onUse(cid, item, fromPosition, itemEx, toPosition) if getPlayerLevel(cid) < 1 then setPlayerStorageValue(cid, 111, 2) doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT) end return true end Alavanca 3 Mostrar conteúdo oculto function onUse(cid, item, fromPosition, itemEx, toPosition) if getPlayerLevel(cid) < 1 then setPlayerStorageValue(cid, 111, 3) doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT) end return true end Bem Pelo Que Entendi Hi, Training, Yes Teleportado Para Era 1 Clicou Na Alavanca E Voltou Hi, Training, Yes Teleportado Para Era 2 Clicou Na Alavanca E Voltou Hi, Training, Yes Teleportado Para Era 3 Clicou Na Ultima Alavanca. Hi, Training, Yes Teleportado Para Sala Do Boss -- Não Testei Ve Ai Se Funciona interessante, bom o anterior, ao usar a action nao funcionou, nao sei pq, dai eu armenguei e funcionou como eu queria, botei um script no monstro que dava o storage quando eu matava, entao o NPC dava o storage value 1, o monstro 1 storage 2, o monstro 2 storage 3, e o monstro 3 storage 4, assim fechando o ciclo, botei um step in com storage XXX <= 3, assim so me permitindo entrar com storage value 4. vou testar este seu. EDIT - O script fucionou direitinho, mas nao usei alavanca, estou usando o script no monstro, Editado Abril 24, 2022 3 anos por underpunk (veja o histórico de edições)
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.