1. 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
  2. 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 haven't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. From the gates of hell, the 5th Special Effect Contest Results have emerged.
    Dismiss Notice
  4. Rubbed the right way, the genie is out of its lamp! The 12th Concept Art Contest Results have been announced.
    Dismiss Notice
  5. Race against the odds and Reforge, Don't Refund. The 14th Techtree Contest has begun!
    Dismiss Notice
  6. 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.

Torch System

Discussion in 'Trigger (GUI) Editor Tutorials' started by Belgarath, Jan 25, 2009.

  1. Belgarath

    Belgarath

    Joined:
    Sep 22, 2007
    Messages:
    2,626
    Resources:
    10
    Maps:
    2
    Spells:
    1
    Tutorials:
    7
    Resources:
    10

    Torch System


    no 360 degree torches.
    Note: this can/should only be used with the call SetDayNightModels("","") trigger.

    What You Need.


    All you need is this - View attachment Light.mdx the light model. It and a few VERY simple triggers will be all that's used here.

    So - why a torch system? Because, since when do torches light up the area ALL around you? They light it up in front of you.

    Preparation.


    1. Make a unit called Light with the Light model, give it locust and invulnerability, set all its shadow values to 0.00.
    2. Open the variable editor (the yellow X), then make a new variable (green X) a Unit variable, call it LightUnit. (This will be the light)
    3. Make another new variable, Location/Point (I forgot the English version) and call it TempPoint. (This will be the position of the person holding the light)
    4. Use a Map Initialization trigger, or wherever you want the "lights off" sign, and create 1 unit with the model of the Light ( View attachment Light.mdx ) at the position of your torch holder. Then set LightUnit = Last Created Unit.
    5. Then use one trigger like this:
      • Custom Script: call SetDayNightModels("","")
    6. Make another trigger that looks like this.
      • Events
        • Time - Every 0.02 seconds of game time
        • Conditions
          • (Life of (Your Unit)) Greater than or equal to 1.0
        • Actions
          • Set TempPoint = (Position of YourUnit)
          • Set TempPoint2 = TempPoint offset by 300.00 towards (Facing of Castaway 0001 <gen>) degrees)
          • Unit - Move LightUnit instantly to TempPoint2
          • Custom script: call RemoveLocation(udg_TempPoint)
          • Custom script: call RemoveLocation(udg_TempPoint2)

    And that's it. Your results will be somewhat like this.

    Torchex1.jpg
    Torchex2.jpg


    Terrain Tips to go with Dark Forests etc:
    • use big summer trees, tinted darkish
    • use 5000 end fogs, with a deep, deep purple (maybe 30,0,30 at max)
    • use a lot of shrubs and rocks, sized up
    • use the ashenvale tileset.



    Thank you for reading the tutorial. I hope it helped you ;)
     
    Last edited: Jun 10, 2009
  2. AirHead

    AirHead

    Joined:
    Apr 5, 2008
    Messages:
    432
    Resources:
    1
    Tutorials:
    1
    Resources:
    1
    This is brilliant! Just what I need to limit the sight of the units in a map I am making.

    +rep for sure.
     
  3. Dr Super Good

    Dr Super Good

    Spell Reviewer

    Joined:
    Jan 18, 2005
    Messages:
    25,928
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    Nice, too bad there is not a jass version. Moving it every 0.01 seconds is pointless, as most displays update only at 60 FPS, so only really modern 100 Hz+ screens will benifit from it. Thus a time of 0.02 is more recommend for half the opperation number per second.

    Remember however, that the WC3 lighting system bugs if there are too many light models near each other, resulting it aweful rectandle borders for the light to become visable.
     
  4. Belgarath

    Belgarath

    Joined:
    Sep 22, 2007
    Messages:
    2,626
    Resources:
    10
    Maps:
    2
    Spells:
    1
    Tutorials:
    7
    Resources:
    10
    I'll be sure to change the 0.01 to 0.02. Thanks :)

    And yeah, the lighting does get annoying - but this is meant for maps with a lack of lighting.
     
  5. AirHead

    AirHead

    Joined:
    Apr 5, 2008
    Messages:
    432
    Resources:
    1
    Tutorials:
    1
    Resources:
    1
    Oh, I just saw something! The condition of your units HP being over 1.00 would be better off as the boolean comparison of
    'Unit - Unit is Alive' like this
    • Trigger
      • Events
        • Bla
      • Conditions
        • ((YourUnit) is Alive) Equal to True
      • Actions
        • Bla
     
  6. TheBlooddancer

    TheBlooddancer

    Joined:
    Jun 24, 2008
    Messages:
    2,908
    Resources:
    0
    Resources:
    0
    Nice tutorial.

    There is a system like this in the spells section.

    You might wanna add a way to make the light to get blocked, by cliffs, and units.
     
  7. Dr Super Good

    Dr Super Good

    Spell Reviewer

    Joined:
    Jan 18, 2005
    Messages:
    25,928
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    TheBlooddancer, such realisitc lighting has been drempt of for ages. However doing so efficently is impossiable. Even the Diablo 3 programmers were unable to do it, let alone within a WC3 map where you have no ability to modify the render chain.

    The closest that could be done to that would be a system involving using unit shadows as the projected shadow and it works by calculating a shadow offset based on the direction of the light from the torch. Overall quite unrealistic, however it should be possiable as it is not that demanding and also adds more realisim.
     
  8. TheBlooddancer

    TheBlooddancer

    Joined:
    Jun 24, 2008
    Messages:
    2,908
    Resources:
    0
    Resources:
    0
    This guy did it pretty well then.
     
  9. Belgarath

    Belgarath

    Joined:
    Sep 22, 2007
    Messages:
    2,626
    Resources:
    10
    Maps:
    2
    Spells:
    1
    Tutorials:
    7
    Resources:
    10
    Added, airhead. Thanks.
    Blooddancer, that's a sight cone. This is a torch system. Completely different. Here, it's for dark maps. His is just for seeing up front.
     
  10. Dr Super Good

    Dr Super Good

    Spell Reviewer

    Joined:
    Jan 18, 2005
    Messages:
    25,928
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    His uses LOS not lighting so does not count.
     
  11. ~Void~

    ~Void~

    Joined:
    Jul 1, 2007
    Messages:
    6,448
    Resources:
    14
    Icons:
    8
    Skins:
    2
    Tutorials:
    4
    Resources:
    14
    Nice tutorial.
     
  12. HINDYhat

    HINDYhat

    Joined:
    Apr 22, 2007
    Messages:
    1,594
    Resources:
    3
    Maps:
    2
    Spells:
    1
    Resources:
    3
    • Unit - Move LightUnit instantly to (TempPoint offset by 300.00 towards (Facing of Castaway 0001 <gen>) degrees)

    Leaks.
     
  13. Belgarath

    Belgarath

    Joined:
    Sep 22, 2007
    Messages:
    2,626
    Resources:
    10
    Maps:
    2
    Spells:
    1
    Tutorials:
    7
    Resources:
    10
    What leaks? The location? I removed the location afterwards.
     
  14. Dr Super Good

    Dr Super Good

    Spell Reviewer

    Joined:
    Jan 18, 2005
    Messages:
    25,928
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    No you dont.
    You remove the base location, not the polar projection one.
     
  15. busterkomo

    busterkomo

    Joined:
    Jun 17, 2007
    Messages:
    1,423
    Resources:
    1
    Tutorials:
    1
    Resources:
    1
    You need another temp point to deal with the point after it is offset. Point with polar offset creates another point from the source. So just modify it:
    • Events
      • Time - Every 0.02 seconds of game time
      • Conditions
        • (Life of (Your Unit)) Greater than or equal to 1.0
      • Actions
        • Set TempPoint = (Position of YourUnit)
        • Set TempPoint2 = TempPoint offset by 300.00 towards (Facing of Castaway 0001 <gen>) degrees)
        • Unit - Move LightUnit instantly to TempPoint2
        • Custom script: call RemoveLocation(udg_TempPoint)
        • Custom script: call RemoveLocation(udg_TempPoint2)
     
  16. Belgarath

    Belgarath

    Joined:
    Sep 22, 2007
    Messages:
    2,626
    Resources:
    10
    Maps:
    2
    Spells:
    1
    Tutorials:
    7
    Resources:
    10
    Okay, thanks.

    EDIT: Woops fuck, deleted half of the tutorial on accident. I'll rewrite it later on >__>
     
    Last edited: Jan 30, 2009
  17. Pyritie

    Pyritie

    Joined:
    Nov 26, 2006
    Messages:
    11,356
    Resources:
    60
    Models:
    30
    Icons:
    9
    Packs:
    3
    Skins:
    12
    Tools:
    1
    Maps:
    1
    Tutorials:
    4
    Resources:
    60
    Approved
     
  18. Silvenon

    Silvenon

    Joined:
    Nov 22, 2006
    Messages:
    1,233
    Resources:
    1
    Tutorials:
    1
    Resources:
    1
    The final picture doesn't show, is it just me?
     
  19. Pyritie

    Pyritie

    Joined:
    Nov 26, 2006
    Messages:
    11,356
    Resources:
    60
    Models:
    30
    Icons:
    9
    Packs:
    3
    Skins:
    12
    Tools:
    1
    Maps:
    1
    Tutorials:
    4
    Resources:
    60
    Nah, it's a broken attachment. Send him a PM.
     
  20. Rainbow Evil

    Rainbow Evil

    Joined:
    Oct 2, 2008
    Messages:
    405
    Resources:
    0
    Resources:
    0
    can I turn this trigger off,like to turn it on during the night and off during the day?