• 🏆 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!

[solved] Does adding and removing units from unitgroup overwrite unitgroup creating leaks?

Status
Not open for further replies.
Level 3
Joined
Mar 1, 2018
Messages
41
Does adding and removing units from unitgroup overwrites the unitgroups creating leaks?

This was the trigger that got me with this question:
I was using Bribe's engine to check if the player has reflection (I should use the unit as reference for reflection but I don't really understand how to do it)

  • Dmg Reflect RealDecimal
    • Events
      • Game - DamageEvent becomes Equal to 1.00
    • Conditions
    • Actions
      • Set Damage_Refl_playerNr = (Player number of (Owner of DamageEventTarget))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Damage_Reflect_Itms[Damage_Refl_playerNr] Greater than 0
          • (DamageEventSource is in Damage_Reflecting_Group) Equal to False
        • Then - Actions
          • Set Damage_CC_Reflect[Damage_Refl_playerNr] = (DamageEventAmount x Damage_CC_Reflect[Damage_Refl_playerNr])
          • Unit - Cause DamageEventTarget to damage DamageEventSource, dealing Damage_CC_Reflect[Damage_Refl_playerNr] damage of attack type Spells and damage type Normal
          • Unit Group - Add DamageEventTarget to Damage_Reflecting_Group
          • Floating Text - Create floating text that reads (String((Integer(Damage_CC_Reflect[Damage_Refl_playerNr])))) above DamageEventSource with Z offset 50.00, using font size 11.00, color (100.00%, 40.00%, 85.00%), and 0.00% transparency
          • Floating Text - Set the velocity of (Last created floating text) to 75.00 towards 90.00 degrees
          • Floating Text - Change (Last created floating text): Disable permanence
          • Floating Text - Change the lifespan of (Last created floating text) to 3.50 seconds
          • Floating Text - Change the fading age of (Last created floating text) to 1.40 seconds
        • Else - Actions
          • Unit Group - Remove DamageEventSource from Damage_Reflecting_Group

Hopefully it will work? I want to avoid infinite reflection loop if both DamageSource and DamageTarget have reflection.

Thanks in advance for the attention.
 
Last edited:
Level 3
Joined
Mar 1, 2018
Messages
41
Thank you very much. I admire your dedication and work, having read and learned from your posts on the forum.


I will be using this group everytime there is damage reflected, to prevent reflection ping-pong if both units have reflection on, like both wearing the same armor with such ability.

My solution was to add them to that group everytime they reflected, so when they deal the reflecting damage, units of that group cannot be targeted back of reflected damage dealt so the target cannot reflect that specific damage back.
 
Status
Not open for further replies.
Top