A while back, i remember someone made a map with fog that cycled through a number of different colors and other properties. Not for any lack of trying, i've been unable to find it again.
Setting fog properties like color and density in MML is very straightforward; what i'm trying to do, ultimately, is make changes to those properties dynamically, based on particular events; for example, player activates a switch or enters a specific polygon, and the fog thickens or changes color.
For instance, a map i'm working on features airlocks between indoor and outdoor (vacuum) environments. Dynamically turning on fog that quickly "thickens," turning an opaque white before fading to zero opacity again, thus appearing to dissipate—simulating oxygen decompression—would make the cycling of the airlock seem more realistic. Another part of the same map features a long lift ride into a deeper subterranean area, which could be made a lot creepier with some fog that gradually appears as the platform descends into darkness.
Admittedly, i'm no pro when it comes to Lua, but i'm sure i could figure out the finer points. Even after looking over the scripting guide, i can't seem to figure out how to how to invoke fog...
Manipulating Fog with Lua/MML
This lightly edited code from Where Monsters Are in Dreams causes fog to fade out when the player finishes the level. (I've cut out a few things you probably won't need.)
Another function used in several Eternal 1.3 levels causes fog's brightness and depth to fade in and out, and to flicker during a rainstorm. You can see it in our split map folder - the first level that uses it is "A Friend in Need", which also uses platforms to activate a map behaviour (it retextures parts of the level and activates the precipitation script over those parts. I'd recommend not trying too hard to wrap your head around the precipitation stuff for now, though - it's just important that the script changes the assignments for precipitation objects on those polygons. Which isn't the best way to do it, but it was the easiest when I wrote it, and I've left it because I have too many other things to do). Between all of that, you should get ideas of how to do some of this stuff, though my code isn't the most efficient or well-constructed.
Hopefully some of this helps. I won't have time to provide a more detailed answer until late this month, but it'd probably be more helpful in the long run for you to figure how to script some of this stuff out yourself, anyway.
Code: Select all
Triggers = {}
function Triggers.init(saved_game)
Game.proper_item_accounting = true
if saved_game then
a = Game.restore_saved()
if not a then
error("restoring data failed")
end
else
Game._finished = 0
Game._countdown = 210
Level.fog.active = true
Level.fog.present = true
Level.fog.affects_landscapes = true
Level.fog.depth = 16
Level.fog.red = 0.25
Level.fog.green = 0.1
Level.fog.blue = 0.24
Level.underwater_fog.active = true
Level.underwater_fog.present = true
Level.underwater_fog.affects_landscapes = true
Level.underwater_fog.depth = 16
Level.underwater_fog.red = 0.21
Level.underwater_fog.green = 0
Level.underwater_fog.blue = 0.07
end
end
function Triggers.idle()
if Game._finished == 0 then
if Level.calculate_completion_state() == "finished" then
Game._finished = 1
Game._countdown = 210
end
else
if Game._countdown then
if Game._countdown > 0 then
Game._countdown = Game._countdown - 1
Level.fog.depth = Level.fog.depth * 1.01125994634
Level.underwater_fog.depth = Level.underwater_fog.depth * 1.00792758236
else
Level.fog.active = false
Level.fog.present = false
Level.fog.affects_landscapes = false
Level.underwater_fog.depth = 42
Level.underwater_fog.affects_landscapes = false
end
end
end
end
Hopefully some of this helps. I won't have time to provide a more detailed answer until late this month, but it'd probably be more helpful in the long run for you to figure how to script some of this stuff out yourself, anyway.
“People should not be afraid of their governments. Governments should be afraid of their people.” —V, V for Vendetta (Alan Moore)
“The trouble is that we have a bad habit, encouraged by pedants and sophisticates, of considering happiness as something rather stupid. Only pain is intellectual, only evil interesting. This is the treason of the artist: a refusal to admit the banality of evil and the terrible boredom of pain. If you can’t lick ’em, join ’em. If it hurts, repeat it. But to praise despair is to condemn delight, to embrace violence is to lose hold of everything else. We have almost lost hold; we can no longer describe happy man, nor make any celebration of joy.” —Ursula K. Le Guin, “The Ones Who Walk Away from Omelas”
“If others had not been foolish, we should be so.” —William Blake, The Marriage of Heaven and Hell
“The law cannot protect anyone unless it binds everyone; and it cannot bind anyone unless it protects everyone.” —Frank Wilhoit
Last.fm · Marathon Chronicles · Marathon Eternal 1.2 · Where Monsters Are in Dreams · YouTube Vidmaster’s Challenge
“The trouble is that we have a bad habit, encouraged by pedants and sophisticates, of considering happiness as something rather stupid. Only pain is intellectual, only evil interesting. This is the treason of the artist: a refusal to admit the banality of evil and the terrible boredom of pain. If you can’t lick ’em, join ’em. If it hurts, repeat it. But to praise despair is to condemn delight, to embrace violence is to lose hold of everything else. We have almost lost hold; we can no longer describe happy man, nor make any celebration of joy.” —Ursula K. Le Guin, “The Ones Who Walk Away from Omelas”
“If others had not been foolish, we should be so.” —William Blake, The Marriage of Heaven and Hell
“The law cannot protect anyone unless it binds everyone; and it cannot bind anyone unless it protects everyone.” —Frank Wilhoit
Last.fm · Marathon Chronicles · Marathon Eternal 1.2 · Where Monsters Are in Dreams · YouTube Vidmaster’s Challenge
Excellent, thank you! This is exactly what i was looking for. i was aware of precipitation effects and other stuff in Eternal, at least one of the maps in RyokoTK's Starlight ("Dissolution," i think?), and a few from Imperium. i'd tried to take a peek at the code, but Atque seems to have stopped working, so i can't split the maps.
The code you provided should be all i need to figure it out. Thanks again.
The code you provided should be all i need to figure it out. Thanks again.
The Man wrote: ↑Jul 19th '22, 19:42 This lightly edited code from Where Monsters Are in Dreams causes fog to fade out when the player finishes the level. (I've cut out a few things you probably won't need.)
Another function used in several Eternal 1.3 levels causes fog's brightness and depth to fade in and out, and to flicker during a rainstorm. You can see it in our split map folder - the first level that uses it is "A Friend in Need", which also uses platforms to activate a map behaviour (it retextures parts of the level and activates the precipitation script over those parts. I'd recommend not trying too hard to wrap your head around the precipitation stuff for now, though - it's just important that the script changes the assignments for precipitation objects on those polygons. Which isn't the best way to do it, but it was the easiest when I wrote it, and I've left it because I have too many other things to do). Between all of that, you should get ideas of how to do some of this stuff, though my code isn't the most efficient or well-constructed.Code: Select all
Triggers = {} function Triggers.init(saved_game) Game.proper_item_accounting = true if saved_game then a = Game.restore_saved() if not a then error("restoring data failed") end else Game._finished = 0 Game._countdown = 210 Level.fog.active = true Level.fog.present = true Level.fog.affects_landscapes = true Level.fog.depth = 16 Level.fog.red = 0.25 Level.fog.green = 0.1 Level.fog.blue = 0.24 Level.underwater_fog.active = true Level.underwater_fog.present = true Level.underwater_fog.affects_landscapes = true Level.underwater_fog.depth = 16 Level.underwater_fog.red = 0.21 Level.underwater_fog.green = 0 Level.underwater_fog.blue = 0.07 end end function Triggers.idle() if Game._finished == 0 then if Level.calculate_completion_state() == "finished" then Game._finished = 1 Game._countdown = 210 end else if Game._countdown then if Game._countdown > 0 then Game._countdown = Game._countdown - 1 Level.fog.depth = Level.fog.depth * 1.01125994634 Level.underwater_fog.depth = Level.underwater_fog.depth * 1.00792758236 else Level.fog.active = false Level.fog.present = false Level.fog.affects_landscapes = false Level.underwater_fog.depth = 42 Level.underwater_fog.affects_landscapes = false end end end end
Hopefully some of this helps. I won't have time to provide a more detailed answer until late this month, but it'd probably be more helpful in the long run for you to figure how to script some of this stuff out yourself, anyway.
“Dissolution” doesn’t have precipitation, but it does vary the fog levels. “Iconic Something”, “Flank Speed”, “Phantom Power”, “Hyacinth House”, “Inaugural Trams”, and “End Times” are the Imperium maps that use precipitation; “Dead by Daybreak” and “End Times” also vary the fog. Also, for some reason “Inaugural Trams” has a secret terminal asking me, specifically, if I cheated to find it.
(At last count, I think sixteen Eternal maps use precipitation: “A Friend in Need”, “Unpfhorseen”, “Pissing on the Corporation”, “My Kingdom Pfhor a Horse”, “Burning Down the Corporation”, “The World Is Hollow”, “Eat S’pht and Die”, “Second to Last of the Mohicans”, “The Land in the Sky”, “The Incredible Hulk”, “Babylon X”, “Floating in the Void”, “The Dead Live in the Catacombs”, “We Met Once in the Garden”, “Where Giants Have Fallen”, and “The Near Side of Everywhere”.)
I’d recommend reporting the Atque bug on GitHub, or just making a separate thread for it or notifying treellama on Discord. Hopefully it’s fixable.
Anyway, glad that helped.
(At last count, I think sixteen Eternal maps use precipitation: “A Friend in Need”, “Unpfhorseen”, “Pissing on the Corporation”, “My Kingdom Pfhor a Horse”, “Burning Down the Corporation”, “The World Is Hollow”, “Eat S’pht and Die”, “Second to Last of the Mohicans”, “The Land in the Sky”, “The Incredible Hulk”, “Babylon X”, “Floating in the Void”, “The Dead Live in the Catacombs”, “We Met Once in the Garden”, “Where Giants Have Fallen”, and “The Near Side of Everywhere”.)
I’d recommend reporting the Atque bug on GitHub, or just making a separate thread for it or notifying treellama on Discord. Hopefully it’s fixable.
Anyway, glad that helped.
“People should not be afraid of their governments. Governments should be afraid of their people.” —V, V for Vendetta (Alan Moore)
“The trouble is that we have a bad habit, encouraged by pedants and sophisticates, of considering happiness as something rather stupid. Only pain is intellectual, only evil interesting. This is the treason of the artist: a refusal to admit the banality of evil and the terrible boredom of pain. If you can’t lick ’em, join ’em. If it hurts, repeat it. But to praise despair is to condemn delight, to embrace violence is to lose hold of everything else. We have almost lost hold; we can no longer describe happy man, nor make any celebration of joy.” —Ursula K. Le Guin, “The Ones Who Walk Away from Omelas”
“If others had not been foolish, we should be so.” —William Blake, The Marriage of Heaven and Hell
“The law cannot protect anyone unless it binds everyone; and it cannot bind anyone unless it protects everyone.” —Frank Wilhoit
Last.fm · Marathon Chronicles · Marathon Eternal 1.2 · Where Monsters Are in Dreams · YouTube Vidmaster’s Challenge
“The trouble is that we have a bad habit, encouraged by pedants and sophisticates, of considering happiness as something rather stupid. Only pain is intellectual, only evil interesting. This is the treason of the artist: a refusal to admit the banality of evil and the terrible boredom of pain. If you can’t lick ’em, join ’em. If it hurts, repeat it. But to praise despair is to condemn delight, to embrace violence is to lose hold of everything else. We have almost lost hold; we can no longer describe happy man, nor make any celebration of joy.” —Ursula K. Le Guin, “The Ones Who Walk Away from Omelas”
“If others had not been foolish, we should be so.” —William Blake, The Marriage of Heaven and Hell
“The law cannot protect anyone unless it binds everyone; and it cannot bind anyone unless it protects everyone.” —Frank Wilhoit
Last.fm · Marathon Chronicles · Marathon Eternal 1.2 · Where Monsters Are in Dreams · YouTube Vidmaster’s Challenge