Scripts / Please check my code!

Author
Message
ZephaHD
8
Years of Service
User Offline
Joined: 19th Mar 2016
Playing:
Posted: 17th Feb 2017 14:36 Edited at: 17th Feb 2017 14:52
Hello, I started to code in LUA for the first time, and this is my first script I made. I wanted it to be so when the player enters a trigger zone, the fog intensity will change to 100, and the blue colour in the fog will change to 99. However, in game, nothing seems to be changing. What am I doing wrong?
GTX 970 Strix, Intel I7 870 (4 cores) -2.9GHz, 16GB RAM, 1920x1080

Attachments

Login to view attachments
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 17th Feb 2017 15:08 Edited at: 17th Feb 2017 15:10
Well for a start the name of the script has to match the name of the 'init' and 'main' functions so the script should be called setfog.lua.

Whenever I create a new script I put Prompt("got here") in main somewhere just so I know it is running.
Been there, done that, got all the T-Shirts!
PM
ZephaHD
8
Years of Service
User Offline
Joined: 19th Mar 2016
Playing:
Posted: 17th Feb 2017 15:11 Edited at: 17th Feb 2017 15:14
Oh yeah I knew that, my bad! Thanks for the tip So that script should work now then? I've attached the new script to check if thats okay with you?
GTX 970 Strix, Intel I7 870 (4 cores) -2.9GHz, 16GB RAM, 1920x1080

Attachments

Login to view attachments
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 17th Feb 2017 15:41
Try it out, I haven't personally played around with the fog commands yet.
Been there, done that, got all the T-Shirts!
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 17th Feb 2017 17:06
Try this one.

What would probably be a better way of doing it though would be to have an entity with a script on it and the closer the player is to the entity the more foggy you make it, sort of a gradual transition rather than a switch on/off effect.
Been there, done that, got all the T-Shirts!

Attachments

Login to view attachments
PM
ZephaHD
8
Years of Service
User Offline
Joined: 19th Mar 2016
Playing:
Posted: 17th Feb 2017 17:48
I'll be sure to try this - thank you!
GTX 970 Strix, Intel I7 870 (4 cores) -2.9GHz, 16GB RAM, 1920x1080

Login to post a reply

Server time is: 2024-04-18 19:14:28
Your offset time is: 2024-04-18 19:14:28