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

[Trigger] call RemoveLocation in loop?

Status
Not open for further replies.
Hi, all!
As the title says is is good to remove locations in loop, or should i remove locations wen the loops are over?
  • Spell
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Spell
    • Actions
      • Set TempLoc1 = (Position of (Triggering unit))
      • Set TempLocNew = (Position of (Triggering unit))
      • For each (Integer A) from 1 to 36, do (Actions)
        • Loop - Actions
          • Unit - Create 1 Dummy for (Triggering player) at TempLoc1 facing Default building facing degrees
          • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
          • Unit - Add Taste of Death(dummy) to (Last created unit)
          • Set TempLoc1_Cast = (TempLocNew offset by 200.00 towards (10.00 x (Real((Integer A)))) degrees)
          • Unit - Order (Last created unit) to Undead Dreadlord - Carrion Swarm TempLoc1_Cast
      • Custom script: call RemoveLocation (udg_TempLoc1)
      • Custom script: call RemoveLocation (udg_TempLoc1_Cast)
      • Custom script: call RemoveLocation (udg_TempLocNew)
  • .
  • .
  • .
  • Te action below are not important now
Now im using the trigger where remove locations aren't in a loop.
 
Level 9
Joined
May 27, 2006
Messages
498
Remove the location used in the loop at its end. Otherwise, you'll leak all the locations used in loop.

  • Actions
    • Set TempPoint = (Position of (Triggering unit))
    • For each (Integer A) from 1 to 10 do (Actions:)
      • Set TempPoint2 = (TempPoint offset by 100 towards (36 x (Integer A)) degrees
      • Unit - ...
      • Custom script: call RemoveLocation(udg_TempPoint2)
    • Custom script: call RemoveLocation(udg_TempPoint)
 
I have a new question, Its a multiple chain ligtning, i have the trigger but i cant make it work:
  • Spell
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Chain of Pain
    • Actions
      • Set TempLoc9 = (Target point of ability being cast)
      • Set GroupVar4 = (Units within 1000.00 of TempLoc9 matching (((Owner of (Last created unit)) is an enemy of (Owner of (Picked unit))) Equal to True))
      • For each (Integer A) from 1 to 5, do (Actions)
        • Loop - Actions
          • Wait 1.10 seconds
          • Unit Group - Pick every unit in GroupVar4 and do (Actions)
            • Loop - Actions
              • Set UnitVarPicked2 = (Random unit from GroupVar4)
          • Unit - Create 1 Dummy(big one) for (Triggering player) at TempLoc9 facing Default building facing degrees
          • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
          • Unit - Add Chain of Pain(dummy) to (Last created unit)
          • Unit - Order (Last created unit) to Orc Far Seer - Chain Lightning UnitVarPicked2
          • Custom script: call DestroyGroup(udg_GroupVar4)
          • Custom script: call RemoveLocation (udg_TempLoc9)
          • Custom script: set udg_UnitVarPicked2 = null
Its something wrong with "picked" unit,it dont detect it. Any ideas are welcome.
HF -BZR-
 
Level 9
Joined
Mar 25, 2005
Messages
252
In your new script you create a location and a group outside the loop, thus you should also remove them outside the loop, unless you wish them to be gone right after the first iteration.
In other words place the following part after the loop:
  • Custom script: call DestroyGroup(udg_GroupVar4)
  • Custom script: call RemoveLocation (udg_TempLoc9)
Also this
  • Custom script: set udg_UnitVarPicked2 = null
is most likely about 99.9999999999999999% useless, that is unless you want it to be null in between the waits.

Also the following can be done better:
  • Unit Group - Pick every unit in GroupVar4 and do (Actions)
  • Loop - Actions
    • Set UnitVarPicked2 = (Random unit from GroupVar4)
because only this part is necessary:
  • Set UnitVarPicked2 = (Random unit from GroupVar4)
and you don't have to have it in that Unit Group loop.
 
Ow, thank to both of you. I'll try to do what you wrote DOL, thanks again!
Thanks again(and again xD) To both of you! It works nice now :)
O crap it dont works perfectly sometimes works sometime dont :S
now i'm using this trigger :
  • Spell
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Chain of Pain
    • Actions
      • Set TempLoc9 = (Target point of ability being cast)
      • Set GroupVar4 = (Units within 2000.00 of TempLoc9 matching (((Owner of (Matching unit)) is an enemy of (Owner of (Triggering unit))) Equal to True))
      • Set UnitVarPicked2 = (Random unit from GroupVar4)
      • For each (Integer A) from 1 to (2 x (Level of Chain of Pain for (Triggering unit))), do (Actions)
        • Loop - Actions
          • Wait 1.00 seconds
          • Special Effect - Create a special effect at TempLoc9 using Abilities\Spells\Undead\DeathCoil\DeathCoilSpecialArt.mdl
          • Set SpecialEffect[1] = (Last created special effect)
          • Unit - Create 1 Dummy(big one) for (Triggering player) at TempLoc9 facing Default building facing degrees
          • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
          • Unit - Add Chain of Pain(dummy) to (Last created unit)
          • Unit - Set level of Chain of Pain(dummy) for (Last created unit) to (Level of Chain of Pain for (Triggering unit))
          • Unit - Order (Last created unit) to Orc Far Seer - Chain Lightning UnitVarPicked2
          • Special Effect - Destroy SpecialEffect[1]
      • Custom script: call DestroyGroup(udg_GroupVar4)
      • Custom script: call RemoveLocation (udg_TempLoc9)
But it looks cool when it works :p
 
Last edited:
Level 9
Joined
Mar 25, 2005
Messages
252
  • Set UnitVarPicked2 = (Random unit from GroupVar4)
should be inside the
  • For each (Integer A) from 1 to (2 x (Level of Chain of Pain for (Triggering unit))), do (Actions)
loop.

Earlier I was speaking of the
  • Unit Group - Pick every unit in GroupVar4 and do (Actions)
loop when I said that you don't have to have it in the Unit Group loop.
 
Knock Back.. Problem..

I searched for this but it useless...
now i use this trigger:(note its the important part)
  • Throw Copy
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Throw
    • Actions
      • Set UnitVarCaster4 = (Triggering unit)
      • Set UnitVarTarget3 = (Target unit of ability being cast)
      • Set TempLoc11 = (Position of UnitVarCaster4)
      • Set TempLoc12 = (Position of UnitVarTarget3)
      • Trigger - Turn on ThrowKnock <gen>
      • Wait 1.50 seconds
      • Trigger - Turn off ThrowKnock <gen>
      • Custom script: call RemoveLocation (udg_TempLoc11)
      • Custom script: call RemoveLocation (udg_TempLoc12)
  • ThrowKnock
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Unit - Move UnitVarTarget3 instantly to (TempLoc12 offset by 256.00 towards 200.00 degrees)
It just blinks the unit somewhere,
i made a knock back a few times but this one is evil :S

HF -BZR-
 
Level 9
Joined
May 27, 2006
Messages
498
(TempLoc12 offset by 256.00 towards 200.00 degrees) <- You forgot to decrease the offset value, didnt you? :p
And you leak a location here. When you're using this action, you create a new point. You should make it like that:
  • Actions
    • Set TempLoc13 = (TempLoc12 offset by [value] towards 200.00 degrees)
    • Unit - Move unit instantly to TempLoc13
    • Custom script: call RemoveLocation(udg_TempLoc13)
 
Thanks, but i made a bit different spell now.

  • Events
    • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Throw
    • Actions
      • Set UnitVarCaster4 = (Triggering unit)
      • Set UnitVarTarget3 = (Target unit of ability being cast)
      • Set TempLoc11 = (Position of UnitVarCaster4)
      • Set TempLoc12 = (Position of UnitVarTarget3)
      • Unit - Add FlyHeight to UnitVarTarget3
      • Special Effect - Create a special effect attached to the chest of UnitVarTarget3 using Abilities\Weapons\IllidanMissile\IllidanMissile.mdl
      • Set SpecialEffect2[1] = (Last created special effect)
      • Animation - Change UnitVarTarget3 flying height to 50.00 at 0.00
      • Animation - Change UnitVarTarget3 flying height to 100.00 at 50.00
      • Unit - Make UnitVarTarget3 Invulnerable
      • Unit - Pause UnitVarTarget3
      • Trigger - Turn on Blade Eush Slide <gen>
      • Wait 1.00 seconds
      • Trigger - Turn off Blade Eush Slide <gen>
      • Animation - Change UnitVarTarget3 flying height to 0.00 at 100.00
      • Unit - Unpause UnitVarTarget3
      • Unit - Make UnitVarTarget3 Vulnerable
      • Special Effect - Destroy SpecialEffect2[1]
      • Custom script: call RemoveLocation(udg_TempLoc11)
      • Custom script: call RemoveLocation(udg_TempLoc12)
  • Events
    • Time - Every 0.01 seconds of game time
  • Conditions
  • Actions
    • Unit - Move UnitVarTarget3 instantly to ((Position of UnitVarTarget3) offset by (0.00 + 5.00) towards (Angle from (Position of UnitVarTarget3) to (TempLoc11 offset by 5.00 towards 5.00 degrees)) degrees)
it needs some work on, but atleast it works.

I see your signature... cant wait, huh? :p (so many sleepless nights)
 
i'd change the periodic trigger to 0.04s ;)
it works to slow with .4 , but thanks for the post :)

Now back to the crappy spell(not the last one, but the one with unit group and chain lightning)
  • Nether Chains
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Nether Chains
    • Actions
      • Set TempLoc9 = (Target point of ability being cast)
      • Special Effect - Create a special effect at TempLoc9 using Abilities\Spells\Other\Drain\DrainCaster.mdl
      • Set SpecialEffect[1] = (Last created special effect)
      • For each (Integer A) from 1 to (2 x (Level of Nether Chains for (Triggering unit))), do (Actions)
        • Loop - Actions
          • Wait 1.00 seconds
          • Special Effect - Create a special effect at TempLoc9 using Abilities\Spells\Undead\DeathCoil\DeathCoilSpecialArt.mdl
          • Special Effect - Destroy (Last created special effect)
          • Unit - Create 1 Dummy(big one) for (Triggering player) at TempLoc9 facing Default building facing degrees
          • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
          • Unit - Add Nether Chains(dummy) to (Last created unit)
          • Unit - Set level of Nether Chains(dummy) for (Last created unit) to (Level of Nether Chains for (Triggering unit))
          • Set GroupVar4 = (Units within 900.00 of TempLoc9 matching (((Owner of (Matching unit)) is an enemy of (Triggering player)) Equal to True))
          • Set UnitVarPicked2 = (Random unit from GroupVar4)
          • Unit - Order (Last created unit) to Orc Far Seer - Chain Lightning UnitVarPicked2
          • Custom script: call DestroyGroup(udg_GroupVar4)
      • Special Effect - Destroy SpecialEffect[1]
      • Custom script: call RemoveLocation (udg_TempLoc9)
This works, only sometimes nothing happens(i it happens, but dummy don't cast chain lightning)
I make this spell work and my spell pack(below in signature) is finished :)
 
Status
Not open for further replies.
Top