Magic

Magic

190k Downloads

Variables not working in calculations

NightScythe1 opened this issue · 3 comments

commented

Hello! it seems magic is having trouble passing certain values through a spell for calculations? Here I'm trying to make a spell 'Committed' that will deal up to 75% bonus damage depending on the target's missing HP. However, in the calculation (shown below) the spell is not reading the full "target_max_health" and is just reading "_max_health" and throwing an error when loaded. I'm not sure why, as I have used "target_max_health" in another spell ('Exploding') and have had no errors and the spell works as intended.

"((((1-(target_health/target_max_health))*0.75)*damage_dealt)"

committed.txt
exploding.txt
2022-08-07_08 20 32

commented

I've tried the spell, but no additional damage is caused by the spell so it doesn't seem to be working (the effects do still play, just the damage isn't working)

commented

Hm weird- could just be a validation bug, can you try to see if the spell works?

I'm guessing it's done something dumb somewhere and parsed just "target" before parsing "target_max_health" - if it's only a validation issue that'd help me track it down.

Thanks!

commented

I made another spell and am receiving the exact same error for it, despite the formula being very simple like 'Exploding' has... I have no clue why it only works in that spell... I also changed the formula for Committed in case it was too complex and still no luck
2022-08-08_10 49 20

leeching:
inherit: base_unique_spell
triggers:
- kill
name: "§4Leeching"
passive: true
description: Steal 7% max health per kill
actions:
cast:
- class: Heal
amount: "target_max_health*0.07"
parameters:
range: 64
target: self
target_type: LivingEntity