• 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+ How to make a rebirth system with damage bonus% with each rebirth

dysodium

New Member
Joined
Aug 11, 2024
Messages
3
Reaction score
0
I know there is onChangeHealth function to make it work. but it doesn't work for me, the only damage that gets increased, is the DMG mobs to the player. I don't know how to fix this. I am in TFS1.5. This is what my code looks like right now:

local event = CreatureEvent("DamageBoost")
function event.onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
primaryDamage = primaryDamage * 100.5
secondaryDamage = secondaryDamage * 100.5
return primaryDamage, primaryType, secondaryDamage, secondaryType
end
event:register()

I do not know how to fix it so that the damage also applies to the player->mob.
 
Make a function that you can recall that player revirth in lua like player:getRebirth() or player:getReborn()

Now you have it defined inside your code which will allow you to do the math for the damage OnHealthChange and onManaChange as you are looking for, by applying simple math, but you have to make sure this creature is a player first so

if attacker then --check if the attacker is still there and not dead by another event running at the same time (rare occurance but happens)
if attacker:isPlayer() then -- there is attacker ok is it player ?
-- here is what it will do if its player
local rebirths = player:getRebirth() -- use the function you declared to select the rebirths whatever the way its created in its just a getter function
local dmgIncreasePerRebirth = 5 * rebirth -- lets say 5% increase per reb
primaryDamage = primaryDamage + (primaryDamage * (rebirth/100) -- this is simple math
-- do the same for secondary damage im from phone
end
end
return primaryDamage, prinaryType, secondaryDamage, secondaryType, origin
end-- for the main event call back

Don't copy paste that its a mess because im explaining how you can do it yourself
 
Back
Top