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

TFS 1.X+ actions onUse

roriscrave

Advanced OT User
Joined
Dec 7, 2011
Messages
1,188
Solutions
34
Reaction score
200
i use tfs 1.2, have an item, like a shovel, that i use-with and after i click on the monster, but i get error

Code:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if target and target:isMonster() then
        print("is monster")
    end
 
    return true
end

Code:
Lua Script Error: [Action Interface]
data/actions/scripts/test.lua:onUse
data/actions/scripts/test.lua:4: attempt to call method 'isMonster' (a nil value)
stack traceback:
        [C]: in function 'isMonster'
        data/actions/script/stest.lua:4: in function <data/actions/scripts/test.lua:3>

If i use isCreature() i dont get error, why i cant check if is monster?
I need to check if target is a monster..
 
Last edited:
Back
Top