Ir para conteúdo
Banner com Efeitos

Featured Replies

Postado

O que posso fazer para este ring virar uma magia? que so poder ser usada a cada X minutos.

 

 

Script do ring (action)

local invisible = createConditionObject(CONDITION_GAMEMASTER, -1, false, GAMEMASTER_INVISIBLE)
local outfit = createConditionObject(CONDITION_INVISIBLE, -1, false)
local percent = 3
local tempo = 1 -- em segundos

function onEquip(cid, item, slot)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "By using this ring you will become fully invisible and lose health over time because of it's curse.")
function lifesteal(cid)
     if isCreature(cid) then
	   doSendAnimatedText(getCreaturePos(cid), "-"..math.floor((getCreatureMaxHealth(cid) * (percent/100))), 144, cid)
        doCreatureAddHealth(cid, -math.floor(getCreatureMaxHealth(cid) * (percent/100)))
     end
	steal = addEvent(lifesteal, 1000*tempo, cid)
	end	 
	lifesteal(cid)
doAddCondition(cid, invisible)
doAddCondition(cid, outfit)
doSendMagicEffect(getCreaturePos(cid), 12)
return true
end

function onDeEquip(cid, item, slot)
doTransformItem(item.uid, 2165)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You're no longer receiving the special bonus..")
stopEvent(steal)
doRemoveCondition(cid, CONDITION_INVISIBLE)
doSendMagicEffect(getCreaturePos(cid), 12)
doRemoveCondition(cid, CONDITION_GAMEMASTER, GAMEMASTER_INVISIBLE)
return true
end

Resolvido por xWhiteWolf

Ir para solução
  • Respostas 6
  • Visualizações 703
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • <instant name="Utana vid" words="exevo invisibility" lvl="55"  aggressive="0" mana="650" selftarget="1" prem="1" exhaustion="1500" needlearn="0" event="script" value="especiais/invisible.lua">&l

Postado
  • Solução
<instant name="Utana vid" words="exevo invisibility" lvl="55"  aggressive="0" mana="650" selftarget="1" prem="1" exhaustion="1500" needlearn="0" event="script" value="especiais/invisible.lua"><vocation id="1"/>
<vocation id="5"/>
</instant> 
local duration = 5 -- em segundos
local invisible = createConditionObject(CONDITION_GAMEMASTER, duration*1000, false, GAMEMASTER_INVISIBLE)
local outfit = createConditionObject(CONDITION_INVISIBLE, duration*1000, false)
local percent = 3
local tempo = 1 -- em segundos
local cooldown = 30 -- em segundos
local storage = 12339 -- local que fica salvo o cooldown


function onCastSpell(cid, var)
if os.time() - getPlayerStorageValue(cid, storage) >= cooldown then
doPlayerSetStorageValue(cid, storage, os.time())
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "By using this spell you will become fully invisible and lose health over time because of it's curse.")
function lifesteal(cid)
     if isCreature(cid) then
  doSendAnimatedText(getCreaturePos(cid), "-"..math.floor((getCreatureMaxHealth(cid) * (percent/100))), 144, cid)
        doCreatureAddHealth(cid, -math.floor(getCreatureMaxHealth(cid) * (percent/100)))
     end
steal = addEvent(lifesteal, 1000*tempo, cid)
end 
lifesteal(cid)
doAddCondition(cid, invisible)
doAddCondition(cid, outfit)
doSendMagicEffect(getCreaturePos(cid), 12)
  addEvent(function()
               if isCreature(cid) then
                   doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You're no longer invisible..")
stopEvent(steal)
doSendMagicEffect(getCreaturePos(cid), 12)
               end
          end, 1000*duration)
else
doPlayerSendCancel(cid, "Your spell is in cooldown, you must wait "..(cooldown - (os.time() - getPlayerStorageValue(cid, storage))).." seconds.")
doSendMagicEffect(getCreaturePos(cid), 2)
end
return true
end

pra editar muda aqui:
local duration = 5 -- em segundos
local percent = 3
local tempo = 1 -- em segundos
local cooldown = 30 -- em segundos
local storage = 12339 -- local que fica salvo o cooldown

duration é o tempo que fica invisivel após usar a magia
percent é a porcentagem de vida que perde por segundo enquanto tá invisivel
tempo é de quanto em quanto tempo perde vida
cooldown é quantos segundos vc vai ter que esperar pra usar a magia após ter usado ela

storage é onde vai ficar salvo o cooldown

Todos os meus trabalhos importantes estão na seção "Sobre mim" no meu perfil; Dá uma passada lá!

"Há três caminhos para o fracasso: não ensinar o que se sabe, não praticar o que se ensina, e não perguntar o que se ignora." - São Beda

I7Pm6ih.png

(obg ao @Beeny por fazer essa linda sign <3)

  • 1 month later...

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.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.7k

Informação Importante

Confirmação de Termo