• 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!

Lua Can't make this spell work

Athenuz

Owlz!
Joined
Oct 1, 2015
Messages
234
Reaction score
27
Location
México
Hello,

I'm trying to make this spell work:

Code:
local t = 60 * 1000
local v = 10


local combat = Combat()
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN)
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0)

local resist = Condition(CONDITION_ATTRIBUTES)
resist:setParameter(CONDITION_PARAM_BUFF_SPELL, 1)
resist:setParameter(CONDITION_PARAM_SUBID, 101)
resist:setParameter(CONDITION_PARAM_TICKS, t)
player:setStorageValue(5, v)
combat:setCondition(resist)

function onCastSpell(creature, var)
    return combat:execute(creature, var)
end

But i get this error:

RNkknZH.png


Can please someone help me?
 
Code:
player:setStorageValue(5, v)
'player' is undefined. You could do like this:
Code:
function onCastSpell(creature, var)
    if creature:isPlayer() then
        creature:setStorageValue(5, v)
    end
    return combat:execute(creature, var)
end
May I ask what you want to achieve? What would you use the storage value for?
I'm guessing you're making a resistance spell, so you would check the storage in a healthchange event. Am I close?
If that's the case, you can check for the condition, in onHealthChange;
Player:getCondition(CONDITION_ATTRIBUTES, CONDITIONID_COMBAT, 101)
 
Code:
player:setStorageValue(5, v)
'player' is undefined. You could do like this:
Code:
function onCastSpell(creature, var)
    if creature:isPlayer() then
        creature:setStorageValue(5, v)
    end
    return combat:execute(creature, var)
end
May I ask what you want to achieve? What would you use the storage value for?
I'm guessing you're making a resistance spell, so you would check the storage in a healthchange event. Am I close?
If that's the case, you can check for the condition, in onHealthChange;
Player:getCondition(CONDITION_ATTRIBUTES, CONDITIONID_COMBAT, 101)

Yes, using a resistance spell :3

It works, thanks <3
 
Back
Top