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

Unit crosses lighting effect

Status
Not open for further replies.
Title says it all, this is a bit complicated, so dont try to answer this with GUI, please.

I've found a spell that does this http://www.wc3c.net/showthread.php?t=103561 but its a little bit complicated (A lot complicated, actually)

what i basically need is just that basic idea, but there's 2 defined points, and the lighting is between them, then if the unit goes in the lighting it dies, plain and simple.

you can use "call KillUnit(u)" if you want, this isn't a spell, its part of a maze.

Thanks!
 
Level 8
Joined
Dec 9, 2009
Messages
397
If it's not part of a spell wouldn't it be easier to make it a location to kill a unit that enters, for effect use a dummy unit casting a channeled spell at another dummy unit., and when you want it removed it's easy to disable that trigger.
 
Level 37
Joined
Mar 6, 2006
Messages
9,243
Here you go. I hope you get the general idea.

But, ZOMG, it's GUI! Oh noes!
  • Untitled Trigger 061
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Set Temp_Loc_1 = (Center of Region 000 <gen>)
      • Set Temp_Loc_2 = (Center of Region 001 <gen>)
      • Set Temp_Real_1 = (Distance between Temp_Loc_1 and Temp_Loc_2)
      • Unit - Create 1 Footman Dummy for Player 1 (Red) at Temp_Loc_1 facing Temp_Loc_2
      • Unit - Set the custom value of (Last created unit) to (Integer((Temp_Real_1 / 2.00)))
      • Unit Group - Add (Last created unit) to Temp_Group_1
      • Unit - Create 1 Footman Dummy for Player 1 (Red) at Temp_Loc_2 facing Temp_Loc_1
      • Unit - Set the custom value of (Last created unit) to (Integer((Temp_Real_1 / 1.00)))
      • Unit Group - Add (Last created unit) to Temp_Group_1
      • Custom script: call RemoveLocation(udg_Temp_Loc_1)
      • Custom script: call RemoveLocation(udg_Temp_Loc_2)
  • Untitled Trigger 062
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in Temp_Group_1 and do (Actions)
        • Loop - Actions
          • Set Temp_Loc_1 = (Position of (Picked unit))
          • Set Temp_Real_1 = (Facing of (Picked unit))
          • Set Temp_Group_2 = (Units within (Real((Custom value of (Picked unit)))) of Temp_Loc_1 matching ((((Matching unit) is alive) Equal to True) and ((Unit-type of (Matching unit)) Not equal to Footman Dummy)))
          • Unit Group - Pick every unit in Temp_Group_2 and do (Actions)
            • Loop - Actions
              • Set Temp_Loc_2 = (Position of (Picked unit))
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Cos((Temp_Real_1 - (Angle from Temp_Loc_1 to Temp_Loc_2)))) Greater than (Cos(2.00))
                • Then - Actions
                  • Unit - Kill (Picked unit)
                  • Special Effect - Create a special effect at Temp_Loc_2 using Abilities\Spells\Undead\AnimateDead\AnimateDeadTarget.mdl
                  • Special Effect - Destroy (Last created special effect)
                • Else - Actions
              • Custom script: call RemoveLocation(udg_Temp_Loc_2)
          • Custom script: call DestroyGroup(udg_Temp_Group_2)
          • Custom script: call RemoveLocation(udg_Temp_Loc_1)
You can experiment with the angle and trigger update rate. Use something to turn the trigger on/off so it doesn't run all the time.
 

Attachments

  • Trap_Line.w3x
    28.3 KB · Views: 40
Maker, thanks! That's very helpful.

Edit: Could i be able to make it so the lighting follows 2 moving units? and when the lighting crosses a unit or the unit crosses the lighting it dies?

i tried this trigger, but it didn't work

  • Untitled Trigger 061
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Set Temp_Loc_1 = (Center of Region 000 <gen>)
      • Set Temp_Loc_2 = (Center of Region 001 <gen>)
      • Set Temp_Real_1 = (Distance between Temp_Loc_1 and Temp_Loc_2)
      • Unit - Create 1 Footman Dummy for Player 1 (Red) at Temp_Loc_1 facing Temp_Loc_2
      • Unit - Set the custom value of (Last created unit) to (Integer((Temp_Real_1 / 2.00)))
      • Unit Group - Add (Last created unit) to Temp_Group_1
      • Set Dummies[0] = (Last created unit)
      • Unit - Create 1 Footman Dummy for Player 1 (Red) at Temp_Loc_2 facing Temp_Loc_1
      • Unit - Set the custom value of (Last created unit) to (Integer((Temp_Real_1 / 1.00)))
      • Unit Group - Add (Last created unit) to Temp_Group_1
      • Set Dummies[1] = (Last created unit)
      • Custom script: call RemoveLocation(udg_Temp_Loc_1)
      • Custom script: call RemoveLocation(udg_Temp_Loc_2)
  • Untitled Trigger 062
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
      • Set Temp_Loc_1 = (Position of Dummies[0])
      • Set Temp_Loc_2 = (Position of Dummies[1])
      • Set Temp_Real_1 = (Distance between Temp_Loc_1 and Temp_Loc_2)
      • Unit - Set the custom value of Dummies[0] to (Integer((Temp_Real_1 / 2.00)))
      • Unit - Set the custom value of Dummies[1] to (Integer((Temp_Real_1 / 1.00)))
      • Lightning - Destroy Lightning
      • Custom script: set udg_Lightning = AddLightningEx( "AFOD" , true, GetLocationX(udg_Temp_Loc_1), GetLocationY(udg_Temp_Loc_1), GetLocationZ(udg_Temp_Loc_1) + 100, GetLocationX(udg_Temp_Loc_2), GetLocationY(udg_Temp_Loc_2), GetLocationZ(udg_Temp_Loc_2) + 100)
      • Custom script: call RemoveLocation(udg_Temp_Loc_1)
      • Custom script: call RemoveLocation(udg_Temp_Loc_2)
      • Unit Group - Pick every unit in Temp_Group_1 and do (Actions)
        • Loop - Actions
          • Set Temp_Loc_1 = (Position of (Picked unit))
          • Set Temp_Real_1 = (Facing of (Picked unit))
          • Set Temp_Group_2 = (Units within (Real((Custom value of (Picked unit)))) of Temp_Loc_1 matching ((((Matching unit) is alive) Equal to True) and ((Unit-type of (Matching unit)) Not equal to Footman Dummy)))
          • Unit Group - Pick every unit in Temp_Group_2 and do (Actions)
            • Loop - Actions
              • Set Temp_Loc_2 = (Position of (Picked unit))
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Cos((Temp_Real_1 - (Angle from Temp_Loc_1 to Temp_Loc_2)))) Greater than (Cos(2.00))
                • Then - Actions
                  • Unit - Kill (Picked unit)
                  • Special Effect - Create a special effect at Temp_Loc_2 using Abilities\Spells\Undead\AnimateDead\AnimateDeadTarget.mdl
                  • Special Effect - Destroy (Last created special effect)
                • Else - Actions
              • Custom script: call RemoveLocation(udg_Temp_Loc_2)
          • Custom script: call DestroyGroup(udg_Temp_Group_2)
          • Custom script: call RemoveLocation(udg_Temp_Loc_1)
 
Last edited:
Status
Not open for further replies.
Top