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
Lever Function [solved]
Axe to the D Offline
Junior Member

Posts: 6
Threads: 2
Joined: Jan 2011
Reputation: 0
#1
Lever Function [solved]

Hi all

I have the following problem. I want to make a lever open a door. I took a look at the script functions in this forum and found one.
After changing it looks like this:

// Secret Lever Function
void OnLeverStateChange("lever_01", 0)
{
SetSwingDoorLocked("door_hidden", false, true);
PlaySoundAtEntity("", "unlock_door", "door_hidden", 0, false);
}

But as I want to start the map - Fatal Error

Can anybody help me? Whats wrong with that function?
(This post was last modified: 01-18-2011, 05:23 PM by Axe to the D.)
01-18-2011, 11:30 AM
Find
Som1Lse Offline
Member

Posts: 183
Threads: 9
Joined: Sep 2010
Reputation: 0
#2
RE: Lever Function

Your function definition is wrong.
Write this:
void OnLeverStateChange(string &in asName, int alState)
Instead of this:
void OnLeverStateChange("lever_01", 0)
01-18-2011, 12:01 PM
Website Find
Axe to the D Offline
Junior Member

Posts: 6
Threads: 2
Joined: Jan 2011
Reputation: 0
#3
RE: Lever Function

Thank you very much.
But one more question. How does the game know that i mean my "lever_01"? It isn't defined anywhere, isn't it?
01-18-2011, 12:13 PM
Find
Axe to the D Offline
Junior Member

Posts: 6
Threads: 2
Joined: Jan 2011
Reputation: 0
#4
RE: Lever Function

Does anyone know the solution?
At least the game doesn't crash anymore but the lever is still not working. The door doesn't open.
01-18-2011, 02:22 PM
Find
Andross Offline
Junior Member

Posts: 38
Threads: 1
Joined: Oct 2010
Reputation: 0
#5
RE: Lever Function

You have to set up the actual callback. It should be this one, not sure:
void SetEntityConnectionStateChangeCallback(string& asName, string& asCallback);
asName would be your "lever_01",
asCallback your callback function "OnLeverStateChange".
01-18-2011, 02:32 PM
Find
Axe to the D Offline
Junior Member

Posts: 6
Threads: 2
Joined: Jan 2011
Reputation: 0
#6
RE: Lever Function

Holy s*** it works now! Thank you sir Big Grin
01-18-2011, 03:09 PM
Find




Users browsing this thread: 1 Guest(s)