• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Spell Level Buff

Fabi Marzan

Well-Known Member
Joined
Aug 31, 2020
Messages
135
Solutions
6
Reaction score
67
Hello friends, I was trying to create a spells where when you reach a certain level, change spells, that is, effect.
In this case it is a Buff that when reaching level 200 changes to another effect.

VERSION: OTX2

Images:

LEVEL 0-200
Screenshot_2.png

Upon reaching level 200, switch to this effect.

LEVEL 200
Screenshot_1.png

The idea is how it is, the spell has a storage that would be to use the level 200, and to obtain that storage you need to be 200 obvious, in which you would have to add it to creatuscripts.
Lua:
function onAdvance(cid, skill, oldLevel, newLevel)
     if skill == SKILL__LEVEL and newLevel == 200 then
         doCreatureSetStorage(cid, 5000, 1)
         doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You got some storage.")
     end
     return true
end

That would be when you reach level 200 which gives you storage 5000...ok, but now to put it on the spell, you can't use the level 200 buff until you have that storage.

This is the Buff scripts:
Code:
local tempo = 30 -- tempo em segundos.
local effect = {200} -- effect no player, caso queira apenas 1, basta remover os outros numeros.
    
local ml = 10 -- quantos ira aumentar o skill de ML
local skillfist = 0 -- quantos ira aumentar o skill de Fist
local skillsword = 0 -- quantos ira aumentar o skill de Sword
local skillaxe = 10 -- quantos ira aumentar o skill de Axe
local skilldistance = 0 -- quantos ira aumentar o skill de Distance
local health = 0 -- A cada 1 segundo quantos aumentar de vida
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0)
    
local condition = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(condition, CONDITION_PARAM_TICKS, tempo*1000)
setConditionParam(condition, CONDITION_PARAM_STAT_MAGICLEVEL, ml)
setConditionParam(condition, CONDITION_PARAM_SKILL_FIST, skillfist)
setConditionParam(condition, CONDITION_PARAM_SKILL_SWORD, skillsword)
setConditionParam(condition, CONDITION_PARAM_SKILL_AXE, skillaxe)
setConditionParam(condition, CONDITION_PARAM_SKILL_CLUB, skillclub)
setConditionParam(condition, CONDITION_PARAM_SKILL_DISTANCE, skilldistance)
setConditionParam(condition, CONDITION_PARAM_SKILL_SHIELD, skillshield)
setConditionParam(condition, CONDITION_PARAM_OUTFIT, outfit)
setCombatCondition(combat, condition)
    
local condition = createConditionObject(CONDITION_REGENERATION)
setConditionParam(condition, CONDITION_PARAM_SUBID, 1)
setConditionParam(condition, CONDITION_PARAM_BUFF, TRUE)
setConditionParam(condition, CONDITION_PARAM_TICKS, tempo*1000)
setConditionParam(condition, CONDITION_PARAM_HEALTHGAIN, health)
setConditionParam(condition, CONDITION_PARAM_HEALTHTICKS, 1000)
setCombatCondition(combat, condition)
        
function magicEffect3(tempo2,tempo3,cid)
if (isCreature(cid)) then
    if getPlayerStorageValue(cid, 1500) > 0 and getCreatureCondition(cid, CONDITION_REGENERATION, 1) then
        for i=1, #effect do
local position = {x=getPlayerPosition(cid).x, y=getPlayerPosition(cid).y, z=getPlayerPosition(cid).z}
doSendMagicEffect(position, effect[i])
-- parte modificada
local summons = getCreatureSummons(cid)
if #summons > 0 then
for k = 1, #summons do
local pos = getCreaturePosition(summons[k])
local positions = {x = pos.x, y = pos.y, z = pos.z}
doSendMagicEffect(positions, effect[i])
end
end
-- fim da parte modificada
        end
    end
end
end
                  
function onCastSpell(cid, var)
local position = {x=getPlayerPosition(cid).x, y=getPlayerPosition(cid).y, z=getPlayerPosition(cid).z}
if getPlayerStorageValue(cid, 1500) ~= 1 or getCreatureCondition(cid, CONDITION_REGENERATION, 1) == false then
    doCombat(cid, combat, var)
    tempo2 = 0
    while (tempo2 ~= (tempo*1000)) do
        addEvent(magicEffect3, tempo2, tempo2, tempo*1000, cid)
        tempo2 = tempo2 + 1500
    end
    
    

    setPlayerStorageValue(cid, 1500,1) -- storage verifica transformado, quando = 1 player esta transformado.
    doCreatureSay(cid, "Kekkei Genkai!", TALKTYPE_ORANGE_1)
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "( Buff ) activado por "..tempo.." segundos!")
    doSendMagicEffect(position, 130)
    local parameters = { cid = cid, var = var}
    
    
else
doSendMagicEffect(getCreaturePosition(cid), 4)
doCreatureSay(cid, "Kekkei Genkai!", TALKTYPE_ORANGE_1)
    doPlayerSendCancel(cid, "Sorry, you are transformed.")
end
end

Although I add these scripts, it continues to use the two effects at the same time, I don't know if that works
Code:
if getCreatureStorage(cid, 5000) == 1 then

In the end it worked for me, but the problem is that I use both effects at the same time, I just want to use level 200.
Code:
local tempo = 30
local effect = {500} -- BUFF LEVEL 0-100

local effect2 = {200} --  BUFF LEVEL 200
    
local ml = 10 -- quantos ira aumentar o skill de ML
local skillfist = 0 -- quantos ira aumentar o skill de Fist
local skillsword = 0 -- quantos ira aumentar o skill de Sword
local skillaxe = 10 -- quantos ira aumentar o skill de Axe
local skilldistance = 0 -- quantos ira aumentar o skill de Distance
local health = 0 -- A cada 1 segundo quantos aumentar de vida
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0)
    
local condition = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(condition, CONDITION_PARAM_TICKS, tempo*1000)
setConditionParam(condition, CONDITION_PARAM_STAT_MAGICLEVEL, ml)
setConditionParam(condition, CONDITION_PARAM_SKILL_FIST, skillfist)
setConditionParam(condition, CONDITION_PARAM_SKILL_SWORD, skillsword)
setConditionParam(condition, CONDITION_PARAM_SKILL_AXE, skillaxe)
setConditionParam(condition, CONDITION_PARAM_SKILL_CLUB, skillclub)
setConditionParam(condition, CONDITION_PARAM_SKILL_DISTANCE, skilldistance)
setConditionParam(condition, CONDITION_PARAM_SKILL_SHIELD, skillshield)
setConditionParam(condition, CONDITION_PARAM_OUTFIT, outfit)
setCombatCondition(combat, condition)
    
local condition = createConditionObject(CONDITION_REGENERATION)
setConditionParam(condition, CONDITION_PARAM_SUBID, 1)
setConditionParam(condition, CONDITION_PARAM_BUFF, TRUE)
setConditionParam(condition, CONDITION_PARAM_TICKS, tempo*1000)
setConditionParam(condition, CONDITION_PARAM_HEALTHGAIN, health)
setConditionParam(condition, CONDITION_PARAM_HEALTHTICKS, 1000)
setCombatCondition(combat, condition)
        
function magicEffect3(tempo2,tempo3,cid)
if (isCreature(cid)) then
    if getPlayerStorageValue(cid, 1500) > 0 and getCreatureCondition(cid, CONDITION_REGENERATION, 1) then
        for i=1, #effect do
local position = {x=getPlayerPosition(cid).x, y=getPlayerPosition(cid).y, z=getPlayerPosition(cid).z}
doSendMagicEffect(position, effect[i])
-- parte modificada
local summons = getCreatureSummons(cid)
if #summons > 0 then
for k = 1, #summons do
local pos = getCreaturePosition(summons[k])
local positions = {x = pos.x, y = pos.y, z = pos.z}
doSendMagicEffect(positions, effect[i])
end
end
-- fim da parte modificada
        end
    end
end
end

function magicEffect4(tempo2,tempo3,cid)
if (isCreature(cid)) then
    if getPlayerStorageValue(cid, 5000) > 0 and getCreatureCondition(cid, CONDITION_REGENERATION, 1) then
        for i=1, #effect2 do
local position = {x=getPlayerPosition(cid).x, y=getPlayerPosition(cid).y, z=getPlayerPosition(cid).z}
doSendMagicEffect(position, effect2[i])
-- parte modificada
local summons = getCreatureSummons(cid)
if #summons > 0 then
for k = 1, #summons do
local pos = getCreaturePosition(summons[k])
local positions = {x = pos.x, y = pos.y, z = pos.z}
doSendMagicEffect(positions, effect2[i])
end
end
-- fim da parte modificada
        end
    end
end
end
                  
function onCastSpell(cid, var)
local position = {x=getPlayerPosition(cid).x, y=getPlayerPosition(cid).y, z=getPlayerPosition(cid).z}
if getPlayerStorageValue(cid, 1500) ~= 1 or getCreatureCondition(cid, CONDITION_REGENERATION, 1) == false then
    doCombat(cid, combat, var)
    tempo2 = 0
    while (tempo2 ~= (tempo*1000)) do
        addEvent(magicEffect3, tempo2, tempo2, tempo*1000, cid)
        tempo2 = tempo2 + 1500
    end
    if getPlayerStorageValue(cid, 5000) ~= 1 or getCreatureCondition(cid, CONDITION_REGENERATION, 1) == false then
    doCombat(cid, combat, var)
    tempo2 = 0
    while (tempo2 ~= (tempo*1000)) do
        addEvent(magicEffect4, tempo2, tempo2, tempo*1000, cid)
        tempo2 = tempo2 + 1500
    end
    end

    
    

    setPlayerStorageValue(cid, 1500,1) -- storage verifica transformado, quando = 1 player esta transformado.
    setPlayerStorageValue(cid, 5000,1) -- STORAGE LEVEL 200
    doCreatureSay(cid, "Kekkei Genkai!", TALKTYPE_ORANGE_1)
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "( Buff ) activado por "..tempo.." segundos!")
    doSendMagicEffect(position, 130)
    local parameters = { cid = cid, var = var}
    
    
else
doSendMagicEffect(getCreaturePosition(cid), 4)
doCreatureSay(cid, "Kekkei Genkai!", TALKTYPE_ORANGE_1)
    doPlayerSendCancel(cid, "Sorry, you are transformed.")
end
end
 
Hello friends, I was trying to create a spells where when you reach a certain level, change spells, that is, effect.
In this case it is a Buff that when reaching level 200 changes to another effect.

VERSION: OTX2

Images:

LEVEL 0-200
View attachment 54870

Upon reaching level 200, switch to this effect.

LEVEL 200
View attachment 54869

The idea is how it is, the spell has a storage that would be to use the level 200, and to obtain that storage you need to be 200 obvious, in which you would have to add it to creatuscripts.
Lua:
function onAdvance(cid, skill, oldLevel, newLevel)
     if skill == SKILL__LEVEL and newLevel == 200 then
         doCreatureSetStorage(cid, 5000, 1)
         doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You got some storage.")
     end
     return true
end

That would be when you reach level 200 which gives you storage 5000...ok, but now to put it on the spell, you can't use the level 200 buff until you have that storage.

This is the Buff scripts:
Code:
local tempo = 30 -- tempo em segundos.
local effect = {200} -- effect no player, caso queira apenas 1, basta remover os outros numeros.
   
local ml = 10 -- quantos ira aumentar o skill de ML
local skillfist = 0 -- quantos ira aumentar o skill de Fist
local skillsword = 0 -- quantos ira aumentar o skill de Sword
local skillaxe = 10 -- quantos ira aumentar o skill de Axe
local skilldistance = 0 -- quantos ira aumentar o skill de Distance
local health = 0 -- A cada 1 segundo quantos aumentar de vida
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0)
   
local condition = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(condition, CONDITION_PARAM_TICKS, tempo*1000)
setConditionParam(condition, CONDITION_PARAM_STAT_MAGICLEVEL, ml)
setConditionParam(condition, CONDITION_PARAM_SKILL_FIST, skillfist)
setConditionParam(condition, CONDITION_PARAM_SKILL_SWORD, skillsword)
setConditionParam(condition, CONDITION_PARAM_SKILL_AXE, skillaxe)
setConditionParam(condition, CONDITION_PARAM_SKILL_CLUB, skillclub)
setConditionParam(condition, CONDITION_PARAM_SKILL_DISTANCE, skilldistance)
setConditionParam(condition, CONDITION_PARAM_SKILL_SHIELD, skillshield)
setConditionParam(condition, CONDITION_PARAM_OUTFIT, outfit)
setCombatCondition(combat, condition)
   
local condition = createConditionObject(CONDITION_REGENERATION)
setConditionParam(condition, CONDITION_PARAM_SUBID, 1)
setConditionParam(condition, CONDITION_PARAM_BUFF, TRUE)
setConditionParam(condition, CONDITION_PARAM_TICKS, tempo*1000)
setConditionParam(condition, CONDITION_PARAM_HEALTHGAIN, health)
setConditionParam(condition, CONDITION_PARAM_HEALTHTICKS, 1000)
setCombatCondition(combat, condition)
       
function magicEffect3(tempo2,tempo3,cid)
if (isCreature(cid)) then
    if getPlayerStorageValue(cid, 1500) > 0 and getCreatureCondition(cid, CONDITION_REGENERATION, 1) then
        for i=1, #effect do
local position = {x=getPlayerPosition(cid).x, y=getPlayerPosition(cid).y, z=getPlayerPosition(cid).z}
doSendMagicEffect(position, effect[i])
-- parte modificada
local summons = getCreatureSummons(cid)
if #summons > 0 then
for k = 1, #summons do
local pos = getCreaturePosition(summons[k])
local positions = {x = pos.x, y = pos.y, z = pos.z}
doSendMagicEffect(positions, effect[i])
end
end
-- fim da parte modificada
        end
    end
end
end
                 
function onCastSpell(cid, var)
local position = {x=getPlayerPosition(cid).x, y=getPlayerPosition(cid).y, z=getPlayerPosition(cid).z}
if getPlayerStorageValue(cid, 1500) ~= 1 or getCreatureCondition(cid, CONDITION_REGENERATION, 1) == false then
    doCombat(cid, combat, var)
    tempo2 = 0
    while (tempo2 ~= (tempo*1000)) do
        addEvent(magicEffect3, tempo2, tempo2, tempo*1000, cid)
        tempo2 = tempo2 + 1500
    end
   
   

    setPlayerStorageValue(cid, 1500,1) -- storage verifica transformado, quando = 1 player esta transformado.
    doCreatureSay(cid, "Kekkei Genkai!", TALKTYPE_ORANGE_1)
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "( Buff ) activado por "..tempo.." segundos!")
    doSendMagicEffect(position, 130)
    local parameters = { cid = cid, var = var}
   
   
else
doSendMagicEffect(getCreaturePosition(cid), 4)
doCreatureSay(cid, "Kekkei Genkai!", TALKTYPE_ORANGE_1)
    doPlayerSendCancel(cid, "Sorry, you are transformed.")
end
end

Although I add these scripts, it continues to use the two effects at the same time, I don't know if that works
Code:
if getCreatureStorage(cid, 5000) == 1 then

In the end it worked for me, but the problem is that I use both effects at the same time, I just want to use level 200.
Code:
local tempo = 30
local effect = {500} -- BUFF LEVEL 0-100

local effect2 = {200} --  BUFF LEVEL 200
   
local ml = 10 -- quantos ira aumentar o skill de ML
local skillfist = 0 -- quantos ira aumentar o skill de Fist
local skillsword = 0 -- quantos ira aumentar o skill de Sword
local skillaxe = 10 -- quantos ira aumentar o skill de Axe
local skilldistance = 0 -- quantos ira aumentar o skill de Distance
local health = 0 -- A cada 1 segundo quantos aumentar de vida
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0)
   
local condition = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(condition, CONDITION_PARAM_TICKS, tempo*1000)
setConditionParam(condition, CONDITION_PARAM_STAT_MAGICLEVEL, ml)
setConditionParam(condition, CONDITION_PARAM_SKILL_FIST, skillfist)
setConditionParam(condition, CONDITION_PARAM_SKILL_SWORD, skillsword)
setConditionParam(condition, CONDITION_PARAM_SKILL_AXE, skillaxe)
setConditionParam(condition, CONDITION_PARAM_SKILL_CLUB, skillclub)
setConditionParam(condition, CONDITION_PARAM_SKILL_DISTANCE, skilldistance)
setConditionParam(condition, CONDITION_PARAM_SKILL_SHIELD, skillshield)
setConditionParam(condition, CONDITION_PARAM_OUTFIT, outfit)
setCombatCondition(combat, condition)
   
local condition = createConditionObject(CONDITION_REGENERATION)
setConditionParam(condition, CONDITION_PARAM_SUBID, 1)
setConditionParam(condition, CONDITION_PARAM_BUFF, TRUE)
setConditionParam(condition, CONDITION_PARAM_TICKS, tempo*1000)
setConditionParam(condition, CONDITION_PARAM_HEALTHGAIN, health)
setConditionParam(condition, CONDITION_PARAM_HEALTHTICKS, 1000)
setCombatCondition(combat, condition)
       
function magicEffect3(tempo2,tempo3,cid)
if (isCreature(cid)) then
    if getPlayerStorageValue(cid, 1500) > 0 and getCreatureCondition(cid, CONDITION_REGENERATION, 1) then
        for i=1, #effect do
local position = {x=getPlayerPosition(cid).x, y=getPlayerPosition(cid).y, z=getPlayerPosition(cid).z}
doSendMagicEffect(position, effect[i])
-- parte modificada
local summons = getCreatureSummons(cid)
if #summons > 0 then
for k = 1, #summons do
local pos = getCreaturePosition(summons[k])
local positions = {x = pos.x, y = pos.y, z = pos.z}
doSendMagicEffect(positions, effect[i])
end
end
-- fim da parte modificada
        end
    end
end
end

function magicEffect4(tempo2,tempo3,cid)
if (isCreature(cid)) then
    if getPlayerStorageValue(cid, 5000) > 0 and getCreatureCondition(cid, CONDITION_REGENERATION, 1) then
        for i=1, #effect2 do
local position = {x=getPlayerPosition(cid).x, y=getPlayerPosition(cid).y, z=getPlayerPosition(cid).z}
doSendMagicEffect(position, effect2[i])
-- parte modificada
local summons = getCreatureSummons(cid)
if #summons > 0 then
for k = 1, #summons do
local pos = getCreaturePosition(summons[k])
local positions = {x = pos.x, y = pos.y, z = pos.z}
doSendMagicEffect(positions, effect2[i])
end
end
-- fim da parte modificada
        end
    end
end
end
                 
function onCastSpell(cid, var)
local position = {x=getPlayerPosition(cid).x, y=getPlayerPosition(cid).y, z=getPlayerPosition(cid).z}
if getPlayerStorageValue(cid, 1500) ~= 1 or getCreatureCondition(cid, CONDITION_REGENERATION, 1) == false then
    doCombat(cid, combat, var)
    tempo2 = 0
    while (tempo2 ~= (tempo*1000)) do
        addEvent(magicEffect3, tempo2, tempo2, tempo*1000, cid)
        tempo2 = tempo2 + 1500
    end
    if getPlayerStorageValue(cid, 5000) ~= 1 or getCreatureCondition(cid, CONDITION_REGENERATION, 1) == false then
    doCombat(cid, combat, var)
    tempo2 = 0
    while (tempo2 ~= (tempo*1000)) do
        addEvent(magicEffect4, tempo2, tempo2, tempo*1000, cid)
        tempo2 = tempo2 + 1500
    end
    end

   
   

    setPlayerStorageValue(cid, 1500,1) -- storage verifica transformado, quando = 1 player esta transformado.
    setPlayerStorageValue(cid, 5000,1) -- STORAGE LEVEL 200
    doCreatureSay(cid, "Kekkei Genkai!", TALKTYPE_ORANGE_1)
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "( Buff ) activado por "..tempo.." segundos!")
    doSendMagicEffect(position, 130)
    local parameters = { cid = cid, var = var}
   
   
else
doSendMagicEffect(getCreaturePosition(cid), 4)
doCreatureSay(cid, "Kekkei Genkai!", TALKTYPE_ORANGE_1)
    doPlayerSendCancel(cid, "Sorry, you are transformed.")
end
end
There is so much wrong / bad with the code.. that it's hard to help.. xD

But, this should accomplish what you want. (I fixed nothing else.)
Lua:
local tempo = 30
local effect = {500} -- BUFF LEVEL 0-100

local effect2 = {200} --  BUFF LEVEL 200
    
local ml = 10 -- quantos ira aumentar o skill de ML
local skillfist = 0 -- quantos ira aumentar o skill de Fist
local skillsword = 0 -- quantos ira aumentar o skill de Sword
local skillaxe = 10 -- quantos ira aumentar o skill de Axe
local skilldistance = 0 -- quantos ira aumentar o skill de Distance
local health = 0 -- A cada 1 segundo quantos aumentar de vida
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0)
    
local condition = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(condition, CONDITION_PARAM_TICKS, tempo*1000)
setConditionParam(condition, CONDITION_PARAM_STAT_MAGICLEVEL, ml)
setConditionParam(condition, CONDITION_PARAM_SKILL_FIST, skillfist)
setConditionParam(condition, CONDITION_PARAM_SKILL_SWORD, skillsword)
setConditionParam(condition, CONDITION_PARAM_SKILL_AXE, skillaxe)
setConditionParam(condition, CONDITION_PARAM_SKILL_CLUB, skillclub)
setConditionParam(condition, CONDITION_PARAM_SKILL_DISTANCE, skilldistance)
setConditionParam(condition, CONDITION_PARAM_SKILL_SHIELD, skillshield)
setConditionParam(condition, CONDITION_PARAM_OUTFIT, outfit)
setCombatCondition(combat, condition)
    
local condition = createConditionObject(CONDITION_REGENERATION)
setConditionParam(condition, CONDITION_PARAM_SUBID, 1)
setConditionParam(condition, CONDITION_PARAM_BUFF, TRUE)
setConditionParam(condition, CONDITION_PARAM_TICKS, tempo*1000)
setConditionParam(condition, CONDITION_PARAM_HEALTHGAIN, health)
setConditionParam(condition, CONDITION_PARAM_HEALTHTICKS, 1000)
setCombatCondition(combat, condition)
        
function magicEffect3(tempo2,tempo3,cid)
    if (isCreature(cid)) then
        if getPlayerStorageValue(cid, 1500) > 0 and getCreatureCondition(cid, CONDITION_REGENERATION, 1) then
            for i=1, #effect do
                local position = {x=getPlayerPosition(cid).x, y=getPlayerPosition(cid).y, z=getPlayerPosition(cid).z}
                doSendMagicEffect(position, effect[i])
                -- parte modificada
                local summons = getCreatureSummons(cid)
                if #summons > 0 then
                    for k = 1, #summons do
                        local pos = getCreaturePosition(summons[k])
                        local positions = {x = pos.x, y = pos.y, z = pos.z}
                        doSendMagicEffect(positions, effect[i])
                    end
                end
                -- fim da parte modificada
            end
        end
    end
end

function magicEffect4(tempo2,tempo3,cid)
    if (isCreature(cid)) then
        if getPlayerStorageValue(cid, 5000) > 0 and getCreatureCondition(cid, CONDITION_REGENERATION, 1) then
            for i=1, #effect2 do
                local position = {x=getPlayerPosition(cid).x, y=getPlayerPosition(cid).y, z=getPlayerPosition(cid).z}
                doSendMagicEffect(position, effect2[i])
                -- parte modificada
                local summons = getCreatureSummons(cid)
                if #summons > 0 then
                    for k = 1, #summons do
                        local pos = getCreaturePosition(summons[k])
                        local positions = {x = pos.x, y = pos.y, z = pos.z}
                        doSendMagicEffect(positions, effect2[i])
                    end
                end
    -- fim da parte modificada
            end
        end
    end
end
                  
function onCastSpell(cid, var)
    local position = {x=getPlayerPosition(cid).x, y=getPlayerPosition(cid).y, z=getPlayerPosition(cid).z}
    if getPlayerStorageValue(cid, 1500) ~= 1 or getCreatureCondition(cid, CONDITION_REGENERATION, 1) == false then
        doCombat(cid, combat, var)
        tempo2 = 0
        while (tempo2 ~= (tempo*1000)) do
            if getPlayerStorageValue(cid, 5000) ~= 1 then
                addEvent(magicEffect3, tempo2, tempo2, tempo*1000, cid)
            else
                addEvent(magicEffect4, tempo2, tempo2, tempo*1000, cid)
            end
            tempo2 = tempo2 + 1500
        end
        
    
        setPlayerStorageValue(cid, 1500,1) -- storage verifica transformado, quando = 1 player esta transformado.
        setPlayerStorageValue(cid, 5000,1) -- STORAGE LEVEL 200
        doCreatureSay(cid, "Kekkei Genkai!", TALKTYPE_ORANGE_1)
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "( Buff ) activado por "..tempo.." segundos!")
        doSendMagicEffect(position, 130)
        local parameters = { cid = cid, var = var}
        
        
    else
        doSendMagicEffect(getCreaturePosition(cid), 4)
        doCreatureSay(cid, "Kekkei Genkai!", TALKTYPE_ORANGE_1)
        doPlayerSendCancel(cid, "Sorry, you are transformed.")
    end
end
 
@Xikini Just what I wanted to do, but how could I put another storage effect, in this case at level 300 another one comes out.

I try to put it like that but it gives me an error.
Code:
 while (tempo2 ~= (tempo*1000)) do
            if getPlayerStorageValue(cid, 5000) ~= 1 then
                addEvent(magicEffect3, tempo2, tempo2, tempo*1000, cid)
            else
                addEvent(magicEffect4, tempo2, tempo2, tempo*1000, cid)
                
            else
            addEvent(magicEffect5, tempo2, tempo2, tempo*1000, cid)
                
                end
            tempo2 = tempo2 + 1500
        end
Lua:
local tempo = 30
local effect = {961} -- BUFF LEVEL 0-100

local effect2 = {646} --  BUFF LEVEL 200
local effect3  = {647} --  BUFF LEVEL 300
    
local ml = 10 -- quantos ira aumentar o skill de ML
local skillfist = 0 -- quantos ira aumentar o skill de Fist
local skillsword = 0 -- quantos ira aumentar o skill de Sword
local skillaxe = 10 -- quantos ira aumentar o skill de Axe
local skilldistance = 0 -- quantos ira aumentar o skill de Distance
local health = 0 -- A cada 1 segundo quantos aumentar de vida
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0)
    
local condition = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(condition, CONDITION_PARAM_TICKS, tempo*1000)
setConditionParam(condition, CONDITION_PARAM_STAT_MAGICLEVEL, ml)
setConditionParam(condition, CONDITION_PARAM_SKILL_FIST, skillfist)
setConditionParam(condition, CONDITION_PARAM_SKILL_SWORD, skillsword)
setConditionParam(condition, CONDITION_PARAM_SKILL_AXE, skillaxe)
setConditionParam(condition, CONDITION_PARAM_SKILL_CLUB, skillclub)
setConditionParam(condition, CONDITION_PARAM_SKILL_DISTANCE, skilldistance)
setConditionParam(condition, CONDITION_PARAM_SKILL_SHIELD, skillshield)
setConditionParam(condition, CONDITION_PARAM_OUTFIT, outfit)
setCombatCondition(combat, condition)
    
local condition = createConditionObject(CONDITION_REGENERATION)
setConditionParam(condition, CONDITION_PARAM_SUBID, 1)
setConditionParam(condition, CONDITION_PARAM_BUFF, TRUE)
setConditionParam(condition, CONDITION_PARAM_TICKS, tempo*1000)
setConditionParam(condition, CONDITION_PARAM_HEALTHGAIN, health)
setConditionParam(condition, CONDITION_PARAM_HEALTHTICKS, 1000)
setCombatCondition(combat, condition)
        
function magicEffect3(tempo2,tempo3,cid)
    if (isCreature(cid)) then
        if getPlayerStorageValue(cid, 1500) > 0 and getCreatureCondition(cid, CONDITION_REGENERATION, 1) then
            for i=1, #effect do
                local position = {x=getPlayerPosition(cid).x+1, y=getPlayerPosition(cid).y, z=getPlayerPosition(cid).z}
                doSendMagicEffect(position, effect[i])
                -- parte modificada
                local summons = getCreatureSummons(cid)
                if #summons > 0 then
                    for k = 1, #summons do
                        local pos = getCreaturePosition(summons[k])
                        local positions = {x = pos.x, y = pos.y, z = pos.z}
                        doSendMagicEffect(positions, effect[i])
                    end
                end
                -- fim da parte modificada
            end
        end
    end
end

function magicEffect4(tempo2,tempo3,cid)
    if (isCreature(cid)) then
        if getPlayerStorageValue(cid, 5000) > 0 and getCreatureCondition(cid, CONDITION_REGENERATION, 1) then
            for i=1, #effect2 do
                local position = {x=getPlayerPosition(cid).x+1, y=getPlayerPosition(cid).y, z=getPlayerPosition(cid).z}
                doSendMagicEffect(position, effect2[i])
                -- parte modificada
                local summons = getCreatureSummons(cid)
                if #summons > 0 then
                    for k = 1, #summons do
                        local pos = getCreaturePosition(summons[k])
                        local positions = {x = pos.x, y = pos.y, z = pos.z}
                        doSendMagicEffect(positions, effect2[i])
                    end
                end
    -- fim da parte modificada
            end
        end
    end
end

function magicEffect5(tempo2,tempo3,cid)
    if (isCreature(cid)) then
        if getPlayerStorageValue(cid, 5002) > 0 and getCreatureCondition(cid, CONDITION_REGENERATION, 1) then
            for i=1, #effect3 do
                local position = {x=getPlayerPosition(cid).x+1, y=getPlayerPosition(cid).y, z=getPlayerPosition(cid).z}
                doSendMagicEffect(position, effect3[i])
                -- parte modificada
                local summons = getCreatureSummons(cid)
                if #summons > 0 then
                    for k = 1, #summons do
                        local pos = getCreaturePosition(summons[k])
                        local positions = {x = pos.x, y = pos.y, z = pos.z}
                        doSendMagicEffect(positions, effect3[i])
                    end
                end
    -- fim da parte modificada
            end
        end
    end
end
                  
function onCastSpell(cid, var)
    local position = {x=getPlayerPosition(cid).x, y=getPlayerPosition(cid).y, z=getPlayerPosition(cid).z}
    if getPlayerStorageValue(cid, 1500) ~= 1 or getCreatureCondition(cid, CONDITION_REGENERATION, 1) == false then
        doCombat(cid, combat, var)
        tempo2 = 0
        while (tempo2 ~= (tempo*1000)) do
            if getPlayerStorageValue(cid, 5000) ~= 1 then
                addEvent(magicEffect3, tempo2, tempo2, tempo*1000, cid)
            else
                addEvent(magicEffect4, tempo2, tempo2, tempo*1000, cid)
                
            else
            addEvent(magicEffect5, tempo2, tempo2, tempo*1000, cid)
                
                end
            tempo2 = tempo2 + 1500
        end
        
    
        setPlayerStorageValue(cid, 1500,1) -- storage verifica transformado, quando = 1 player esta transformado.
        setPlayerStorageValue(cid, 5000,1) -- STORAGE LEVEL 200
        setPlayerStorageValue(cid, 5002,1) -- STORAGE LEVEL 300
        doCreatureSay(cid, "Kekkei Genkai!", TALKTYPE_ORANGE_1)
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "( Buff ) activado por "..tempo.." segundos!")
        doSendMagicEffect(position, 130)
        local parameters = { cid = cid, var = var}
        
        
    else
        doSendMagicEffect(getCreaturePosition(cid), 4)
        doCreatureSay(cid, "Kekkei Genkai!", TALKTYPE_ORANGE_1)
        doPlayerSendCancel(cid, "Sorry, you are transformed.")
    end
end
 
@Xikini Just what I wanted to do, but how could I put another storage effect, in this case at level 300 another one comes out.

I try to put it like that but it gives me an error.
Code:
 while (tempo2 ~= (tempo*1000)) do
            if getPlayerStorageValue(cid, 5000) ~= 1 then
                addEvent(magicEffect3, tempo2, tempo2, tempo*1000, cid)
            else
                addEvent(magicEffect4, tempo2, tempo2, tempo*1000, cid)
               
            else
            addEvent(magicEffect5, tempo2, tempo2, tempo*1000, cid)
               
                end
            tempo2 = tempo2 + 1500
        end
Lua:
local tempo = 30
local effect = {961} -- BUFF LEVEL 0-100

local effect2 = {646} --  BUFF LEVEL 200
local effect3  = {647} --  BUFF LEVEL 300
   
local ml = 10 -- quantos ira aumentar o skill de ML
local skillfist = 0 -- quantos ira aumentar o skill de Fist
local skillsword = 0 -- quantos ira aumentar o skill de Sword
local skillaxe = 10 -- quantos ira aumentar o skill de Axe
local skilldistance = 0 -- quantos ira aumentar o skill de Distance
local health = 0 -- A cada 1 segundo quantos aumentar de vida
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0)
   
local condition = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(condition, CONDITION_PARAM_TICKS, tempo*1000)
setConditionParam(condition, CONDITION_PARAM_STAT_MAGICLEVEL, ml)
setConditionParam(condition, CONDITION_PARAM_SKILL_FIST, skillfist)
setConditionParam(condition, CONDITION_PARAM_SKILL_SWORD, skillsword)
setConditionParam(condition, CONDITION_PARAM_SKILL_AXE, skillaxe)
setConditionParam(condition, CONDITION_PARAM_SKILL_CLUB, skillclub)
setConditionParam(condition, CONDITION_PARAM_SKILL_DISTANCE, skilldistance)
setConditionParam(condition, CONDITION_PARAM_SKILL_SHIELD, skillshield)
setConditionParam(condition, CONDITION_PARAM_OUTFIT, outfit)
setCombatCondition(combat, condition)
   
local condition = createConditionObject(CONDITION_REGENERATION)
setConditionParam(condition, CONDITION_PARAM_SUBID, 1)
setConditionParam(condition, CONDITION_PARAM_BUFF, TRUE)
setConditionParam(condition, CONDITION_PARAM_TICKS, tempo*1000)
setConditionParam(condition, CONDITION_PARAM_HEALTHGAIN, health)
setConditionParam(condition, CONDITION_PARAM_HEALTHTICKS, 1000)
setCombatCondition(combat, condition)
       
function magicEffect3(tempo2,tempo3,cid)
    if (isCreature(cid)) then
        if getPlayerStorageValue(cid, 1500) > 0 and getCreatureCondition(cid, CONDITION_REGENERATION, 1) then
            for i=1, #effect do
                local position = {x=getPlayerPosition(cid).x+1, y=getPlayerPosition(cid).y, z=getPlayerPosition(cid).z}
                doSendMagicEffect(position, effect[i])
                -- parte modificada
                local summons = getCreatureSummons(cid)
                if #summons > 0 then
                    for k = 1, #summons do
                        local pos = getCreaturePosition(summons[k])
                        local positions = {x = pos.x, y = pos.y, z = pos.z}
                        doSendMagicEffect(positions, effect[i])
                    end
                end
                -- fim da parte modificada
            end
        end
    end
end

function magicEffect4(tempo2,tempo3,cid)
    if (isCreature(cid)) then
        if getPlayerStorageValue(cid, 5000) > 0 and getCreatureCondition(cid, CONDITION_REGENERATION, 1) then
            for i=1, #effect2 do
                local position = {x=getPlayerPosition(cid).x+1, y=getPlayerPosition(cid).y, z=getPlayerPosition(cid).z}
                doSendMagicEffect(position, effect2[i])
                -- parte modificada
                local summons = getCreatureSummons(cid)
                if #summons > 0 then
                    for k = 1, #summons do
                        local pos = getCreaturePosition(summons[k])
                        local positions = {x = pos.x, y = pos.y, z = pos.z}
                        doSendMagicEffect(positions, effect2[i])
                    end
                end
    -- fim da parte modificada
            end
        end
    end
end

function magicEffect5(tempo2,tempo3,cid)
    if (isCreature(cid)) then
        if getPlayerStorageValue(cid, 5002) > 0 and getCreatureCondition(cid, CONDITION_REGENERATION, 1) then
            for i=1, #effect3 do
                local position = {x=getPlayerPosition(cid).x+1, y=getPlayerPosition(cid).y, z=getPlayerPosition(cid).z}
                doSendMagicEffect(position, effect3[i])
                -- parte modificada
                local summons = getCreatureSummons(cid)
                if #summons > 0 then
                    for k = 1, #summons do
                        local pos = getCreaturePosition(summons[k])
                        local positions = {x = pos.x, y = pos.y, z = pos.z}
                        doSendMagicEffect(positions, effect3[i])
                    end
                end
    -- fim da parte modificada
            end
        end
    end
end
                 
function onCastSpell(cid, var)
    local position = {x=getPlayerPosition(cid).x, y=getPlayerPosition(cid).y, z=getPlayerPosition(cid).z}
    if getPlayerStorageValue(cid, 1500) ~= 1 or getCreatureCondition(cid, CONDITION_REGENERATION, 1) == false then
        doCombat(cid, combat, var)
        tempo2 = 0
        while (tempo2 ~= (tempo*1000)) do
            if getPlayerStorageValue(cid, 5000) ~= 1 then
                addEvent(magicEffect3, tempo2, tempo2, tempo*1000, cid)
            else
                addEvent(magicEffect4, tempo2, tempo2, tempo*1000, cid)
               
            else
            addEvent(magicEffect5, tempo2, tempo2, tempo*1000, cid)
               
                end
            tempo2 = tempo2 + 1500
        end
       
   
        setPlayerStorageValue(cid, 1500,1) -- storage verifica transformado, quando = 1 player esta transformado.
        setPlayerStorageValue(cid, 5000,1) -- STORAGE LEVEL 200
        setPlayerStorageValue(cid, 5002,1) -- STORAGE LEVEL 300
        doCreatureSay(cid, "Kekkei Genkai!", TALKTYPE_ORANGE_1)
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "( Buff ) activado por "..tempo.." segundos!")
        doSendMagicEffect(position, 130)
        local parameters = { cid = cid, var = var}
       
       
    else
        doSendMagicEffect(getCreaturePosition(cid), 4)
        doCreatureSay(cid, "Kekkei Genkai!", TALKTYPE_ORANGE_1)
        doPlayerSendCancel(cid, "Sorry, you are transformed.")
    end
end
you gotta stop giving them storages in the spell script. xD

Only give them the storage in the onAdvance script.
Lua:
local tempo = 30
local effect = {961} -- BUFF LEVEL 0-100

local effect2 = {646} --  BUFF LEVEL 200
local effect3  = {647} --  BUFF LEVEL 300
    
local ml = 10 -- quantos ira aumentar o skill de ML
local skillfist = 0 -- quantos ira aumentar o skill de Fist
local skillsword = 0 -- quantos ira aumentar o skill de Sword
local skillaxe = 10 -- quantos ira aumentar o skill de Axe
local skilldistance = 0 -- quantos ira aumentar o skill de Distance
local health = 0 -- A cada 1 segundo quantos aumentar de vida
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0)
    
local condition = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(condition, CONDITION_PARAM_TICKS, tempo*1000)
setConditionParam(condition, CONDITION_PARAM_STAT_MAGICLEVEL, ml)
setConditionParam(condition, CONDITION_PARAM_SKILL_FIST, skillfist)
setConditionParam(condition, CONDITION_PARAM_SKILL_SWORD, skillsword)
setConditionParam(condition, CONDITION_PARAM_SKILL_AXE, skillaxe)
setConditionParam(condition, CONDITION_PARAM_SKILL_CLUB, skillclub)
setConditionParam(condition, CONDITION_PARAM_SKILL_DISTANCE, skilldistance)
setConditionParam(condition, CONDITION_PARAM_SKILL_SHIELD, skillshield)
setConditionParam(condition, CONDITION_PARAM_OUTFIT, outfit)
setCombatCondition(combat, condition)
    
local condition = createConditionObject(CONDITION_REGENERATION)
setConditionParam(condition, CONDITION_PARAM_SUBID, 1)
setConditionParam(condition, CONDITION_PARAM_BUFF, TRUE)
setConditionParam(condition, CONDITION_PARAM_TICKS, tempo*1000)
setConditionParam(condition, CONDITION_PARAM_HEALTHGAIN, health)
setConditionParam(condition, CONDITION_PARAM_HEALTHTICKS, 1000)
setCombatCondition(combat, condition)
        
function magicEffect3(tempo2,tempo3,cid)
    if (isCreature(cid)) then
        if getPlayerStorageValue(cid, 1500) > 0 and getCreatureCondition(cid, CONDITION_REGENERATION, 1) then
            for i=1, #effect do
                local position = {x=getPlayerPosition(cid).x+1, y=getPlayerPosition(cid).y, z=getPlayerPosition(cid).z}
                doSendMagicEffect(position, effect[i])
                -- parte modificada
                local summons = getCreatureSummons(cid)
                if #summons > 0 then
                    for k = 1, #summons do
                        local pos = getCreaturePosition(summons[k])
                        local positions = {x = pos.x, y = pos.y, z = pos.z}
                        doSendMagicEffect(positions, effect[i])
                    end
                end
                -- fim da parte modificada
            end
        end
    end
end

function magicEffect4(tempo2,tempo3,cid)
    if (isCreature(cid)) then
        if getPlayerStorageValue(cid, 5000) > 0 and getCreatureCondition(cid, CONDITION_REGENERATION, 1) then
            for i=1, #effect2 do
                local position = {x=getPlayerPosition(cid).x+1, y=getPlayerPosition(cid).y, z=getPlayerPosition(cid).z}
                doSendMagicEffect(position, effect2[i])
                -- parte modificada
                local summons = getCreatureSummons(cid)
                if #summons > 0 then
                    for k = 1, #summons do
                        local pos = getCreaturePosition(summons[k])
                        local positions = {x = pos.x, y = pos.y, z = pos.z}
                        doSendMagicEffect(positions, effect2[i])
                    end
                end
    -- fim da parte modificada
            end
        end
    end
end

function magicEffect5(tempo2,tempo3,cid)
    if (isCreature(cid)) then
        if getPlayerStorageValue(cid, 5002) > 0 and getCreatureCondition(cid, CONDITION_REGENERATION, 1) then
            for i=1, #effect3 do
                local position = {x=getPlayerPosition(cid).x+1, y=getPlayerPosition(cid).y, z=getPlayerPosition(cid).z}
                doSendMagicEffect(position, effect3[i])
                -- parte modificada
                local summons = getCreatureSummons(cid)
                if #summons > 0 then
                    for k = 1, #summons do
                        local pos = getCreaturePosition(summons[k])
                        local positions = {x = pos.x, y = pos.y, z = pos.z}
                        doSendMagicEffect(positions, effect3[i])
                    end
                end
    -- fim da parte modificada
            end
        end
    end
end
                  
function onCastSpell(cid, var)
    local position = {x=getPlayerPosition(cid).x, y=getPlayerPosition(cid).y, z=getPlayerPosition(cid).z}
    if getPlayerStorageValue(cid, 1500) ~= 1 or getCreatureCondition(cid, CONDITION_REGENERATION, 1) == false then
        doCombat(cid, combat, var)
        tempo2 = 0
        while (tempo2 ~= (tempo*1000)) do
        
            -- put highest level to lowest level
            
            if getPlayerStorageValue(cid, 5002) ~= -1 then -- 300
                addEvent(magicEffect5, tempo2, tempo2, tempo*1000, cid)
                
            elseif getPlayerStorageValue(cid, 5000) ~= -1 then -- 200
                addEvent(magicEffect4, tempo2, tempo2, tempo*1000, cid)
                
            else -- this means if none of the other levels have been achieved, do the level 0-199 effect
                addEvent(magicEffect3, tempo2, tempo2, tempo*1000, cid)
                
            end
            tempo2 = tempo2 + 1500
        end
        
        --[[
        
        stop giving them storages in the spell! xD
        If you set the storage inside the spell, level 0-199 will instantly have level 300 effect
        
        setPlayerStorageValue(cid, 1500,1) -- storage verifica transformado, quando = 1 player esta transformado.
        setPlayerStorageValue(cid, 5000,1) -- STORAGE LEVEL 200
        setPlayerStorageValue(cid, 5002,1) -- STORAGE LEVEL 300
        
        --]]
        doCreatureSay(cid, "Kekkei Genkai!", TALKTYPE_ORANGE_1)
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "( Buff ) activado por "..tempo.." segundos!")
        doSendMagicEffect(position, 130)
        local parameters = { cid = cid, var = var}
        
        
    else
        doSendMagicEffect(getCreaturePosition(cid), 4)
        doCreatureSay(cid, "Kekkei Genkai!", TALKTYPE_ORANGE_1)
        doPlayerSendCancel(cid, "Sorry, you are transformed.")
    end
end
 
@Xikini
Thank you very much, I had another idea that each effect has a different level of magic, for example the base effect gives me 10 levels of magic, and when it reaches level 200 that would be another effect of 20 levels of magic.

I do not know if I explain myself, I made another post about something similar.
 
Back
Top