• 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
131
Reaction score
19
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
 
Solution
F
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...
Friday The 13Th GIF by Digg
bro you read this theard to the end ? :O
 
This will add magicspend and also send a message with the remaining time.
(Again untested, so let me know if there are any errors.)
LUA:
local config = {
    tileActionId = 9000,  -- Tile actionId in RME
    exhaustTime = 40,     -- Exhaust time in minutes.
    allowNoneVoc = false    -- Set to true to allow the None(0) vocation
    debugMode = true,     -- Sets exhaustTime to 20 seconds. Change to false in live environment.
    experience = 100000,
 
    addSkills = true,
    skill_types = {SKILL_AXE, SKILL_SWORD, SKILL_CLUB, SKILL_DISTANCE, SKILL_SHIELD, SKILL_FIST},
    skill_tries = 100000,
 
    addMagic = true,
    magic_tries = 100000,
}

--dont edit below

local store = {}

local function removeExhaust(key)
    if store[key] then
        store[key] = nil
    end
    return
end

local gainXpAndSkills = MoveEvent()
function gainXpAndSkills.onStepIn(player, item, position, fromPosition)
 
    --do basic checks
    if not player:isPlayer() or (not config.allowNoneVoc and player:getVocation():getId() == 0) then
        return false
    end
 
    local now = os.time()
    local playerId = player:getGuid()
    local key = ('%d:%d:%d:%d'):format(playerId, position.x, position.y, position.z)
 
    --check for exhaust
    if store[key] then
        player:teleportTo(fromPosition)
        position:sendMagicEffect(CONST_ME_POFF)
        fromPosition:sendMagicEffect(CONST_ME_POFF)
     
        local remainder = store[key] - now
        local hours = floor(remainder / 3600)
        local minutes = floor((remainder % 3600) / 60)
        local seconds = remainder % 60
        local remainderString = ("%02dh:%02dm:%02ds"):format(hours, minutes, seconds)
     
        player:sendTextMessage(MESSAGE_STATUS_SMALL , ('You can use this again in %s'):format(remainderString))
        return true
    end
 
    --add exp
    player:addExperience(config.experience, true)
 
    --add skill tries
    if config.addSkills then
        for _, skill_type in ipairs(config.skill_types) do
            player:addSkillTries(skill_type, config.skill_tries)
        end
    end
 
    --add mana tries
    if config.addMagic then
        player:addManaSpent(config.magic_tries)
    end
 
    --schedule the exhaust removal for the future
    local _exhaustTime = config.debugMode and 20 or (config.exhaustTime * 60)
    addEvent(removeExhaust, _exhaustTime * 1000, key)
 
    store[key] = now + _exhaustTime
    return true
end
gainXpAndSkills:aid(config.tileActionId)
gainXpAndSkills:register()

Showing an effect only visible to a specific player can be very inefficient. There is no "good" way to do it. It would involve checking getSpectators around every position, and then checking that the player doesn't have an exhaust for that position. Only then would you send effect/text message to the tile for only that one spectator(player) to see it. If you are doing this with 100+ positions every 5 seconds, it becomes a waste for such a gimmick...

How can I change this to receive skills every 5 minutes?
Without stepping on the tiles again?
it's about staying where you are and gaining experience and skills over and over again..
 
Back
Top