• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Torch System

Level 21
Joined
Sep 22, 2007
Messages
2,772

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:

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,180
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.
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,180
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.
 
Level 17
Joined
Jun 17, 2007
Messages
1,433
What leaks? The location? I removed the location afterwards.
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)
 
Level 13
Joined
Nov 22, 2006
Messages
1,260
You can use a timer then. There's an event (I think) that fires when the time reaches a certain value. You can have three triggers, one would fire when the night begins, this is when you can start the timer (repeating, 0.02 seconds timeout), then the second would be when the night is over, that's when you pause the timer, and finally the third would be the actual trigger that makes a torch. The third trigger should run every time that timer expires (there's an event for that).

It's as simple as that (if I didn't screw up anywhere).
 
Level 21
Joined
Sep 22, 2007
Messages
2,772
Easy way to do the cycling on and off is this:
  • Unbezeichneter Auslöser 001
    • Ereignisse
      • Spiel - The in-game time of day becomes Gleich 18.00
      • Spiel - The in-game time of day becomes Gleich 6.00
    • Bedingungen
    • Aktionen
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • 'IF'-Bedingungen
          • (In-game time of day) Größer gleich (>=) 18.00
        • 'THEN'-Aktionen
          • Trigger - Turn on Torch <gen>
        • 'ELSE'-Aktionen
          • Trigger - Turn off Torch <gen>
You could also remove and add people from a unit/player group to toggle it at any time. :)
 
Level 13
Joined
Nov 22, 2006
Messages
1,260
Thanks, this might be very useful for my map. Is there a way to increase or decrease the intensity of the light? Can it be done easily with Magos Model Editor? I'm not into that sort of things, so I don't want to screw something up.

"do you know any gooder terrain than DOTA? IceFrog omg best terrain ever!!"

Argh, dota is really lame, everything about it, map, heroes, loading screen... yet it's popular...
 
Level 4
Joined
May 20, 2009
Messages
96
how would you make a saw type thing

every time day comes you lose 2hp per second at night time you lose 1hp per .70 second's HOW WOULD YOU DO SOMETHIN LIKE THAT!
 
Level 6
Joined
May 1, 2009
Messages
156
Hi, the tutorials great btw, but how do you turn of the black mask? If it was day and I would want to take off that script that turns everything dark... how could I do this?
 
Level 2
Joined
May 13, 2009
Messages
19
What's this for? Custom Script: call SetDayNightModels("","")

Also i think you shouldn't have light behind you because you don't have eyes in the back of your head. =.=
 
Level 21
Joined
Sep 22, 2007
Messages
2,772
What's this for? Custom Script: call SetDayNightModels("","")

Also i think you shouldn't have light behind you because you don't have eyes in the back of your head. =.=

that's why the light's in front (sorry if you're agreeing with me)

the call setdaynightmodels("","") is to "turn off" the lights - as you see, in the screenshots, its extremely dark.
this is because wc3 uses lighting models of a sort - with that custom script, the models are gone, and custom models can be used properly to replace the lighting. thats why using "call SetDayNightModels ("Environment\DNC\DNCAshenvale\DNCAshenvaleTerrain\DNCAshenvaleTerrain.mdx","Environment\DNC\DNCAshe nvale\DNCAshenvaleUnit\DNCAshenvaleUnit.mdx")"
turns the light back on - under the Ashenvale lighting. you can check through the MPQ for different lighting settings, ie. village, underground etc.
 
Level 2
Joined
Dec 1, 2007
Messages
11
Just wondering, is it possible to add a new light to a newly trained unit/ spell use?
I'm using a car with the spell "Turn on lights".
Can I add a light to that car, and still make the light move?
-Yuil
 
Top