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

[Trigger] Fixing Leaks causing Spell to work only once!

Status
Not open for further replies.
Level 3
Joined
Apr 21, 2009
Messages
42
Hello!

I'm creating this Venom Splasher (inspired by a skill in RO's Assassin). Problem is with the "leak-killer" custom codes are enabled, it would only make the skill work once.

1) If I remove the timer pause and destroy timer, the trigger would trigger multiple times
2) If the 3 custom scripts at the bottom are enabled, the units are not added to the Area UNITGroup and are not damaged!

  • Venom Splash End
    • Events
      • Time - VenomSplasher_TIMER expires
    • Conditions
    • Actions
      • Countdown Timer - Pause VenomSplasher_TIMER
      • Custom script: call DestroyTimer(udg_VenomSplasher_TIMER)
      • Set VenomSplasher_targetLoc = (Position of VenomSplasher_target)
      • Custom script: set bj_wantDestroyGroup = true
      • Set VenomSplasher_area = (Units within 500.00 of VenomSplasher_targetLoc matching (((Matching unit) belongs to an ally of (Owner of VenomSplasher_caster)) Equal to False))
      • Unit Group - Pick every unit in VenomSplasher_area and do (Actions)
        • Loop - Actions
          • Set VenomSplasher_count = (VenomSplasher_count + 1.00)
          • Unit Group - Add (Picked unit) to VenomSplasher_targetGrp
          • Game - Display to (All players) the text: (Count + (String(VenomSplasher_count)))
      • Set VenomSplasher_dmg = (1000.00 / VenomSplasher_count)
      • Unit Group - Pick every unit in VenomSplasher_targetGrp and do (Actions)
        • Loop - Actions
          • Game - Display to (All players) the text: (Damage + (String(VenomSplasher_dmg)))
          • Unit - Cause VenomSplasher_caster to damage (Picked unit), dealing VenomSplasher_dmg damage of attack type Spells and damage type Universal
      • Animation - Change VenomSplasher_target's vertex coloring to (100.00%, 100.00%, 100.00%) with 0.00% transparency
      • Set VenomSplasher_count = 0.00
      • Game - Display to (All players) the text: (Final Count + (String(VenomSplasher_count)))
      • Game - Display to (All players) the text: (Total Damage + (String(VenomSplasher_dmg)))
      • Custom script: call RemoveLocation(udg_VenomSplasher_targetLoc)
      • Custom script: call DestroyGroup(udg_VenomSplasher_area)
      • Custom script: call DestroyGroup(udg_VenomSplasher_targetGrp)

Please help correcting my trigger so the skill is leakless and working

NOTE: This is the effect part of the Skill Trigger, the INIT part is only to check/trigger this EVENT when the skill is used
 
Level 3
Joined
Apr 21, 2009
Messages
42
1. There's no need to null the timer.
Possibly that's causing the bug.

2. Delete the set bj_wantDestroyGroup = true
Also, why use 2 unit groups instead of one?

The reason i've been nulling the timer is: according to threads/tutorial i've been reading if the timer isn't nulled/destroyed it would cause a leak.


Hahaha, yeah what's the point? I'll correct it right away!



----EDIT
Yup, it fixed it thanks!

However there's another problem. Let's say the within the 500 range of the target unit there's another enemy unit of the caster. If kill the other unit the target unit of the skill should receive 1000 damage, instead of 500. It shows 500 damage dealt on the Game Message
 
Last edited:
Level 13
Joined
Mar 29, 2012
Messages
530
This:
1. There's no need to null the timer.
Possibly that's causing the bug.
- When timer destroyed, the variable storing it became null.

- The VenomSplasher_area group is destroyed after triggered because the custom script: set bj_wantDestroyGroup = true
You can either remove it or the custom script: call DestroyGroup(udg_VenomSplasher_area)

- Destroy the timer if that timer is no longer needed. It will make that trigger run only once, except you create the timer again
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Don't destroy the timer :) Use the same for every cast (be aware of MUIness or MPIness). Alternativelly, use a local timer to handle the whole thing.
 
Level 3
Joined
Apr 21, 2009
Messages
42
This:

- When timer destroyed, the variable storing it became null.

- The VenomSplasher_area group is destroyed after triggered because the custom script: set bj_wantDestroyGroup = true
You can either remove it or the custom script: call DestroyGroup(udg_VenomSplasher_area)

- Destroy the timer if that timer is no longer needed. It will make that trigger run only once, except you create the timer again


Gotcha! Thanks for the clarification.

How about this problem


Let's say the within the 500 range of the target unit there's another enemy unit of the caster. If kill the other unit the target unit of the skill should receive 1000 damage, instead of 500. It shows 500 damage dealt on the Game Message.

Same thing occurs when another unit enters the AoE. The system still detects that there are 2 units instead of 3.

How do I correct this? So that when the Damage is dealt, the system would reflect the number of units that are currently in the AoE
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Probably because you're never removing the units from the group :) You should do so after dealing the damage. Maybe there are enemy units around that are not alive, but still count as targets. Try adding "Life of Matching Unit > 0".

You can also pick every unit, and exclude those you don't want with an if then else, it's easier than using Matching Unit

I could do this for you inn simple explained jass but I don't have time right now. If no one does i'll do it later.
 
Level 3
Joined
Apr 21, 2009
Messages
42
Probably because you're never removing the units from the group :) You should do so after dealing the damage. Maybe there are enemy units around that are not alive, but still count as targets. Try adding "Life of Matching Unit > 0".

You can also pick every unit, and exclude those you don't want with an if then else, it's easier than using Matching Unit

I could do this for you inn simple explained jass but I don't have time right now. If no one does i'll do it later.

Thanks! Preferrably in GUI since I really don't know how to work w/ Jass. I'm trying a couple of ways now
 
Status
Not open for further replies.
Top