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

What im doing wrong on this tile?

Tbol

Well-Known Member
Joined
Apr 7, 2019
Messages
529
Reaction score
56
Why my tile doesnt work? TFS 1.2
Lua:
function onStepIn(cid, item, position)

if isPlayer(cid) == 1 then
doPlayerAddMana(cid,-100)
doPlayerAddHealth(cid,-100)
doPlayerAddSoul(cid,1)
doPlayerAddExp(cid, 10)
doPlayerAddSkillTry(cid,0,10)
        end
    return true
end

XML:
<movevent event="StepIn" itemid="448" script="damage.lua" />
 
Solution
Lua:
function onStepIn(creature, item, position, fromPosition)
    if(creature:isPlayer()) then
        creature:addMana(-100)
        creature:addHealth(-100)
        creature:addSoul(1)
        creature:addExperience(10)
        creature:addSkillTries(0,10)
    end
end

New tfs using class like scriptsystem, so you don't have to call function with creature id as parameter, you just call exacly creature class func.
Why my tile doesnt work? TFS 1.2
Lua:
function onStepIn(cid, item, position)

if isPlayer(cid) == 1 then
doPlayerAddMana(cid,-100)
doPlayerAddHealth(cid,-100)
doPlayerAddSoul(cid,1)
doPlayerAddExp(cid, 10)
doPlayerAddSkillTry(cid,0,10)
        end
    return true
end

XML:
<movevent event="StepIn" itemid="448" script="damage.lua" />
Hello,
Try:
Lua:
function onStepIn(cid, item, position)
local player = Player(cid)
if player then
doPlayerAddMana(player,-100)
doPlayerAddHealth(player,-100)
doPlayerAddSoul(player,1)
doPlayerAddExp(player, 10)
doPlayerAddSkillTry(player,0,10)
end
    return true
end
 
Hello,
Try:
Lua:
function onStepIn(cid, item, position)
local player = Player(cid)
if player then
doPlayerAddMana(player,-100)
doPlayerAddHealth(player,-100)
doPlayerAddSoul(player,1)
doPlayerAddExp(player, 10)
doPlayerAddSkillTry(player,0,10)
end
    return true
end
Okay so now at least it gave attempt to call doPlayerAddHealth so i replaced it with doCreatureAddHealth but now console crashes :D TFS 1.2 8.60
 
Lua:
function onStepIn(creature, item, position, fromPosition)
    if(creature:isPlayer()) then
        creature:addMana(-100)
        creature:addHealth(-100)
        creature:addSoul(1)
        creature:addExperience(10)
        creature:addSkillTries(0,10)
    end
end

New tfs using class like scriptsystem, so you don't have to call function with creature id as parameter, you just call exacly creature class func.
 
Solution
Lua:
function onStepIn(creature, item, position, fromPosition)
    if(creature:isPlayer()) then
        creature:addMana(-100)
        creature:addHealth(-100)
        creature:addSoul(1)
        creature:addExperience(10)
        creature:addSkillTries(0,10)
    end
end

New tfs using class like scriptsystem, so you don't have to call function with creature id as parameter, you just call exacly creature class func.
Hmm it crashes my server. This faking ninja tfs have a some kind of bug in health change or something like that. Any ideas?
 
Back
Top