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
What's wrong with this lever?
SkuLLfac3 Offline
Junior Member

Posts: 48
Threads: 11
Joined: Jun 2011
Reputation: 0
#1
What's wrong with this lever?

Hey,

I have a problem with my script. But I can't find the mistake. Someone may find it? Huh


void OnStart()
{


    
SetEntityPlayerInteractCallback("lever_easteregg", "Open_easteregg", true);
}


void Open_easteregg (string &in asEntity)
{
     PlaySoundAtEntity("", "door_large_castle_open.snt", "shelf_easteregg", 1.0 / 2, false);
     SetEntityActive("shelf_easteregg",false);
     SetEntityActive("shelf_easteregg2",true);
}


void OnEnter()
{

}

Thanks Smile

[Die Latrine der Angst] The demo of my 1st story (:
07-09-2011, 12:19 AM
Find
Kyle Offline
Posting Freak

Posts: 911
Threads: 36
Joined: Sep 2010
Reputation: 7
#2
RE: What's wrong with this lever?

You don't use a SetEntityPlayerInteractCallback, you use this:

void OnStart()
{
     SetEntityConnectionStateChangeCallback("lever_easteregg", "Open_easteregg");
}
void Open_easteregg(string &in asEntity, int alState)
{
     if (alState == 1)
     {
          PlaySoundAtEntity("", "door_large_castle_open.snt", "shelf_easteregg", 1.0 / 2, false);
          SetEntityActive("shelf_easteregg", false);
          SetEntityActive("shelf_easteregg2", true);
     }
}

07-09-2011, 12:23 AM
Find
SkuLLfac3 Offline
Junior Member

Posts: 48
Threads: 11
Joined: Jun 2011
Reputation: 0
#3
RE: What's wrong with this lever?

Hmm but I found another mistake and now it works o.O

The lever in the LevelEditor had the wrong name. Blush I changed it and it worked. But the sound doesen't appear. Is your solution the reason for that?

[Die Latrine der Angst] The demo of my 1st story (:
07-09-2011, 12:58 AM
Find
Kyle Offline
Posting Freak

Posts: 911
Threads: 36
Joined: Sep 2010
Reputation: 7
#4
RE: What's wrong with this lever?

(07-09-2011, 12:58 AM)SkuLLfac3 Wrote: Hmm but I found another mistake and now it works o.O

The lever in the LevelEditor had the wrong name. Blush I changed it and it worked. But the sound doesen't appear. Is your solution the reason for that?

Nope. It's because you are making a sound appear at an area that doesn't exist (or active).

Since in the same function the location from which the sound is played is unactive, causing it to appear from nowhere, causing it to break itself.

Replace the PlaySoundAtEntity with this:

PlaySoundAtEntity("", "door_large_castle_open.snt", "shelf_easteregg2", 0, false);


If it doesn't work, check the .snt sound and make sure it matches with the one that exists in the sound folder.

(This post was last modified: 07-09-2011, 01:11 AM by Kyle.)
07-09-2011, 01:10 AM
Find
SkuLLfac3 Offline
Junior Member

Posts: 48
Threads: 11
Joined: Jun 2011
Reputation: 0
#5
RE: What's wrong with this lever?

Yeah the sound file exists.

But I made no soundthingy on the map. Maybe this is the reason?

[Die Latrine der Angst] The demo of my 1st story (:
07-09-2011, 01:41 AM
Find
Kyle Offline
Posting Freak

Posts: 911
Threads: 36
Joined: Sep 2010
Reputation: 7
#6
RE: What's wrong with this lever?

(07-09-2011, 01:41 AM)SkuLLfac3 Wrote: Yeah the sound file exists.

But I made no soundthingy on the map. Maybe this is the reason?

That is difinately not the reason. You might as well create a ScriptArea near the area in which you want it to play, and then put that in the PlaySoundAtEntity command.

07-09-2011, 02:26 AM
Find
SkuLLfac3 Offline
Junior Member

Posts: 48
Threads: 11
Joined: Jun 2011
Reputation: 0
#7
RE: What's wrong with this lever?

Hmm...ok thanks for all Smile

[Die Latrine der Angst] The demo of my 1st story (:
07-09-2011, 02:43 AM
Find




Users browsing this thread: 1 Guest(s)