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

Lightning and Special effects

Status
Not open for further replies.
Level 6
Joined
May 15, 2009
Messages
191
Hello Hivers

I'm making a trigger that creates a link between two locations (one of the locations being centered on a moveable hero), damaging all enemy units getting too close to the link.
I've got the damage working alright, but I also want to have a Lightning Effect show between the two points, signifying the link -and furthermore, I'd like to have a special effect on the units that get caught by the link. The trigger loop follows below.
  • Infernal Totem Loop
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
      • (HeroUnit[1] is alive) Equal to True
      • (Number of living Infernal Totem units owned by Player 1 (Red)) Greater than 0
    • Actions
      • -------- Sets the initial variables: tempp1 = casterloc, tempp2 = totemloc, tempr1 = distance between points, tempr2 = burnAoE, tempr3 = angle between points --------
      • Set Tempp1 = (Position of HeroUnit[1])
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to Infernal Totem)) and do (Actions)
        • Loop - Actions
          • Set Tempp2 = (Position of (Picked unit))
      • Set Tempr1 = (Distance between Tempp1 and Tempp2)
      • Set Tempr2 = 150.00
      • Set Tempr3 = (Angle from Tempp1 to Tempp2)
      • -------- Updates the link, then picks units around the link and damages them. --------
      • Lightning - Create a Finger of Death lightning effect from source Tempp1 to target Tempp2
      • Lightning - Destroy (Last created lightning effect)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Tempr4 Less than or equal to Tempr1
        • Then - Actions
          • Set Tempr4 = (Tempr4 + Tempr2)
          • Set Tempp3 = (Tempp1 offset by Tempr4 towards Tempr3 degrees)
          • Custom script: set bj_wantDestroyGroup = true
          • Unit Group - Pick every unit in (Units within Tempr2 of Tempp3 matching ((((Matching unit) is A structure) Not equal to True) and ((((Matching unit) belongs to an enemy of (Owner of HeroUnit[1])) Equal to True) and ((((Matching unit) is Magic Immune) Not equal to True) and (((Matching unit) and do (Actions)
            • Loop - Actions
              • Special Effect - Create a special effect attached to the overhead of (Picked unit) using Abilities\Spells\Other\ImmolationRed\ImmolationRedDamage.mdl
              • Unit - Cause HeroUnit[1] to damage (Picked unit), dealing (Tempr1 / 20.00) damage of attack type Spells and damage type Normal
              • Special Effect - Destroy (Last created special effect)
        • Else - Actions
          • Set Tempr4 = 0.00
Help is much appreciated, if anything needs elaboration, do not hesitate to ask.
 
Last edited:
What exactly is working, and what is not working?

  • Unit Group - Pick every unit in (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to Infernal Totem)) and do (Actions)
    • Loop - Actions
      • Set Tempp2 = (Position of (Picked unit))
Oh noes, what is this? :eek: Very useless actions in here.

Tempr2 is always 150? Do not set it each time again. Doing so in Init is enough.

Same this:
  • (Number of living Infernal Totem units owned by Player 1 (Red)) Greater than 0

  • (Tempr4 Less than or equal to Tempr1)

And just in theory, you always wanna move +150 and then pick all units in range of 150. This way you should go 2*150 = 300 forward to prevent picking same unit again.

Your methode is bit confusing, why you do you do steps to demage units? Use a loop instead and check for distance each time.

And why destroying lightning each time? Maybe moving it would suffice.

In case you forgot, you're leaking.

Please use
tags for your trigger. It's stretching the site.
 
Level 2
Joined
Jan 23, 2014
Messages
14
1.if in your map there are more than one "Infernal totem" at the same time and you want to damage everything between HeroUnit[1] and ALL your totems then change this
  • Unit Group - Pick every unit in (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to Infernal Totem)) and do (Actions)
    • Loop - Actions
      • Set Tempp2 = (Position of (Picked unit))
It only picks the position of one totem cause rest of code is outside the "pick unit action" section

2.A very important question: what is your default value for Tempr4? If the initial value is 0.0 then (as the IcemanBo said) add the 300 to Tempr4 instead of 150. otherwise you pick some units twice

the rest of code seems generally okay in logic
 
Level 6
Joined
May 15, 2009
Messages
191
To go thorugh the things you mentioned:
The Tempp2 sets the location of the Infernal Totem (there's only one in the whole map, the one placed by the ability), but I suppose I'll just make a couple of variables uniquely for this trigger, things that will be set in the Activate Trigger, this will also be done for the Tempr2.
The condition makes sure that the trigger stops looping when the Totem dies or despawns from expiration.
I'll also set the distance for offset to 300, thank you for pointing that out.

I'll try placing the Lightning effect with the activation trigger, then moving it in the loop. But this still doesn't solve the Special Effects problem, they seem to removed too fast. How to mend this?

And btw, the trigger always worked fine, the only thing missing was the purely aesthetic thing with Lightning- and Special Effects.

UPDATE: Moving the Lightning effect around works perfectly, but the special effects are still not showing - any advice?
 
Last edited:
Status
Not open for further replies.
Top