• 🏆 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] Need help with a unit/unit group variable

Status
Not open for further replies.
Level 25
Joined
Mar 23, 2008
Messages
1,813
What sort of variable should i use for this trigger?
  • Events
    • Lightning Strike
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Rune of Lightning Strike
    • Actions
      • Set LightningTaunt_Target = (Casting unit)
      • Unit Group - Pick every unit in (Units within 400.00 of (Position of LightningTaunt_Target)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is A structure) Equal to False
              • ((Owner of (Picked unit)) is an enemy of (Owner of LightningTaunt_Target)) Equal to True
            • Then - Actions
              • [COLOR="Red"]----->[/COLOR]Set Variable = (Picked unit)[COLOR="Red"]<-----[/COLOR]
                • Set Lightning_Damage = ((Intelligence of LightningTaunt_Target (Include bonuses)) x (Level of Rune of Lightning Strike for LightningTaunt_Target))
                • Unit - Cause LightningTaunt_Target to damage (Picked unit), dealing (Real(Lightning_Damage)) damage of attack type Spells and damage type Normal
                • Special Effect - Create a special effect at (Position of (Picked unit)) using Abilities\Spells\Other\Monsoon\MonsoonBoltTarget.mdl
                • Trigger - Turn on Lightning Strike Taunt <gen>[COLOR="Yellow"]This one is for a trigger that orders the picked units to attack the caster, but if i use the variable that i set earlier in the trigger only one of the units the spell damages attacks me[/COLOR]
            • Else - Actions
              • Do nothing
What sort of variable should i use? Unit/unit group/something else?
 
Level 16
Joined
Jun 25, 2008
Messages
1,043
The first unit group leaks,
use
  • Custom script: set bj_wantDestroyGroup = true
In the very start of the trigger.

Also, add a condition that says
  • ((Picked unit) Is Alive) Equal to True
Else it may targets dead units as well.

For the variable, you can do it the easy way, like this:
  • Unit Group - Add (Picked Unit) to (Lightning_Targets)
and then pick every unit in Lightning_Targets in the next trigger.


Should work. If not, post the 2nd trigger as well so I can look into that!

edit: also don't forget to use
  • Unit Group - Remove all units from (Lightning_Targets)
when you're done with the second trigger.

edit 2:
After
  • Special Effect - Create a special effect at (Position of (Picked unit)) using Abilities\Spells\Other\Monsoon\MonsoonBoltTarget.mdl
Use
  • Special Effect - Destroy (Last Created special effect)
this will make the effect run the animation 1 time, and then it gets removed.

You leak points too, to fix it:
  • Set TempPoint = Position of (Casting Unit)
  • Unit Group - Pick every unit in (Units withing 400.00 of (TempPoint) and do (Actions)
  • Custom Script - call RemoveLocation(udg_TempPoint)
  • set TempPoint2 = Position of (Picked Unit)
  • Special Effect - Create a special effect at (TempPoint2) using Abilities\Spells\Other\Monsoon\MonsoonBoltTarget.mdl
  • Special Effect - Destroy (Last Created special effect)
  • Custom Script - call RemoveLocation(udg_TempPoint2)


Then, in the end of the trigger
 
Level 9
Joined
Aug 28, 2005
Messages
271
Add the picked unit to a unit group to use it the second trigger.
Also you have leaks in the trigger.
Unit Group - Pick every unit in (Units within 400.00 of (Position of LightningTaunt_Target)) and do (Actions) - point leak

Special Effect - Create a special effect at (Position of (Picked unit)) using Abilities\Spells\Other\Monsoon\MonsoonBoltTarget.mdl - another point leak

Also you didn't destroy the specil effect which also leaks.
 
Status
Not open for further replies.
Top