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 / Scancodekeypressed : play sound only once

Author
Message
Captain Kirk
19
Years of Service
User Offline
Joined: 30th Aug 2005
Location: Sickbay
Posted: 1st Jan 2008 14:28
Hi all!

Based on a script i found here, i modified a script to do the following: when player press "F" the player will hear a sound.

But I have a problem. During the key is pressed the game plays the sound rapidly again and agin. Is it possible to play the sound only once and force the player to press button again to hear the sound?

I tried to solve this with a timer:


This worked, but not the best, because sound delayed after key pressed.
Has anybody a solution for this without timer?
0 Geoff 0
17
Years of Service
User Offline
Joined: 3rd Aug 2007
Location:
Posted: 1st Jan 2008 18:46
This should work better. The sound plays when you press the key then wait's .7seconds then allows the sound to be played again by pressing the key. I think this is what you meant. I hav'nt tested it but i can't see it not working.
;Artificial Intelligence Script

;Header

desc = Play sound when "F" key is pressed


;Triggers

:state=0:state=1
:state=1,scancodekeypressed=33:sound=audiobank\voices\male\hurt1.wav,timerstart,state=2
:state=2,timergreater=700:state=1

;End of Script
Captain Kirk
19
Years of Service
User Offline
Joined: 30th Aug 2005
Location: Sickbay
Posted: 2nd Jan 2008 10:04
Thanks. Your version is better then mine.

Login to post a reply

Server time is: 2024-11-24 01:46:36
Your offset time is: 2024-11-24 01:46:36