• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Spells Leaking?

Status
Not open for further replies.
Level 6
Joined
Jan 2, 2007
Messages
189
Im a little new to making spells with GUI triggers and i have run into a problem. When I cast my custom spells the game suffers from serious lag. I dont know why! Is it leaking from things I missed/neglected?
Off topic note:
I have a question I would really like awnsered because i have hade different awnsers. Is it okay to have a non MUI spell if:
a) a duplicate of the same hero cannot exist on a map (exp: 2 Arthas in a map).

b) a duplicate of the same spell cannot exist on a map (exp: 2 storm bolts in a map).

thanks for your time:cool:
 
Level 3
Joined
Aug 24, 2007
Messages
33
Im new too, hope this is helpfull? lol

How detailed are your custom spells, do they have like 10 different buffs and 5 different cinematics?

I think its ok, because i have seen both 2 duplicates and 2 spell duplicates on a map at a time. Example: Dota same hero mode
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
I have a question I would really like awnsered because i have hade different awnsers. Is it okay to have a non MUI spell if:
a) a duplicate of the same hero cannot exist on a map (exp: 2 Arthas in a map).

b) a duplicate of the same spell cannot exist on a map (exp: 2 storm bolts in a map).
Unless the effect lasted longer than the cooldown, you should be fine.

Im a little new to making spells with GUI triggers and i have run into a problem. When I cast my custom spells the game suffers from serious lag. I dont know why! Is it leaking from things I missed/neglected?
As Yngwie said, we could use a trigger.
 
Level 6
Joined
Jan 2, 2007
Messages
189
Well here is one spell

  • Events
  • Unit-A unit Starts the effect of an ability
  • Conditions
  • (Ability being cast) Equal to frost wave
  • frostwave Equal to 1
  • Actions
  • Set frostwave_caster = (Casting unit)
  • Wait 0.01 seconds
  • Unit - Create 1 Frost Wave Dummy for (Owner of frostwave_caster) at (Position of frostwave_caster) facing Default building facing degrees
  • Set frostwave_dummy[1] = (Last created unit)
  • Unit - Order frostwave_dummy[1] to Move To ((Position of frostwave_caster) offset by 500.00 towards 0.00 degrees)
  • Unit - Add a 1.00 second Generic expiration timer to frostwave_dummy[1]
  • Unit - Create 1 Frost Wave Dummy for (Owner of frostwave_caster) at (Position of frostwave_caster) facing Default building facing degrees
  • Set frostwave_dummy[2] = (Last created unit)
  • Unit - Order frostwave_dummy[2] to Move To ((Position of frostwave_caster) offset by 500.00 towards 90.00 degrees)
  • Unit - Order frostwave_dummy[2] to Move To ((Position of frostwave_caster) offset by 500.00 towards 90.00 degrees)
  • Unit - Create 1 Frost Wave Dummy for (Owner of frostwave_caster) at (Position of frostwave_caster) facing Default building facing degrees
  • Set frostwave_dummy[3] = (Last created unit)
  • Unit - Order frostwave_dummy[3] to Move To ((Position of frostwave_caster) offset by 500.00 towards 180.00 degrees)
  • Unit - Add a 1.00 second Generic expiration timer to frostwave_dummy[3]
  • Unit - Create 1 Frost Wave Dummy for (Owner of frostwave_caster) at (Position of frostwave_caster) facing Default building facing degrees
  • Set frostwave_dummy[4] = (Last created unit)
  • Unit - Order frostwave_dummy[4] to Move To ((Position of frostwave_caster) offset by 500.00 towards 270.00 degrees)
  • Unit - Add a 1.00 second Generic expiration timer to frostwave_dummy[4]
  • Unit - Create 1 Frost Wave Effect for (Owner of frostwave_caster) at (Position of frostwave_caster) facing (Facing of frostwave_caster) degrees
  • Set frostwave_dummy[5] = (Last created unit)
  • Unit - Add a 1.20 second Generic expiration timer to frostwave_dummy[5]
  • Unit Group - Pick every unit in (Units within 400.00 of (Position of frostwave_caster) matching ((((Owner of (Matching unit)) is an ally of (Owner of frostwave_caster)) Equal to False) and (((Matching unit) is A structure) Equal to False))) and do (Actions)
    • Loop - Actions
      • Unit - Cause frostwave_caster to damage (Picked unit), dealing 200.00 damage of attack type Spells and damage type Normal
      • Unit - Add frost wave (freeze) to frostwave_caster
      • Unit - Set level of frost wave (freeze) for frostwave_caster to 1
      • Unit - Order frostwave_caster to Human Mountain King - Thunder Clap
  • Wait 0.50 seconds
  • Unit - Remove frost wave (freeze) from frostwave_caster
  • Set frostwave_caster = No unit
  • Set frostwave_dummy[1] = No unit
  • Set frostwave_dummy[2] = No unit
  • Set frostwave_dummy[3] = No unit
  • Set frostwave_dummy[4] = No unit
  • Set frostwave_dummy[5] = No unit

This spell is not 100% finished but it lags the most. I think it's because of all the polar projection.
 
Level 6
Joined
Jan 2, 2007
Messages
189
In fact, you don't appear to clean up a single leak.

Oh, that would explain the lag. If i didnt clean any leaks (I thought i did:eek:) how would i go about cleaning all/most of the leaks?
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
The two major leaks: Groups and locations (bleg, Points in GUI, but location sounds better x.x)

Soo... for Points, it's really easy. Just create a location variable, and call it something. I like to use loc or TempPoint (erm, well, when I used locations that is >_>)

Now that we have TempPoint, find every place you're using a location. Note: if you use the same location twice in a row, you don't need to destroy it and readd it as shown here. Only destroy the location when you're done with it, and readd it if you need to clean a different one.

Eg:

Unit - Create 1 unit at (Center of (Playable Map Area))

Center of Playable Map Area is a location and is leaking. To fix this, we assign it to a variable, then clean it up

Set TempPoint = (Center of (Playable Map Area))
Unit - Create 1 unit at TempPoint
Custom script: call RemoveLocation( udg_TempPoint )

Notice how udg_ is added to the start of the 'global' variable.

If we were to create another unit at the center of the map, we could use it again before destroying it, but if we wanted to change where to create the unit, we would have to re-create TempPoint after the RemoveLocation.

So, later on, a simple trigger may be fixed up to look like:

Set TempPoint = (Center of (Playable Map Area))
Unit - Create 1 unit at TempPoint
Unit - Create 1 other unit at TempPoint
Custom script: call RemoveLocation( udg_TempPoint )
Set TempPoint = (Player 1 (Red) Start Location)
Unit - Create 1 other other unit at TempPoint
Custom script: call RemoveLocation( udg_TempPoint )

Groups are even easier. There are 2 ways you can pick to do it.

Way 1:

Find every Unit Group which doesn't use a variable (if it's stored in a variable, you're probably using it later, and then we can destroy it later). Add this line before them:

Custom script: set bj_wantDestroyGroup = true

That's it. No fuss. No hassle.

Way 2:

Same steps as how to clear locations, but with a group variable. The remove line is:

Custom script: call DestroyGroup(udg_TempGroup)

or whatever other group variable name you used, prefixed by udg_ as always.
 
Level 6
Joined
Mar 2, 2006
Messages
306
cleaning leaks is important, but they cause gradual lag (over time), not instant. you must have made a more serious error in the spell up-there. the problem is in your pick-loop:
Unit - Add frost wave (freeze) to frostwave_caster
Unit - Set level of frost wave (freeze) for frostwave_caster to 1
you do that for every enemy/neutral unit in 400 dots radius! you didn't want to add thunder clap to a caster 38 times, right?
even more important,
Unit - Order frostwave_caster to Human Mountain King - Thunder Clap
you don't want him to cast thunder clap 38 times, even if he could (which he can not do instantly). move those three lines above the pick-loop (which should only damage units) and then try the spell.

- - -

once that is taken care of, do you really want thunder clap icon appearing on the caster's icon-card for 0.5 seconds? he does the damage (which takes care of the kill count) but there is no need that caster himself applies the slowing buff. you can easily have frostwave_dummy[5] cast the thunder clap instead.
 
Status
Not open for further replies.
Top