Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help Interact with door script
goodcap Offline
Member

Posts: 193
Threads: 112
Joined: Jun 2012
Reputation: 3
#1
Interact with door script

I'm trying to make it that when you try to open a door which is locked you hear a voice coming from a speaker. When I interact with the door I don't hear anything. This is my script:

void OnStart()
{
SetEntityPlayerInteractCallback("PlayMusicBox", "PlayMusicBox", false);
}

void PlayMusicBox(string &in asEntity, int alState)
{
PlaySoundAtEntity("", "16_puzzle_bridge.snt", "speakers_1", 0.05f, false);
}
07-21-2014, 08:39 PM
Find
victorkim890(KimmyChimmy) Offline
Senior Member

Posts: 316
Threads: 1
Joined: Jun 2014
Reputation: 1
#2
RE: Interact with door script

probally speaker1 cant play the sound u hav to choose another thing to play the sound in?

07-21-2014, 08:44 PM
Find
goodcap Offline
Member

Posts: 193
Threads: 112
Joined: Jun 2012
Reputation: 3
#3
RE: Interact with door script

I tried a bunch of entities but it doesnt work
07-21-2014, 08:52 PM
Find
victorkim890(KimmyChimmy) Offline
Senior Member

Posts: 316
Threads: 1
Joined: Jun 2014
Reputation: 1
#4
RE: Interact with door script

for playmusicbox u put (string &in asEntity)

right after playmusicbox

also u hav to put the volume to 1

(This post was last modified: 07-21-2014, 09:04 PM by victorkim890(KimmyChimmy).)
07-21-2014, 09:03 PM
Find
goodcap Offline
Member

Posts: 193
Threads: 112
Joined: Jun 2012
Reputation: 3
#5
RE: Interact with door script

I'm sorry. What do you mean?
07-21-2014, 09:11 PM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#6
RE: Interact with door script

The callback syntax for SetEntityPlayerInteractCallback is
PHP Code: (Select All)
void MyFunc(string &in asEntity

The int alState does not belong there.

Also, when using PlaySoundAtEntity, I recommend using a ScriptArea because they're more reliable.

07-21-2014, 09:20 PM
Find
goodcap Offline
Member

Posts: 193
Threads: 112
Joined: Jun 2012
Reputation: 3
#7
RE: Interact with door script

I got it to work. Thanks guys Smile
(This post was last modified: 07-21-2014, 09:27 PM by goodcap.)
07-21-2014, 09:23 PM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#8
RE: Interact with door script

Is "lol" the name of the script area?

Is your script file properly loaded? Is the sound file found?

I think if you go to Documents\Amnesia\Main and look at hpl.log, it might mention any errors or warnings.

07-21-2014, 09:50 PM
Find
victorkim890(KimmyChimmy) Offline
Senior Member

Posts: 316
Threads: 1
Joined: Jun 2014
Reputation: 1
#9
RE: Interact with door script

i name my area lol1, lol2, lol3, lol4 but only jumpscares...............................................gdfgwahegWFL GKAWNRLKG NWLAR GJ;KLAWEB

07-21-2014, 10:40 PM
Find
Nice Offline
Posting Freak

Posts: 3,812
Threads: 37
Joined: Jan 2012
Reputation: 153
#10
RE: Interact with door script

(07-21-2014, 10:40 PM)victorkim890(KimmyChimmy) Wrote: gdfgwahegWFL GKAWNRLKG NWLAR GJ;KLAWEB

did you have a stroke


Sorry but we cannot change your avatar as the new avatar you specified is too big. The maximum dimensions are 80x80 (width x height)
07-21-2014, 11:22 PM
Find




Users browsing this thread: 1 Guest(s)