• 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.2 (8.6, 10.77) addManaSpent - knight bug

klepacz

New Member
Joined
Aug 12, 2015
Messages
35
Reaction score
0
ERROR EDITED
Code:
if vocation == 4 or vocation == 8 then
    while player:getSkillLevel(SKILL_SHIELD) < 50 do
            player:addSkillTries(SKILL_SHIELD, player:getVocation():getRequiredSkillTries(SKILL_SHIELD, player:getSkillLevel(SKILL_SHIELD) + 1) - player:getSkillTries(SKILL_SHIELD))
    end
    while player:getSkillLevel(SKILL_SWORD) < 90 do
            player:addSkillTries(SKILL_SWORD, player:getVocation():getRequiredSkillTries(SKILL_SWORD, player:getSkillLevel(SKILL_SWORD) + 1) - player:getSkillTries(SKILL_SWORD))
    end
   while player:getSkillLevel(SKILL_AXE) < 90 do
            player:addSkillTries(SKILL_AXE, player:getVocation():getRequiredSkillTries(SKILL_AXE, player:getSkillLevel(SKILL_AXE) + 1) - player:getSkillTries(SKILL_AXE))
    end
    while player:getSkillLevel(SKILL_CLUB) < 90 do
            player:addSkillTries(SKILL_CLUB, player:getVocation():getRequiredSkillTries(SKILL_CLUB, player:getSkillLevel(SKILL_CLUB) + 1) - player:getSkillTries(SKILL_CLUB))
    end
    while player:getBaseMagicLevel() < 5 do
            player:addManaSpent(player:getVocation():getRequiredManaSpent(player:getBaseMagicLevel() + 1) - player:getManaSpent())
    end
end

This code makes debug (8.6 by Ninja) or "Connecting to the game ..." all the time (10.77 official TFS).

It's implemented in onLogin creaturescript.

Client error log:
Code:
Player Action: 053 049 046 050 053 052 046 050 049 056 046 049 050 048 058 055 049 055 052
Player.cpp 361:exception occured,reason:
Network.cpp 946:exception occured (ErrorCode = 0),reason:
Network.cpp 921: assertion failed (BufferSize = 0) (NextToWrite = 16394), reason:
BufferSize>0

EDIT.

I've checked it wrong. Now i see that its enought for me to comment 1 of 4 while loops and it works...
It looks like i cant have 4 while loops in 'if' statement.
 
Last edited:
Made some progress. I found out that server is sending to client too many 'Server log' massages.
I replaced this
Code:
    while player:getSkillLevel(SKILL_SHIELD) < 50 do
            player:addSkillTries(SKILL_SHIELD, player:getVocation():getRequiredSkillTries(SKILL_SHIELD, player:getSkillLevel(SKILL_SHIELD) + 1) - player:getSkillTries(SKILL_SHIELD))
    end

with this
Code:
local x=0
while x < 70 do
    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, x)
end

And it works good. After login except advances it print numbers 0->69.
BUT when i made it like that:
Code:
local x=0
while x < 70 do
    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You advanced to sword fighting level '..x)
end
it crash the client :D

The only solution i see now is source edit to make server not to send advance massages in specific situations or instead of send it like:
'16:43 You advanced to shielding level 11.'
'16:43 You advanced to shielding level 12.'
'16:43 You advanced to shielding level 13.'
...
'16:43 You advanced to shielding level 90.'

Do it just in one message:
'16:43 You advanced to shielding level 90.'

So far i deleted advance message if its sword fighting massage and it works - no client crash with all skills added correct
 
Last edited:
I've never actually had a client crash in my live server using that method, but I have experienced very occasional login issues (note that I'm not using the downgraded TFS version though)
I can't think of any reason why all experience/skill advance shouldn't be moved entirely to Lua, then we could have more control over how and when they display.

I will probably go down that path.
 
I've never actually had a client crash in my live server using that method, but I have experienced very occasional login issues (note that I'm not using the downgraded TFS version though)
I can't think of any reason why all experience/skill advance shouldn't be moved entirely to Lua, then we could have more control over how and when they display.

I will probably go down that path.
I just modified source not to show advance msg when i dont want it to be shown.
 
Back
Top