Hey guys,
I'm sure I can work this one out with a bit more trial and error, but its doing my head in and some help would be appreciated!
Okay so I need a way to forget all known spells in one hit.
This is where I am at so far..
(talkaction for debug purposes)
The server throws the following error:
The script half works at the moment..if ran a few times it will forget all the spells, i'll take another look at it after dinner anyway.
If anyone is able to help in the meantime, thanks!
I'm sure I can work this one out with a bit more trial and error, but its doing my head in and some help would be appreciated!
Okay so I need a way to forget all known spells in one hit.
This is where I am at so far..
(talkaction for debug purposes)
Code:
function onSay(cid, words, param)
local player = Player(cid)
local count = getPlayerInstantSpellCount(cid)
for i = 0, count - 1 do
local spell = getPlayerInstantSpellInfo(cid, i)
if spell.level ~= 0 then
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, spell.name)
player:forgetSpell(spell.name)
end
end
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "success")
return true
end
The server throws the following error:
Code:
Lua Script Error: [TalkAction Interface]
data/talkactions/scripts/debugspells.lua:onSay
LuaScriptInterface::luaGetPlayerInstantSpellInfo(). Spell not found
stack traceback:
[C]: in function 'getPlayerInstantSpellInfo'
data/talkactions/scripts/debugspells.lua:8: in function <data/talkaction
s/scripts/debugspells.lua:1>
Lua Script Error: [TalkAction Interface]
data/talkactions/scripts/debugspells.lua:onSay
data/talkactions/scripts/debugspells.lua:9: attempt to index local 'spell' (a bo
olean value)
stack traceback:
[C]: in function '__index'
data/talkactions/scripts/debugspells.lua:9: in function <data/talkaction
s/scripts/debugspells.lua:1>
The script half works at the moment..if ran a few times it will forget all the spells, i'll take another look at it after dinner anyway.
If anyone is able to help in the meantime, thanks!