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

Lightning Test v1.0

This system helps the user to choose the correct lightning effect for spells.

Functionality 1:
Press ESC, and a lightning of every type is created, and the code and the name listed above it. Press ESC again and they will disappear.

asdf.jpg



Useful for knowing the code to be used when creating a lightning:

  • Lightning - Create a Chain Lightning - Primary lightning effect from source point1 to target point2
JASS:
call AddLightningEx("CLPB", true, x1, y1, z1, x2, y2, z2)


Functionality 2:
Type -code to set a variable called LLL to your entered string. The code is the four character string for each lightning, like afod, leas, mbur.

Then you can use the string in your code to generate lightnings, like this
JASS:
call AddLightningEx(LLL, true, x1, y1, z1, x2, y2, z2)

For example you can cast your spell and check the lightnings.

zxcv2.jpg


Then type -leas to change the lightning to Magic Leash. Cast the spell again to see the new lightnings.

zxcv.jpg


And so on.

Test spell included.

JASS:
//==================================================================================//
//                                                                                  //
//  Lightning Test by Maker v1.00                                                   //                      
//                                                                                  //
//          Allows the user to see available lightnings and lists their string code //
//          Press ESC to toggle lightnings                                          //
//          Type -code to set variable called LLL to the entered string             //                                           
//          For example -mbur                                                       //
//          Then you can use LLL in your spell and easily change the lightning type //
//          between casts.                                                          //
//==================================================================================//

library LightningTest initializer Init

    globals
        private constant    real                SZ  = 0.028 // Floating text size
        private constant    real                OX  = 0     // Origin x of upmost lightning
        private constant    real                OY  = 0     // Origin y of upmost lightning
        private constant    real                OF  = 100   // Space between lightnings
        private             boolean             ESC = true  // Begins test when Esc is pressed
        
        // Do not change the ones below
                            string              LLL = "LEAS"
        private             boolean             TOG = true
        private             string      array   SA
        private             lightning   array   LA
        private             texttag     array   TA
    endglobals
    
    private function InitStrings takes nothing returns nothing
        set SA[0] = "CLPB - Chain Lightning Primary"
        set SA[1] = "CLSB - Chain Lightning Secondary"
        set SA[2] = "DRAB - Drain"
        set SA[3] = "DRAL - Drain Life"
        set SA[4] = "DRAM - Drain Mana"
        set SA[5] = "AFOD - Finger of Death"
        set SA[6] = "FORK - Forked Lightning"
        set SA[7] = "HWPB - Healing Wave Primary"
        set SA[8] = "HWSB - Healing Wave Secondary"
        set SA[9] = "CHIM - Lightning Attack"
        set SA[10] = "LEAS - Magic Leash"
        set SA[11] = "MBUR - Mana Burn"
        set SA[12] = "MFPB - Mana Flare"
        set SA[13] = "SPLK - Spirit Link"
    endfunction
    
    private function SetStr takes nothing returns nothing
        set LLL = SubString(GetEventPlayerChatString(), 1, 5)
    endfunction
    
    function LightningTestBegin takes nothing returns nothing
        local integer i = 0
        local real alpha
        
        if TOG then
            call FogEnable(false)
            call FogMaskEnable(false)
            call SetCameraPosition(OX, OY)
            set alpha = 1
        else
            set alpha = 0
        endif
        loop
            call SetTextTagVisibility(TA[i], TOG)
            call SetLightningColor(LA[i], 1, 1, 1, alpha)
            set i = i + 1
            exitwhen LA[i] == null
        endloop
        set TOG = not TOG
    endfunction
    
    function LightningTestEnd takes nothing returns nothing
        set TOG = true
        call LightningTestBegin()
    endfunction
    
    private function Init takes nothing returns nothing
        local trigger t1
        local trigger t2 = CreateTrigger()
        local real x = OX
        local real y = OY
        local integer i = 0
        if ESC then
            set t1 = CreateTrigger()
            call TriggerAddAction(t1, function LightningTestBegin)
            call TriggerRegisterPlayerEvent(t1, Player(0), EVENT_PLAYER_END_CINEMATIC)
            set t1 = null
        endif
        call InitStrings()
        loop
            set TA[i] = CreateTextTag()
            call SetTextTagText(TA[i], SA[i], SZ)
            call SetTextTagPos(TA[i], x, y, 80)
            set LA[i] = AddLightningEx(SubString(SA[i], 0, 4), false, x, y, 50, x + 300, y, 50)
            call SetTextTagVisibility(TA[i], false)
            call SetLightningColor(LA[i], 1, 1, 1, 0)
            set i = i + 1
            exitwhen SA[i] == null
            set y = y - 100
        endloop
        call TriggerRegisterPlayerChatEvent(t2, Player(0), "-", false)
        call TriggerAddAction(t2, function SetStr)
        call DisplayTimedTextToPlayer(Player(0), 0, 0, 1000, "Press ESC to show/hide lightning types.")
        call DisplayTimedTextToPlayer(Player(0), 0, 0, 1000, "Type -xxxx to change the lightning string.")
        call DisplayTimedTextToPlayer(Player(0), 0, 0, 1000, "For example -mbur")
        set t2 = null
    endfunction

endlibrary

Keywords:
lightning, test
Contents

Lightning Test (Map)

Reviews
10 Oct 2011 Bribe: It does its job well. I plan to use this next time I am testing out lightning. Status: Highly Recommended for people who want to test out lightning.

Moderator

M

Moderator

10 Oct 2011
Bribe: It does its job well. I plan to use this next time I am testing out lightning.

Status: Highly Recommended for people who want to test out lightning.
 
Level 7
Joined
Sep 2, 2011
Messages
349
I have a question. Is there a custom lightning? Like, you can import? Because I have seen some lightning that has different colors.
 
Level 37
Joined
Mar 6, 2006
Messages
9,243
Tips:
function init -> function Init
function initStrings -> function InitStrings

Done.

  • Lightning - Create a Chain Lightning - Primary lightning effect from source point1 to target point2
This doesn't turn into this?

JASS:
call AddLightningEx("CLPB", true, x1, y1, z1, x2, y2, z2)

You're right, but that's not the point. The point is to demonstrate where one can use the lightning codes and the names.

I don't understand the LLL variable thingy. Do you use it in the code, or does it replace the type of lightning in-game with a preset from the trigger code?

Can this read the lightning code of custom lightning data?

LLL is a global variable, you can use it in your code when you test which lightning you want to use.

I use LLL variable in the example spell. Cast it. Then type some other lightning code. Cast the spell again. The lightnings change.

You can add your custom lightning codes to the list in InitStrings.

I have a question. Is there a custom lightning? Like, you can import? Because I have seen some lightning that has different colors.

http://www.hiveworkshop.com/forums/tutorial-submission-283/how-customise-lightning-effects-203171/
 
Level 4
Joined
Nov 24, 2010
Messages
62
  • Lightning - Create a Chain Lightning - Primary lightning effect from source point1 to target point2
This doesn't turn into this?

JASS:
call AddLightningEx("CLPB", true, x1, y1, z1, x2, y2, z2)

Isn't it:

JASS:
call AddLightning("CLPB", true, x1, y1, x2, y2)

z is the height of the lighting.
JASS:
call AddLightning("CLPB", true, x1, y1, x2, y2)
This make lightning on the earth ( z = height = 0 ) and it's looked so ugly!
 
Top