1. Join Texturing Contest #30 now in a legendary battle of mythological creatures!
    Dismiss Notice
  2. The Aftermath has been revealed for the 19th Terraining Contest! Be sure to check out the Results and see what came out of it.
    Dismiss Notice
  3. Melee Mapping Contest #3 - Results are out! Congratulate the winners and check plenty of new 4v4 melee maps designed for this competition!
    Dismiss Notice
  4. The winners of our cinematic soundtrack competition have been decided! Step by the Music Contest #11 - Results to check the entries and congratulate the winners!
    Dismiss Notice
  5. Check out the Staff job openings thread.
    Dismiss Notice

Lightning Flashes - Environmental Effect

Discussion in 'General Mapping Tutorials' started by Legal_Ease, Mar 30, 2016.

  1. Legal_Ease

    Legal_Ease

    Joined:
    Feb 8, 2013
    Messages:
    1,455
    Resources:
    28
    Icons:
    11
    Packs:
    1
    Skins:
    2
    Maps:
    10
    Template:
    1
    Tutorials:
    3
    Resources:
    28
    zZZZLightning FlashesZZZz

    What this tutorial will teach you to do:

    Create a flashing lightning effect to add to your dynamic environmental effects. You may know how to put nature sounds across a region, create ambient rain or fog in a region and create a periodic roll of thunder, but now add heat lightning to your environment. I looked everywhere for a tutorial on how to do this. I still really like the monsoon target buff .mdx but I couldn't make the blast and fumes at the end of the animation disappear. So unless some really nice model-maker comes along and creates one, this will have to do for now.
    What you need to get started:
    1. View attachment Light.mdx
    2. World Editor

    Let's get started:

    Step 1:

    Import Light.mdx into your map with Import Manager and
    SAVE! .

    Step 2:

    Select a unit in Object Editor and make sure it is highlighted.
    Press cntrl-C and then contrl-V (copy and paste).
    Then click OK.
    This will be our light dummy unit.
    [​IMG]

    Step 3:

    Edit the unit's data fields in Object Editor as follows:
    PHP:

    Abilities - Normal: Locust
    Movement - Height: 70
    Movement - Type: Fly
    Pathing - Collision Size: 0.00
    Art - Scaling Value: 5.00
    Combat - Attacks Enabled: None
    Feel free to give it a lightning icon and anything else you want. Height is not so important but it will change the downward angle of the flash.
    And then rename it something appropriate, like LightningDummy, or fxUnit (that's what I will call it).


    Step 4:



    You can do this part many ways, and I am sure this is not the best by any means. They way you do this next part might depend on how your map is intended to function.
    Open Trigger Editor.
    Now create the trigger. Here's what I did:

    GUI
    • Lightning Flashing Effect
      • Events
        • Time - Every 60.00 seconds of game time
      • Conditions
        • (Blood Moore <gen> contains unit) Equal to True
      • Actions
        • -----set to store location for removal later. we hate leaks------
        • Set temploc = (Position of (pWhatever_Unit))
        • Set temploc2 = (temploc offset by 200.00 towards 0.00 degrees)
        • -------The distance and angle will change the intensity and x,y direction of the flash----
        • ----------------------------------------------------------------------------------------
        • Unit - Create 1 Lightning for Neutral Passive at temploc2 facing Default building facing degrees
        • Custom script: call RemoveLocation(udg_temploc)
        • Custom script: call RemoveLocation(udg_temploc2)
        • Set fxUnit = (Last created unit)
        • Wait 0.03 seconds
        • Unit - Remove fxUnit from the game
        • --------One flash is complete, but one is never enough for a spooky storm------
        • ----------so. . . . . . --------
        • Wait 0.04 seconds
        • Set temploc = (Position of unit)
        • Set temploc2 = (temploc offset by 200.00 towards 0.00 degrees)
        • Unit - Create 1 Lightning for Neutral Passive at temploc2 facing Default building facing degrees
        • Custom script: call RemoveLocation(udg_temploc)
        • Custom script: call RemoveLocation(udg_temploc2)
        • Set fxUnit = (Last created unit)
        • Wait 0.04 seconds
        • Unit - Remove fxUnit from the game
        • ------And again-------------------------------------
        • Wait 0.04 seconds
        • Set temploc = (Position of unit)
        • Set temploc2 = (temploc offset by 200.00 towards 0.00 degrees)
        • Unit - Create 1 Lightning for Neutral Passive at temploc2 facing Default building facing degrees
        • Custom script: call RemoveLocation(udg_temploc)
        • Custom script: call RemoveLocation(udg_temploc2)
        • Set fxUnit = (Last created unit)
        • Wait 0.05 seconds
        • Unit - Remove fxUnit from the game
        • -----Pause for effect and ... wait for it-----
        • Wait 1.00 seconds
        • Sound - Play RollingThunder1 <gen>
        • -----And how about a bit of thunder for a nice finish-------------

    Blizzard did it this way in Chapter 4 of the Night Elf Campaign like this:
    gui
    • Occasional Lightning
      • Events
        • Time - LightningTimer expires
      • Conditions
      • Actions
        • Wait until (InCinematic Equal to False), checking every 1.00 seconds
        • Countdown Timer - Start LightningTimer as a One-shot timer that will expire in (Random real number between 25.00 and 60.00) seconds
        • Cinematic - Fade out and back in over 0.12 seconds using texture White Mask and color (100.00%, 100.00%, 100.00%) with 5.00% transparency
        • Wait 0.03 seconds
        • Cinematic - Fade out and back in over 0.12 seconds using texture White Mask and color (100.00%, 100.00%, 100.00%) with 5.00% transparency
        • Wait 0.20 seconds
        • Set RandomSound = (Random integer number between 1 and 2)
        • If (RandomSound Equal to 1) then do (Sound - Play LightningBolt1 <gen>) else do (Do nothing)
        • If (RandomSound Equal to 2) then do (Sound - Play RollingThunder1 <gen>) else do (Do nothing)


    Or as suggested in a comment below, a better way would be to use an advanced filter. This protects tooltips:

    • Cinematic - Apply a filter over 0.12 seconds using Normal blending on texture White Mask, starting with color (100.00%, 100.00%, 100.00%) and 25.00% transparency and ending with color (0.00%, 0.00%, 0.00%) and 100.00% transparency




    Put them both together to get this effect ---->

    For more on lighting and environmental effects,
    try reading the following:

    [​IMG]




     
    Last edited: Apr 17, 2016
  2. Veritas 117

    Veritas 117

    Joined:
    Nov 17, 2010
    Messages:
    1,126
    Resources:
    0
    Resources:
    0
    I like this. I'm gonna use this for sure. I always like to make the atmosphere more immersive. Good thinking.
     
  3. PurgeandFire

    PurgeandFire

    Code Moderator

    Joined:
    Nov 11, 2006
    Messages:
    7,419
    Resources:
    18
    Icons:
    1
    Spells:
    4
    Tutorials:
    9
    JASS:
    4
    Resources:
    18
    Neat tutorial, I really like the concept.

    Approved.
     
  4. Legal_Ease

    Legal_Ease

    Joined:
    Feb 8, 2013
    Messages:
    1,455
    Resources:
    28
    Icons:
    11
    Packs:
    1
    Skins:
    2
    Maps:
    10
    Template:
    1
    Tutorials:
    3
    Resources:
    28
    I am still hunting for a better model. For now, this is the best way I know and the best (only) way yet explained in any tutorial.
     
  5. Chaosy

    Chaosy

    Joined:
    Jun 9, 2011
    Messages:
    10,523
    Resources:
    17
    Maps:
    1
    Spells:
    10
    Tutorials:
    6
    Resources:
    17
    Why not use a cinematic filter?
    It seems really simple that way.
     
  6. Veritas 117

    Veritas 117

    Joined:
    Nov 17, 2010
    Messages:
    1,126
    Resources:
    0
    Resources:
    0
    I've seen them done with a cinematic filter and it looks ok, but I like the way this looks way better personally. I guess it's up to you which method you prefer.
     
  7. Chaosy

    Chaosy

    Joined:
    Jun 9, 2011
    Messages:
    10,523
    Resources:
    17
    Maps:
    1
    Spells:
    10
    Tutorials:
    6
    Resources:
    17
    I just looked at the gif and thought that it was really similar, I don't think I'd personally see the difference.
    But I am not a sucker for details in general so I am not the best one to ask in that regard.
     
  8. Legal_Ease

    Legal_Ease

    Joined:
    Feb 8, 2013
    Messages:
    1,455
    Resources:
    28
    Icons:
    11
    Packs:
    1
    Skins:
    2
    Maps:
    10
    Template:
    1
    Tutorials:
    3
    Resources:
    28
    The tutorial explains how to do both, so please feel free to experiment and do whatever you think looks best. I just hope this was useful for someone and saved someone precious life minutes. I know I searched way too long looking for an answer before figuring it out myself. Which, did not actually take that long.
     
  9. A Void

    A Void

    Joined:
    Mar 29, 2011
    Messages:
    2,482
    Resources:
    10
    Models:
    2
    Spells:
    1
    Tutorials:
    7
    Resources:
    10
    The only bug and problem with blizzard method is that it (fade filters) bugs out tooltips, that's why tooltips were broken in TfT Night Elf Chapter 4 (they haven't fixed it yet). Instead of normal fade filter trigger you should use Advanced Fade Filter trigger.
     
  10. Legal_Ease

    Legal_Ease

    Joined:
    Feb 8, 2013
    Messages:
    1,455
    Resources:
    28
    Icons:
    11
    Packs:
    1
    Skins:
    2
    Maps:
    10
    Template:
    1
    Tutorials:
    3
    Resources:
    28
    Can you post the trigger for an advanced filter? I will add it to the tutorial.
     
  11. A Void

    A Void

    Joined:
    Mar 29, 2011
    Messages:
    2,482
    Resources:
    10
    Models:
    2
    Spells:
    1
    Tutorials:
    7
    Resources:
    10
    It's in Cinematic - Advanced Filter.
    • Cinematic - Apply a filter over 2.00 seconds using Normal blending on texture White Mask, starting with color (100.00%, 100.00%, 100.00%) and 100.00% transparency and ending with color (0.00%, 0.00%, 0.00%) and 0.00% transparency
     
  12. Chaosy

    Chaosy

    Joined:
    Jun 9, 2011
    Messages:
    10,523
    Resources:
    17
    Maps:
    1
    Spells:
    10
    Tutorials:
    6
    Resources:
    17
    I tried to apply this just now.
    Looks bad if you don't random the angle.
     
  13. Legal_Ease

    Legal_Ease

    Joined:
    Feb 8, 2013
    Messages:
    1,455
    Resources:
    28
    Icons:
    11
    Packs:
    1
    Skins:
    2
    Maps:
    10
    Template:
    1
    Tutorials:
    3
    Resources:
    28
    That's a nice addition. So you mean that we should do this?

    • Set temploc2 = (temploc offset by 200.00 towards (Random number from 0 to 360) degrees)
     
  14. KILLCIDE

    KILLCIDE

    Administrator

    Joined:
    Jul 22, 2015
    Messages:
    3,479
    Resources:
    20
    Models:
    2
    Icons:
    10
    Spells:
    7
    Tutorials:
    1
    Resources:
    20
    The images are broken for me. Are they in a private album or uploaded on a third-party site?
     
  15. A Void

    A Void

    Joined:
    Mar 29, 2011
    Messages:
    2,482
    Resources:
    10
    Models:
    2
    Spells:
    1
    Tutorials:
    7
    Resources:
    10
    Neither. They are working fine for me. Maybe you are using some addons in your browser?
     
  16. KILLCIDE

    KILLCIDE

    Administrator

    Joined:
    Jul 22, 2015
    Messages:
    3,479
    Resources:
    20
    Models:
    2
    Icons:
    10
    Spells:
    7
    Tutorials:
    1
    Resources:
    20
    Huhh that's odd xD when I was first reading this tutorial, they were broken. After I came back to see what you said, the images are working :p
     
  17. Chaosy

    Chaosy

    Joined:
    Jun 9, 2011
    Messages:
    10,523
    Resources:
    17
    Maps:
    1
    Spells:
    10
    Tutorials:
    6
    Resources:
    17
    Exactly, randoming offset is not bad either. Maybe between 175 and 225

    My last suggestion is using a loop instead of repeating code.
    • Untitled Trigger 001
      • Events
        • Time - Elapsed game time is 3.00 seconds
      • Conditions
      • Actions
        • Custom script: local location udg_loc
        • Custom script: local location udg_loc2
        • Custom script: local unit udg_u
        • Unit - Order Ancient of Lore 0000 <gen> to Move To (Center of Region 001 <gen>)
        • Camera - Lock camera target for Player 1 (Red) to Ancient of Lore 0000 <gen>, offset by (0.00, 0.00) using Default rotation
        • Camera - Set Player 1 (Red)'s camera Rotation to 120.00 over 0.00 seconds
        • Camera - Set Player 1 (Red)'s camera Distance to target to 1050.00 over 0.00 seconds
        • Camera - Set Player 1 (Red)'s camera Angle of attack to 350.00 over 0.00 seconds
        • Wait 3.00 seconds
        • For each (Integer A) from 1 to 3, do (Actions)
          • Loop - Actions
            • Set loc = (Position of Ancient of Lore 0000 <gen>)
            • Set loc2 = (loc offset by 200.00 towards (Random angle) degrees)
            • Unit - Create 1 Lightning for Neutral Passive at loc2 facing Default building facing degrees
            • Set u = (Last created unit)
            • Custom script: call RemoveLocation(udg_loc)
            • Custom script: call RemoveLocation(udg_loc2)
            • Wait 0.03 seconds
            • Sound - Play RollingThunder1 <gen>
            • Unit - Remove u from the game
            • Wait 5.00 seconds


    This creates lightning 3 times with a 5 second interval.
    Obviously you can ignore the camera and order stuff, that's for my map alone.
     
    Last edited: May 21, 2016