Facebook Twitter YouTube Frictional Games | Forum | Newsletter | Dev Blog | Dev Wiki | Support | Gametee


Post Reply 
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help Working secret door?
Author Message
goodcap Offline
Member

Posts: 182
Joined: Jun 2012
Reputation: 3
Post: #1
Working secret door?

I'm re-creating the secret office door from A Machine For Pigs. This is my setup:

Lever
Name: lever_small01_1
ConnectionStateChangeCallback: SecretDoor1

Secret Painting Door
Name: OfficeSecretDoor
ConnectionStateChangeCallback: SecretDoor1
Locked: YES

SCRIPT
oid SecretDoor1(string &in asEntity, int alState)
{
AddTimer("", 0, "TimerPushSecret");
SetLocalVarInt("SecretDoorOpen", 1);
SetEntityInteractionDisabled("secretdoorswitchsecretdoorswitch", false);
}

void TimerPushSecret(string &in asTimer)
{
SetSwingDoorLocked("secretdoorswitchsecretdoorswitch", false, false);
SetSwingDoorClosed("secretdoorswitchsecretdoorswitch", false, false);
SetSwingDoorDisableAutoClose("secretdoorswitchsecretdoorswitch", true);
AddBodyForce("secretdoorswitchsecretdoorswitch", 0.0f, 0.0f, -8000.0f, "world");
}


Everything seems to work except for the door automatically opening that should be happening thanks to the AddBodyForce line
03-20-2017 06:04 PM
Find all posts by this user Quote this message in a reply
Mudbill Offline
Posting Freak

Posts: 3,396
Joined: Apr 2013
Reputation: 160
Post: #2
RE: Working secret door?

Since you have to push it angularly, simply applying force on an axis may not work that well. I think you need to apply adequent force in both X and Z, using timers to lessen the X/Z one and increase the Z/X one (depending on the direction it's facing).

This video on doors may work the same way:



03-20-2017 11:11 PM
Find all posts by this user Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)