1. Are you planning to upload your awesome spell or system to Hive? Please review the rules here.
    Dismiss Notice
  2. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  3. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  4. The Lich King demands your service! We've reached the 19th edition of the Icon Contest. Come along and make some chilling servants for the one true king.
    Dismiss Notice
  5. The 4th SFX Contest has started. Be sure to participate and have a fun factor in it.
    Dismiss Notice
  6. The poll for the 21st Terraining Contest is LIVE. Be sure to check out the entries and vote for one.
    Dismiss Notice
  7. The results are out! Check them out.
    Dismiss Notice
  8. Don’t forget to sign up for the Hive Cup. There’s a 555 EUR prize pool. Sign up now!
    Dismiss Notice
  9. The Hive Workshop Cup contest results have been announced! See the maps that'll be featured in the Hive Workshop Cup tournament!
    Dismiss Notice
  10. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Lightning Test v1.0

Submitted by Maker
This bundle is marked as approved. It works and satisfies the submission rules.
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.
Image

[​IMG]


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

Code (vJASS):
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
Code (vJASS):

call AddLightningEx(LLL, true, x1, y1, z1, x2, y2, z2)
 


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

[​IMG]

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

[​IMG]

And so on.

Test spell included.

Code (vJASS):

//==================================================================================//
//                                                                                  //
//  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
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.
  1. 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.
     
  2. Zaio

    Zaio

    Joined:
    Jul 3, 2011
    Messages:
    247
    Resources:
    1
    Spells:
    1
    Resources:
    1
    Can this really be classified as a spell?

    But still i could see uses of this for people wanting to create spells and effects and i dont see anything else like it, good job.
     
  3. Maximum_Evil

    Maximum_Evil

    Joined:
    Nov 28, 2009
    Messages:
    1,527
    Resources:
    4
    Maps:
    4
    Resources:
    4
    The screenie is kinda usefulll :) never knew the difference between Primary and Secondary,

    this could be very usefull
     
  4. Magtheridon96

    Magtheridon96

    Joined:
    Dec 12, 2008
    Messages:
    6,006
    Resources:
    26
    Maps:
    1
    Spells:
    8
    Tutorials:
    7
    JASS:
    10
    Resources:
    26
    Cool.
    This could be very useful :)

    Tips:
    function init -> function Init
    function initStrings -> function InitStrings

    Jass convention ;D
     
  5. baassee

    baassee

    Joined:
    Nov 14, 2008
    Messages:
    3,220
    Resources:
    17
    Spells:
    14
    Tutorials:
    3
    Resources:
    17
    • Lightning - Create a Chain Lightning - Primary lightning effect from source point1 to target point2

    This doesn't turn into this?

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


    Isn't it:

    Code (vJASS):
    call AddLightning("CLPB", true, x1, y1, x2, y2)
     
  6. Jazztastic

    Jazztastic

    Joined:
    Apr 4, 2011
    Messages:
    896
    Resources:
    7
    Spells:
    6
    Tutorials:
    1
    Resources:
    7
    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?
     
  7. RakEnRoL

    RakEnRoL

    Joined:
    Sep 2, 2011
    Messages:
    316
    Resources:
    0
    Resources:
    0
    I have a question. Is there a custom lightning? Like, you can import? Because I have seen some lightning that has different colors.
     
  8. Maker

    Maker

    Joined:
    Mar 6, 2006
    Messages:
    9,181
    Resources:
    17
    Maps:
    2
    Spells:
    14
    Tutorials:
    1
    Resources:
    17
    Done.

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

    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.

    http://www.hiveworkshop.com/forums/tutorial-submission-283/how-customise-lightning-effects-203171/
     
  9. Gopinich

    Gopinich

    Joined:
    Nov 24, 2010
    Messages:
    58
    Resources:
    0
    Resources:
    0
    z is the height of the lighting.
    Code (vJASS):
    call AddLightning("CLPB", true, x1, y1, x2, y2)

    This make lightning on the earth ( z = height = 0 ) and it's looked so ugly!
     
  10. baassee

    baassee

    Joined:
    Nov 14, 2008
    Messages:
    3,220
    Resources:
    17
    Spells:
    14
    Tutorials:
    3
    Resources:
    17
    Wasn't my point with my post. Maker got my point just fine anyway. And I know the natives well enough trust me.
     
  11. Gopinich

    Gopinich

    Joined:
    Nov 24, 2010
    Messages:
    58
    Resources:
    0
    Resources:
    0
    Don't be serious :p
    Just for anyone who doesn't know about it :grin:
     
  12. Zeatherann

    Zeatherann

    Joined:
    Nov 25, 2008
    Messages:
    1,303
    Resources:
    6
    Skins:
    1
    Tools:
    1
    Maps:
    4
    Resources:
    6
    What's the point of this? to make using lightning effects easier or to just provide a table of lightning types and natives? Both are useful.
     
  13. Zaio

    Zaio

    Joined:
    Jul 3, 2011
    Messages:
    247
    Resources:
    1
    Spells:
    1
    Resources:
    1
    True, but you can change theese in-game for faster viewing of all types of lightning.