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

[Solved] Do i need to destroy this point?

Status
Not open for further replies.
Level 2
Joined
Jun 27, 2009
Messages
11
  • HAMMERTIME
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to HAMMER TIME
    • Actions
      • Set HammerGuy_hammertime_target = (Target unit of ability being cast)
      • Set HammerGuy_hammertime_target_l = (Position of HammerGuy_hammertime_target)
      • Set HammerGuy_hammertime_quantity = 30
      • For each (Integer A) from 0 to (HammerGuy_hammertime_quantity - 1), do (Actions)
        • Loop - Actions
          • Unit - Create 1 hammerguy-dummy for (Owner of (Triggering unit)) at (HammerGuy_hammertime_target_l offset by 400.00 towards (Random angle) degrees) facing HammerGuy_hammertime_target_l
          • Set HammerGuy_hammertime_dummy[(Integer A)] = (Last created unit)
          • Unit - Order HammerGuy_hammertime_dummy[(Integer A)] to Human Mountain King - Storm Bolt HammerGuy_hammertime_target
          • Wait 0.01 game-time seconds
      • Wait 1.00 game-time seconds
      • For each (Integer A) from 0 to (HammerGuy_hammertime_quantity - 1), do (Actions)
        • Loop - Actions
          • Unit - Remove HammerGuy_hammertime_dummy[(Integer A)] from the game
      • Custom script: call RemoveLocation(udg_HammerGuy_hammertime_target_l)
So i have this line:
  • Unit - Create 1 hammerguy-dummy for (Owner of (Triggering unit)) at (HammerGuy_hammertime_target_l offset by 400.00 towards (Random angle) degrees) facing HammerGuy_hammertime_target_l
And i was wondering do i have to store that new point with offset in a new variable and then destroy it with a custom script?
In other "words" do i have to do this:
  • Set HammerGuy_hammertime_temppoint = (HammerGuy_hammertime_target_l offset by 400.00 towards (Random angle) degrees)
  • Unit - Create 1 hammerguy-dummy for (Owner of (Triggering unit)) at HammerGuy_hammertime_temppoint facing HammerGuy_hammertime_target_l
  • Set HammerGuy_hammertime_dummy[(Integer A)] = (Last created unit)
  • Unit - Order HammerGuy_hammertime_dummy[(Integer A)] to Human Mountain King - Storm Bolt HammerGuy_hammertime_target
  • Custom script: call RemoveLocation(udg_HammerGuy_hammertime_temppoint)
 
Last edited:
Level 6
Joined
Feb 10, 2011
Messages
188
IIRC the setting offset also leaks, you need to store that to a variable to.
Also, to make it easier to read. You could just use tempPoint1, tempPoint2, etc etc etc.
 
Level 22
Joined
Aug 27, 2013
Messages
3,973
if you use point with offset, you leaks twice
so do this
  • Set TempPoint = Position of YourUnit
  • Set TempPoint2 = TempPoint with offset by 400.00 towards (Random angle) degrees
then you just have to use the TempPoint2 variable when you're create your unit
when you're done using it (use the variables) then destroy it like this
  • Custom script: call RemoveLocation(udg_TempPoint)
  • Custom script: call RemoveLocation(udg_TempPoint2)
and so your trigger is leakless
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
Instead of the wait, use an expiration timer for the dummies. And as mentioned, HammerGuy_hammertime_target_l is very cumbersome to type. I use names like p1, p2 for global variables in GUI since they are short to type. You should share these kind of global variables between spells, not every spell need its own variables.
 
Level 2
Joined
Jun 27, 2009
Messages
11
Thanks for the help! It makes sense that it will leak twice. And Rheiko i did do that in the sample i posted but the second RemoveLocation function is just out of the loop and i didn't post it.
A few things that i want to say about the variables:
It is a bad programming practice to use 1 variables for 2 thing. And each variable's name should be as descriptive as possible.
 
Polar Location
jakeZinc, that's what he meant.
Anything that is a child handle leaks when not cleaned properly:
JASS:
type agent              extends     handle  // all reference counted objects

type event              extends     agent  // a reference to an event registration

type player             extends     agent  // a single player reference

type widget             extends     agent  // an interactive game object with life

type unit               extends     widget  // a single unit reference

type destructable       extends     widget

type item               extends     widget

type ability            extends     agent

type buff               extends     ability

type force              extends     agent

type group              extends     agent

type trigger            extends     agent

type triggercondition   extends     agent

type triggeraction      extends     handle

type timer              extends     agent

type location           extends     agent

type region             extends     agent

type rect               extends     agent

type boolexpr           extends     agent

type sound              extends     agent

type conditionfunc      extends     boolexpr

type filterfunc         extends     boolexpr

type unitpool           extends     handle

type itempool           extends     handle

type race               extends     handle

type alliancetype       extends     handle

type racepreference     extends     handle

type gamestate          extends     handle

type igamestate         extends     gamestate

type fgamestate         extends     gamestate

type playerstate        extends     handle

type playerscore        extends     handle

type playergameresult   extends     handle

type unitstate          extends     handle

type aidifficulty       extends     handle



type eventid            extends     handle

type gameevent          extends     eventid

type playerevent        extends     eventid

type playerunitevent    extends     eventid

type unitevent          extends     eventid

type limitop            extends     eventid

type widgetevent        extends     eventid

type dialogevent        extends     eventid

type unittype           extends     handle



type gamespeed          extends     handle

type gamedifficulty     extends     handle

type gametype           extends     handle

type mapflag            extends     handle

type mapvisibility      extends     handle

type mapsetting         extends     handle

type mapdensity         extends     handle

type mapcontrol         extends     handle

type playerslotstate    extends     handle

type volumegroup        extends     handle

type camerafield        extends     handle

type camerasetup        extends     handle

type playercolor        extends     handle

type placement          extends     handle

type startlocprio       extends     handle

type raritycontrol      extends     handle

type blendmode          extends     handle

type texmapflags        extends     handle

type effect             extends     agent

type effecttype         extends     handle

type weathereffect      extends     handle

type terraindeformation extends     handle

type fogstate           extends     handle

type fogmodifier        extends     agent

type dialog             extends     agent

type button             extends     agent

type quest              extends     agent

type questitem          extends     agent

type defeatcondition    extends     agent

type timerdialog        extends     agent

type leaderboard        extends     agent

type multiboard         extends     agent

type multiboarditem     extends     agent

type trackable          extends     agent

type gamecache          extends     agent

type version            extends     handle

type itemtype           extends     handle

type texttag            extends     handle

type attacktype         extends     handle

type damagetype         extends     handle

type weapontype         extends     handle

type soundtype          extends     handle

type lightning          extends     handle

type pathingtype        extends     handle

type image              extends     handle

type ubersplat          extends     handle

type hashtable          extends     agent
 
Status
Not open for further replies.
Top