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

Lua Variable Monsters Health (TFS 0.4.0)

Tadelho

New Member
Joined
Aug 12, 2007
Messages
38
Solutions
1
Reaction score
2
Hi there, I'm recreating D&D aspects in my personal server (TFS 0.4.0 based) and I would like to recreate the variable max health from creatures. I mean, actually the max health is based in the monster.xml file, as default (health max ="xxx"), so every creature from the same type has the same amount of HP.

I was wondering how to bring a new formula to this, making it varies, even if I need to create a personal formula for each monster individually. Is there some way, maybe with "onlogin" function (I'm not sure, I'm kinda noob) to verify if the creature is a monster and then set this new HP/MaxHP when it spawns?

Thanks for helping, cya!
 
Hi there, I'm recreating D&D aspects in my personal server (TFS 0.4.0 based) and I would like to recreate the variable max health from creatures. I mean, actually the max health is based in the monster.xml file, as default (health max ="xxx"), so every creature from the same type has the same amount of HP.

I was wondering how to bring a new formula to this, making it varies, even if I need to create a personal formula for each monster individually. Is there some way, maybe with "onlogin" function (I'm not sure, I'm kinda noob) to verify if the creature is a monster and then set this new HP/MaxHP when it spawns?

Thanks for helping, cya!

Well, there's plenty of ways this could be done.
Not sure if 0.4 has an onSpawn event for creatures, but if it does, it could be used in conjunction with setCreatureMaxHealth.
If not, you can go to sources and in monsters.cpp you will find the variable healthMax which is assigned to monsters (by default, they get whatever you put in XML multiplied by any multipliers you have in your xml configs).
You can change this formula to contain some random value or some value based on some other variable, even create new variable like monster level and base it off of that.
 
Back
Top