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

[Spell] How can i do a lightning area that does damage like This

Status
Not open for further replies.
Level 2
Joined
Sep 13, 2020
Messages
25
Screenshot (5).png
Something like This i like this one very much. So is this model or trigger? or something else? Soo can someone please help me with it.
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,884
The lightning effect is pretty simple, it's just 10 of these:
  • Lightning - Create a Forked Lightning lightning effect from source Point[A] to target Point[B]
But you'd have to go into detail on how the damage is dealt. Is everything inside of that pentagram going to take damage? Or only if the enemy is touching the lightning?
 
Level 2
Joined
Sep 13, 2020
Messages
25
and can u do this trigger like this do not know how to do this triger :/ (send map with full trigger ("full trigger" fully like this lighting please) please)
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,884
and can u do this trigger like this do not know how to do this triger :/ (send map with full trigger ("full trigger" fully like this lighting please) please)
I could make the trigger but I use the latest version of Warcraft 3. You can't open my map if you are using an older version.

Also, I'm not 100% sure what you mean by: "if enemy touch or go into the lightnin he will take damage"

So in your picture the Hero (Fire Lord) would take damage? Or NOT take damage? He's in the center, not touching any lightning, so I assume he would NOT take damage.
 
Level 2
Joined
Sep 13, 2020
Messages
25
uhhh lightnin is like area without space and if enemy do not touch lightning they will take damage ("do not touch" in lighting area
 
Level 24
Joined
Feb 27, 2019
Messages
833
It would take me too long to create that trigger. I made a similar trigger a while ago though. Its not very efficient like Line Segment Enumeration would be but it may give a clue how it could be done. My lightning moves around so I have to set variables each time. I made it a while ago.
  • LightningDamage
    • Events
      • Time - Every (Random real number between 0.27 and 0.28) seconds of game time
    • Conditions
    • Actions
      • Set VariableSet ChainDistance = 100
      • Set VariableSet LightPoint1 = (Position of Farmer Kenneth 0001 <gen>)
      • Set VariableSet LightPoint2 = (Position of Steven)
      • Set VariableSet ChainCount_Integer = ((Integer((Distance between LightPoint1 and LightPoint2))) / ChainDistance)
      • Set VariableSet ChainCount_Integer = (ChainCount_Integer - 1)
      • For each (Integer A) from 1 to ChainCount_Integer, do (Actions)
        • Loop - Actions
          • Set VariableSet ChainPoint = (LightPoint1 offset by (Real(ChainDistance)) towards (Angle from LightPoint1 to LightPoint2) degrees.)
          • Set VariableSet LightGroup1 = (Units within 90.00 of ChainPoint matching (((Unit-type of (Matching unit)) Equal to Scared Pig) and (((Matching unit) is alive) Equal to True)).)
          • Unit Group - Pick every unit in LightGroup1 and do (Actions)
            • Loop - Actions
              • Unit - Cause Farmer Kenneth 0001 <gen> to damage (Picked unit), dealing 8.00 damage of attack type Spells and damage type Lightning
              • Special Effect - Create a special effect attached to the chest of (Picked unit) using Abilities\Weapons\FarseerMissile\FarseerMissile.mdl
              • Special Effect - Destroy (Last created special effect)
          • Custom script: call RemoveLocation(udg_ChainPoint)
          • Custom script: call DestroyGroup(udg_LightGroup1)
          • Set VariableSet ChainDistance = (ChainDistance + 100)
      • Custom script: call RemoveLocation(udg_LightPoint1)
      • Custom script: call RemoveLocation(udg_LightPoint2)
For the pentagram spell this would work aswell. Youd need a few more points created at an angle and offset from the unit.

Point1 = Location of Triggering unit offset by 392 towards 0
Point2 = Location of Triggering unit offset by 392 towards 72
Point3 = Location of Triggering unit offset by 392 towards 144
Point4 = Location of Triggering unit offset by 392 towards 216
Point5 = Location of Triggering unit offset by 392 towards 288

Create lightning between Point1 and Point2
Create lightning between Point2 and Point3
Create lightning between Point3 and Point4
Create lightning between Point4 and Point5
Create lightning between Point5 and Point1

Create lightning between Point1 and Point3
Create lightning between Point3 and Point5
Create lightning between Point5 and Point2
Create lightning between Point2 and Point4
Create lightning between Point4 and Point1

So youd need 10 loops looking something like mine. To avoid double damage one could add units to a group instead of creating a temp group and apply damage in the end of the trigger. I dont think it would lag but it certainly wouldnt be the most efficient way of doing it.
 

Chaosy

Tutorial Reviewer
Level 41
Joined
Jun 9, 2011
Messages
13,241
Are you sure that is the cleanest solution? that's a lot of code for displaying some lightning. Admittedly path detection is annoying but since you are using a system for that..

I remember making a similar effect for a cinematic where I had a rotating lightning star for some summon effect. I do not have perfect memory but probably five times less code.
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,884
Are you sure that is the cleanest solution? that's a lot of code for displaying some lightning. Admittedly path detection is annoying but since you are using a system for that..

I remember making a similar effect for a cinematic where I had a rotating lightning star for some summon effect. I do not have perfect memory but probably five times less code.
Cleanest solution? Definitely not. A working solution? Yes.

Most of the clutter is from the Line Segment system though. I have to set Point A and Point B each time, for 10 separate Lightning effects. Then pick every unit each time... Clean up points each time... etc...

I could maybe clean it up though so that it's all done in one Loop. It was easier to just make the pentagon using a Loop and then manually make the star shape referencing the pentagon's 5 points.
 
Last edited:

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,884
Edit: Newer version. Still not perfect but I'm not great at math... It's definitely cleaner though.

Anyway, @Jahongir you won't be able to open my map but I figured I'd put it together anyway. It's a bit complex.

Note that Lightning is bugged in Reforged so this will only work in Classic Graphics.

It uses some Custom Script (Jass) that creates a Pentagram shape. I copied and edited an existing Pentagon function from this thread ===Formula Thread===.

vJASS:
function CreatePentagram takes string lite, real centerX, real centerY, real facing, real radius returns nothing
    local integer sides = 5
    local real array x
    local real array y
    local location tempLoc
    local integer i=0
    local integer j=0
    local real angle=facing*3.14159/180
    loop
        exitwhen (i==sides)
        set x[i]=centerX+Cos(angle)*radius
        set y[i]=centerY+Sin(angle)*radius
        set angle=angle+(2*3.14159/sides)
        set i=i+1
    endloop
    set i=0
    loop
        exitwhen (i==sides)
        set j=ModuloInteger(i+2,sides)
        set udg_Penta_P[i] = Location(x[i], y[i])
        set tempLoc = Location(x[j], y[j])
        set udg_Penta_Lite[i] = AddLightningEx(lite, true , GetLocationX(udg_Penta_P[i]), GetLocationY(udg_Penta_P[i]), GetLocationZ(udg_Penta_P[i]) + udg_Penta_Z, GetLocationX(tempLoc), GetLocationY(tempLoc), GetLocationZ(tempLoc) + udg_Penta_Z)
        call RemoveLocation(tempLoc)
        set udg_Penta_P[i+sides] = Location(x[i], y[i])
        if i != 4 then
            set tempLoc = Location(x[i+1], y[i+1])
        else
            set tempLoc = Location(x[0], y[0])
        endif
        set udg_Penta_Lite[i+sides] = AddLightningEx(lite, true , GetLocationX(udg_Penta_P[i]), GetLocationY(udg_Penta_P[i]), GetLocationZ(udg_Penta_P[i]) + udg_Penta_Z, GetLocationX(tempLoc), GetLocationY(tempLoc), GetLocationZ(tempLoc) + udg_Penta_Z)
        call RemoveLocation(tempLoc)
        set i=i+1
    endloop
    set tempLoc = null
endfunction
You can choose the type of Lightning Art you want to use when you call the CreatePentagram function by changing this line: "CLPB"

Here is a list of the Lightning Art to choose from:
vJASS:
"Chain Lightning Primary" - "CLPB"
"Chain Lightning Secondary" - "CLSB"
"Drain" - "DRAB"
"Drain Life" - "DRAL"
"Drain Mana" - "DRAM"
"Finger of Death" - "AFOD"
"Forked Lightning" - "FORK"
"Healing Wave Primary" - "HWPB"
"Healing Wave Secondary" - "HWSB"
"Lightning Attack" - "CHIM"
"Magic Leash" - "LEAS"
"Mana Burn" - "MBUR"
"Mana Flare" - "MFPB"
"Spirit Link" - "SPLK"

Here are the triggers. I realize it's a bit complicated to recreate.
  • Create Pentagram Lightning
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to PutYourAbilityHere
    • Actions
      • -------- -=-=-=-=-=-=-=-=-=-=-=-=- --------
      • -------- CONFIGURE: --------
      • -------- The size of the Pentagram: --------
      • Set VariableSet Penta_Radius = 400.00
      • -------- The width of the Lightning. Think of it as the Area of Effect of each Lightning: --------
      • Set VariableSet Penta_Width = 50.00
      • -------- The damage dealt every 0.10 seconds: --------
      • Set VariableSet Penta_Damage = 5.00
      • -------- The height of the Lightning from the ground: --------
      • Set VariableSet Penta_Z = 40.00
      • -------- How long the effect lasts (make sure this is longer than the spell's cooldown): --------
      • Set VariableSet Penta_Duration = 5.00
      • -------- -=-=-=-=-=-=-=-=-=-=-=-=- --------
      • -------- --------
      • Set VariableSet Penta_Hero = (Triggering unit)
      • Custom script: call CreatePentagram("CLPB", GetUnitX(udg_Penta_Hero), GetUnitY(udg_Penta_Hero), GetUnitFacing(udg_Penta_Hero), udg_Penta_Radius)
      • -------- CreatePentagram Parameters: LightningArt, UnitX, UnitY, UnitAngle, Radius --------
      • -------- --------
      • -------- Turn On Damage --------
      • Trigger - Turn on Pentagram Damage <gen>
      • -------- --------
      • Wait Penta_Duration seconds
      • -------- --------
      • -------- Turn Off Damage --------
      • Trigger - Turn off Pentagram Damage <gen>
      • -------- --------
      • -------- Clean Up --------
      • For each (Integer Penta_Loop) from 0 to 9, do (Actions)
        • Loop - Actions
          • Lightning - Destroy Penta_Lite[Penta_Loop]
          • Custom script: call RemoveLocation(udg_Penta_P[udg_Penta_Loop])
  • Pentagram Damage
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Set VariableSet LSE_Offset = Penta_Width
      • -------- --------
      • For each (Integer Penta_Loop) from 0 to 9, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Penta_Loop Less than 5
            • Then - Actions
              • Set VariableSet LSE_Loc_1 = (Penta_P[Penta_Loop] offset by (0.00, 0.00))
              • Set VariableSet LSE_Loc_2 = (Penta_P[(Penta_Loop + 2)] offset by (0.00, 0.00))
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Penta_Loop Less than 9
                • Then - Actions
                  • Set VariableSet LSE_Loc_1 = (Penta_P[Penta_Loop] offset by (0.00, 0.00))
                  • Set VariableSet LSE_Loc_2 = (Penta_P[(Penta_Loop + 1)] offset by (0.00, 0.00))
                • Else - Actions
                  • Set VariableSet LSE_Loc_1 = (Penta_P[Penta_Loop] offset by (0.00, 0.00))
                  • Set VariableSet LSE_Loc_2 = (Penta_P[0] offset by (0.00, 0.00))
          • -------- --------
          • Trigger - Run LSE_GetUnits (ignoring conditions)
          • Unit Group - Pick every unit in LSE_Group and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Picked unit) belongs to an enemy of (Owner of Penta_Hero).) Equal to True
                  • ((Picked unit) is alive) Equal to True
                  • ((Picked unit) is in Penta_wasDamaged.) Equal to False
                • Then - Actions
                  • Unit Group - Add (Picked unit) to Penta_wasDamaged
                  • Unit - Cause Penta_Hero to damage (Picked unit), dealing Penta_Damage damage of attack type Spells and damage type Magic
                • Else - Actions
          • -------- --------
          • Custom script: call RemoveLocation(udg_LSE_Loc_1)
          • Custom script: call RemoveLocation(udg_LSE_Loc_2)
      • -------- --------
      • Unit Group - Remove all units from Penta_wasDamaged.
It's using the Line Segment Enumeration system I linked before.

Note that the spell is not MUI and will break if you cast it again while an existing cast is still active.

In other words, the Cooldown needs to be be longer than the Duration and only 1 Unit should have this ability at a time.
 

Attachments

  • Pentagram Ability 1.w3m
    32.6 KB · Views: 14
  • variables.png
    variables.png
    21.3 KB · Views: 19
Last edited:

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,884
It's not too difficult to recreate, I have everything listed out. You can use Search for Text to find all of the Actions.

I attached step by step pictures on how to do it. Follow steps 1 to 7.
 

Attachments

  • step 1.png
    step 1.png
    819.3 KB · Views: 22
  • step 2.png
    step 2.png
    792.3 KB · Views: 21
  • step 2 finished.png
    step 2 finished.png
    821.5 KB · Views: 29
  • step 3.png
    step 3.png
    413.6 KB · Views: 31
  • step 4.png
    step 4.png
    912.5 KB · Views: 32
  • step 4 finished.png
    step 4 finished.png
    807 KB · Views: 24
  • step 5.png
    step 5.png
    892.8 KB · Views: 36
  • step 6.png
    step 6.png
    847.7 KB · Views: 31
  • step 7.png
    step 7.png
    969 KB · Views: 25
Last edited:
Status
Not open for further replies.
Top