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 / Trigger zone flickers light script

Author
Message
Opposing force
19
Years of Service
User Offline
Joined: 10th Aug 2005
Location: England
Posted: 21st May 2008 13:40
I know requests aren't really allowed but I very rarely ask for things. I'm a noob at FPI scripting but I'm sure this is a simple script. Ok, basically I am trying to make a script that does the following. There's a normal light marker placed in the level, the player walks through a trigger zone and that same light flickers for a second then returns to normal. I know it involves timers and stuff but I just don't know what to do.

Any help will be greatly appreciated. Thanks.

http://www.freewebs.com/teammegabasic/
For low price FPSC and Dark BASIC media packs.
Plystire
22
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 21st May 2008 14:48
Read the following thread (there should be multiple tutorials in it):

A Complete Newb's Guide to Scripting


Now, upon reading the tutorials, you should have a basic scripting understanding.

Here are some hints for your endeavor:

- Make the light the IfUsed entity of the triggerzone
- Use some timers to turn the light on and off after small increments.
- When the flicker is finished... turn the light on and freeze the light's script.


That should do it.

I'm not going to give you any actual code, because I believe that would be denying you a learning experience.


The one and only,


Opposing force
19
Years of Service
User Offline
Joined: 10th Aug 2005
Location: England
Posted: 21st May 2008 15:44 Edited at: 21st May 2008 15:45
Ok, I had a look through your guide and I found it really helpful.

I had a go at scripting, using light1.fpi as a base. Light1 turned off when I walked through a trigger zone so I added more code to make the trigger zone flash the light on and off. It didn't work, what am I doing wrong?


I've been coding in Dark Basic classic and professional for several years now so I should know all this.

http://www.freewebs.com/teammegabasic/
For low price FPSC and Dark BASIC media packs.
Plystire
22
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 21st May 2008 22:48
Well... let's take a look at your code line by line:

State 0:
Go to State 1

State 1:
IF the Light Entity is NOT activated, THEN turn light ON and go to State 2

State 2:
IF the Light Entity IS activated, THEN go to State 10

State 10:
***** ERROR *****
This line is missing an Action Colon.


Let's stop there, shall we?

From the looks of things, the way you scripted it should work. However, It hink you'll want to have a bit of a faster flicker to your light. Right now you have it set up to wait an entire second between turning off and on.

Fix up those lines that are missing Action Colons and it should probably work.


Here's a small tip that I use when reading other people's scripts. When I see the first colon on the line I say to myself "IF". Then I read the conditions. When I see the second colon on a line I say to myself "THEN", and continue to read the actions that should be executed when the conditions are TRUE. Some of your lines are missing the "THEN", which is rather important.


The one and only,


Opposing force
19
Years of Service
User Offline
Joined: 10th Aug 2005
Location: England
Posted: 22nd May 2008 00:07
No, it still doesn't work. I gave the light this script as its main script and set the light to dynamic. I named the light "light1", then created a trigger zone, set its main to "plrinzoneactivateifused.fpi", put its "ifused" as "light1". I then gave the light this edited script, as its main...



First time I tested the level, the light was on, I walked through the trigger zone, light still on. No change. I tested the level again with the same setup and this time there was no light at all, before and after entering the trigger zone.

http://www.freewebs.com/teammegabasic/
For low price FPSC and Dark BASIC media packs.
Plystire
22
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 22nd May 2008 07:36
Ah, I see the problem.

When you alter the light (On or OFF), remember to start the tiemr again. Otherwise the timer is ALWAYS going to be greater than 100, because it never got reset back to 0.


Try that out and lemme know how it goes.


The one and only,


Opposing force
19
Years of Service
User Offline
Joined: 10th Aug 2005
Location: England
Posted: 22nd May 2008 12:38 Edited at: 22nd May 2008 15:00
Ok, it works now. However, when I test the same level again, the light doesn't come on at all, it stays off.

Edit: Nevermind, everything works perfectly now. Thank you Plystire, you helped me a lot. I will credit you in my project.

http://www.freewebs.com/teammegabasic/
For low price FPSC and Dark BASIC media packs.
wgreg2001
19
Years of Service
User Offline
Joined: 9th Jun 2005
Location: Philadelphia
Posted: 22nd May 2008 19:49
I am new to FPS , how do you use a Trigger Zone to make some thing happen, like turn a fog , close a door

warren gregory

Login to post a reply

Server time is: 2025-05-22 15:22:39
Your offset time is: 2025-05-22 15:22:39