The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 906 - File: showthread.php PHP 7.2.24-0ubuntu0.18.04.17 (Linux)
File Line Function
/showthread.php 906 errorHandler->error



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
Getting a door to open using scripts
go.go Offline
Junior Member

Posts: 11
Threads: 2
Joined: Jun 2012
Reputation: 0
#1
Getting a door to open using scripts

I've had this problem for a while now and no matter what I do I can't seem to solve it. I've looked at this: http://www.youtube.com/watch?v=VSZ_uWz-P...8&index=16 and it still won't work.

Basically, what I want to do is get a door to open when a player enters a script area. The way I understand it there are two ways to do this, either by using SetSwingDoorClosed to False and True, or by using the AddPropForce. The problem is that I am probably doing something wrong because neither of these are working for me.

The doors name is "1_mansion", the script area is "area_opendoor1", here is the code I have for opening it slowly like in the youtube video:

void OnStart()
{
    AddEntityCollideCallback("Player", "area_opendoor1", "opendoor1", true, 1);
}
void opendoor1(string &in item)
{
    SetSwingDoorDisableAutoClose("1_mansion", true);
    SetSwingDoorClosed("1_mansion", false, false);
        for (int i = 0; i < 10; i++)
    {
        AddTimer("1_mansion", i * 0.1, "OpenDoorSlightly");
    }

    }
void OpenDoorSlightly(string &in door_name)
{
    AddPropForce(door_name, 1000, 1000, 1000, "world");
}


Nothing at all happens when I use this code. No errors, but also no effects. Even when I tried putting "SetSwingDoorDisableAutoClose("1_mansion", true);" directly in OnStart, the door would still auto close itself when almost closed.

I've also tried using just SetSwingDoorClosed("1_mansion", false, false); with false, false and false, true. Still won't work. I really have no idea what the problem is. Would really appreciate some help here!
09-21-2012, 02:54 PM
Find


Messages In This Thread
Getting a door to open using scripts - by go.go - 09-21-2012, 02:54 PM



Users browsing this thread: 1 Guest(s)