Postado Novembro 25, 2021 3 anos .Qual servidor ou website você utiliza como base? Qual o motivo deste tópico? Está surgindo algum erro? Se sim coloque-o aqui. Citar Você tem o código disponível? Se tiver publique-o aqui: function onUse(player, item, fromPosition, target, toPosition, isHotkey) local playerPos = player:getPosition() local position = Position(playerPos.x, playerPos.y + 1, playerPos.z) local npcName = "Mad" local storage = "2252" local npc = Game.createNpc(npcName, position) function removeNpc(creature) local target = Npc(npc) target:getPosition():sendMagicEffect(CONST_ME_TELEPORT) player:setStorageValue(storage, 0) target:remove() end if npc then npc:setMasterPos(position) position:sendMagicEffect(CONST_ME_POFF) player:say("can you help me?", TALKTYPE_MONSTER_SAY) player:setStorageValue(storage, os.time() + 1*60) addEvent(removeNpc, 1*60*1000, npcName) return true else position:sendMagicEffect(CONST_ME_POFF) end end Bom vamos lá Fiz um action que ao usar um certo scroll tu sumona um npc por 1 minuto. O codigo em si está 100% funcional porém quanto mais eu clico no scroll mais npcs eu gero. Queria limitar apenas a 1 npc. Mas não estou conseguindo... Alguem pode me auxiliar? Você tem alguma imagem que possa auxiliar no problema? Se sim, coloque-a aqui.
Postado Novembro 25, 2021 3 anos local function removeNpc(creature) local target = Npc(npc) target:getPosition():sendMagicEffect(CONST_ME_TELEPORT) player:setStorageValue(storage, 0) target:remove() end function onUse(player, item, fromPosition, target, toPosition, isHotkey) if player:getStorageValue(storage) >= os.time() then local playerPos = player:getPosition() local position = Position(playerPos.x, playerPos.y + 1, playerPos.z) local npcName = "Mad" local storage = 2252 local npc = Game.createNpc(npcName, position) if npc then npc:setMasterPos(position) position:sendMagicEffect(CONST_ME_POFF) player:say("can you help me?", TALKTYPE_MONSTER_SAY) player:setStorageValue(storage, os.time() + 1 * 60) addEvent(removeNpc, 1 * 60 * 1000, npcName) end else position:sendMagicEffect(CONST_ME_POFF) end return true end Editado Novembro 25, 2021 3 anos por Marco Oliveira (veja o histórico de edições)
Postado Novembro 25, 2021 3 anos Autor 1 hora atrás, Marco Oliveira disse: local function removeNpc(creature) local target = Npc(npc) target:getPosition():sendMagicEffect(CONST_ME_TELEPORT) player:setStorageValue(storage, 0) target:remove() end function onUse(player, item, fromPosition, target, toPosition, isHotkey) if player:getStorageValue(storage) >= os.time() then local playerPos = player:getPosition() local position = Position(playerPos.x, playerPos.y + 1, playerPos.z) local npcName = "Mad" local storage = 2252 local npc = Game.createNpc(npcName, position) if npc then npc:setMasterPos(position) position:sendMagicEffect(CONST_ME_POFF) player:say("can you help me?", TALKTYPE_MONSTER_SAY) player:setStorageValue(storage, os.time() + 1 * 60) addEvent(removeNpc, 1 * 60 * 1000, npcName) end else position:sendMagicEffect(CONST_ME_POFF) end return true end não deu certo, dessa forma nem sumona o npc fica dando o poff mesmo se eu nao tiver com o os.time
Postado Novembro 25, 2021 3 anos function onUse(player, item, fromPosition, target, toPosition, isHotkey) local playerPos = player:getPosition() local position = Position(playerPos.x, playerPos.y + 1, playerPos.z) local npcName = "Mad" local function removeNpc(name) local var = Npc(name) if var and var:isNpc() then var:remove() end end if not Npc(npcName) then local create = Game.createNpc(npcName, position) if create then create:setMasterPos(position) position:sendMagicEffect(CONST_ME_POFF) player:say("can you help me?", TALKTYPE_MONSTER_SAY) addEvent(removeNpc, 1*60*1000, npcName) return true end else position:sendMagicEffect(CONST_ME_POFF) end end [*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*] DISCORD: vodkart#6090
Postado Novembro 26, 2021 3 anos Autor 6 horas atrás, Vodkart disse: function onUse(player, item, fromPosition, target, toPosition, isHotkey) local playerPos = player:getPosition() local position = Position(playerPos.x, playerPos.y + 1, playerPos.z) local npcName = "Mad" local function removeNpc(name) local var = Npc(name) if var and var:isNpc() then var:remove() end end if not Npc(npcName) then local create = Game.createNpc(npcName, position) if create then create:setMasterPos(position) position:sendMagicEffect(CONST_ME_POFF) player:say("can you help me?", TALKTYPE_MONSTER_SAY) addEvent(removeNpc, 1*60*1000, npcName) return true end else position:sendMagicEffect(CONST_ME_POFF) end end testei aqui ele não sumona, fica dando poff como se ja existisse um npc criado. Vou mandar um video 20211125_232815.mp4
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.