Page 1 of 3
run script upon save game load? FX lights issue, LightSource
Posted: Wed Nov 07, 2012 12:20 am
by Komag
I am using a lot of fx lights and save games don't keep them! this is causing problems, but I can clear it up if I could just run a certain script upon the player loading a save game - is this possible?
Re: can I run a certain script every time a player loads a g
Posted: Wed Nov 07, 2012 2:03 am
by Batty
uhhhh...I don't see how unless you maybe saved the party's location so that when they moved after loading you'd search for your FXs and when not found you'd know they just loaded?
Actually, I would turn all those FXs into LightSource objects so they survive saves then you can manipulate them better.
Re: can I run a certain script every time a player loads a g
Posted: Wed Nov 07, 2012 2:21 am
by Grimwold
You could have a ticker script that constantly checks for the presence of one of your FX entities... if it isn't there run the script to spawn them all.
You may need to move the timer to the current level every time the party changes level though, as timers run slower if on different levels
Re: can I run a certain script every time a player loads a g
Posted: Wed Nov 07, 2012 3:03 am
by Komag
Thanks both of you, each suggestion is valuable! After looking into setting up custom lightsource objects, I believe that is the best most controllable way to go. But I should have thought of the constant ticker checker idea, that's a good solution too!
THANKS!!!
Re: run script upon save game load? FX lights issue, LightSo
Posted: Wed Nov 07, 2012 2:44 pm
by Komag
Odd "bug" I'm encountering, but all my LightSource objects are casting shadows, even though I have...
...clearly in the definition
Anyone else seeing this?
It says "castShadow: a boolean which turns dynamic shadow rendering on and off", so maybe "dynamic" means when monsters walk by, etc?
But my old FX lights truly didn't cast shadows of any kind when set to false, so the light went through walls, statues, etc.
Re: run script upon save game load? FX lights issue, LightSo
Posted: Wed Nov 07, 2012 8:59 pm
by Ancylus
I've tried to use FXs with a timer for lighting and got it working. However, I noticed that multiple FXs can hit performance really hard, even when they're completely out of sight. Presumably it's because their effects can't be precalculated. So I'd say using LightSources is much preferable.
And the castShadow field really doesn't seem to have any effect on LightSources, though it works fine with FXs.
Re: run script upon save game load? FX lights issue, LightSo
Posted: Wed Nov 07, 2012 9:18 pm
by petri
FX objects are meant to be used for short unimportant effects that need not persist across save games (persisting the state of particle effects would make the save game system much more complex because each individual particle would need to be saved).
Re: run script upon save game load? FX lights issue, LightSo
Posted: Wed Nov 07, 2012 10:27 pm
by HaunterV
petri wrote:FX objects are meant to be used for short unimportant effects that need not persist across save games (persisting the state of particle effects would make the save game system much more complex because each individual particle would need to be saved).
That sounds like witch talk to me. Keep the quantum mechanics or star trek teleportation pattern talk out of grimrock!
Re: run script upon save game load? FX lights issue, LightSo
Posted: Wed Nov 07, 2012 11:16 pm
by aaneton
I figured out the light save problem by creating lights as objects.
Objects.lua
example red floor light:
Code: Select all
defineObject{
name = "red_floor_light",
class = "LightSource",
lightPosition = vec(0.5, 0.5, 0),
lightRange = 6,
lightColor = vec(1, 0, 0),
brightness = 60,
castShadow = true,
placement = "floor",
editorIcon = 88,
}
Now you can place (and spawn) light objects in editor, and of course destroy when needed to be off.
Re: run script upon save game load? FX lights issue, LightSo
Posted: Wed Nov 07, 2012 11:52 pm
by Komag
Yes, that is what I've done now, all LightSource objects