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 / End a script

Author
Message
Scurvy Lobster
18
Years of Service
User Offline
Joined: 3rd Mar 2006
Location: Denmark
Posted: 12th Apr 2008 11:44 Edited at: 12th Apr 2008 11:47
I have run into a bug with one of my scripts for automatic doors. The script opens a door in the room when you shoot a prisoner in a cell. In the next room a script closes the door again behind you. But the first script immediatly opens the door again (it must still be active). My question is: how do I end the script, so that it only runs itself once?

The script is:



Note: this script is from the following thread: http://forum.thegamecreators.com/?m=forum_view&t=109868&b=23
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 12th Apr 2008 12:22
Right after you active the door with your first script, send that script into a state that isn't being used (effectively ending the script).

If that script will NEVER be used again... you also use the "destroy" command.


The one and only,
~PlystirE~

Scurvy Lobster
18
Years of Service
User Offline
Joined: 3rd Mar 2006
Location: Denmark
Posted: 12th Apr 2008 12:34 Edited at: 12th Apr 2008 12:39
Thanks for the help!

Will something like this do the trick:



?
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 12th Apr 2008 12:37
I was actually thinking of something more like this:



Your "state=2" line is missing the second colon, btw. Thought I should mention it to ya, just for future reference. That comma should be a colon to tell the engine that you're starting the list of actions and stopping the list of conditions.


The one and only,
~PlystirE~

Scurvy Lobster
18
Years of Service
User Offline
Joined: 3rd Mar 2006
Location: Denmark
Posted: 12th Apr 2008 13:37
Thank you very much! The door stays closed so it works

But I am still having one big problem that is related to this script.

If I die or restart the game the entity that controls the script is not respawned into the game (so now the door will not open). A user will be have to completely exit the game and restart it to play again from the beginning. This problem was already there before the change to the script. Can anything be done about this? I am thinking if there is a function to reset all scripts when you start the level?
Scurvy Lobster
18
Years of Service
User Offline
Joined: 3rd Mar 2006
Location: Denmark
Posted: 12th Apr 2008 13:54
Hehe, sometimes you ask and then find the answer just after...

I made the entity spawn when destroyed and that makes it appear again in a new game.

Check the attached image for details.

Attachments

Login to view attachments

Login to post a reply

Server time is: 2024-11-24 08:00:48
Your offset time is: 2024-11-24 08:00:48