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 / "Use Key" Script

Author
Message
freak of nature 64
15
Years of Service
User Offline
Joined: 19th Jan 2009
Location: Look in your car...
Posted: 19th Apr 2009 03:55
Hello forum members! I have JUST started scripting and I can't figure out how to make a simple script where when you press the "Use Key" it makes a sound. So if anyone can help it would be much appreciated!

fgadzsv
Leon Kennedy
16
Years of Service
User Offline
Joined: 7th Sep 2008
Location: Neither here nor there
Posted: 19th Apr 2009 15:34
Need a little more information from you on this:

1. Can you show us your script?
2. Where (what folder on your hard drive) do you have the sound located?
3. What are you attaching this script to?

Priest of the Church of Joe Wood
freak of nature 64
15
Years of Service
User Offline
Joined: 19th Jan 2009
Location: Look in your car...
Posted: 19th Apr 2009 22:08
1.I don't have one.
2.audiobank\misc.
3.nothing. I just want it to play a sound.

fgadzsv
JRH
18
Years of Service
User Offline
Joined: 8th Jul 2006
Location: Stirling, UK
Posted: 19th Apr 2009 23:42
Where X and whatever.wav are the appropriate value.


Good Luck,
JRH

freak of nature 64
15
Years of Service
User Offline
Joined: 19th Jan 2009
Location: Look in your car...
Posted: 20th Apr 2009 00:29
What is state=x and what do I put?

fgadzsv
Leon Kennedy
16
Years of Service
User Offline
Joined: 7th Sep 2008
Location: Neither here nor there
Posted: 20th Apr 2009 13:53
My suggestion here after your last post (and JRH, that was fantastic help) is to read the community guide and some of the scripting tutorials. Not to be mean, but the guide will help you out tremendously, especially considering that you are new to scripting.

Priest of the Church of Joe Wood
freak of nature 64
15
Years of Service
User Offline
Joined: 19th Jan 2009
Location: Look in your car...
Posted: 20th Apr 2009 19:29
I just want to know what I put for x and what the state command means. I do not want to spend my day looking through a PDF when I have other things to do.

fgadzsv
The Silent Ayehika
18
Years of Service
User Offline
Joined: 15th Apr 2006
Location: My Home
Posted: 20th Apr 2009 19:36
Its not to be harmful to you or anything, but you will have to learn to code yourself.


P.S
JRH only gave you a piece of the code and not the whole code.

P.P.S
With such an attitude you will never come far, everyone has a lot of things to do, dont use that as an excuse.
Leon Kennedy
16
Years of Service
User Offline
Joined: 7th Sep 2008
Location: Neither here nor there
Posted: 20th Apr 2009 20:42
Quote: "I do not want to spend my day looking through a PDF when I have other things to do."

Not to sound mean, but your statement just makes it sound like you want someone else to do the work for you.

You really need to learn how to script. I know - with FPSC you can create a full game without having to write a single line of code. It's true - you can do it. But your games will be much better if you learn scripting. Scripting will enable you to do so much more.

To answer what's left of this topic:

Quote: "1. Can you show us your script?
1.I don't have one."

JRH provided a piece of one, but you'll really need to learn scripting in order to finish this.

Quote: "2. Where (what folder on your hard drive) do you have the sound located?
2.audiobank\misc."

Had to ask - some people don't know that you need to have audio sounds in the audiobank folder.

Quote: "3. What are you attaching this script to?
3.nothing. I just want it to play a sound."

My first question after this is... when do you want it to play the sound? When a weapon is picked up? Background music that is always playing? When the player does something? If you can let us know that, we can tell you what it has to be attached to.

Quote: "What is state=x and what do I put?"

This is why you need to learn scripting. State, simply put, is the "state of being or isness" of the particular script. Depending on what state the script is in, certain actions happen. For example, look at the following 2 lines of script.


(Note - do NOT use this code. It is for example purposes only.) In the code, the script checks to see if it is in state 0. If it is, it then turns the light on. It then checks to see if it is in state 0 AND the light is on. If it is, then it moves to state 2. If not, it stays in state 0.

For the example JRH provided, you would need to make state equal to some number. And what number depends on when the sound is supposed to be played, and if other actions need to be performed.

Now do you see why you need to learn scripting?

Priest of the Church of Joe Wood
freak of nature 64
15
Years of Service
User Offline
Joined: 19th Jan 2009
Location: Look in your car...
Posted: 20th Apr 2009 20:50
Ok, here is a better description. I will apply it to a trigger zone where I spawn and when I press "E" it plays my sound. That is all I want it to do.

fgadzsv bla bla bla
Red Eye
16
Years of Service
User Offline
Joined: 15th Oct 2008
Location:
Posted: 20th Apr 2009 20:57 Edited at: 21st Apr 2009 19:37
attach this to a dynamic light with a range of 0

copy this to notepad and save as a .fpi file put it in your scriptbank



NO REQUESTS PLEASE (or things like that)

You are at a forum to learn from others and help others. Keep that in mind please.


Red Eye: Now in the Forums
freak of nature 64
15
Years of Service
User Offline
Joined: 19th Jan 2009
Location: Look in your car...
Posted: 20th Apr 2009 21:38
Thanks, Red Eye. You should get some eye drops!

fgadzsv bla bla bla
Leon Kennedy
16
Years of Service
User Offline
Joined: 7th Sep 2008
Location: Neither here nor there
Posted: 20th Apr 2009 22:32
Red Eye, your script is a little....incorrect. It should read:



Nothing major, but checking for the scancodekeypressed needs to be before the second colon.

Priest of the Church of Joe Wood
Red Eye
16
Years of Service
User Offline
Joined: 15th Oct 2008
Location:
Posted: 21st Apr 2009 15:38
sorry for that, i made indeed a mistake, i was typing on my iphone, i am embarassed. Sorry, i did know


Red Eye: Now in the Forums
Leon Kennedy
16
Years of Service
User Offline
Joined: 7th Sep 2008
Location: Neither here nor there
Posted: 21st Apr 2009 16:54
it's all good. typing on an iphone isn't the easiest thing in the world to do.

Priest of the Church of Joe Wood
freak of nature 64
15
Years of Service
User Offline
Joined: 19th Jan 2009
Location: Look in your car...
Posted: 22nd Apr 2009 02:00
bla bla bla

fgadzsv bla bla bla
freak of nature 64
15
Years of Service
User Offline
Joined: 19th Jan 2009
Location: Look in your car...
Posted: 22nd Apr 2009 02:00
bla bla bla bla bla

fgadzsv bla bla bla
freak of nature 64
15
Years of Service
User Offline
Joined: 19th Jan 2009
Location: Look in your car...
Posted: 22nd Apr 2009 02:00
lol, I just triple posted

fgadzsv bla bla bla
Red Eye
16
Years of Service
User Offline
Joined: 15th Oct 2008
Location:
Posted: 22nd Apr 2009 09:47 Edited at: 22nd Apr 2009 09:48
i wont do that if i were you , mods dont like it


Red Eye: Now in the Forums
freak of nature 64
15
Years of Service
User Offline
Joined: 19th Jan 2009
Location: Look in your car...
Posted: 24th Apr 2009 20:23
2 of my threads are locked for seemingly no reason. Weird.

fgadzsv bla bla bla

Login to post a reply

Server time is: 2024-11-25 00:38:54
Your offset time is: 2024-11-25 00:38:54