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 lever wont stick in positon once turned
serbusfish Offline
Member

Posts: 211
Threads: 75
Joined: Aug 2012
Reputation: 0
#1
Wheel lever wont stick in positon once turned

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.

06-24-2016, 02:28 PM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#2
RE: Wheel lever wont stick in positon once turned

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: (Select All)
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.

(This post was last modified: 06-24-2016, 05:11 PM by Mudbill.)
06-24-2016, 05:08 PM
Find
serbusfish Offline
Member

Posts: 211
Threads: 75
Joined: Aug 2012
Reputation: 0
#3
RE: Wheel lever wont stick in positon once turned

(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

(This post was last modified: 06-25-2016, 08:17 AM by serbusfish.)
06-25-2016, 07:54 AM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#4
RE: Wheel lever wont stick in positon once turned

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: (Select All)
SetPropStaticPhysics(asEntitytrue); 

Which entity as you using btw?

(This post was last modified: 06-25-2016, 08:03 AM by Mudbill.)
06-25-2016, 08:02 AM
Find
serbusfish Offline
Member

Posts: 211
Threads: 75
Joined: Aug 2012
Reputation: 0
#5
RE: Wheel lever wont stick in positon once turned

(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: (Select All)
SetPropStaticPhysics(asEntitytrue); 

Which entity as you using btw?

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

06-25-2016, 09:11 PM
Find




Users browsing this thread: 1 Guest(s)