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

Solved onHealthChange

Codinablack

Dreamer
Content Editor
Joined
Dec 26, 2013
Messages
2,022
Solutions
13
Reaction score
1,337
Location
USA
GitHub
Codinablack
Greetings again otland. I am having some problems with onHealthChange and I was trying to see if anyone knew why it wasn't calling the creatures storage value...

when I use this script:
Code:
function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType)
    print(creature:getStorageValue(40107))
    return primaryDamage, primaryType, -secondaryDamage, secondaryType
end

The storage value is in my database, saved for the player I am trying it with. The onHealthChange is registered correctly in creaturescripts.xml.

Any Ideas?
 
Yes, but it turned out to be a simple capitol letter where there should have been a lower case letter from the event registered in login.lua and the one in creaturescripts.xml file... simply overlooked it over and over again.. Thanks tho....
 
Why is it not working? TFS 1.3

creaturescripts/creaturescripts.xml:
Code:
<event type="healthchange" name="BleedingEffect" script="bleedingeffect.lua" />

creaturescripts/scripts/login.lua:
Code:
player:registerEvent("BleedingEffect")

creaturescripts/scripts/bleedingeffect.lua:
Code:
function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType)
   return primaryDamage * 5, primaryType, secondaryDamage, secondaryType
end
 
Back
Top