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
Xanathar
Posts: 629
Joined: Sun Apr 15, 2012 10:19 am
Location: Torino, Italy
Contact:

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

Post by Xanathar »

Tried with findentity == nil ? that is, without havin nil between " characters.
Waking Violet (Steam, PS4, PSVita, Switch) : http://www.wakingviolet.com

The Sunset Gate [MOD]: viewtopic.php?f=14&t=5563

My preciousss: http://www.moonsharp.org
User avatar
Phitt
Posts: 442
Joined: Tue Aug 14, 2012 9:43 am

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

Post by Phitt »

Xanathar wrote:Tried with findentity == nil ? that is, without havin nil between " characters.
Indeed, indeed. That worked. Clearly the :facepalm: smiley is missing here. But I guess :roll: will do as well. Thanks!
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 »

yeah, when it didn't find the string "nil" it might as well been looking for "timbucktoo" cause it wouldn't find that either :D

glad you got it working :)
Finished Dungeons - complete mods to play
Batty
Posts: 509
Joined: Sun Apr 15, 2012 7:04 pm

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

Post by Batty »

Ahh, this is good, I need to use this too, I hope the forever ticking ticker doesn't affect performance, probably won't.
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 »

it shouldn't be a problem if the tick is infrequent enough
Finished Dungeons - complete mods to play
Batty
Posts: 509
Joined: Sun Apr 15, 2012 7:04 pm

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

Post by Batty »

Well, I can't get it to work anyway, the fx object is only lasting as long as its effect plays.

So, after the earthquake_dust stops it tests as nil again and then you get sound upon sound played and it gets loud quick.

edit: oops, works with Komag's setLight set to last a bazillion seconds, it gets destroyed when you quit so tests as nil upon load (unless your play session > bazillion seconds :lol: ).
User avatar
Phitt
Posts: 442
Joined: Tue Aug 14, 2012 9:43 am

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

Post by Phitt »

Komag wrote:yeah, when it didn't find the string "nil" it might as well been looking for "timbucktoo" cause it wouldn't find that either :D

glad you got it working :)
Thanks for the help!
Batty wrote:Ahh, this is good, I need to use this too, I hope the forever ticking ticker doesn't affect performance, probably won't.
Every game is different I guess, but in ES games at least scripts did have almost no effect on performance at all - and we're talking about thousands of lines of code processed each frame. If Grimrock is even a tiny bit similar then even a timer set to 0.01 calling a simple function like the one presented here wouldn't have any impact on performance at all.
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 »

I set up some scripts in a room to check for different kinds of light (to recreate the darkness requirement of the weapon of power room), and check every 0.1 seconds, and it made my framerate tank badly. I adjusted it to 0.5 seconds and I could still notice the small hiccup every half second, but livable now. So it can happen
Finished Dungeons - complete mods to play
User avatar
Phitt
Posts: 442
Joined: Tue Aug 14, 2012 9:43 am

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

Post by Phitt »

Komag wrote:I set up some scripts in a room to check for different kinds of light (to recreate the darkness requirement of the weapon of power room), and check every 0.1 seconds, and it made my framerate tank badly. I adjusted it to 0.5 seconds and I could still notice the small hiccup every half second, but livable now. So it can happen
Sure it was really the script causing the slowdown? Just tested with 10 timers running with a 0.01 second interval (= ~per frame), each checking for the entity. And then compared the framerate to a save game without any timer active (standing in exactly the same spot). It was the same, 85 FPS in both cases. Even put in a dozen monsters into the level to make sure there is already a bit of AI taxing the CPU (plus tons of monsters in levels 1-3 and some other timers running). Maybe you had some kind of loop in your script that checks for more or less everything in the whole dungeon? I could imagine that loops can be quite taxing depending on what they do.
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 »

it was definitely the script, had some serious looping going on each time, checking many places for many things every time, hardcore stuff. It also checks what the mouse is carrying, which may possibly work differently, I don't know. Maybe these scripts that just check for the entity's existence run much faster, which is good news :)
Finished Dungeons - complete mods to play
Post Reply