Sorry to necro this thread, but it's the only one I could find on this particular subject. 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.
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 guess something is different between them? 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.