Jump to content

Torches light range/radius


Recommended Posts

Hi. Can someone explain me this:

 

inst:AddComponent("firefx")
    inst.components.firefx.levels =
{
    {anim="level1", sound="dontstarve/common/campfire", radius=2, intensity=.1, falloff=.33, colour = {0/255,255/255,0/255}, soundintensity=.05},
    {anim="level2", sound="dontstarve/common/campfire", radius=3, intensity=.9, falloff=.44, colour = {255/255,0/255,0/255}, soundintensity=.6},
    {anim="level3", sound="dontstarve/common/campfire", radius=4, intensity=.1, falloff=.44, colour = {0/255,0/255,255/255}, soundintensity=1},
}
    
   
    anim:SetFinalOffset(-1)
    inst.components.firefx:SetLevel(0)
    inst.components.firefx.usedayparamforsound = true

 

 

I change intensity and colors to try to understand how it works. In the LUA the lvl1 is green, lvl2 red and lvl3 blue. Now, ingame, when I'm close to the torch the light is green and that should be fine. Then when I walk away it turn blue for 1-2 seconds and then red. Can't find a spot where the light stays blue, it's blue only passing a line from the green to the red. So this also seems to be Green - Blue - Red but it should be Green - Red - Blue, shouldn't it?

 

Another thing I don't understand is what actually "radius" means. Like 3 radius of lvl2 is, say, 3 meters starting from the torch or 3 meters starting from lvl1 border?

 

And what about those?

    anim:SetFinalOffset(-1)
    inst.components.firefx:SetLevel(0)

 

 

 

(How do you guys, in general, know what all those LUA terms mean?)

 

Link to comment
Share on other sites

I made some tests....it's really weird how it works.

 

I found that to have the right light 'intensity' and 'falloff' must be in the middle, respectively .5 and .50. With 'intensity' at .9 it's brighter but very short range, at .1 it's just dark. With 'falloff' at .9 the light range is really short, at .1 it's almost endless. I setted radius the same value for all the levels. With 'intensity' at .9 and 'falloff' at .1 it's almost endless but has more gradient/shade. Something like that.

But still, how can I just set 1 level? I tried deleting two of them but it crashed.

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...