run script upon save game load? FX lights issue, LightSource

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
User avatar
Komag
Posts: 3658
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

run script upon save game load? FX lights issue, LightSource

Post 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?
Finished Dungeons - complete mods to play
Batty
Posts: 509
Joined: Sun Apr 15, 2012 7:04 pm

Re: can I run a certain script every time a player loads a g

Post 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? :lol:

Actually, I would turn all those FXs into LightSource objects so they survive saves then you can manipulate them better.
User avatar
Grimwold
Posts: 511
Joined: Thu Sep 13, 2012 11:45 pm
Location: A Dungeon somewhere in the UK

Re: can I run a certain script every time a player loads a g

Post 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
User avatar
Komag
Posts: 3658
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: can I run a certain script every time a player loads a g

Post 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!!! :D
Finished Dungeons - complete mods to play
User avatar
Komag
Posts: 3658
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: run script upon save game load? FX lights issue, LightSo

Post by Komag »

Odd "bug" I'm encountering, but all my LightSource objects are casting shadows, even though I have...

Code: Select all

	castShadow = false,
...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.
Finished Dungeons - complete mods to play
Ancylus
Posts: 50
Joined: Thu Oct 11, 2012 5:54 pm

Re: run script upon save game load? FX lights issue, LightSo

Post 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.
User avatar
petri
Posts: 1917
Joined: Thu Mar 01, 2012 4:58 pm
Location: Finland

Re: run script upon save game load? FX lights issue, LightSo

Post 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).
User avatar
HaunterV
Posts: 676
Joined: Mon Apr 16, 2012 9:54 pm
Location: Barrie, Ontario, Canada

Re: run script upon save game load? FX lights issue, LightSo

Post 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!
Grimrock Community 'FrankenDungeon 2012. Submit your entry now!: http://tinyurl.com/cnupr7h
SUBMIT YOUR ASSETS! Community Asset Pack (C.A.P.): http://tinyurl.com/bqvykrp
Behold! The HeroQuest Revival!: http://tinyurl.com/cu52ksc
User avatar
aaneton
Posts: 189
Joined: Fri Sep 21, 2012 1:53 pm

Re: run script upon save game load? FX lights issue, LightSo

Post 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.
My Grimrock mod (LoG1): The Onkalo Project
My Android (and windows desktop) game: Balloon Gentleman
User avatar
Komag
Posts: 3658
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: run script upon save game load? FX lights issue, LightSo

Post by Komag »

Yes, that is what I've done now, all LightSource objects
Finished Dungeons - complete mods to play
Post Reply