• 🏆 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] Question about fixing leaks in custom spells and the chances of two spells coliding

Status
Not open for further replies.
Level 25
Joined
Jun 5, 2008
Messages
2,572
I was wondering is there a chance to cast two spell in the exact same moment, that is in the exact second because i have spells of type:
  • Event - Unit finishes casting an ability
  • Condition - Ability being cast equal to *myability1*
  • Actions - Set Temp_Point1 = target point of ability being cast
    • Special effect - create at Temp_Point1 using *myeffect1*
    • Set Temp_Effect1 = last created effect
    • Unit - Cause casting unit to damage area centered at Temp_Point1 with size *myAOE* of type *myType*
    • Custom script: call RemoveLocation(udg_Temp_Point1)
    • wait *random time scaling from 0.3-1 second*(depending on the spell animation speed)
    • Destroy Temp_Effect1
Second Trigger:

  • Event - Unit finishes casting an ability
  • Condition - Ability being cast equal to *myability2*
  • Actions - Set Temp_Point1 = target point of ability being cast
    • Special effect - create at Temp_Point1 using *myeffect2*
    • Set Temp_Effect1 = last created effect
    • Unit - Cause casting unit to damage area centered at Temp_Point1 with size *myAOE2* of type *myType2*
    • Custom script: call RemoveLocation(udg_Temp_Point1)
    • wait *random time scaling from 0.3-1 second*(depending on the spell animation speed)
    • Destroy Temp_Effect1
Now what are the chances of these two spell coliding - one disrupting the other one damage and special effect point cause already have an bunch of variables 380+ in my map and to make it less leaking i have created several variable which i call Temp_Point/Effect/Unit_Group to reduce the trouble of having all 200 custom spells having points Temp_Point# #1-200
Also when using Leak check 1.3 when having the
  • Special effect create at unit/point
  • Set Temp_Effect = last created effect
trigger the program defines the Temp_Effect as an unit group- bug or what?
Need help about that.
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
That won't work in the first place, since Finishes Casting an Ability does not store Target Point of Ability Being Cast.

However, the only MUI problems you'll have is the effect. And yes, it's a bug that Leak Checker registers it as a unit group.

To fix this, simply do two things.

  1. Add a new line as your first action, reading
    • Custom script: local effect udg_Temp_Effect
  2. Add the following line to the end of your trigger
    • Custom script: set udg_Temp_Effect = null
 
Level 25
Joined
Jun 5, 2008
Messages
2,572
Thanks, now i know that you need to set the point in unit - begins casting event, all my spells function like that, the triggers down i already presumed that i have determined my point in an trigger with unit - begins casting event, i just forgot to mention that.
Will adding those custom scripts remove the MUI problem? Or i need to make an seperate variable for each spell?
 
Status
Not open for further replies.
Top