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

RevScripts [REQUEST] Specific Tile with gaining experience, skill per minute

Xedoxo

Member
Joined
Oct 24, 2010
Messages
81
Reaction score
7
Hi everyone,

many people have already helped me a lot here, for which I am very grateful. Doesnt know what prefix should i choose
I wonder if there is any ready-made script that would ensure receiving XP/SKILL per minute for staying at specific tile (x/y/z pos).
Gaining SKILL on the basis of as if the character was training i.e. she was attacking e.g. monk all the time depends skill rate. Same with experience.
It is possible to do? If somebody ask - Nekiro TFS 1.5 8.0
 
Lua:
local pos = {x = 2918, y = 3120, z = 6} -- Coordinates where players need to be
local xp_per_minute = 1000 -- Replace with the amount of XP you want to give per minute
local skill_types = {SKILL_AXE, SKILL_SWORD, SKILL_CLUB, SKILL_DISTANCE, SKILL_SHIELD, SKILL_FIST} -- Types of skills you want to increase
local skill_rate = 10000000000000 -- Rate at which to increase the skills
local interval = 60 -- Interval in seconds (1 minute)

local gainXpAndSkill = GlobalEvent("gainXpAndSkill")

function gainXpAndSkill.onThink(interval, lastExecution)
    local players = Game.getPlayers()
    for _, player in ipairs(players) do
        if player:getPosition().x == pos.x and player:getPosition().y == pos.y and player:getPosition().z == pos.z then
            player:addExperience(xp_per_minute, true) -- Add experience to the player
            for _, skill_type in ipairs(skill_types) do
                player:addSkillTries(skill_type, skill_rate) -- Increase the player's skill for each skill type
            end
        end
    end
    return true
end

gainXpAndSkill:interval(interval * 1000) -- Convert seconds to milliseconds
gainXpAndSkill:register() -- Register the global event
 
Last edited:
Lua:
local positions = {
    {x = 2918, y = 3120, z = 6},
    {x = 2917, y = 3120, z = 6},
    {x = 2919, y = 3120, z = 6} -- Add more positions as needed
}

local xp_per_minute = 100000 -- Replace with the amount of XP you want to give per minute
local skill_types = {SKILL_AXE, SKILL_SWORD, SKILL_CLUB, SKILL_DISTANCE, SKILL_SHIELD, SKILL_FIST} -- Types of skills you want to increase
local skill_rate = 100000 -- Rate at which to increase the skills
local interval = 60 -- Interval in seconds (1 minute)

local gainXpAndSkill = GlobalEvent("gainXpAndSkill")

function gainXpAndSkill.onThink(interval, lastExecution)
    local players = Game.getPlayers()
    for _, player in ipairs(players) do
        for _, pos in ipairs(positions) do
            if player:getPosition().x == pos.x and player:getPosition().y == pos.y and player:getPosition().z == pos.z then
                player:addExperience(xp_per_minute, true) -- Add experience to the player
                for _, skill_type in ipairs(skill_types) do
                    player:addSkillTries(skill_type, skill_rate) -- Increase the player's skill for each skill type
                end
                break -- Exit the loop once a match is found
            end
        end
    end
    return true
end

gainXpAndSkill:interval(interval * 1000) -- Convert seconds to milliseconds
gainXpAndSkill:register() -- Register the global event
Here you can select more than one tile (x/y/z pos)
You must respond and explain if the script works well and report that it has been solved
 
Lua:
local positions = {
    {x = 2918, y = 3120, z = 6},
    {x = 2917, y = 3120, z = 6},
    {x = 2919, y = 3120, z = 6} -- Add more positions as needed
}

local xp_per_minute = 100000 -- Replace with the amount of XP you want to give per minute
local skill_types = {SKILL_AXE, SKILL_SWORD, SKILL_CLUB, SKILL_DISTANCE, SKILL_SHIELD, SKILL_FIST} -- Types of skills you want to increase
local skill_rate = 100000 -- Rate at which to increase the skills
local interval = 60 -- Interval in seconds (1 minute)

local gainXpAndSkill = GlobalEvent("gainXpAndSkill")

function gainXpAndSkill.onThink(interval, lastExecution)
    local players = Game.getPlayers()
    for _, player in ipairs(players) do
        for _, pos in ipairs(positions) do
            if player:getPosition().x == pos.x and player:getPosition().y == pos.y and player:getPosition().z == pos.z then
                player:addExperience(xp_per_minute, true) -- Add experience to the player
                for _, skill_type in ipairs(skill_types) do
                    player:addSkillTries(skill_type, skill_rate) -- Increase the player's skill for each skill type
                end
                break -- Exit the loop once a match is found
            end
        end
    end
    return true
end

gainXpAndSkill:interval(interval * 1000) -- Convert seconds to milliseconds
gainXpAndSkill:register() -- Register the global event
Here you can select more than one tile (x/y/z pos)
You must respond and explain if the script works well and report that it has been solved
There is no need to loop through Game.getPlayers()... and the more players online, the more inefficient your script becomes.

Just loop through the positions, get the Tile and loop through tile:getCreatures() and then check if its a player, and add exp, skills.
Lua:
local positions = {
    {x = 2918, y = 3120, z = 6},
    {x = 2917, y = 3120, z = 6},
    {x = 2919, y = 3120, z = 6} -- Add more positions as needed
}

local xp_per_minute = 100000 -- Replace with the amount of XP you want to give per minute
local skill_types = {SKILL_AXE, SKILL_SWORD, SKILL_CLUB, SKILL_DISTANCE, SKILL_SHIELD, SKILL_FIST} -- Types of skills you want to increase
local skill_rate = 100000 -- Rate at which to increase the skills
local interval = 60 -- Interval in seconds (1 minute)

local gainXpAndSkill = GlobalEvent("gainXpAndSkill")

function gainXpAndSkill.onThink(interval, lastExecution)
    for _, pos in ipairs(positions) do
        local tile = Tile(position)
        if tile then
            local creatures = tile:getCreatures()
            if creatures then
                for __, player in ipairs(creatures) do
                    if player:isPlayer() then
                        player:addExperience(xp_per_minute, true) -- Add experience to the player
                        for ___, skill_type in ipairs(skill_types) do
                            player:addSkillTries(skill_type, skill_rate) -- Increase the player's skill for each skill type
                        end
                    end
                end
            end
        end
    end
    return true
end

gainXpAndSkill:interval(interval * 1000) -- Convert seconds to milliseconds
gainXpAndSkill:register() -- Register the global event
 
Last edited:
Back
Top