• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

damage dealing technical logical problem

Status
Not open for further replies.
I tried to create a map that does extra damage whenever a hero is attacking
But there is a technical logical error - that does not cause a game crash and does work, but is laggy because of the technicalities


Trigger = Unit is being damaged
Action =
Deal damage using a dummy unit to that unit based on the damaging unit's intelligance.
now do other actions


Problem:
Damage is dealt => damage is then dealt by dummy unit => that active the same trigger a second time before finishing the first trigger

This is not a loop, but it is technically a massive error since I am forcing the same trigger (damage is being dealt) to work twice midway of activation. There is a noticable lag and it might cause the gpu to run harder because of the technical "loop" Ive been thinking about it for a week now but I don't know how to avoid it.

Has anyone ever done something like this in the past? I mean, the extra damage must come from some ability or come as a raw damage bonus to avoid this kind of error am I wrong?
 
Level 12
Joined
Feb 5, 2018
Messages
521
Events - Whatever
Conditions - Whatever
Actions

Trigger (turn off this trigger)
--do actions--
Trigger (turn on this trigger)

EDIT: This is needed to avoid infinite loops :)
 
Or you can make the trigger only works for certain type of units or not work for the dummy.
Technically still a logical error since you ask something from the trigger midway execution
Events - Whatever
Conditions - Whatever
Actions

Trigger (turn off this trigger)
--do actions--
Trigger (turn on this trigger)

EDIT: This is needed to avoid infinite loops :)
Amazing way to solve it

My way to solve it was = I replaced the damage with actual hp removal and made a hashtable to each unit with "last owner of damager unit" then when the unit is dead and the killing unit is no unit , the actual last damager is getting rawarded.

Yours was way better tho xD
 
Level 24
Joined
Jun 26, 2020
Messages
1,853
Technically still a logical error since you ask something from the trigger midway execution
Triggers don't execute two times at the same time, if it runs again it would take it as a separate action, thats the reason why exists local variables.
But, anyway, I think is better the trigger doesn't run to run and check (less actions), but it will be difficult determine the exact time to turn on the trigger again.

Edit: Nah, Its a better solution, you don't need to add a wait.
 
Last edited:
Status
Not open for further replies.
Top