![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | Spiky_Potato |
So I have reworked my script and have run into a different problem, my damage formula seems to be spitting out nothing. My Magic damage formula, which is exactly the same save for the variables used, does seem to work correctly though. If anyone has an ideas, please let me know.
func WeaponAttack(User, Target):
Damage = null
Damage = ceil(User.Attack * (100 / (100 + Target.Defense)))
Target.Health = Target.Health - Damage
DialogueBox.text = "The " + User.Name + " attacked the " + Target.Name + ", it dealt " + str(Damage) + " damage."
yield(get_tree().create_timer(0.2),"timeout")
emit_signal("next_player")
func MagicAttack(User, Target, SpellElement):
Damage = null
Damage = ceil(User.MagicAttack * (100 / (100 + Target.MagicDefense)))
CheckElementResistance(Target, SpellElement)
Target.Health = Target.Health - Damage
DialogueBox.text = "The " + User.Name + " cast a " + User.Element + " spell at the " + Target.Name + ", it dealt " + str(Damage) + " damage."
yield(get_tree().create_timer(0.2),"timeout")
emit_signal("next_player")