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

[REQUEST] Training Monk tiles give faster skill gain rates.

FenX

Advanced OT User
Joined
Jul 8, 2019
Messages
360
Solutions
1
Reaction score
159
Hi,

Project:
OT-ServBR

Request description:
I am looking for a way to make tiles in the training room increase the player's skill gain rate (that includes all combat skills) while training as for example, there will be 2 sections to the training monks, standard & advanced.
I presume this is possible with a movement script where tile of ActionID xxxx will increase skill gain rate when stood on it?
However, I'm quite dead awful at scripting so I would like to request this kind of script from anybody that is able to do it.

I'm still learning to script so I apologise.

Would be greatly appreciated,

Thanks!
 
Solution
Hi,

Project: OT-ServBR

Request description:
I am looking for a way to make tiles in the training room increase the player's skill gain rate (that includes all combat skills) while training as for example, there will be 2 sections to the training monks, standard & advanced.
I presume this is possible with a movement script where tile of ActionID xxxx will increase skill gain rate when stood on it?
However, I'm quite dead awful at scripting so I would like to request this kind of script from anybody that is able to do it.

I'm still learning to script so I apologise.

Would be greatly appreciated,

Thanks!
Assuming you are using TFS 1.X this is what I would suggest:

data/events/scripts/player.lua -->...
Hi,

Project: OT-ServBR

Request description:
I am looking for a way to make tiles in the training room increase the player's skill gain rate (that includes all combat skills) while training as for example, there will be 2 sections to the training monks, standard & advanced.
I presume this is possible with a movement script where tile of ActionID xxxx will increase skill gain rate when stood on it?
However, I'm quite dead awful at scripting so I would like to request this kind of script from anybody that is able to do it.

I'm still learning to script so I apologise.

Would be greatly appreciated,

Thanks!
Assuming you are using TFS 1.X this is what I would suggest:

data/events/scripts/player.lua --> find the following function and edit it to this:
Lua:
function Player:onGainSkillTries(skill, tries)
    if APPLY_SKILL_MULTIPLIER == false then
        return tries
    end

    -- Training Room Tile
    local tile = self:getTile()
    local ground = tile and tile:getGround()
    if ground and ground.actionid == 9000 then -- change 9000 to whatever action id you set the tiles to
        tries = math.floor(tries * 2) -- example: 2x skill rate
    end

    if skill == SKILL_MAGLEVEL then
        return tries * configManager.getNumber(configKeys.RATE_MAGIC)
    end
    return tries * configManager.getNumber(configKeys.RATE_SKILL)
end

Note that if you do not want magic level to be affected by the multiplier than just move my section of code below the if ... end statement that includes SKILL_MAGLEVEL.

Alternatively you could use an onStepIn and onStepOut event as you suggested registered to the action id which sets a player storage then make edit within this onGainSkillTries function to check if the storage value is set and if so then multiplier the tries just as I did here.
 
Solution
Assuming you are using TFS 1.X this is what I would suggest:

data/events/scripts/player.lua --> find the following function and edit it to this:
Lua:
function Player:onGainSkillTries(skill, tries)
    if APPLY_SKILL_MULTIPLIER == false then
        return tries
    end

    -- Training Room Tile
    local tile = self:getTile()
    local ground = tile and tile:getGround()
    if ground and ground.actionid == 9000 then -- change 9000 to whatever action id you set the tiles to
        tries = math.floor(tries * 2) -- example: 2x skill rate
    end

    if skill == SKILL_MAGLEVEL then
        return tries * configManager.getNumber(configKeys.RATE_MAGIC)
    end
    return tries * configManager.getNumber(configKeys.RATE_SKILL)
end

Note that if you do not want magic level to be affected by the multiplier than just move my section of code below the if ... end statement that includes SKILL_MAGLEVEL.

Alternatively you could use an onStepIn and onStepOut event as you suggested registered to the action id which sets a player storage then make edit within this onGainSkillTries function to check if the storage value is set and if so then multiplier the tries just as I did here.

It would all be perfect but I've got an issue that whenever I try to step onto the tile I get the message '11:47 The tile seems to be protected against unwanted intruders.'. I already checked if the actionid I put in the script isn't being used by something else and it isn't, just to even test it again I used a random unused actionid and I still get the same message.

Edit: I just realised the issue was with the fact that I am putting an actionid onto a "glowing switch" tile which is the reason for that. Is there anyway that I can work around that? I want the tiles to remain glowing switches.

It works perfectly otherwise, so thank you for that.
 
Last edited:
It would all be perfect but I've got an issue that whenever I try to step onto the tile I get the message '11:47 The tile seems to be protected against unwanted intruders.'. I already checked if the actionid I put in the script isn't being used by something else and it isn't, just to even test it again I used a random unused actionid and I still get the same message.

Edit: I just realised the issue was with the fact that I am putting an actionid onto a "glowing switch" tile which is the reason for that. Is there anyway that I can work around that? I want the tiles to remain glowing switches.

It works perfectly otherwise, so thank you for that.
You can either use an action id less than 1000 or you can edit this line:

To something like this:
Code:
if item.actionid >= 1000 and item.actionid ~= 9000 then
And change 9000 to whatever you have you action id set to.
 
You can either use an action id less than 1000 or you can edit this line:

To something like this:
Code:
if item.actionid >= 1000 and item.actionid ~= 9000 then
And change 9000 to whatever you have you action id set to.

That's exactly what I thought of doing, I just couldn't find tiles.lua in data/movements, it was in a random folder in the movements folder.

All sorted, thank you to both.
 
Back
Top