• 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+ Creature.lua (issue using trainning dummy)

Patt Marq

New Member
Joined
Jan 2, 2020
Messages
10
Reaction score
3
Location
Mexico
when I run my forgottten server I got this issue

[Warning - Events::load] Can not load script: creature.lua data/events/scripts/creature.lua:11: 'end' expected (to close 'function' at line 9) near 'if'


This is my creature.lua
function Creature:onChangeOutfit(outfit) return true end function Creature:onAreaCombat(tile, isAggressive) return true end function Creature:onTargetCombat(target) return RETURNVALUE_NOERROR if target:getName() == "Trainer" then target:registerEvent("EventDPS") end

How can I solve the error? thanks in advance
 
Solution
Lua:
function Creature:onChangeOutfit(outfit)
    return true
end

function Creature:onAreaCombat(tile, isAggressive)
    return true
end

function Creature:onTargetCombat(target)
            if target:getName() == "Trainer" then
            target:registerEvent("EventDPS")
        return RETURNVALUE_NOERROR
    end
end
Lua:
function Creature:onChangeOutfit(outfit)
    return true
end

function Creature:onAreaCombat(tile, isAggressive)
    return true
end

function Creature:onTargetCombat(target)
            if target:getName() == "Trainer" then
            target:registerEvent("EventDPS")
        return RETURNVALUE_NOERROR
    end
end
 
Solution
Lua:
function Creature:onChangeOutfit(outfit)
    return true
end

function Creature:onAreaCombat(tile, isAggressive)
    return true
end

function Creature:onTargetCombat(target)
            if target:getName() == "Trainer" then
            target:registerEvent("EventDPS")
        return RETURNVALUE_NOERROR
    end
end
it works! ty
 
Back
Top