Scripts / Flickering fire / flame light

Author
Message
Avenging Eagle
18
Years of Service
User Offline
Joined: 2nd Oct 2005
Location: UK
Posted: 10th Mar 2020 19:40 Edited at: 10th Mar 2020 19:44
I thought I was doing pretty well when I jotted down this little script earlier. It's supposed to be attached to dynamic lights to give a flickering flame effect; a bit of range-flickering, colour-fluctuating, and position-wobbling. On one light it works fine, but attach it to any more than that and it only works on the most recently-placed dynamic light.



What am I doing wrong?

EDIT: Here's the script working on one light.



AE
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 10th Mar 2020 20:15

Been there, done that, got all the T-Shirts!
PM
Avenging Eagle
18
Years of Service
User Offline
Joined: 2nd Oct 2005
Location: UK
Posted: 10th Mar 2020 20:49
Almost...



AE
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 10th Mar 2020 20:50 Edited at: 10th Mar 2020 20:55
Quote: "lights[ e ].x = lx
    lights[ e ].y = ly
    lights[ e ].z = lz
    lights[ e ].r = lr
    lights[ e ].g = lg
    lights[ e ].b = lb"

you can store those without declaring them as a list/array?
edit: just saw AE posted at same time - figured it would error, good to know even amen misses the basics sometimes
you need to declare the info in the list set up
i.e.
lights[ e ] = { num = GetEntityLightNumber( e ) , x = 0, y = 0, z = 0, r = 0, g = 0, b = 0}
i don't think they need a default value because they are being set later but i'll set all to 0 so it doesn't error if any are left as nil
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 10th Mar 2020 21:31 Edited at: 10th Mar 2020 21:33
line 19? doesn't match my script!

And yes once you have created a list you can add whatever you want to it without any declaration.
Been there, done that, got all the T-Shirts!
PM
Avenging Eagle
18
Years of Service
User Offline
Joined: 2nd Oct 2005
Location: UK
Posted: 10th Mar 2020 22:17
Make that line 21 (the only thing I was missing was the generic comment at the top " -- LUA script - precede every function...")

@smallg, you don't mean like this do you?



AE

AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 10th Mar 2020 22:40 Edited at: 10th Mar 2020 22:46
Ahh, I see the problem.

Lines 8 and 9 should be lights[ e ].num instead of lightNum



There, that's better.

Edited to add, got there eventually, I really need to learn how to spell.
Been there, done that, got all the T-Shirts!
PM
Avenging Eagle
18
Years of Service
User Offline
Joined: 2nd Oct 2005
Location: UK
Posted: 10th Mar 2020 23:31


Helpful as ever, lads

AE

Login to post a reply

Server time is: 2024-04-20 02:40:59
Your offset time is: 2024-04-20 02:40:59