09-21-2012, 02:54 PM
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:
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!
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:
Code:
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!