This is a read only copy without any forum functionality of the old Modcraft forum.
If there is anything that you would like to have removed, message me on Discord via Kaev#5208.
Big thanks to Alastor for making this copy!

Menu

Author Topic: [LUA] My spell script doesn't show the damage done  (Read 873 times)

Kobiesan

  • Registred Member
  • Wiki Incarnate
  • *****
  • Posts: 161
    • View Profile
[LUA] My spell script doesn't show the damage done
« on: April 03, 2016, 02:34:53 am »
Hi. I recently made a dummy script for a spell that does 150 damage to a target but if they are knocked down it does 300 damage instead. It works perfect HOWEVER it doesn't show the damage dealt when you cast it. The target's health changes but no numbers pop up on the screen showing the damage done. Can anyone crack the code?

Code: [Select]
function Tenderizer(effectIndex, spell)
if (spell:GetTarget():HasAuraWithMechanic(12)) then
spell:GetCaster():DealDamage(spell:GetTarget(), 300, 80914)
else
spell:GetCaster():DealDamage(spell:GetTarget(), 150, 80914)
end
end

RegisterDummySpell(80914, Tenderizer)
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Ascathos

  • Moderators
  • Creator of Worlds
  • *****
  • Posts: 1129
    • View Profile
Re: [LUA] My spell script doesn't show the damage done
« Reply #1 on: April 03, 2016, 03:57:49 am »
It only deals damage, it's not actually casting the spells... That's what I'd assume. Does DealDamage() take the spell variable as parameter for cast ?
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Kobiesan

  • Registred Member
  • Wiki Incarnate
  • *****
  • Posts: 161
    • View Profile
Re: [LUA] My spell script doesn't show the damage done
« Reply #2 on: April 03, 2016, 04:18:16 am »
Quote from: "Ascathos"
It only deals damage, it's not actually casting the spells... That's what I'd assume. Does DealDamage() take the spell variable as parameter for cast ?

What do you mean? DealDamage deals damage to target with specified spell. I think the problem might be that it deals damage to the target with the spell value of itself but the spell doesn't do anything other than do this script. But I don't know how to fix that.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Kobiesan

  • Registred Member
  • Wiki Incarnate
  • *****
  • Posts: 161
    • View Profile
Re: [LUA] My spell script doesn't show the damage done
« Reply #3 on: April 03, 2016, 11:41:49 pm »
Bump.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Ascathos

  • Moderators
  • Creator of Worlds
  • *****
  • Posts: 1129
    • View Profile
Re: [LUA] My spell script doesn't show the damage done
« Reply #4 on: April 04, 2016, 02:08:55 pm »
Somehow I just doubt that DealDamage() is actually the function you are looking for. Something like CastSpell or similar seems far more plausible. But, I never worked too much with LUA.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »