Frictional Games Forum (read-only)

Full Version: Open Door Script problem
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hey guys Smile
I have a problem I made a timer for making a door open slowly and copied the script from one of the original scripts and it worked however i made a second timer exactly like the first one with anothe rname and it doesn't work..
can anybody help me?

Code:
working timer:
        SetSwingDoorClosed("mansion_2", false, false);
    SetSwingDoorDisableAutoClose("mansion_2", true);
    AddTimer("mansion_2", 0.01f, "TimerSwingDoor");

void TimerSwingDoor(string &in asTimer)
{
    if(GetLocalVarInt("SwingDoor") == 10){
        SetLocalVarInt("SwingDoor", 0);
        return;
    }
    
    if(asTimer == "mansion_2") AddPropForce(asTimer, 70.0f, 0, 0, "World");
    else AddPropForce(asTimer, -95.0f, 0, 0, "World");
    
    AddLocalVarInt("SwingDoor", 1);
    
    AddTimer(asTimer, 0.03f, "TimerSwingDoor");
}
Not working timer:
        SetSwingDoorLocked("mansion_4", false, false);
    SetSwingDoorClosed("mansion_4", false, false);
    SetSwingDoorDisableAutoClose("mansion_4", true);
    GiveSanityDamage(30, true);
    AddTimer("mansion_4", 0.01f, "TimerSwingDoor2");

void TimerSwingDoor2(string &in asTimer)
{
    if(GetLocalVarInt("SwingDoor1") == 10){
        SetLocalVarInt("SwingDoor1", 0);
        return;
    }
    
    if(asTimer == "mansion_4") AddPropForce(asTimer, 70.0f, 0, 0, "World");
    else AddPropForce(asTimer, -95.0f, 0, 0, "World");
    
    AddLocalVarInt("SwingDoor1", 1);
    
    AddTimer(asTimer, 0.03f, "TimerSwingDoor2");
}
Is your second door along the same axis as the first one? Make sure you apply the forces on the correct vector.
(02-06-2011, 12:15 PM)Tottel Wrote: [ -> ]Is your second door along the same axis as the first one? Make sure you apply the forces on the correct vector.

yeah thanks i just had to change the force direction to the opposite because teh door was rotated 180°