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 Make a Swing Door which has already been auto-closed swing open?
Cruzore Offline
Senior Member

Posts: 301
Threads: 2
Joined: Jun 2012
Reputation: 37
#5
RE: Make a Swing Door which has already been auto-closed swing open?

Thanks to Damascus' Solution, I got it to work. If you want an example script:

PHP Code: (Select All)
void OnStart()
{
 
SetEntityCallbackFunc("ItemnameHere""OnPickup");
}
void OnPickup(string &in asEntitystring &in astype)
{
if(
asEntity == "CrowbarNameHere")
{
SetEntityPlayerLookAtCallback("ScriptAreaNameHere""CloseDoorFunc"true);
}
}
void CloseDoorFunc(string &in asEntityint alState
{
if(
GetSwingDoorState("DoorNameHere")==-1)
{
SetSwingDoorDisableAutoClose("DoorNameHere"true); 
SetSwingDoorClosed("DoorNameHere"falsefalse); 
AddPropForce("DoorNameHere", -80000"world");
}


Now for how I did it:
At first, we got a entity callback for picking up the item(function name must be Onpickup).
Inside the function, we set up a look at callback for a script area, which is around the door(the whole wall, not just the door). When you look at that area, the CloseDoorFunc will be run, where, if the door is closed(state = -1), it will disable the autoclose, it will open the door and use AddpropForce to slightly open it.
06-28-2012, 07:33 PM
Find


Messages In This Thread
RE: Make a Swing Door which has already been auto-closed swing open? - by Cruzore - 06-28-2012, 07:33 PM



Users browsing this thread: 2 Guest(s)