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
Valve interaction
Apjjm Offline
Is easy to say

Posts: 496
Threads: 18
Joined: Apr 2011
Reputation: 52
#4
RE: Valve interaction

You will want the function "SetEntityConnectionStateChangeCallback" for that job.
Quote:void SetEntityConnectionStateChangeCallback(string& asName, string& asCallback);
A callback called when ever the connection state changes (button being switched on, lever switched, etc).
Callback syntax: void Func(string &in EntityName, int alState)
alState: -1 = off, 0 = between, 1 = on
E.g:
void OnStart()
{
  SetEntityConnectionStateChangeCallback("valve", "callback_func");
}
void callback_func(string &in EntityName, int alState)
{
  //Called when the var alState of the lever/valve changes between:
  // -1 (off), 0 (middle), 1 (on)
  if(alState == 1)
   { //Turn object on
   }
  else if(alState ==-1)
   { //Turn object off
   }
}
(This post was last modified: 04-19-2011, 02:04 AM by Apjjm.)
04-19-2011, 02:04 AM
Find


Messages In This Thread
Valve interaction - by Josh707 - 04-19-2011, 01:50 AM
RE: Valve interaction - by Anxt - 04-19-2011, 01:56 AM
RE: Valve interaction - by Josh707 - 04-19-2011, 02:00 AM
RE: Valve interaction - by Apjjm - 04-19-2011, 02:04 AM
RE: Valve interaction - by Anxt - 04-19-2011, 02:12 AM
RE: Valve interaction - by Josh707 - 04-19-2011, 02:14 AM
RE: Valve interaction - by Anxt - 04-19-2011, 02:27 AM
RE: Valve interaction - by Josh707 - 04-19-2011, 12:48 PM



Users browsing this thread: 1 Guest(s)