Postado Julho 22, 2019 5 anos Boa tarde, alguém poderia me dizer onde eu consigo o evento dice automático?
Postado Julho 22, 2019 5 anos Este tópico foi movido para a área correta. Esta é uma mensagem automática!Pedimos que leia as regras do fórum! Spoiler This topic has been moved to the correct area. This is an automated message!Please read the forum rules. Projeto ATS (Naruto)Informações AbaixoFacebookYoutubeDiscord Tutoriais / ConteúdosClique Aqui
Postado Julho 23, 2019 5 anos @baiakpro Data/Npc/NpcDice.xml <?xml version="1.0" encoding="UTF-8"?> <npc name="[EVENT] Dice Event" script="data/npc/scripts/DiceScript.lua" walkinterval="0" floorchange="0"> <health now="100" max="100"/> <look type="289" head="114" body="114" legs="91" feet="91" addons="3"/> </npc> Data/Npc/Scripts/DiceScript.lua local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} local x = 0 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 randomDice = { [1] = 5792, [2] = 5793, [3] = 5794, [4] = 5795, [5] = 5796, [6] = 5797 } ----------------Config----------------------| local player_teleport = {x=160,y=54,z=7} -- Posicao para onde o player vai ser teleportado quando perder local rewards = { -- Id dos premios caso o player ganhe 2160, } --------------------------------------------| function creatureSayCallback(cid, type, msg) npcPos = getNpcPos() positionNpc = { NORTH = {x=npcPos.x, y=npcPos.y-2, z=npcPos.z, stackpos = STACKPOS_TOP_CREATURE}, SOUTH = {x=npcPos.x, y=npcPos.y+2, z=npcPos.z, stackpos = STACKPOS_TOP_CREATURE}, WEST = {x=npcPos.x-2, y=npcPos.y, z=npcPos.z, stackpos = STACKPOS_TOP_CREATURE}, EAST = {x=npcPos.x+2, y=npcPos.y, z=npcPos.z, stackpos = STACKPOS_TOP_CREATURE}, } local npc = getNpcCid() local dice_pos = {x=npcPos.x+1,y=npcPos.y,z=npcPos.z, stackpos=1} if getTileThingByPos(dice_pos).itemid == 0 then doCreateItem(5792, dice_pos) end if getThingFromPos(positionNpc.NORTH).uid ~= 0 or getThingFromPos(positionNpc.SOUTH).uid ~= 0 or getThingFromPos(positionNpc.WEST).uid ~= 0 or getThingFromPos(positionNpc.EAST).uid ~= 0 then if msgcontains(msg, '1') or msgcontains(msg, '2') or msgcontains(msg, '3') or msgcontains(msg, '4') or msgcontains(msg, '5') or msgcontains(msg, '6') then local dice_random_number = math.random(1, #randomDice) local dice = randomDice[math.random(1, #randomDice)] if (tonumber(msg) == dice_random_number) then local item_reward = rewards[math.random(1, #rewards)] doSendMagicEffect(dice_pos, CONST_ME_CRAPS) doTransformItem(getThingFromPos(dice_pos).uid, randomDice[dice_random_number]) doCreatureSay(npc, getCreatureName(npc).." rolled a "..dice_random_number.. ".", MESSAGE_STATUS_CONSOLE_ORANGE) doCreatureSay(npc, getCreatureName(npc).." voce ganhou "..getItemNameById(item_reward).. ".", MESSAGE_STATUS_CONSOLE_ORANGE) doPlayerAddItem(cid, item_reward, 1) doTeleportThing(cid, player_teleport) else doCreatureSay(npc, getCreatureName(npc).. " rolled a "..dice_random_number.. ".", MESSAGE_STATUS_CONSOLE_ORANGE) doSendMagicEffect(dice_pos, CONST_ME_CRAPS) doTransformItem(getThingFromPos(dice_pos).uid, randomDice[dice_random_number]) doCreatureSetSpeakType(cid, MESSAGE_STATUS_CONSOLE_ORANGE) doCreatureSay(cid, "Perdi!!! :@") doTeleportThing(cid, player_teleport) end end end x = 0 end function HavePlayer() npcPos = getNpcPos() positionNpc = { NORTH = {x=npcPos.x, y=npcPos.y-2, z=npcPos.z, stackpos = STACKPOS_TOP_CREATURE}, SOUTH = {x=npcPos.x, y=npcPos.y+2, z=npcPos.z, stackpos = STACKPOS_TOP_CREATURE}, WEST = {x=npcPos.x-2, y=npcPos.y, z=npcPos.z, stackpos = STACKPOS_TOP_CREATURE}, EAST = {x=npcPos.x+2, y=npcPos.y, z=npcPos.z, stackpos = STACKPOS_TOP_CREATURE}, } local npc = getNpcCid() local position = {x=npcPos.x, y=npcPos.y-2, z=npcPos.z, stackpos = STACKPOS_TOP_CREATURE} if (x == 0) then if getThingFromPos(positionNpc.NORTH).uid ~= 0 then npcHandler:say("Escolha um numero de 1 a 6, "..getCreatureName(getThingFromPos(positionNpc.NORTH).uid)) doCreatureSetLookDirection(npc, NORTH) x = 1 end if getThingFromPos(positionNpc.SOUTH).uid ~= 0 then npcHandler:say("Escolha um numero de 1 a 6, "..getCreatureName(getThingFromPos(positionNpc.SOUTH).uid)) doCreatureSetLookDirection(npc, SOUTH) x = 1 end if getThingFromPos(positionNpc.WEST).uid ~= 0 then npcHandler:say("Escolha um numero de 1 a 6, "..getCreatureName(getThingFromPos(positionNpc.WEST).uid)) doCreatureSetLookDirection(npc, WEST) x = 1 end if getThingFromPos(positionNpc.EAST).uid ~= 0 then npcHandler:say("Escolha um numero de 1 a 6, "..getCreatureName(getThingFromPos(positionNpc.EAST).uid)) doCreatureSetLookDirection(npc, EAST) x = 1 end end return true end function onThink() if HavePlayer() then return false end npcHandler:onThink() end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
Postado Julho 23, 2019 5 anos @victor4312 não é mais fácil criar um portal para abrir em determinado tempo??? Projeto ATS (Naruto)Informações AbaixoFacebookYoutubeDiscord Tutoriais / ConteúdosClique Aqui
Postado Julho 23, 2019 5 anos @victor4312 Ta ai o globalevent <globalevent name="NpcDiceEvent" interval="60" event="script" value="eventDice.lua"/> local horarios = { ["19:47"] = { npc_name = "NpcDice", -- Nome do Npc XML pos_respawn_npc = {x=160,y=53,z=9}, -- Posicao aonde o Npc vai ser criado quando o evento começar pos_create_teleport= {x=157,y=57,z=7,stackpos=2}, -- Posicao do Teleport quando evento começar pos_to_teleport = {x=156,y=56,z=9}, -- Para onde o teleport irá levar time = 2, -- Duracao do evento em minutos msg_start = "O teleport para evento Dice esta aberto!", -- Mensagem quando o evento começar msg_finish = "O Evento Dice acabou!", -- Mensagem quando o evento acabar }, } function onThink(interval, lastExecution) local hours = horarios[os.date("%H:%M")] if hours then doBroadcastMessage(hours.msg_start) if not isCreature(hours.pos_respawn_npc) then doCreateNpc(hours.npc_name, hours.pos_respawn_npc) end doCreateTeleport(1387, hours.pos_to_teleport, hours.pos_create_teleport) doSendMagicEffect(hours.pos_create_teleport, 10) addEvent(function() doBroadcastMessage(hours.msg_finish) local npc = getTopCreature(hours.pos_respawn_npc).uid doRemoveCreature(npc) if getTileItemById(hours.pos_create_teleport, 1387).uid >= 1 then doSendMagicEffect(hours.pos_create_teleport, 10) doRemoveItem(getTileItemById(hours.pos_create_teleport, 1387).uid, 1) end end, 1000 * 60 * hours.time) end return true end
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.