FX:setlight weirdness
FX:setlight weirdness
I was wondering why even low brightness levels were causing lights to get ridiculously bright until I figured out that, not only do lights time over time according to their duration, but a negative will cause it to keep to increase in brightness. I had thought setting it to -1 would just make the light stay on constant , but I'm just guessing that makes it increase by the brightness number every second. Is there any way to have a light stay besides setting the duration to a million?
Re: FX:setlight weirdness
I'd just like to see a functioning use of the FX object... I have yet to call it and get any visual results. 
** The Script reference mentions fx:translate(x,y,z); but whenever I call that (with coordinates), I get a 'nil value' error... so I must be somehow calling it before it's initialized/created?.

** The Script reference mentions fx:translate(x,y,z); but whenever I call that (with coordinates), I get a 'nil value' error... so I must be somehow calling it before it's initialized/created?.
Re: FX:setlight weirdness
Yeah, that's a problem I've been having. FX entities inside functions don't seem to think they exist unless they're already actively doing something. Just spawning one outside a function work fine.Isaac wrote:I'd just like to see a functioning use of the FX object... I have yet to call it and get any visual results.
** The Script reference mentions fx:translate(x,y,z); but whenever I call that (with coordinates), I get a 'nil value' error... so I must be somehow calling it before it's initialized/created?.
Re: FX:setlight weirdness
The X, Y, Z seem to be mixed up
I placed an FX that I named fxlight. I just put it in the middle of a room
Then I made a script nearby, set to run at mapstart:
That is what works to get it off the ground, but I would have thought it would need to be (0, 0, 1). The documentation says:
So either the documentation is wrong, or there is a bug in the program mixing up the coordinates, or I'm just reading/thinking of it wrong
(and I'm also curious what to set the duration to make it last forever, other than just using a really big number)
I placed an FX that I named fxlight. I just put it in the middle of a room
Then I made a script nearby, set to run at mapstart:
Code: Select all
fxlight:setLight(0, 1, 0, 10, 20, 100, true)
fxlight:translate(0, 1, 0)
but I have to adjust the Y to make it go up off the ground. I think the X, Y should be consistent with setSubtileOffset, where X controls east-west placement, and Y controls north-south placement.FX:translate(x, y, z)
Translates (i.e. moves) the FX by x,y,z in world space. This function is typically used to lift particle system off the ground.
So either the documentation is wrong, or there is a bug in the program mixing up the coordinates, or I'm just reading/thinking of it wrong
(and I'm also curious what to set the duration to make it last forever, other than just using a really big number)
Finished Dungeons - complete mods to play
Re: FX:setlight weirdness
The engine uses a left-handed world coordinate system where Y points up. translate() operates on 3D world coordinates, subtile offset in 2D tile coordinates. So it works correctly.
Re: FX:setlight weirdness
Okay, I can accept that. So, in 3D space, looking north:
X: left-right
Y: up-down
Z: forward-back
X: left-right
Y: up-down
Z: forward-back
Finished Dungeons - complete mods to play
Re: FX:setlight weirdness
Yep, that's right.
Re: FX:setlight weirdness
I have a button that is supposed run a script to spawn an FX light (perhaps the star effect seen with the teleporter); but I cannot get any visual result from it. My intention is that you press the button and the effect appears.petri wrote:Yep, that's right.
How would I do this in the script; (spawn a particle effect at a given location)?
I'm missing something fundamental... I tried swapping out the fxlight code above, but I get no visual result.

Re: FX:setlight weirdness
When in doubt, Scripting Reference is your friend.Isaac wrote: I have a button that is supposed run a script to spawn an FX light (perhaps the star effect seen with the teleporter); but I cannot get any visual result from it. My intention is that you press the button and the effect appears.
How would I do this in the script; (spawn a particle effect at a given location)?
I'm missing something fundamental... I tried swapping out the fxlight code above, but I get no visual result.

Re: FX:setlight weirdness
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