• Using lua to trigger map events based on server date/time
    3 replies, posted
Is it possible to use a lua_run entity in my map to get the server's date or time of day and trigger map logic based on this? My ideas are to change the map's look for certain holidays, or for it to know whether it's night or day and trigger map logic based on that. If this is possible, how would the code be structured? I know how to trigger logic_relays if a certain case is true, false, etc, but I am a beginner to Lua. Any help is greatly appreciated!
You can do that via lua although, like running logic_relays and such entities that trigger events on map [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/ents/FindByName]ents.FindByName[/url] [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Entity/Fire]Entity:Fire[/url]
[QUOTE=gonzalolog;52729528]You can do that via lua although, like running logic_relays and such entities that trigger events on map [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/ents/FindByName]ents.FindByName[/url] [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Entity/Fire]Entity:Fire[/url][/QUOTE] Yep, I have firing map logic figured out. I am wondering how to have the code check the server's date/time and then fire certain logic when it is a certain date, range of days, or within a certain time of day.
[QUOTE=Matt2468rv;52729538]Yep, I have firing map logic figured out. I am wondering how to have the code check the server's date/time and then fire certain logic when it is a certain date, range of days, or within a certain time of day.[/QUOTE] [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/os/date]os.date[/url] Use the example as reference.
Sorry, you need to Log In to post a reply to this thread.