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 / Sleep Script (HELP!)

Author
Message
Acmeman
15
Years of Service
User Offline
Joined: 20th Mar 2009
Location: Joyzey
Posted: 4th Aug 2013 02:51
Hey y'all, Acmeman here. I'm having trouble with a script. What I want to happen is this: The player goes into his suite and by the bed, a hud comes up that says "press enter". When the player presses enter, the level would fade out, or in this case, win the level. I tried looking at this thread:

http://forum.thegamecreators.com/?m=forum_view&t=182314&b=23

The hud part seems to work for me, but every time I put my win zone in a test level, it doesn't give me the option to actually press enter, it just fades out right then and there. Here is my script:

;Artificial Intelligence Script

;Header

desc = Press Enter to win level

;Triggers

:state=0:scancodekeypressed=28

:state=0,plrwithinzone=1:activateallinzone=1,sound=$0,state=1
:state=0:hudreset,hudx=50,hudy=63,hudimagefine=gamecore\huds\joshcustom\letter.png,hudname=letter,hudhide=1,hudmake=display,state=1
:state=1,plrwithinzone=1:sound=$0,hudshow=letter,state=2
:state=2,plrwithinzone=0:hudfadeout=letter,destroy

Can someone please help? BlackFox wasn't specific enough as to where to put "scancodeskeypressed=28" in the script. :/

Swag syndrome-Harmful disease that is spread through music, TV, and media. Subjects of swag syndrome try their hardest to imitate celebrities and live their lives as if they are rich and famous.
ncmako
12
Years of Service
User Offline
Joined: 19th Feb 2012
Location: Hendersonville,NC
Posted: 4th Aug 2013 03:07 Edited at: 4th Aug 2013 03:16
Hi Acmeman
Quote: "it doesn't give me the option to actually press enter, it just fades out right then and there"

Look at your script..":state=0,plrwithinzone=1:activateallinzone=1
As soon as you enter the zone it activates ALL.

Try this...
A r e n a s
15
Years of Service
User Offline
Joined: 9th Jun 2008
Location:
Posted: 4th Aug 2013 04:35
Hi Acmeman,

There are a couple of bugs in your code. FPI is a language which is formed through a set of clauses (conditions) separated by commas. There is then a colon. If the conditions to the left of the colon are all true, then the actions on the right are executed. 'state' is both a condition and an action depending upon which side of the colon it is on (left = condition, right = action).

Quote: ":state=0:scancodekeypressed=28"


Here 'scancodekeypressed' is a condition, there should be a comma after ':state=0' and then a colon after the 'scancodekeypressed=28' with a set of actions to make this a valid piece of code. Below is some code which should do what you want.



If you are planning on writing more code you may want to read a little on Finite State Machines. They are what FPI code models really. It may be a bit of overkill but they are core to all computing to they're worth knowing about anyway! In the link just look at the pictures, they seem to explain it well enough.

Teabone
Valued Member
17
Years of Service
User Offline
Joined: 8th Jun 2006
Location: Canada
Posted: 4th Aug 2013 05:25 Edited at: 4th Aug 2013 06:59
I made a script for beds where as you go up to them click action and the player goes into the bed and screen fades and your health is restored and game saved lol then you wake up.

Inspired by Fallout and Skyrim.

Acmeman
15
Years of Service
User Offline
Joined: 20th Mar 2009
Location: Joyzey
Posted: 4th Aug 2013 06:33
Thanks guys for the help, I'll try the codes out asap

Teabone: That script sounds pretty darn legit lol

Swag syndrome-Harmful disease that is spread through music, TV, and media. Subjects of swag syndrome try their hardest to imitate celebrities and live their lives as if they are rich and famous.
jono gamer
11
Years of Service
User Offline
Joined: 29th Oct 2012
Location: check your closest
Posted: 21st Sep 2013 12:33
teabone your script seems cool is it up for download on the forums???

living a sweet death

Login to post a reply

Server time is: 2024-04-19 21:19:26
Your offset time is: 2024-04-19 21:19:26