GA
pedido scripts

[Resolvido] Item que ao usar não perder lv e skills por um periodo

Por Gabrielkss, 26 de jul. de 2017 em Resolvidos

5
2.2k
GabrielkssG
26 de julho de 2017 às 22:48

Alguém poderia fazer um script no qual quando o jogador usasse, ele ficaria um tempo tipo 1 dia sem perder lv e skills dps desse tempo perdia o efeito e se morrer perder lv e skills.

 

Agradeço desde já.

Editado Julho 26 por Gabrielkss

1 mês depois...
LeoxtibiaL
03 de agosto de 2017 às 09:33
Melhor resposta

Não testado.

 

Em creaturescripts/scripts:

 

deathProtect.lua

 

Spoiler

function onDeath(cid, corpse, deathList)
if (getPlayerStorageValue(cid, 17331) - os.time()) > 0 then
    doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, 0)
    doPlayerSetLossPercent(cid, PLAYERLOSS_MANA, 0)
    doPlayerSetLossPercent(cid, PLAYERLOSS_SKILLS, 0)
end
end

 

No login.lua:

 

registerCreatureEvent(cid, "DeathProtect")

 

Em creaturescripts.xml:

 

<event type="death" name="DeathProtect" event="script" value="deathProtect.lua">

 

Em actions/scripts:

 

protect.lua

 

Spoiler

 

local tempo = 1 -- em dias

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if (getPlayerStorageValue(cid, 17331) - os.time()) <= 0 then
        setPlayerStorageValue(cid, 17331, (tempo*24*3600)+os.time())
        doCreatureSay(cid, "You are protected now!", TALKTYPE_ORANGE_1, cid)
    else
        doCreatureSay(cid, "You are still protected.", TALKTYPE_ORANGE_1, cid)
    end    
end

 

 

Em actions.xml:

 

<action itemid="ID_DO_ITEM" script="protect.lua" />

 

2 meses depois...
UntFrcU
02 de outubro de 2017 às 03:24
Em 03/08/2017 at 09:33, Leoxtibia disse:

Não testado.

 

Em creaturescripts/scripts:

 

deathProtect.lua

 

  Ocultar conteúdo

function onDeath(cid, corpse, deathList)
if (getPlayerStorageValue(cid, 17331) - os.time()) > 0 then
    doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, 0)
    doPlayerSetLossPercent(cid, PLAYERLOSS_MANA, 0)
    doPlayerSetLossPercent(cid, PLAYERLOSS_SKILLS, 0)
end
end

 

No login.lua:

 

registerCreatureEvent(cid, "DeathProtect")

 

Em creaturescripts.xml:

 

<event type="death" name="DeathProtect" event="script" value="deathProtect.lua">

 

Em actions/scripts:

 

protect.lua

 

  Ocultar conteúdo

 

local tempo = 1 -- em dias

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if (getPlayerStorageValue(cid, 17331) - os.time()) <= 0 then
        setPlayerStorageValue(cid, 17331, (tempo*24*3600)+os.time())
        doCreatureSay(cid, "You are protected now!", TALKTYPE_ORANGE_1, cid)
    else
        doCreatureSay(cid, "You are still protected.", TALKTYPE_ORANGE_1, cid)
    end    
end

 

 

Em actions.xml:

 

<action itemid="ID_DO_ITEM" script="protect.lua" />

 


Deixando registrado aqui que eu testei e funcionou impecavelmente.

PoccnnP
02 de outubro de 2017 às 20:41

@Gabrielkss

se seu pedido foi atendido, por favor comunique a moderação para poder fechar seu tópico.

Obrigado.

1 mês depois...
StigalS
29 de novembro de 2017 às 15:29
O pedido neste tópico de foi atendido e/ou o autor do tópico resolveu sua duvida. Este tópico está fechado e foi movido para Pedidos - Resolvidos. Se você tiver outros pedidos, crie um novo tópico.