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

Feature onStatsChange for TFS 1.0

gunz

GunzOT Owner
Premium User
Joined
Dec 30, 2007
Messages
529
Solutions
5
Reaction score
191
Hello,

Since I upgraded my server from TFS 0.4 to TFS 1.0 I experienced that a lot of functions from 0.4 are not provided by 1.0. onStatsChange is one of the essential function for creating events like Zombie, Last man standing, teambattle and so on. There are some functions like onChangeHealth and onChangeMana but they're not working as onStatsChange do. I've decided to share this feature with community.

I won't write the whole tutorial for editing the files, I've just created diff patch from the latest commit(4th April). Here are the steps to make it working on Linux.
Inside your TFS source folder:
Code:
cd src
wget http://gunz.sk/opentibia/statschange.patch
patch -p0 < statschange.patch

After patching the files you should compile the TFS again. You will be able to create creature event like this:

Code:
function onStatsChange(cid, attacker, changetype, combat, value)
  doPlayerSendTextMessage(attacker, MESSAGE_INFO_DESCR, "Something changed: " .. changetype .. " value: " .. value)
  return true
end
 
Awesome... But how I use this on windows?

@EDIT: Nvm I did it, but the combat value is always 0. Thanks you anyway.
 
Last edited:
@up

It's zero only if the damage is by player, idk why it's done that way in TFS 1.0
 
Thank you for your contribution.

I haven't made the change for TFS 1.0, my concern is exactly this limitation of some features that are not yet available. I believe that the events are a way to characterize the OTserv.
 
Can't you download it from the link, and then just add it to your source code?
 
WibbenZ I followed it, and I see it, but all that code is that whats replaced or what, I never seen a file or webpage like statschange.patch


I'm sure I will get it figured out...
 
@Evil Puncker that was badass... and thanks for being an asshole at the same time... idk what to call it... diff files... wouldn't have been included in my googling
 
I did everything right, but still the player to kill the same team in my Battlefield event! Can anyone help me?
 
I did everything right, but still the player to kill the same team in my Battlefield event! Can anyone help me?
can you post here what does it says ingame when you use this script:

Code:
function onStatsChange(cid, attacker, changetype, combat, value)
  doPlayerSendTextMessage(attacker, MESSAGE_INFO_DESCR, "Something changed: " .. changetype .. " value: " .. value)
  return true
end
 
Back
Top