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 Wheel Troubles!
BonesTheRabbit Offline
Member

Posts: 68
Threads: 20
Joined: Feb 2012
Reputation: 2
#1
Wheel Troubles!

I've been trying to get this working, and I'm guessing I'm doing something silly, because it just doesn't want to work with me. The idea is that a function should trigger when the valve is turned all the way to its endpoint. The names are all just for the sake of clarity, and the functions in the trigger are just for testing.

void OnEnter()
{    
    SetEntityConnectionStateChangeCallback("EntityName", "FunctionName");
}

void FunctionName(string &in asEntity, int ValveState)
{    
    if (ValveState == 1)
    {
        SetPropObjectStuckState("EntityName", 1);
        PlaySoundAtEntity("", "explosion_rock_large.snt", "Player", 0.0f, false);
    }
}

I've triple checked the entity name, but the valve isn't locking, and the sound isn't playing. I've been looking through various tutorials, though most deal with levers, and I'm really stumped. I have a valve which opens a sliding door elsewhere on my map, and that works fine, but this one is proving problematic.

Any help would be greatly appreciated.
10-13-2013, 07:51 PM
Find
DnALANGE Offline
Banned

Posts: 1,549
Threads: 73
Joined: Jan 2012
#2
RE: Wheel Troubles!

void YOURCODENAMEINEDITOR(string &in asEntity, int alState)
{
if (alState == 1)
{
SetPropObjectStuckState("EntityName", 1);
PlaySoundAtEntity("", "explosion_rock_large.snt", "Player", 0.0f, false);
}
}


***YOURCODENAMEINEDITOR =
Open editor -> go to your wheel -> EntityTAB -> ConnectStateChangeCallBack "YOURCODENAMEINEDITOR"

You can remove this line then :
SetEntityConnectionStateChangeCallback("EntityName", "FunctionName");
(This post was last modified: 10-14-2013, 01:56 AM by DnALANGE.)
10-14-2013, 01:53 AM
Find
Apjjm Offline
Is easy to say

Posts: 496
Threads: 18
Joined: Apr 2011
Reputation: 52
#3
RE: Wheel Troubles!

Stick an AddDebugMessage() in the callback before the if statement - so you can check if it is being called and what the state of the lever is:
void FunctionName(string &in asEntity, int ValveState)
{    
    AddDebugMessage(asEntity + " - state: " + ValveState,false);
    if (ValveState == 1)
    {
        SetPropObjectStuckState("EntityName", 1);
        PlaySoundAtEntity("", "explosion_rock_large.snt", "Player", 0.0f, false);
    }
}
This would let you determine if the problem is in setting up the callback or if the entity is some strange valve/wheel that turns from max->min instead of min->max.
(This post was last modified: 10-14-2013, 02:41 AM by Apjjm.)
10-14-2013, 02:40 AM
Find
BonesTheRabbit Offline
Member

Posts: 68
Threads: 20
Joined: Feb 2012
Reputation: 2
#4
RE: Wheel Troubles!

Got it working. Not sure what was wrong originally, but once I added the debug message, the thing started working. Thanks for the help!
10-15-2013, 12:06 AM
Find




Users browsing this thread: 1 Guest(s)