function turnon()
spawn("fx", 1, 3, 10, 3, "light1")
light1:setLight(1,1,1,10,6, 360000, true)
end
function turnoff()
light1:setLight(1,1,1,10,6, 0.1, true)
end
Blichew wrote:I still don't get those FXs,
this is the error I'm getting when I try to setLight from a function:
needless to say there's a FX item nearby with an ID skFxRoom. I've also tried using findEntity("skFxRoom"):setLight(...)
any help would be appreciated
Study the code above (the post above yours). Use the Spawn function in your code; spawn the Fx where (and when) you want it, don't place it there by hand in the editor.
Thanks, will go that direction.
So it seems that static FXs are for static lights only that spawn at dungeon load. My above line works well if I take it out from the function block.
Lmaoboat wrote:setLight seems to just add upon itself every time it's use instead replace the last setting, so to turn a light off, you need to give it the opposite value:
spawn("fx", 1, 3, 10, 3, "light1")
light1:setLight(0,0,0,10,6, 360000, true)
function turnon()
light1:setLight(1,1,1,10,6, 360000, true)
end
function turnoff()
light1:setLight(-1,-1,-1,10,6, 360000, true)
end
I wouldn't use this too much though, turning it off and on a lot seems to cause fps drop.
I realize this is a bit old, but I wanted to add a note about something I discovered:
"setLight" is actually creating a NEW ADDITIONAL light every time, so if you "turn it off and on" 5 times you have actually created 10 lights (all cancelling each other out in color), killing your performance in the area.
That's why the next version you gave is better, because turning if off by setting the time to 0.1 does in fact kill the light entity out of existence, maintaining performance.