Scripts / light flickering script

Author
Message
Scanman
4
Years of Service
User Offline
Joined: 8th Dec 2019
Playing: Total War Saga: Troy, Amytric Pulse
Posted: 21st May 2020 16:33 Edited at: 22nd May 2020 16:36
Need help with my roller-baller script, which I want to introduce to everybody. It is absolutely free and can be used for any purpose without any fee.
This is a script, which can be useful for creating some kind of light cirquits. Take a look on working example. There are two light cirquits in this demo. They are very simple but show what my script can do. First of all I want to mention that I used several threads on forum to get some info and these are the links.

Information about visibility
Entity name parser
Light control

Light Cirquit Script as i call it has two parts: entity script and light cirquits switch. Look at the picture how it looks like in editor.

Prepared scene with two light cirquits

You can see many lights on the picture: 3 red decals, 7 blue decals, 1 orange light source, 3 blue light sources, but red lights not active, only blue lights play role of cirquit parts.
The term curquit means group of lights that can be held separately by the script. Ideally, the script can program the behaviour of lights easily in one string. So each light itself is just a part of cirquit one. Nevertheless, lights can be combined in parts of cirquits to become equal between each other. In my example, the first cirquit has one part, which consists of 4 elements: 3 blue decals and blue light source, and the second cirquit has two independent parts with 3 elements in every part: 2 blue decals and 1 blue light source.

To setup each cirquit you need to place lights and give the right names to them. The syntax for naming is very simple, but it must be used without any mistakes or spaces. It's a pity, but my try to use string.match function like i saw in Barrel example leads to errors. So, all numbers in name are to have single digits, because i used string.sub function. The name of single light is to be as following:
Light Cirquit:-=Cirquit Number=- -=Cirquit Part Number=- -=Single Entity Number in Part=- -=Light Flag "l"=-
For example: "Light Cirquit:1 2 1", or "Light Cirquit:2 1 2", or "Light Cirquit:2 1 2 l"
Pay an attention to letter "l" in the third example name. It is very important, because it is used respawn lights in separate way from decals.
So, here is the result of many hours.

Light Cirquit Script in action

To program the cirquit you need to set the value "interval" into _init function of light cirquit switch.
And here it is Light Cirquit Script as is:
1. Entity script (must applied to each single entity without change, entity is to be in "No static" mode)


2. Main Light Switch (must be applied one time to any asset in "No static mode")


To program you need to change Main Light Switch Script like below:


These settings are for my example. I created two cirquits, so i was to write two setting strings with separate interval. And the numbers in index of array lc_settings must correspond to the first number in entity's name, because it means light cirquit number.
If you have comments, feel free to post it. I will be glad to read any answers.
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 21st May 2020 17:17 Edited at: 21st May 2020 17:18
You might find the attached interesting.

https://forum.game-guru.com/thread/220055?page=2#msg2622840
Been there, done that, got all the T-Shirts!

Attachments

Login to view attachments
PM
Scanman
4
Years of Service
User Offline
Joined: 8th Dec 2019
Playing: Total War Saga: Troy, Amytric Pulse
Posted: 21st May 2020 17:37 Edited at: 21st May 2020 17:37
@AmenMoses In plans to create more programming functions, like fading. Now my script can only to switch off, switch on light parts sequentially.
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 21st May 2020 19:48
Feel free to use any parts of my script that are useful, for example the part that takes the parameters from the name of the entity.
Been there, done that, got all the T-Shirts!
PM
Scanman
4
Years of Service
User Offline
Joined: 8th Dec 2019
Playing: Total War Saga: Troy, Amytric Pulse
Posted: 14th Jul 2020 18:31 Edited at: 14th Jul 2020 20:07
Hello,

Worked out some improvements for my light flickering script. Here you can see an example how to create light cirquit with entities, which are not decals.

The trick is in duplicating entity of a lamp with no any other texture then _D (or _color). So this duplicated entity that lost all illumination will be some kind of "turned off" lamp. Then you need to merge this two light sources on you map and while naming set one lamp in one part of cirquit (for ex, "1 1 1") and the second "turned off" lamp in another part (for ex, "1 2 1"). So, that makes script to switch on and off it but the player will always see a lamp in place with blinking effect. Cool!

Another improvement - I added processing of suffix "d" if you want to program a decal. With this this suffix ( for ex, "2 3 1 d") script will turn
decal to player.

Another improvement - I added processing of new setting "constant_length". If it is equal to 1 cirquit blinks with equal to "interval" periods. And if it is equal to 0, cirquit blinks with random length not more then "interval". In the following video, you can see that I mixed my barrel mess explosion script which sets fog in a room with changing this new setting of cirquit. This makes cirquit to start chaotically blink after explosion.



Here is part of barrel script, where cirquit changes behavior


And now new versions of light_switch.lua and light_cirquit.lua


PM
GubbyBlips
5
Years of Service
User Offline
Joined: 14th Jan 2019
Location:
Posted: 14th Jul 2020 19:45
I like your work- very nice. And what I'm going to say next is
not YOUR fault, it's the fault of old GG lighting-- as you probably
noticed, dynamic lights in old GG goes through all structures
and never casts shadows or reflects. But mostly at issue
is that it goes through everything infinitely to it's set radius.
You simply cannot build dynamic lighting scenes with GG.
This has been a terminally malignant issue the life of GG- no?

What will MAX do? Well, that I do not know-- and neither does
anyone else.
PM

Login to post a reply

Server time is: 2024-04-25 02:27:12
Your offset time is: 2024-04-25 02:27:12