Frictional Games Forum (read-only)
Opening Door Script not working - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods (https://www.frictionalgames.com/forum/forum-35.html)
+--- Thread: Opening Door Script not working (/thread-5036.html)



Opening Door Script not working - theDARKW0LF - 10-13-2010

So I'm trying to get a door to open in the face of a player as quick as scripts I've seen and used where the door slams closed. So far I've used codes like the setdoorswinglocked to false, the setdoorswingclosed to false, the setdoordisableautoclose to false, and also the addpropimpulse in the right direct to have the door open (in this case, positive Z). But for some reason, I can't get it to open? I can easily get the scripts where the door closes shut quickly to work, but for some reason I can't get this one to work!

Help?


RE: Opening Door Script not working - Chilton - 10-13-2010

Hmm... Try disabling effects with the door closing thing, other than that this is interesting


RE: Opening Door Script not working - Entih - 10-13-2010

Hmm. Did you say you disabled the disabling of the auto-close? Wouldn't that mean you enabled automatic door closing? That might be your issue if that wasn't a mis-type, same double negative got me confused in the early stage of my map.

Otherwise, make sure you are using more than one impulse, as a single impulse is often ineffective. Multiple using timers is effective. Refer to the script for the doors in the first map in Amnesia for reference.

Though you have me curious about what the difference is between a physics impulse and physics force.


RE: Opening Door Script not working - theDARKW0LF - 10-13-2010

Hmm, I'll check, that might be the issue if that wasn't a typo I made.


RE: Opening Door Script not working - Pandemoneus - 10-13-2010

Take a look at my little test map:

http://www.mediafire.com/?h4g1mk3rbt8rl0z

The force you need to push a door seems to vary from door to door though.


RE: Opening Door Script not working - theDARKW0LF - 10-15-2010

Sorry for the relatively late reply, got caught up in college studies. In regards to the previous posters, no I still couldn't get the door to open correctly...

Ok, Pandemoneus, once I have some good amount of free time, I'll check it out, thanks.


RE: Opening Door Script not working - Entih - 10-15-2010

If it doesn't open when it is unlocked, unclosed, and won't auto-close, then it must be something with the force applied to it. Have you tried 'AddPropForce' rather than 'AddPropImpulse'? As I said, I have no clue what the difference is, but it may or may not be important. Otherwise, the value of the force may be too weak, or there are too few forces being used over time.


RE: Opening Door Script not working - Frontcannon - 10-15-2010

(10-15-2010, 06:47 AM)Entih Wrote: If it doesn't open when it is unlocked, unclosed, and won't auto-close, then it must be something with the force applied to it. Have you tried 'AddPropForce' rather than 'AddPropImpulse'? As I said, I have no clue what the difference is, but it may or may not be important. Otherwise, the value of the force may be too weak, or there are too few forces being used over time.

I've asked me that question, too.. AddPropForce doesn't work in my floating tut, though.


RE: Opening Door Script not working - Entih - 10-15-2010

Yes, but force is, however, what I had used to open doors in my own map, to complete success, as seen in the following code snippet.

Code:
void MainhallDoorTouch(string &in entity)
{
    AddQuest("mainhall00", "mainhall00");
    
    SetSwingDoorLocked("Mainhall_Offdoor_1", false, false);
    SetSwingDoorClosed("Mainhall_Offdoor_1", false, false);
    SetSwingDoorDisableAutoClose("Mainhall_Offdoor_1", true);
    
    AddTimer("SidedoorTimer", RandFloat(5.0f, 10.0f), "MainhallSidedoorOpen");
    SetLocalVarInt("Sidedoor_Swinging", 0);
}

void MainhallSidedoorOpen(string &in asTimer)
{
    if(GetLocalVarInt("Sidedoor_Swinging") == 0)
    {
        PlaySoundAtEntity("DoorCreak", "joint_door_move_special.snt", "Mainhall_Offdoor_1", 1.0f / 2.5f, false);
        StartPlayerLookAt("Mainhall_Offdoor_1", 1.2f, 1.4f, "SidehallLookedat");
        AddTimer("LookStop_mhall", 2, "MainhallSidedoorOpen");
    }
    
    if(asTimer == "LookStop_mhall")
        StopPlayerLookAt();
        
    AddLocalVarInt("Sidedoor_Swinging", 1);
    AddPropForce("Mainhall_Offdoor_1", 0, 0, -75.0f, "World");
    
    if(GetLocalVarInt("Sidedoor_Swinging") < 15)
    {
        AddTimer("SidedoorTimer", 0.07f, "MainhallSidedoorOpen");
    }
    else
    {
        SetSwingDoorDisableAutoClose("Mainhall_Offdoor_1", false);
        StopSound("DoorCreak", 1.0f);
    }
}



RE: Opening Door Script not working - theDARKW0LF - 10-17-2010

Again, been too busy to respond, but I got it to work. Apparently 10 is too low of a force and I had to put it all the way up to 45 to get it to open all the way.