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

Lua [TFS 0.4] Addskill tile

ausirosiris

New Member
Joined
May 23, 2020
Messages
57
Reaction score
2
need a very basic and simple script for a ground tile that adds SKILL__MAGLEVEL tries each 2 seconds while you on it.
 
I quickly edited your title; please choose a better title next time instead of just writing your TFS version.
Describe your problem in the title. A title that doesn’t describe the content of the thread is seen as an invalid title.
 
need a very basic and simple script for a ground tile that adds SKILL__MAGLEVEL tries each 2 seconds while you on it.
Just setup an actionId on the tile

Lua:
local manaSpentAmount = 100

local trainingCreatures = {}

local function giveMagicTrainingOverTime(cid, lastKnownTraining)
    if not isPlayer(cid) then
        trainingCreatures[cid] = nil
        return
    end
    if not trainingCreatures[cid] or trainingCreatures[cid] != lastKnownTraining then
        return
    end
    trainingCreatures[cid] = trainingCreatures[cid] + 1
    if trainingCreatures[cid] % 20 == 0 then
        doPlayerAddSpentMana(cid, manaSpentAmount)
    end
    addEvent(giveMagicTrainingOverTime, 100, cid, lastKnownTraining + 1)
end


function onStepIn(cid, item, frompos, itemEx, topos)
    if not isPlayer(cid) then
        return true
    end
    trainingCreatures[cid] = 0
    giveMagicTrainingOverTime(cid, 0)
    return true
end


function onStepOut(cid, item, frompos, itemEx, topos)
    if not isPlayer(cid) then
        return true
    end
    trainingCreatures[cid] = nil
    return true
end
 
Last edited:
Back
Top