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

Will this leak? Spawn at point.

Status
Not open for further replies.
Level 10
Joined
Jun 7, 2008
Messages
420
  • Stealth 360
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Stealth (Interceptor generic 360s dummy)
    • Actions
      • Unit - Create 1 Dummy Invisibility for (Owner of (Triggering unit)) at (Position of (Triggering unit)) facing Default building facing degrees
      • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
      • Unit - Order (Last created unit) to Human Sorceress - Invisibility (Triggering unit)
It isn't a 'center of' trigger, so was wondering if it will still leak. This is for my battleships game.
 
Level 11
Joined
Jan 17, 2009
Messages
790
Yes, it will leak.

It will always leak whenever you assign a handle without using a variable.
Assign 'Position of Triggering Unit' to a variable then use the variable for the action.
Then, clean the location with
Custom Script: "call RemoveLocation(udg_variablename)"
 
Level 13
Joined
May 11, 2008
Messages
1,198
you can use a different create unit function to spawn at coordinates instead. the reals used in a set of coordinates don't leak. there is a giant does this leak thread somewhere you could also check. there is also a function called GetUnitX(and GetUnitY) which is useful, even GetLocationX which help to get your coordinates. if you stick with that same old create unit function that you are using, you'll need to clean the reference as already mentioned.

center of region makes the game register the point called the center of region. all you're doing here is making the game register the point called where the unit is at.

when you're dealing with points, and they are significant, i prefer to use global variables. your trigger doesn't use variables at all. using global variables can be buggy if you try using them for insignificant situations such as this. in an insignificant situation like this, the game can easily produce some reals and use an alternate function. then throw the reals away. it's a little more difficult to throw away a point because the game assumes you will need the point again.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
Here's my full comment:

  • Unit - A unit Begins casting an ability
Don't use this action, instead, use "Starts the effect of an ability"
It may lead to abusive action such as, the trigger is fired, but no cooldown and mana cost to the casting unit, because the trigger is fired even before the spell is fired

  • Unit - Create 1 Dummy Invisibility for (Owner of (Triggering unit)) at (Position of (Triggering unit)) facing Default building facing degrees
This LEAK, point-type leak
You must save the point through variable first, only then, you can clean the leak
Like this:
  • Actions
    • Set DummyLocation = (Position of (Triggering unit))
    • Unit - Create 1 Dummy Invisibility for (Owner of (Triggering unit)) at DummyLocation facing Default building facing degrees
    • Custom script: call RemoveLocation(udg_DummyLocation)
DummyLocation is Point-type variable
To set a variable, go to Action and find Set Variable action
This way, it is leakless

  • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
Usually, I use 0.50 for better efficiency
Standard casting time for all unit is at most 0.2 ~ 0.3 second
Using a 1 second clean leak of a unit creation dummy is not wrong, but you can shorten its lifespan, it is more efficient
 
Level 10
Joined
Jun 7, 2008
Messages
420
  • Stealth 360
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Stealth (Interceptor generic 360s dummy)
    • Actions
      • Set temploc = (Position of (Triggering unit))
      • Unit - Create 1 Dummy Invisibility for (Owner of (Triggering unit)) at temploc facing Default building facing degrees
      • Unit - Add a 0.50 second Generic expiration timer to (Last created unit)
      • Unit - Order (Last created unit) to Human Sorceress - Invisibility (Triggering unit)
      • Custom script: call RemoveLocation(udg_temploc)
Like this? There is no mana cost so it's fine, cooldown is almost nonexistent too.
 
Level 13
Joined
May 11, 2008
Messages
1,198
  • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
Usually, I use 0.50 for better efficiency
Standard casting time for all unit is at most 0.2 ~ 0.3 second
Using a 1 second clean leak of a unit creation dummy is not wrong, but you can shorten its lifespan, it is more efficient

this is not even close to true unless you have very limited spells.
if you want the dummy to channel something, it will not work.
if you want the dummy to have a delay(some casting time added to the spell), it will not work.
if you want the dummy to cast a spell periodically, it will not work once the period times the casts passes the lifespan.
there are probably other reasons why your suggestion is wrong, as well.

in short, the dummy dying is not a leak cleaning...the game will do that on it's own. but you should kill the dummy unless he has automatic death configured into him(negative regen like phoenix, or something). all killing the dummy sooner accomplishes is makes one less unit on the screen, which is only desirable if you have a large number of units to deal with at any given time. in that case, the spell will still be broken if you try to do any of the above things and don't set the expiration timer for the dummy high enough.
 
Level 10
Joined
Jun 7, 2008
Messages
420
Ah k it's instant cast so shouldn't be a problem. However why not just have one dummy in the game with infinite cast range so he can affect any unit on the map? And he can juggle 5 custom skills at once! (not that I have that many)
 
Level 13
Joined
May 11, 2008
Messages
1,198
Ah k it's instant cast so shouldn't be a problem. However why not just have one dummy in the game with infinite cast range so he can affect any unit on the map? And he can juggle 5 custom skills at once! (not that I have that many)

there is a system that works like that. although, i don't like it...
the reason being all damage from spells wold have to be done manually through the triggers in order to get the correct killer of a unit. because the dummy unit is owned by someone other than the player. at least, that's how that system worked.
 
Status
Not open for further replies.
Top