Facebook Twitter YouTube Frictional Games | Forum | Newsletter | Dev Blog | Dev Wiki | Support | Shelf | Store

Privacy Policy


Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Lever Function [solved]
Author Message
Axe to the D Offline
Junior Member

Posts: 6
Joined: Jan 2011
Reputation: 0
Post: #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 all posts by this user Quote this message in a reply
Someone else Offline
Member

Posts: 179
Joined: Sep 2010
Reputation: 0
Post: #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)

Support the developer.
Say no to piracy.
My avatar used to shape shift, but that is no longer the case.
01-18-2011 12:01 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Axe to the D Offline
Junior Member

Posts: 6
Joined: Jan 2011
Reputation: 0
Post: #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 all posts by this user Quote this message in a reply
Axe to the D Offline
Junior Member

Posts: 6
Joined: Jan 2011
Reputation: 0
Post: #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 all posts by this user Quote this message in a reply
Andross Offline
Junior Member

Posts: 38
Joined: Oct 2010
Reputation: 0
Post: #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 all posts by this user Quote this message in a reply
Axe to the D Offline
Junior Member

Posts: 6
Joined: Jan 2011
Reputation: 0
Post: #6
RE: Lever Function
Holy s*** it works now! Thank you sir Big Grin
01-18-2011 03:09 PM
Find all posts by this user Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)