Ir para conteúdo

Featured Replies

Postado

Ola,alguem poderia me fazer uma script que deixa o personagem sem tomar dano por X segundos com X exausted e uma MSG em cima do player "IMORTAL" no player que usar

OBRIGADO A TODOS QUE PODEREM AJUDAR <3 REP+
 

  • 2 weeks later...
Postado

Em creaturescripts.xml

<event type="statschange" name="invencible" event="script" value="nomedoseuarquivo.lua"/>

Crie um arquivo na pasta creaturescripts/scripts com o mesmo nome do arquivo registrado na tag xml. Dentro do arquivo cole o seguinte:

local config = { 
storage = 3482101, ---- storage utilizada,
effect1 = 2 --- efeito ao ser atacado estando invulneravel

 

Em login.lua:

    ---------- Imortalidade ----------------
    registerCreatureEvent(cid, "invencible")
    if getPlayerStorageValue(cid, 3482101) ~= 0 then
        setPlayerStorageValue(cid, 3482101, 0) 
    end


function onStatsChange(cid, attacker, type, combat, value)
if value >= 1 and (type == STATSCHANGE_HEALTHLOSS or (getCreatureCondition(cid, CONDITION_MANASHIELD) and type == STATSCHANGE_MANALOSS))  then
if getPlayerStorageValue(cid,config.storage) - os.time() > 0 and isCreature(attacker) then
doSendMagicEffect(getCreaturePosition(cid), config.effect1)
doSendAnimatedText(getCreaturePosition(cid), "IMORTAL", 180)
return false
end
end
return true
end

 

Agora em spells.xml, cole a seguinte tag:
<instant name="Nome da magia" words="Nome da magia" lvl="400" mana="4000" maglv="110" prem="0" aggressive="1" exhaustion="100" needlearn="0" script="diretoriodoarquivo.lua"> 

</instant>

crie 1 arquivo.lua para a spell com o seguinte código:

local config = { 
storage = 3482101,
cooldown = 60,  --- tempo entre um uso e outro
duration = 5, --- duracao
effect1 = 279 -- efeito que sai ao falar a spell

function onCastSpell(cid, var)

if os.time() - getPlayerStorageValue(cid, 55695) >= config.cooldown then
setPlayerStorageValue(cid, 55695, os.time())
    for k = 1, 9 do
        addEvent(function()
            if isCreature(cid) then
                local pos1 = {x = getPlayerPosition(cid).x + 1, y = getPlayerPosition(cid).y + 0, z = getPlayerPosition(cid).z}
                doSendMagicEffect(pos1, 326)
            end
        end, 1 + ((k-1) * 500))
    end
setPlayerStorageValue(cid, config.storage, os.time() + config.duration)
doCreatureSay(cid,"IMORTAL!!!", 15)
doPlayerSendTextMessage(cid, 20, "Voce tem ".. config.duration .." segundos de invulnerabilidade.")
else
doPlayerSendCancel(cid, "Sua habilidade esta em cooldown, voce deve esperar "..(config.cooldown - (os.time() - getPlayerStorageValue(cid, 55695))).." segundos.")
return false
end  
    return true
end

 

  • 4 weeks later...
Postado
Em 19/11/2019 em 19:35, TottenXD disse:

Em creaturescripts.xml

<event type="statschange" name="invencible" event="script" value="nomedoseuarquivo.lua"/>

Crie um arquivo na pasta creaturescripts/scripts com o mesmo nome do arquivo registrado na tag xml. Dentro do arquivo cole o seguinte:

local config = { 
storage = 3482101, ---- storage utilizada,
effect1 = 2 --- efeito ao ser atacado estando invulneravel

 

Em login.lua:

    ---------- Imortalidade ----------------
    registerCreatureEvent(cid, "invencible")
    if getPlayerStorageValue(cid, 3482101) ~= 0 then
        setPlayerStorageValue(cid, 3482101, 0) 
    end


function onStatsChange(cid, attacker, type, combat, value)
if value >= 1 and (type == STATSCHANGE_HEALTHLOSS or (getCreatureCondition(cid, CONDITION_MANASHIELD) and type == STATSCHANGE_MANALOSS))  then
if getPlayerStorageValue(cid,config.storage) - os.time() > 0 and isCreature(attacker) then
doSendMagicEffect(getCreaturePosition(cid), config.effect1)
doSendAnimatedText(getCreaturePosition(cid), "IMORTAL", 180)
return false
end
end
return true
end

 

Agora em spells.xml, cole a seguinte tag:
<instant name="Nome da magia" words="Nome da magia" lvl="400" mana="4000" maglv="110" prem="0" aggressive="1" exhaustion="100" needlearn="0" script="diretoriodoarquivo.lua"> 

</instant>

crie 1 arquivo.lua para a spell com o seguinte código:

local config = { 
storage = 3482101,
cooldown = 60,  --- tempo entre um uso e outro
duration = 5, --- duracao
effect1 = 279 -- efeito que sai ao falar a spell

function onCastSpell(cid, var)

if os.time() - getPlayerStorageValue(cid, 55695) >= config.cooldown then
setPlayerStorageValue(cid, 55695, os.time())
    for k = 1, 9 do
        addEvent(function()
            if isCreature(cid) then
                local pos1 = {x = getPlayerPosition(cid).x + 1, y = getPlayerPosition(cid).y + 0, z = getPlayerPosition(cid).z}
                doSendMagicEffect(pos1, 326)
            end
        end, 1 + ((k-1) * 500))
    end
setPlayerStorageValue(cid, config.storage, os.time() + config.duration)
doCreatureSay(cid,"IMORTAL!!!", 15)
doPlayerSendTextMessage(cid, 20, "Voce tem ".. config.duration .." segundos de invulnerabilidade.")
else
doPlayerSendCancel(cid, "Sua habilidade esta em cooldown, voce deve esperar "..(config.cooldown - (os.time() - getPlayerStorageValue(cid, 55695))).." segundos.")
return false
end  
    return true
end

 

 

QUando coloca no no login.lua da erro

Editado por XGaduX (veja o histórico de edições)

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.

Conteúdo Similar

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.7k

Informação Importante

Confirmação de Termo