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

Any Leaks@ This Spell?

Status
Not open for further replies.
Level 6
Joined
Oct 4, 2011
Messages
226
no unitgroup leak, idk what else :D thanks guys. I thought maybe the Casting unit would leak so i did call RemoveUnit(udg_etc... and realized that removes unit from game so i figured that doesnt leak?

  • Goo and Bugs
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Goo and Bugs (Crypt fiend)
    • Actions
      • Set CarrionSwarm_CasterUnit = (Casting unit)
      • Set CarrionSwarm_UnitGroup = (Units within 425.00 of (Target point of ability being cast) matching ((((Matching unit) belongs to an enemy of (Owner of (Casting unit))) Equal to True) and (((Matching unit) is A structure) Equal to False)))
      • Unit Group - Pick every unit in CarrionSwarm_UnitGroup and do (Actions)
        • Loop - Actions
          • Unit - Set (Picked unit) movement speed to ((Default movement speed of (Picked unit)) x 0.20)
      • Wait 3.00 seconds
      • Unit Group - Pick every unit in CarrionSwarm_UnitGroup and do (Actions)
        • Loop - Actions
          • Unit - Set (Picked unit) movement speed to (Default movement speed of (Picked unit))
          • Unit - Cause CarrionSwarm_CasterUnit to damage (Picked unit), dealing 50.00 damage of attack type Spells and damage type Normal
      • Custom script: call DestroyGroup(udg_CarrionSwarm_UnitGroup)
 
Level 8
Joined
Dec 9, 2009
Messages
397
No leaks(Ok, I missed a leak), but

Waits are BAD, they kill your skills if you want them useable by more than one person/unit within that wait time.

You'll need to learn to use hashtables, or an easier route would be adding a custom value to each unit on map (and every unit to enter map)

  • Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set TempGroup = (Units in (Playable map area))
      • Unit Group - Pick every unit in TempGroup and do (Actions)
        • Loop - Actions
          • Set CreepValue = (CreepValue + 1)
          • Unit - Set the custom value of (Picked unit) to CreepValue
      • Custom script: call DestroyGroup(udg_TempGroup)
To get rid of the wait you need to make a periodic trigger.
(This trigger is initially off)

  • GooLoop
    • Events
      • Time - Every 0.50 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in GooGroup and do (Actions)
        • Loop - Actions
          • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • GooGroupTimer[(Custom value of (Picked unit))] Less than or equal to (<=) 1
            • Then - Actions
              • Unit Group - Remove (Picked unit) from GooGroup
              • Unit - Cause GooCaster[(Custom value of (Picked unit))] to damage (Picked unit), dealing GooDamage[(Custom value of (Picked unit))] damage of attack type Spells and damage type Normal
            • Else - Actions
              • Set GooGroupTimer[(Custom value of (Picked unit))] = (GooGroupTimer[(Custom value of (Picked unit))] - 1)
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Number of units in GooGroup) Equal to (==) 0
          • Then - Actions
            • Trigger - Turn off (This trigger)
          • Else - Actions
Then you need to add these within your first trigger in the loop

  • Actions
    • Set GooCaster[(Custom value of (Picked unit))] = (Casting unit)
    • -------- However you want damage calculated --------
    • Set GooDamage[(Custom value of (Picked unit))] = (Real((Strength of (Casting unit) (Include bonuses))))
    • Set GooGroupTimer[(Custom value of (Picked unit))] = 6
    • Trigger - Turn on GooLoop <gen>

These triggers do not support the effect stacking, best to add a buff to the units that are effected by the skill so you can check if unit has buff in your first loop.
 
Last edited:
Level 26
Joined
Mar 19, 2008
Messages
3,140
Actaully no; it would require locals usage in such case, because you can't just refer to globals with TriggerSleepAction. You risk interfering with other instances that are currently running what can lead to total mess.

Timers/indexing + loop/hashtables + loop is the way to make it MUI; or.. locals usage.
 
Level 6
Joined
Oct 4, 2011
Messages
226
I suck T.T..... None of that makes sense for me.. Map initilazition trigger? I think seriously i giveup. Probably all of my work has leaks and is crap.
 
Last edited:
Level 7
Joined
Apr 1, 2010
Messages
289
what you should do is
  • Goo and Bugs
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Goo and Bugs (Crypt fiend)
    • Actions
      • Custom script: local unit u = GetTriggerUnit()
      • Custom script: local group g
      • Set CarrionSwarm_CasterUnit = (Casting unit)//this is equal to triggering unit
      • Set Loc = (Target Point of Ability being cast)
      • Set CarrionSwarm_UnitGroup = (Units within 425.00 of Loc matching ((((Matching unit) belongs to an enemy of (Owner of (Casting unit))) Equal to True) and (((Matching unit) is A structure) Equal to False)))
      • Unit Group - Pick every unit in CarrionSwarm_UnitGroup and do (Actions)
        • Loop - Actions
          • Unit - Set (Picked unit) movement speed to ((Default movement speed of (Picked unit)) x 0.20)
      • Custom script: call RemoveLocation(udg_Loc)
      • Custom script: set g = udg_CarrionSwarm_UnitGroup
      • Wait 3.00 seconds
      • Custom script: udg_CarrionSwarm_UnitGroup = g
      • Unit Group - Pick every unit in CarrionSwarm_UnitGroup and do (Actions)
        • Loop - Actions
          • Unit - Set (Picked unit) movement speed to (Default movement speed of (Picked unit))
          • Unit - Cause CarrionSwarm_CasterUnit to damage (Picked unit), dealing 50.00 damage of attack type Spells and damage type Normal
      • Custom script: call DestroyGroup(udg_CarrionSwarm_UnitGroup)
      • Custom script: set u = null
      • Custom script: set g = null
this will work and you won't have to do more then one trigger for it.
my 200th post
 
Level 26
Joined
Mar 19, 2008
Messages
3,140
@Narogog That probably won't. You have to add units in one group to second with function instead.

@Ultimatony
DONT EVER suggest someone custom value manipulation - if you do that by your own, let it be, but please don't complicate others life. Custom values are required for Indexers (AutoIndex/AIDS/UnitIndexer/GUI UnitIndexer) - that is first; and secondly, custom values could have far more usage in custom maps for job hard to handle instead of using them just for a spell.
I suggest to you that as well: remove CV manipulation.
 
Level 8
Joined
Dec 9, 2009
Messages
397
I was basically showing him an easy way to index, with each unit having a custom value your able to save things about them individually without hashes. It can be used for any aspect of the map.

How is that any different?

In my map it's used for Respawn System, Regen System, Triggered Damage system, saves armor, crit chance, crit rate, position, facing angle, unit specific timers. So it's used in almost everything in my map.

(Maker is the one that suggested the system 2 yrs ago btw)
 
Status
Not open for further replies.
Top