Ir para conteúdo

Tabela de Classificação


Conteúdo Mais Visto

Exibindo conteúdo com a maior reputação em 5em todas áreas

  1. 1 ponto
    Anderkrox

    [NPC] RPG - Royal Fufu

    Tu já pensou em criar um NPC com inteligencia artificial?[/size] Eu pensei, e criei![/size] Este NPC que eu criei vai andar até determinado local e voltar.[/size] Também irá falar frases divertidas automaticamente.[/size] Na rota que o NPC fará, ele irá parar em uma caixa e irá "abri-la".[/size] O script ficou consideravelmente grande, porque não tenho muitas habilidades nesta área, mas estou partilhando para melhorias.[/size] No mapa do meu servidor, o NPC anda entre dois pontos que eu determinei. Em cada ponto terá uma caixa... ele irá olhar para uma e ira "abrir", depois de um tempo ele andará novamente até a outra caixa e irá "abrir". Como se estivesse levando produtos de uma caixa para a outra. Em fim, o script está funcionando 100%.[/size] Eu uso no meu servidor, e estou partilhando para melhorias no mesmo![/size] No npc.lua poste este código:[/size] -- [[ Feito por Anderson (BomBa)]] waypoint_royalFufu = 971714008 local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local msgs = { "Que meus inimigos sejam fortes e bravos para que eu nao sinta remorsos ao derrota-los", "Voce deve se fazer uma pergunta: 'Estou com sorte?", "Nunca se ouviu dizer que filho valente tivera nascido de pai temeroso.", "Nunca comece uma briga, mas sempre a termine.", "Eu me pergunto qual seria melhor, ser temido ou respeitado? Seria de mais pedir os dois. ", } 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 local function greet(cid) return false end function onThink() local pos = getCreaturePosition(getNpcCid()) -- indo if getGlobalStorageValue(waypoint_royalFufu) <= 0 then doTeleportThing(getNpcCid(), {x=1011, y=1357, z=6}, true) setGlobalStorageValue(waypoint_royalFufu, 1) elseif getGlobalStorageValue(waypoint_royalFufu) == 1 then doTeleportThing(getNpcCid(), {x=1010, y=1357, z=6}, true) setGlobalStorageValue(waypoint_royalFufu, 2) elseif getGlobalStorageValue(waypoint_royalFufu) == 2 then doTeleportThing(getNpcCid(), {x=1009, y=1357, z=6}, true) setGlobalStorageValue(waypoint_royalFufu, 3) elseif getGlobalStorageValue(waypoint_royalFufu) == 3 then doTeleportThing(getNpcCid(), {x=1008, y=1357, z=6}, true) setGlobalStorageValue(waypoint_royalFufu, 4) elseif getGlobalStorageValue(waypoint_royalFufu) == 4 then doTeleportThing(getNpcCid(), {x=1007, y=1357, z=6}, true) setGlobalStorageValue(waypoint_royalFufu, 5) elseif getGlobalStorageValue(waypoint_royalFufu) == 5 then doTeleportThing(getNpcCid(), {x=1006, y=1357, z=6}, true) setGlobalStorageValue(waypoint_royalFufu, 6) elseif getGlobalStorageValue(waypoint_royalFufu) == 6 then doTeleportThing(getNpcCid(), {x=1005, y=1357, z=6}, true) setGlobalStorageValue(waypoint_royalFufu, 7) elseif getGlobalStorageValue(waypoint_royalFufu) == 7 then doTeleportThing(getNpcCid(), {x=1005, y=1358, z=6}, true) setGlobalStorageValue(waypoint_royalFufu, 8) elseif getGlobalStorageValue(waypoint_royalFufu) == 8 then doTeleportThing(getNpcCid(), {x=1005, y=1360, z=7}, true) setGlobalStorageValue(waypoint_royalFufu, 9) elseif getGlobalStorageValue(waypoint_royalFufu) == 9 then doTeleportThing(getNpcCid(), {x=1005, y=1361, z=7}, true) setGlobalStorageValue(waypoint_royalFufu, 10) elseif getGlobalStorageValue(waypoint_royalFufu) == 10 then doTeleportThing(getNpcCid(), {x=1005, y=1362, z=7}, true) setGlobalStorageValue(waypoint_royalFufu, 11) elseif getGlobalStorageValue(waypoint_royalFufu) == 11 then doTeleportThing(getNpcCid(), {x=1005, y=1363, z=7}, true) setGlobalStorageValue(waypoint_royalFufu, 12) elseif getGlobalStorageValue(waypoint_royalFufu) == 12 then doTeleportThing(getNpcCid(), {x=1005, y=1364, z=7}, true) setGlobalStorageValue(waypoint_royalFufu, 13) elseif getGlobalStorageValue(waypoint_royalFufu) == 13 then doTeleportThing(getNpcCid(), {x=1005, y=1365, z=7}, true) setGlobalStorageValue(waypoint_royalFufu, 14) elseif getGlobalStorageValue(waypoint_royalFufu) == 14 then doTeleportThing(getNpcCid(), {x=1005, y=1366, z=7}, true) setGlobalStorageValue(waypoint_royalFufu, 15) elseif getGlobalStorageValue(waypoint_royalFufu) == 15 then doTeleportThing(getNpcCid(), {x=1005, y=1367, z=7}, true) setGlobalStorageValue(waypoint_royalFufu, 16) elseif getGlobalStorageValue(waypoint_royalFufu) == 16 then doTeleportThing(getNpcCid(), {x=1006, y=1367, z=7}, true) setGlobalStorageValue(waypoint_royalFufu, 17) elseif getGlobalStorageValue(waypoint_royalFufu) == 17 then doTeleportThing(getNpcCid(), {x=1007, y=1367, z=7}, true) setGlobalStorageValue(waypoint_royalFufu, 18) elseif getGlobalStorageValue(waypoint_royalFufu) == 18 then doTeleportThing(getNpcCid(), {x=1008, y=1367, z=7}, true) setGlobalStorageValue(waypoint_royalFufu, 19) elseif getGlobalStorageValue(waypoint_royalFufu) == 19 then doTeleportThing(getNpcCid(), {x=1008, y=1366, z=7}, true) setGlobalStorageValue(waypoint_royalFufu, 20) elseif getGlobalStorageValue(waypoint_royalFufu) == 20 then doTeleportThing(getNpcCid(), {x=1008, y=1365, z=7}, true) setGlobalStorageValue(waypoint_royalFufu, 21) elseif getGlobalStorageValue(waypoint_royalFufu) == 21 then doTeleportThing(getNpcCid(), {x=1008, y=1364, z=7}, true) setGlobalStorageValue(waypoint_royalFufu, 22) elseif getGlobalStorageValue(waypoint_royalFufu) == 22 then doTeleportThing(getNpcCid(), {x=1008, y=1363, z=7}, true) doCreatureSetLookDir(getNpcCid(), WEST) addEvent(setGlobalStorageValue, 20000, waypoint_royalFufu, 23) -- voltando elseif getGlobalStorageValue(waypoint_royalFufu) == 23 then doTeleportThing(getNpcCid(), {x=1008, y=1364, z=7}, true) setGlobalStorageValue(waypoint_royalFufu, 24) elseif getGlobalStorageValue(waypoint_royalFufu) == 24 then doTeleportThing(getNpcCid(), {x=1008, y=1365, z=7}, true) setGlobalStorageValue(waypoint_royalFufu, 25) elseif getGlobalStorageValue(waypoint_royalFufu) == 25 then doTeleportThing(getNpcCid(), {x=1008, y=1366, z=7}, true) setGlobalStorageValue(waypoint_royalFufu, 26) elseif getGlobalStorageValue(waypoint_royalFufu) == 26 then doTeleportThing(getNpcCid(), {x=1008, y=1367, z=7}, true) setGlobalStorageValue(waypoint_royalFufu, 27) elseif getGlobalStorageValue(waypoint_royalFufu) == 27 then doTeleportThing(getNpcCid(), {x=1007, y=1367, z=7}, true) setGlobalStorageValue(waypoint_royalFufu, 28) elseif getGlobalStorageValue(waypoint_royalFufu) == 28 then doTeleportThing(getNpcCid(), {x=1006, y=1367, z=7}, true) setGlobalStorageValue(waypoint_royalFufu, 29) elseif getGlobalStorageValue(waypoint_royalFufu) == 29 then doTeleportThing(getNpcCid(), {x=1005, y=1367, z=7}, true) setGlobalStorageValue(waypoint_royalFufu, 30) elseif getGlobalStorageValue(waypoint_royalFufu) == 30 then doTeleportThing(getNpcCid(), {x=1005, y=1366, z=7}, true) setGlobalStorageValue(waypoint_royalFufu, 31) elseif getGlobalStorageValue(waypoint_royalFufu) == 31 then doTeleportThing(getNpcCid(), {x=1005, y=1365, z=7}, true) setGlobalStorageValue(waypoint_royalFufu, 32) elseif getGlobalStorageValue(waypoint_royalFufu) == 32 then doTeleportThing(getNpcCid(), {x=1005, y=1364, z=7}, true) setGlobalStorageValue(waypoint_royalFufu, 33) elseif getGlobalStorageValue(waypoint_royalFufu) == 33 then doTeleportThing(getNpcCid(), {x=1005, y=1363, z=7}, true) setGlobalStorageValue(waypoint_royalFufu, 34) elseif getGlobalStorageValue(waypoint_royalFufu) == 34 then doTeleportThing(getNpcCid(), {x=1005, y=1362, z=7}, true) setGlobalStorageValue(waypoint_royalFufu, 35) elseif getGlobalStorageValue(waypoint_royalFufu) == 35 then doTeleportThing(getNpcCid(), {x=1005, y=1361, z=7}, true) setGlobalStorageValue(waypoint_royalFufu, 36) elseif getGlobalStorageValue(waypoint_royalFufu) == 36 then doTeleportThing(getNpcCid(), {x=1005, y=1360, z=7}, true) setGlobalStorageValue(waypoint_royalFufu, 37) elseif getGlobalStorageValue(waypoint_royalFufu) == 37 then doTeleportThing(getNpcCid(), {x=1005, y=1358, z=6}, true) setGlobalStorageValue(waypoint_royalFufu, 38) elseif getGlobalStorageValue(waypoint_royalFufu) == 38 then doTeleportThing(getNpcCid(), {x=1006, y=1358, z=6}, true) setGlobalStorageValue(waypoint_royalFufu, 39) elseif getGlobalStorageValue(waypoint_royalFufu) == 39 then doTeleportThing(getNpcCid(), {x=1007, y=1358, z=6}, true) setGlobalStorageValue(waypoint_royalFufu, 40) elseif getGlobalStorageValue(waypoint_royalFufu) == 40 then doTeleportThing(getNpcCid(), {x=1008, y=1358, z=6}, true) setGlobalStorageValue(waypoint_royalFufu, 41) elseif getGlobalStorageValue(waypoint_royalFufu) == 41 then doTeleportThing(getNpcCid(), {x=1009, y=1358, z=6}, true) setGlobalStorageValue(waypoint_royalFufu, 42) elseif getGlobalStorageValue(waypoint_royalFufu) == 42 then doTeleportThing(getNpcCid(), {x=1010, y=1357, z=6}, true) doCreatureSetLookDir(getNpcCid(), SOUTH) addEvent(setGlobalStorageValue, 20000, waypoint_royalFufu, 0) end -- falas local falarA = math.random(1, 100000) if falarA <= 500 then doCreatureSay(getNpcCid(), msgs[math.random(#msgs)], TALKTYPE_SAY) end return true end npcHandler:addModule(FocusModule:new()) npcHandler:setCallback(CALLBACK_GREET, greet) E em globalevents, procure por 'init.lua', então adicione esta linha: setGlobalStorageValue(waypoint_royalFufu, 0) https://www.youtube.com/watch?v=PwXeV-Nctig
Esta tabela de classificação está definida como São Paulo/GMT-03:00
×