[Trigger] tempPoint Destruction

Status
Not open for further replies.
Level 5
Joined
May 21, 2006
Messages
174
Just a quick question,

If I have a tempPoint within a For Each (Integer A) loop, do I need to destroy the tempPoint in the end of the loop or is it sufficient to destroy it at the end of the trigger?

  • Actions
    • For each (Integer A) from 1 to 3, do (Actions)
      • Loop - Actions
        • Set tempPoint = (Center of REGION <gen>)
        • Unit - Create 1 UNIT for (Player((Integer A))) at tempPoint facing Default building facing (270.0) degrees
    • Custom script: call RemoveLocation( udg_tempPoint )
Thanks.
 
If the temppoint is assigned inside the loop - as you have done - you need to destroy it at the end of each loop. Thus, do:

  • Actions
    • For each (Integer A) from 1 to 3, do (Actions)
      • Loop - Actions
        • Set tempPoint = (Center of REGION <gen>)
        • Unit - Create 1 UNIT for (Player((Integer A))) at tempPoint facing Default building facing (270.0) degrees
        • Custom script: call RemoveLocation( udg_tempPoint )
However, if your location is the center of a preset region, it'll remain the same each cycle of the loop, thus in your specific example, this would be better:

  • Actions
    • Set tempPoint = (Center of REGION <gen>)
    • For each (Integer A) from 1 to 3, do (Actions)
      • Loop - Actions
        • Unit - Create 1 UNIT for (Player((Integer A))) at tempPoint facing Default building facing (270.0) degrees
    • Custom script: call RemoveLocation( udg_tempPoint )
 
do it like this

  • Actions
  • Set tempPoint = (Center of REGION <gen>)
  • For each (Integer A) from 1 to 3, do (Actions)
    • Loop - Actions
      • Unit - Create 1 UNIT for (Player((Integer A))) at tempPoint facing Default building facing (270.0) degrees
    • Custom script: call RemoveLocation( udg_tempPoint )
edit:oh elea was faster :<
 
Status
Not open for further replies.
Back
Top