Frictional Games Forum (read-only)

Full Version: Wheel lever wont stick in positon once turned
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have wrote a script which opens a bulkhead door, but for some reason the wheel lever wont stick in position even though it is sucessfully opening the door. I tried using the stuckstate command and SetPropStaticPhysics but neither work. Here is what I have:

Quote:void OnStart()
{
SetEntityConnectionStateChangeCallback("Gate_Valve_1", "ValveEventHandler");

void ValveEventHandler (string &in asEntity, int alState)

{
if (alState == 1)
{
SetPropStaticPhysics("Gate_Valve_1", true);
SetMoveObjectStateExt("sewer_bulkhead_1", 0.88, 5, 1, 0.12, true);

}
}

Any help is really appreciated.
The script is incorrectly formatted so I assume you're crashing the game?

Remember you cannot call a void block function from within another function (like inside your OnStart). Try this:

PHP Code:
void OnStart()
{
    
SetEntityConnectionStateChangeCallback("Gate_Valve_1""ValveEventHandler");
}

void ValveEventHandler(string &in asEntityint alState)
{
    if(
alState == 1)
    {
        
SetPropStaticPhysics("Gate_Valve_1"true);
        
SetMoveObjectStateExt("sewer_bulkhead_1"0.88510.12true);
    }


With this you can also try //commenting out the SetPropStaticPhysics and see if SetWheelStuckState works better for you if you want.
(06-24-2016, 05:08 PM)Mudbill Wrote: [ -> ]The script is incorrectly formatted so I assume you're crashing the game?

Remember you cannot call a void block function from within another function (like inside your OnStart). Try this:

I added the {} to the OnStart part manually so that is why it look wrong, the actual script file is correct and the level works fine but the wheel wont become stuck or static.

EDIT: Well this is strange because now the script is working!

I have had this sort of thing happen before, for example a few times now I have put a custom sound in my CS folder and the game wont find it, but the next day after a PC restart it now does find it. Something to do with cache perhaps? I dont know, but my script now works so thank you anyway Smile
You can try replacing the name of the wheel with asEntity inside your ValveEventHandler function. That will make sure it always gets the right name of the entity.

PHP Code:
SetPropStaticPhysics(asEntitytrue); 

Which entity as you using btw?
(06-25-2016, 08:02 AM)Mudbill Wrote: [ -> ]You can try replacing the name of the wheel with asEntity inside your ValveEventHandler function. That will make sure it always gets the right name of the entity.

PHP Code:
SetPropStaticPhysics(asEntitytrue); 

Which entity as you using btw?

Cheers for that tip, I am using 'valve_iron'.