Itutorial
Legendary OT User
- Joined
- Dec 23, 2014
- Messages
- 2,434
- Solutions
- 68
- Reaction score
- 1,082
Alright, I have no idea what is going wrong here. TFS 1.3
The code should make summons hit more based on players level. I have everything set up but the code just doesn't run.
This is how it looks:
Creaturescripts.xml
monster files.xml
and the lua
I added prints at the begining of the code and nothing shows in console. So the code isn't even being run. Any ideas?
I did add the registers in login.lua also but I know thats not needed.
The code should make summons hit more based on players level. I have everything set up but the code just doesn't run.
This is how it looks:
Creaturescripts.xml
XML:
<event type="healthchange" name="summonHitHealth" script="summonhit.lua" />
<event type="manachange" name="summonHitMana" script="summonhit.lua" />
monster files.xml
XML:
<script>
<event name="summonHitHealth"/>
<event name="summonHitMana"/>
</script>
and the lua
LUA:
function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
if primaryType == COMBAT_HEALING then return primaryDamage, primaryType, secondaryDamage, secondaryType, origin end
if attacker:isMonster() then
if isInArray(summonNames, attacker:getName()) then
local player = Player(attacker:getMaster())
if player then
local newName = string.gsub(target:getName(), " Summon", "")
local SUM = summonSystem[newName]
if SUM then
local newDmg = -((player:getLevel() * SUM.dmgMultiplier.level) + (player:getMagicLevel() * SUM.dmgMultiplier.magicLevel))
if newDmg > SUM.damageMax then
newDmg = SUM.damageMax
end
primaryDamage = primaryDamage + newDmg
end
end
end
end
return primaryDamage, primaryType, secondaryDamage, secondaryType, origin
end
function onManaChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
if primaryType == COMBAT_HEALING then return primaryDamage, primaryType, secondaryDamage, secondaryType, origin end
if attacker:isMonster() then
if isInArray(summonNames, attacker:getName()) then
local player = Player(attacker:getMaster())
if player then
local newName = string.gsub(target:getName(), " Summon", "")
local SUM = summonSystem[newName]
if SUM then
local newDmg = -((player:getLevel() * SUM.dmgMultiplier.level) + (player:getMagicLevel() * SUM.dmgMultiplier.magicLevel))
if newDmg > SUM.damageMax then
newDmg = SUM.damageMax
end
primaryDamage = primaryDamage + newDmg
end
end
end
end
return primaryDamage, primaryType, secondaryDamage, secondaryType, origin
end
I added prints at the begining of the code and nothing shows in console. So the code isn't even being run. Any ideas?
I did add the registers in login.lua also but I know thats not needed.