Scripts / How to Increase or Decrease things like Fog?

Author
Message
Teabone
Forum Support
18
Years of Service
User Offline
Joined: 8th Jun 2006
Location: Earth
Posted: 4th Aug 2017 04:38 Edited at: 4th Aug 2017 07:41
Having some troubles figuring out how to increase fog settings without setting to an exact value.

For example:

SetFogNearest((GetFogNearest+1))

SetFogNearest(GetFogNearest+1)

SetFogNearest(+1)

SetFogNearest + 1

SetFogNearest = SetFogNearest + 1


None of the above work unfortunately. Is it possible to increase and decrease with the Set...etc... commands? I'm trying to do this with fog, ambient lighting and surface lighting.

EDIT:

So i tried this and it worked. But was hoping it be a bit more simpler than this:

temp = temp + 1
SetFogNearest(temp)


But how do you actually compare with a value like Fog?

if GetFogNearest > temp then

doesn't not work :/ returns error saying you cant compare a function to a value.

EDIT #2:

temp = GetFogNearest(e)

Seems to have worked as a way to detect the fog position. I guess from here i can figure out the rest. I'm working on a night and day weather system from scratch and its going extremely well so far.
Twitter - Teabone3 | Youtube - Teabone3 | Twitch - Teabone3 | TGC Assets - Store Link

i7 -2600 CPU @ 3.40GHz - Windows 7 - 8GB RAM - Nivida GeForce GTX 960

Attachments

Login to view attachments
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 4th Aug 2017 09:00 Edited at: 4th Aug 2017 09:02
Yes, for some reason you need to specify an entity value in some of the instructions before they will work.

Remember though that if you just stick it in a script:

SetFogNearest( GetFogNearest(e) + 1 )

Then it will get called every frame so you will effectively just max out the value before you have had a chance to see it working, better to create a function which increments the value until it reaches a specific value then stops:

local fogDistInc = 1

local function IncreaseFogDist( e, toValue )
local fogDist = GetFogNearest( e )
if fogDist < toValue then SetFogNearest( fogDist + fogDistInc ) end
end
Been there, done that, got all the T-Shirts!
PM
Tarkus1971
Audio Media Maker
9
Years of Service
User Offline
Joined: 24th Feb 2015
Location: England, UK
Posted: 4th Aug 2017 12:13
yes these kind of lua commands need a very good guide, i'm having similar issues with the field of view of the player.
Aftershock Quad Core AMD FM2+ 3.5 GHz 8GB Motherboard and Processor, A7700k apu, Asus GT970 STRIX 4gb Nvidia gfx card.
King Korg Synth, Alesis SR18 Drum Machine, Akai MPX8 sample player, Roland Fantom XA Synth, Axus Digital AXK2 Digital Drum Kit, Novation Ultranova Synth, Waldorf Blofeld Synth.

Login to post a reply

Server time is: 2024-12-23 00:35:04
Your offset time is: 2024-12-23 00:35:04