• 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.

[Trigger] How to make this NOT lagg(Memory leak?)

Status
Not open for further replies.
Level 1
Joined
May 15, 2007
Messages
88
  • Periodic Copy
    • Events
      • Unit - A unit Is issued an order targeting a point
      • Unit - A unit Is issued an order targeting an object
      • Unit - A unit Is issued an order with no target
    • Conditions
    • Actions
      • Wait until ((Terrain type at (Position of (Triggering unit))) Equal to Cityscape - Dirt), checking every 0.50 seconds

I know this will make it lagg, but is there any way I can make it clear up the (Leaks?)?

Thanks.

PS: I can't use the:
Unit is issued order,

Condition: Terrain type=dirt


Action: Kill triggering unit


Since that would not work because the position of the triggering unit when issued the order is NOT dirt, but e.g: Grass.
 
Level 18
Joined
May 27, 2007
Messages
1,689
well to get rid of leaks in that you would need to make a point variable call lets say "TempPoint" then before you do your wait, set the "TempPoint=Position of ((Triggering) Unit)"
then instead of having "Position of ((Triggering)Unit) use the TempPoint instead, and after your trigger is COMPLETLY done, make a custom script action like so "Call RemoveLocation (udg_TempPoint)" JASS is very case sensitive
 
I haven't tested it, but I believe something like this would work.

  • Periodic Copy
    • Events
      • Unit - A unit Is issued an order targeting a point
      • Unit - A unit Is issued an order targeting an object
      • Unit - A unit Is issued an order with no target
    • Conditions
    • Actions
      • Custom script: local integer i
      • Unit - Set the custom value of (Triggering unit) to ((Custom value of (Triggering unit)) + 1)
      • Custom script: set i = GetUnitUserData(GetTriggerUnit())
      • Custom script: loop
      • Custom script: exitwhen GetTerrainType(GetUnitX(GetTriggerUnit()), GetUnitY(GetTriggerUnit())) == 'Ydrt'
      • Custom script: if GetUnitUserData(GetTriggerUnit()) != i or GetUnitState(GetTriggerUnit(), UNIT_STATE_LIFE) <= 0. then
      • Skip remaining actions
      • Custom script: endif
      • Wait 0.25 seconds
      • Custom script: endloop
      • Unit - Kill (Triggering unit)
 
Level 11
Joined
Jul 12, 2005
Messages
764
well to get rid of leaks in that you would need to make a point variable call lets say "TempPoint" then before you do your wait, set the "TempPoint=Position of ((Triggering) Unit)"
then instead of having "Position of ((Triggering)Unit) use the TempPoint instead, and after your trigger is COMPLETLY done, make a custom script action like so "Call RemoveLocation (udg_TempPoint)" JASS is very case sensitive
You are right, JASS IS case sensitive, so you shouldn't have made a mistake. "Call" should be "call"!!! And you should not leave a space between the function name and the first bracket!
Destroy the location right after using it, and not at the end of the trigger, as newer locations will overwrite the old ones, and won't be destroyed. For example, this leaks:
  • Set TempLoc = Position of (Triggering unit)
  • Do something at TempLoc
  • Set TempLoc = Position of (Target unit of ability being cast)
  • Do something at TempLoc again
  • Custom script: call RemoveLocation(udg_TempLoc)
Anyway JedimasterYoda, your part should look like this:
  • Set TempLoc = Position of (Triggering unit)
  • Wait until ((Terrain type at TempLoc) Equal to Cityscape - Dirt), checking every 0.50 seconds
  • Custom script: call RemoveLocation(udg_TempLoc)


Illidan, i don't get why you complicate this with custom value, and jass.. It's ok that coordinates are faster than locations, but why ar eyou using custom value?
 
Status
Not open for further replies.
Top