Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

FPSC Classic Scripts / Light sequence

Author
Message
protoborg
17
Years of Service
User Offline
Joined: 2nd Jul 2007
Location: Somewhere in this reality
Posted: 31st Oct 2007 04:52
I am wondering if there is a way to turn on a series of lights in such a way to make it look like they have activated one after another. What I mean is you enter a large cavernous space and it is initially completely dark. After a moment, the lights begin to come on. They come on one at a time, but the lights that are on remain on when the next light comes on. It would add to the enormity of the room. Any have any suggestions?

You know your code sucks when it does what you want before you know what you want.
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 31st Oct 2007 08:43 Edited at: 31st Oct 2007 10:11
This... is a nice script.

I read your post and absolutely had to go make it

It's not often that people ask for something that actually needs a weird workaround for, so I was pleased to make this.

Okay, first things first, you'll want to make an "invisible entity". You need this because Lights don't have an IfUsed field, and we need that for what we're about to do.

The invisible entity should use this script as it's "Spawn" script:



I use these entities a lot so treat them nicely.

Next, save this script in the user folder of the scriptbank:


I named this "DelayActivate.fpi" but you can use a different name if you so choose.

NOTE: This script will make sure that all the lights won't come on at once, you can adjust the delay between lights by changing that "1000" to a different number.

Now, set up all your lights to be turned on in sequence. When I did this I named them "Light1", "Light2", etc. all the way up to 7, which is how many lights I tested this with. Make sure they are all dynamic lights! And give them the "light1off.fpi" script, so they start out being turned off.

Okay, now for each light EXCEPT the last light, make an accompanying invisible entity. Name it THE SAME NAME as which Light is belongs to! So for "Light1" there should be an invisible entity called "Light1". Give all these invisible entities the script that I made. Yes, every single one of them will use the SAME script. Also, make sure they have the "Always Active" property set to "Yes", and to save on processing time, turn the "Physics On?" property to "No".

Okay, for the invisible "Light" entity, put in it's "If Used" property the name of the NEXT "Light" entity in the sequence. So the invisible "Light1" entity would have "Light2" as it's "If Used" property.

Do that for all the invisible entities.

To test this, I had them started up from a switch. For the switch, I simply gave it the name of the first Light in it's "If Used" property. So, to clarify, my switch had "Light1" in it's "If Used" property.

Having ROWS of lights turned on just like the ones above:
Now, you may be wondering about "rows" of lights turning on one after the other, and that you would need a boat-load of invisible entities for that. Actually... each "row" of lights need only one invisible entity. For each row of lights to be turned on, there need be only one invisible entity. Just name all the lights in each row the same name.
NOTE!!! Having large rows of dynamic lights will cause only some of them to be activated at a time as the engine will only allow a certain number of dynamic lights to be viewed by the player at any given time.

Tada! That setup will have all the lights turned on, in sequence, 1 second after the previous one. To change the delay read the "NOTE" after the script.


If you are having any problems understanding what's going on here, or if something isn't working right. Just ask, I'll do my best to give you an answer. Just know that I have it working, and once you understand how to set it up, it doesn't take long at all!

I loved the effect this made in-game. Thank you for asking about this!


The one and only,
~PlystirE~

[EDIT]
Changed it to a simpler method.

Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 31st Oct 2007 09:26
Btw, I played around with it a little more and decided I'd post what I got as a final result.

For an even sweeter result, IMHO, replace the "light1off.fpi" that the light's use with this script:



That code will make the lights play a 3d sound when they turn on as well as do a sort of "flicker" before completely turning on.

I thought it was an awesome effect and thought you'd like it too.


The one and only,
~PlystirE~

Nickydude
Retired Moderator
18
Years of Service
User Offline
Joined: 4th Nov 2006
Location: Look outside...
Posted: 31st Oct 2007 10:26
This is great! All we need now is for the lights to go off in sequence.

"he is coming!..." - WIP in 'Showcase'
Veron
18
Years of Service
User Offline
Joined: 22nd Nov 2006
Location:
Posted: 31st Oct 2007 10:47
This is a seriously nice contribution Plystire, thanks a lot!


protoborg
17
Years of Service
User Offline
Joined: 2nd Jul 2007
Location: Somewhere in this reality
Posted: 31st Oct 2007 10:48
Plystire, you have no idea just how surprising it is that you came up with that third part. That was exactly what I was thinking of when I came up with this idea. I was inspired by the generator cavern in the first Myst game. When you open the door to the cavern, a series of lights came on one row after the other. As each row kicks on, there is the sound of a massive switch or circuit breaker switching over. The lights are enormous and hang from the ceiling. After I saw a screenshot someone had posted to the FPS Creator home page, I thought of how I could use such a large vaulted room. That was when I thought of the generator room in Myst. Everything I tried failed miserably. That is why I have to thank you for these scripts.

You know your code sucks when it does what you want before you know what you want.
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 31st Oct 2007 11:01
Awww, stop it. You guys are being too nice. You're making me feel all warm and fuzzy inside. lol

@Nickydude:

That's an easy fix.

Change the "DelayActivate.fpi" code to this if you want the lights to turn off in sequence with the same delay:



I made it so they all turned off at the same time because that's how real lights work.


The one and only,
~PlystirE~

Cheese Cake
17
Years of Service
User Offline
Joined: 11th Dec 2006
Location: At the bakery
Posted: 31st Oct 2007 11:10 Edited at: 31st Oct 2007 23:26
Hey thanks nice script man! ---EDIT--- Forgot a word
greatly appreciated....

Will surely use this for my game.


Cheers,
Cheese Cake.


protoborg
17
Years of Service
User Offline
Joined: 2nd Jul 2007
Location: Somewhere in this reality
Posted: 31st Oct 2007 19:32 Edited at: 31st Oct 2007 20:14
I am having a small problem. The stupid lights come on as soon as the level starts. The screenshot shows what I mean.

EDIT: I fixed the problem. I am not sure what I had done wrong exactly. I tried the row of lights thing and discovered that (at least on my computer) it does not work very well to have five lights in a row. I will see what happens when I build the thing.

You know your code sucks when it does what you want before you know what you want.

Attachments

Login to view attachments
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 31st Oct 2007 21:12
Quote: "Hey thanks script man!"


Perhaps there is a word missing, but you are most welcome!

@protoborg:

Quote: "NOTE!!! Having large rows of dynamic lights will cause only some of them to be activated at a time as the engine will only allow a certain number of dynamic lights to be viewed by the player at any given time.
"


Sorry, that would be a directX limitation and is not just for FPSC.

I'm glad you fixed it sorta. But yes, dynamic lights in mass quantities can cause some rather strange appearance issues. Like when I tested it with 3 lights per row, only the first two rows of lights would show up, and as I walked through the hallway I had set up, lights would turn on and off depending on how far awayor close to the player they are.

That is mainly to save the CPU from having a mental breakdown.


The one and only,
~PlystirE~

Butter fingers
18
Years of Service
User Offline
Joined: 20th Mar 2006
Location: Mecca
Posted: 1st Nov 2007 18:46
Quote: "That is mainly to save the CPU from having a mental breakdown"


This is a very nice script dude. I'd done this using emptys mod, with a trigger zone, but I had never considered it with entities. I personally like the lights going OFF. Like in Eternal Sunshine of a spotless mind, when the corridoor infront gradually dissapears into darkness.

I'd just like to clarify something for people, especially as I can see alot of people are going to try this out, and then bug you with problems that aren't the fault of your system, but that of Direct X.

DirectX 9 (and therefore FPSC and DBpro), can only handle 8 dynamic lights [numbered 0 to 7]. BUT! FPSC already defaults some of them elsewhere. Light 0 is ambient light, light 1 is muzzleflash and light 2 is used up elsewhere... I wish I knew, oh I think it provides the light effect that illuminates your gun when under a static light.

Anyway, that leaves you with 5 dynamic lights to play with. You can add more than 5, and FPSC will simply render the 5 nearest to you. But as soon as you go beyond the 5 limit, you're going to start raping the CPU, because it has to start calculating the distance of all the dynamic lights from the player to decide which ones to render.

Hope that helps. When I've finished some modelling I'm gonna grab all this stuff and see if there's a way around using the timers, but whatever great script dude. Props

Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 2nd Nov 2007 01:10
Thanks, Butter Fingers, that means a lot coming from you.

And, yes, thank you for clearing that up for everyone.

It's strange though, that in my rows of lights I had up to 6 on at a time.


The one and only,
~PlystirE~

Butter fingers
18
Years of Service
User Offline
Joined: 20th Mar 2006
Location: Mecca
Posted: 2nd Nov 2007 03:31
In which case, my assumtion that one of the lights was used to "light" the static lights when you're under them is wrong, and you have 6 available.

I haven't used FPSC for a while, and just checked it out in the DBpro manual. I kinda just tried to figure what lights would already be in use.

Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 2nd Nov 2007 09:08
That, or DX allows up to 9 lights, lol.

I see what you mean about the static light lighting up your gun, and I think you may be correct on that point.

If DX only allows 8 lights, then perhaps there is not light used for muzzle flash. If there is it's probably the same light that's used for lighting up the gun around static lights.


The one and only,
~PlystirE~

protoborg
17
Years of Service
User Offline
Joined: 2nd Jul 2007
Location: Somewhere in this reality
Posted: 2nd Nov 2007 16:55 Edited at: 2nd Nov 2007 18:32
It sucks that DX9 only handles so many dynamic lights. There is one thing you might want to point out, though. While DX9 can only handle 8 or 9 lights, your 3D video card can handle all the rest. That means that you really should not have to worry about killing your cpu. Unfortunately, some people do not have a 3D card and so TGC, in their infinite wisdom, apparently decided NOT to utilize the video card's on-board processor. It seems like that would a useful option.

You know your code sucks when it does what you want before you know what you want.
Seth Black
FPSC Reloaded TGC Backer
19
Years of Service
User Offline
Joined: 22nd Feb 2005
Location: Pittsburgh, PA
Posted: 2nd Nov 2007 19:11
Quote: "...TGC, in their infinite wisdom..."





Own It, Or Get Owned...
NewKlear
20
Years of Service
User Offline
Joined: 5th Aug 2004
Location: Essex, England
Posted: 11th Nov 2007 18:40
How do you make invisible entities?

www.steveharris.info
Seth Black
FPSC Reloaded TGC Backer
19
Years of Service
User Offline
Joined: 22nd Feb 2005
Location: Pittsburgh, PA
Posted: 11th Nov 2007 20:05


...set this as the entity's SPAWN SCRIPT. Works like a charm...


Own It, Or Get Owned...
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 12th Nov 2007 01:54
Yes, it would be wise to thoroughly read the instructions and obtain a grasp of what's happening. That will usually prevent the earliest of questions.


The one and only,
~PlystirE~

NewKlear
20
Years of Service
User Offline
Joined: 5th Aug 2004
Location: Essex, England
Posted: 12th Nov 2007 23:34
Sorry, didn't really follow what was going on properly. When you say SPAWN SCRIPT you mean the AI Script -> Start -> appear.fpi bit?

www.steveharris.info
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 13th Nov 2007 01:51
Yes, that's the spawn Script. Perhaps I should refer to it as the "Start AI" from now on


The one and only,
~PlystirE~

NewKlear
20
Years of Service
User Offline
Joined: 5th Aug 2004
Location: Essex, England
Posted: 13th Nov 2007 23:04 Edited at: 13th Nov 2007 23:07
Thanks for the reply

www.steveharris.info

Login to post a reply

Server time is: 2024-11-24 01:20:40
Your offset time is: 2024-11-24 01:20:40