MrVilhelm
Mafia Penguin
Hola amigos!
Im fairly new to Lua and Im trying to rap my head around how the TFS functions work etc.
So I was planning on adding a simple crit chance + crit damage system. So I thought that was a good place to start!
But Im running into some problems (error free).
I wrote this in CritSystem.lua
And this in creaturescripts.xml
Finally, this in login.lua as I searched around a lil for how other people made the crit system and found THIS script made by @Mackerel
But it does not seem to do anything. Not giving any errors nor giving any crit chance or damage.
Where am I going wrong?
All help appreciated! <3
Im fairly new to Lua and Im trying to rap my head around how the TFS functions work etc.
So I was planning on adding a simple crit chance + crit damage system. So I thought that was a good place to start!
But Im running into some problems (error free).
I wrote this in CritSystem.lua
Lua:
local config = {
effect = 173,
multiplier = 10,
chance = math.random(10,0)
}
function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
if(config.chance > 5) then
creature:getPosition().sendMagicEffect(config.effect)
return primaryDamage * config.multiplier, primaryType, secondaryDamage, secondaryType
end
end
And this in creaturescripts.xml
XML:
<event type="healthchange" name="CritSystem" script="CritSystem.lua" />
Finally, this in login.lua as I searched around a lil for how other people made the crit system and found THIS script made by @Mackerel
Lua:
player:registerEvent("CritSystem")
But it does not seem to do anything. Not giving any errors nor giving any crit chance or damage.
Where am I going wrong?
All help appreciated! <3