• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

[Trigger] Trigger doesn't deal damage, maybe conversion issue?

Status
Not open for further replies.
Level 1
Joined
Dec 12, 2019
Messages
3
Hello,

I would like to ask for help regarding my trigger for a custom spell. It is supposed to deal damage according to the targeted unit's missing health (somewhat like Reaper's Scythe in Dota for Necrophos), and if the targeted unit died, reset every cooldown on casting unit afterwards. However, I have seen to run into a problem, as (probably due to a conversion issue, but that's just my wild guess) no damage is being dealt to the enemies. Might the problem be the subtraction, or the multiplication with the 0.80/1/1.20/1.50x mutliplier?

x1XQmPc.jpg


Also as a sidenote, I can't really do JASS or stuff only GUI, so if the trigger might be not perfect or efficient it's because of this.

Edit: Also, the z_Emperor_PublicExecHP is a real variable, and also the spell itself is simple unit target (Storm Bolt modified), it works if i put 300 or some number instead of the arithmetic stuff, forgot to add that info.


Thanks for the help in advance!
 
Last edited:

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,202
Likely related to the wait (TriggerSleepAction) being used. Try deleting the wait and seeing if it works.

Both maximum hitpoints and current hitpoints are reals, so there should be no need for conversion.

The conversion might break if the units have stupid amounts of health. For example more than 2,147,483,647 HP. Numeric overflow might then occur which would result in a nonsense amount of damage. Another reason not to do any conversion and keep the values as reals through the entire process.

An array set up at map initialization can be used to map spell ability level to damage multiplier. The index of the array is the ability level and that lookup would replace the current multiplier constants. This greatly neatens/improves maintainability of the code by remove the nested branches used to resolve ability level and putting all balance data in a single place.
 
Level 1
Joined
Dec 12, 2019
Messages
3
In the meantime, I managed to find the problem, the Wait command delayed so much that the trigger couldn't find a casting unit or target of ability being cast, so I added some extra variables (probably more than necessary, but I wanted the simplest way possible).
The new trigger that actually works:
kdjxJXy.jpg


I'm posting it in case anyone wants to do something similar.

EDIT: Also, I just saw you posting the solution as well, Dr Super Good, thanks for the help! ^^
 
Status
Not open for further replies.
Top