Thanks, this worked for me.Lmaoboat wrote:...
FX:setlight weirdness
Re: FX:setlight weirdness
Re: FX:setlight weirdness
Here's a much better one:Isaac wrote:Thanks, this worked for me.Lmaoboat wrote:...
Code: Select all
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)
endRe: FX:setlight weirdness
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
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
Re: FX:setlight weirdness
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.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
** spawn(object, level, x, y, facing, [id])
Re: FX:setlight weirdness
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.
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.
Re: FX:setlight weirdness
I realize this is a bit old, but I wanted to add a note about something I discovered: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:I wouldn't use this too much though, turning it off and on a lot seems to cause fps drop.Code: Select all
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
"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.
Finished Dungeons - complete mods to play
