- Joined
- Dec 26, 2013
- Messages
- 2,124
- Solutions
- 14
- Reaction score
- 1,518
- Location
- USA
- GitHub
- Codinablack
Greetings again Otland. I come asking for help with a new talkaction I was trying to make and release because I need it and I believe many others will find it useful for making custom servers. Anyways I was trying to make a talkaction that creates a condition on the person using it, the condition only being spellcooldown, but also changes which spell id the spell cools you down from the number used as param in the talkaction. Sure it could be buggy if player said something different than a number, but I couldn't even get to that part, first I tried only creating the condition and using doAddCondition() but that didn't work, so then I tried setting the condition to the combat (combat turned out to be nice idea, can give an animation too) and use combat:execute(cid, cid)
but that didn't work... I suspect this is where the problem is, but I don't know how to fix this, anyone got an idea.
when using that, I get this
but that didn't work... I suspect this is where the problem is, but I don't know how to fix this, anyone got an idea.
Code:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_YELLOW_RINGS)
local cooldown = Condition(CONDITION_SPELLCOOLDOWN)
function onSay(cid, words, param)
local player = Player(cid)
local spellid = tonumber(param)
cooldown:setParameter(CONDITION_PARAM_SUBID, spellid)
cooldown:setParameter(CONDITION_PARAM_TICKS, 5000)
combat:setCondition(cooldown)
combat:execute(cid, cid)
-- doAddCondition(cid, cooldown)
return false
end
when using that, I get this
Code:
Lua Script Error: [TalkAction Interface]
data/talkactions/scripts/spellid.lua:onSay
attempt to index a number value
stack traceback:
[C]: at 0x013f3139a0
[C]: in function 'execute'
data/talkactions/scripts/spellid.lua:12: in function <data/talkactions/s
cripts/spellid.lua:6>