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

TFS 1.X+ Monster Experience in Look

Fabi Marzan

Well-Known Member
Joined
Aug 31, 2020
Messages
135
Solutions
6
Reaction score
67
I use TFS 1.5

Good, I had thought about how to make a script that when you take a look at the monster it shows you the experience that it is going to give you.

Something like an example, using the (MonsterType("name of monster"):experience())

This scripts is an example, it doesn't work for what I want.

Lua:
function Player:onLook(thing, position, distance)
    if thing:isMonster() then
    local description = ""
        description = string.format("%s\nEXP: %d", description, thing:getType():getExperience())
    self:sendTextMessage(MESSAGE_INFO_DESCR, description)
 end
end

But I really want you to show me the real experience that it will give me, depending on the stage

So it would look like:

Experience: XXXX for your level.
 
Last edited:
Solution
E
no, I mean this:

thing:getType():getExperience() * Game.getExperienceStage(self:getLevel())

:D
try multiplying it by Game.getExperienceStage(self:getLevel())
Do you mean to put it like this?

Lua:
if thing:isCreature() then
    if thing:isMonster() then
    --description = string.format("%s\nEXP: %d", description, thing:getType():getExperience())
    description = string.format("%s\nExperience: "..Game.getExperienceStage(self:getLevel()), description)
    end
end

It only marks the stage that I have in config.lua, and not the experience that it will give me.
 
no, I mean this:

thing:getType():getExperience() * Game.getExperienceStage(self:getLevel())

:D
When I look at the rat, it tells me 2000 experience.

But killing her actually gives me 3000, any reason?

In the same way that the cyclops says 60,000 and when I kill it it gives me 90,000

This would be the complete scripts:

Lua:
if thing:isCreature() then
    if thing:isMonster() then
    description = string.format("%s\nExperience: %d", description, thing:getType():getExperience() * Game.getExperienceStage(self:getLevel()))
    end
end
 
I'm guessing you are premium and have 'happy hour' experience available, giving you the 1.5x experience.

Lua:
if thing:isCreature() then
    if thing:isMonster() then
        local exp = thing:getType():getExperience() -- get monster experience
        exp = exp * Game.getExperienceStage(self:getLevel()) -- apply experience stage multiplier
        if configManager.getBoolean(configKeys.STAMINA_SYSTEM) then -- check if stamina system is active on the server
            local staminaMinutes = self:getStamina()
            if staminaMinutes > 2340 and self:isPremium() then -- 'happy hour' check
                exp = exp * 1.5
            elseif staminaMinutes <= 840 then -- low stamina check
                exp = exp * 0.5
            end
        end
    
        description = string.format("%s\nExperience: %d", description, exp)
    end
end
 
I'm guessing you are premium and have 'happy hour' experience available, giving you the 1.5x experience.

Lua:
if thing:isCreature() then
    if thing:isMonster() then
        local exp = thing:getType():getExperience() -- get monster experience
        exp = exp * Game.getExperienceStage(self:getLevel()) -- apply experience stage multiplier
        if configManager.getBoolean(configKeys.STAMINA_SYSTEM) then -- check if stamina system is active on the server
            local staminaMinutes = self:getStamina()
            if staminaMinutes > 2340 and self:isPremium() then -- 'happy hour' check
                exp = exp * 1.5
            elseif staminaMinutes <= 840 then -- low stamina check
                exp = exp * 0.5
            end
        end
   
        description = string.format("%s\nExperience: %d", description, exp)
    end
end
The player is not premium, in fact I created another character just in case and even so it is still the experience in 2000.

I tried your script and it shows me the same, even so if there is no solution I would leave it like that, it doesn't bother me, of course it gains more experience than it says by taking a look at it but it's just calculating. :D

Thank You @Xikini @Evil Puncker
 
Back
Top