Quote: "What I want is to walk up to a key and have to press the [use] button to pick it up"
Hey SR212787, good to see you asking questions about scripting and FPSC. About your first question, you're searching for a reasonable script about picking up keys. However, perhaps in future you should show your progress or attempts so far so we can better help you. This is so you can learn better by understanding scripting and save us designing a script for you. That's just a friendly suggestion, as you're most likely to get the best results out of the forum that way. However, you aren't asking for much.
;Artificial Intelligence Script
;Header
desc = Pickup Key
;Triggers
:state=0:hudreset,hudx=50,hudy=90,hudimagefine=gamecore\text\pickedupakey.tga,hudname=keyprompt,hudhide=1,hudmake=display
:state=0:hudreset,hudx=50,hudy=90,hudimagefine=gamecore\text\pressentertouse.tga,hudname=usekeyprompt,hudhide=1,hudmake=display,state=10
:state=10,plrdistwithin=40:hudshow=usekeyprompt,hudfadeout=usekeyprompt
:state=10,plrdistwithin=40,plrusingaction=1:state=1,playertake,coloff,plrsound=audiobank\misc
\ping.wav,hudshow=keyprompt,hudfadeout=keyprompt
:state=1:rundecal=5
;End of Script
What I did was piece together this script with the addition of a few lines. This line here defined the 'press enter to use' hud:
:state=0:hudreset,hudx=50,hudy=90,hudimagefine=gamecore\text\pressentertouse.tga,hudname=usedoorprompt,hudhide=1,hudmake=display
This was added on the same state that detected when the use key was pressed to show the use hud:
:state=10,plrdistwithin=40:hudshow=usedoorprompt,hudfadeout=usedoorprompt
And plrusingaction=1 was added to detect if the use key was being pressed.
Quote: "Also, after using the key on a door to unlock it, how do I get it to stop saying Door locked use key etc?"
This one has been answered in the FPSC community guide. If you haven't already looked through it I would definitely reccomend the read, it has most valuable knowledge within it. You can find it located in your fps creator\docs folder, along with other files you definitely should look through (script syntax list . . .). Here's the exact text from the guide answering the question:
Stop "door locked, requires a key to open" when carrying key By EldestDragon
This stops the annoyance of it still saying "door locked, requires a key to open" when you actually have the key.
;Artificial Intelligence Script
;Header desc = Key Door (Open 'With Key' and Close), better hud
The Official Community Guide to FPS Creator – Revision 3 Page 89
;Triggers
:state=0:hudreset,hudx=50,hudy=90,hudimagefine=gamecoretextlockeddoor.tga,hudname=keydoorprompt,hudhide=1,hudmake=display :state=0:hudreset,hudx=50,hudy=90,hudimagefine=gamecoretextpressentertouse.tga,hudname=entertouse,hudhide=1,hudmake=display,state=10 :state=10,plrdistwithin=60,plrhaskey=0:hudshow=keydoorprompt,hudfadeout=keydoorprompt :state=10,plrdistwithin=60,plrhaskey=1:hudshow=entertouse,hudfadeout=entertouse :state=10,plrdistwithin=60,plrhaskey=1,plrusingaction=1:state=1,setframe=0,sound=$0 :state=1:incframe=0 :state=1,frameatend=0:state=2,coloff :state=2,plrdistfurther=60:state=3,sound=$1,colon :state=3:decframe=0 :state=3,frameatstart=0:state=10,setframe=0
;End of Script
Open up doorkey.fpi and delete all the contents, then copy this into it. Put a door(key) segment in your level. Put a key entity in your level. (I hid it behind a door on which I'd used my first script to make it harder to open.)
First walk up to the locked door, then go and get the key. Then walk up to it again and open it.
Variation:
Change the bottom line to:
:state=3,frameatstart=0:state=4,setframe=0
Add another line at the bottom of the script:
:state=4:none
Now the door will only open once (when you have the key) and then it will not let you open it again.
Or, on page 88. Hope this helped,
Burger
- An Instinctive Fear IndieDB page, download demo today!