Caduceus
Unknown Member
- Joined
- May 10, 2010
- Messages
- 321
- Solutions
- 2
- Reaction score
- 24
Server Version: 1.2
Action Script's purpose is to award 2x experience on use. This issue is not the award experience, but the
Condition(CONDITION_LIGHT). I have posted below the error given within consol.
Action Script's purpose is to award 2x experience on use. This issue is not the award experience, but the
Condition(CONDITION_LIGHT). I have posted below the error given within consol.
Code:
Lua Script Error: [Action Interface]
data/actions/scripts/custom/expboost.lua:onUse
data/actions/scripts/custom/expboost.lua:13: attempt to call method 'setCondition' (a nil value)
stack traceback:
[C]: in function 'setCondition'
data/actions/scripts/custom/expboost.lua:13: in function <data/actions/scripts/custom/expboost.lua:1>
Lua Script Error: [Action Interface]
data/actions/scripts/custom/expboost.lua:onUse
data/actions/scripts/custom/expboost.lua:13: attempt to call method 'setCondition' (a nil value)
stack traceback:
[C]: in function 'setCondition'
data/actions/scripts/custom/expboost.lua:13: in function <data/actions/scripts/custom/expboost.lua:1>
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local player = Player(cid)
if player:getStorageValue(1234) >= os.time() then
player:say('You already have double exp!', TALKTYPE_MONSTER_SAY)
return true
end
--Trying to set an ambient light to player for 2 hours
local condition = Condition(CONDITION_LIGHT)
condition:setParameter(CONDITION_PARAM_LIGHT_LEVEL, 4)
condition:setParameter(CONDITION_PARAM_LIGHT_COLOR, 22)
condition:setParameter(CONDITION_PARAM_TICKS, (2 * 60 * 60) * 1000)
combat:setCondition(condition)
player:setStorageValue(1234, os.time() + 7200)
Item(item.uid):remove(1)
player:say('Your 2 hours of double XP has started!', TALKTYPE_MONSTER_SAY)
return true
end
function Player:onGainExperience(source, exp, rawExp)
if self:getStorageValue(1234) >= os.time() then
exp = exp * 2
end
return exp
end
Last edited: