MagicPlugin icon indicating copy to clipboard operation
MagicPlugin copied to clipboard

Variables not working in calculations

Open NightScythe1 opened this issue 3 years ago • 3 comments

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

NightScythe1 avatar Aug 07 '22 07:08 NightScythe1

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!

NathanWolf avatar Aug 07 '22 15:08 NathanWolf

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)

NightScythe1 avatar Aug 07 '22 16:08 NightScythe1

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

NightScythe1 avatar Aug 08 '22 09:08 NightScythe1