(02-14-2013, 01:01 AM)serbusfish Wrote: I tried this script but it wont work, what am I doing wrong?
You put the code i gave you in a collide function, but it's supposed to be a timer. That's why it doesn't work
void OnStart()
{
AddEntityCollideCallback("Player", "ScriptArea_slam", "DoorSlam", true, 1);
}
void DoorSlam(string &in asParent, string &in asChild, int alState)
{
AddTimer("PushDoor", 0.2f, "DoorSlamTimer");
}
void DoorSlamTimer(string &in asTimer)
{
if(GetLocalVarInt("PushDoorVar") == 10)
{
return;
}
AddLocalVarInt("PushDoorVar", 1);
AddPropImpulse("castle_arched01_11", 1.0f, 0.0f, 0.0f, "World");
AddTimer("PushDoor", 0.2f, "DoorSlamTimer");
}
Since you want the door to slam, it should need this: SetSwingDoorClosed("castle_arched01_11", true, false);
because if it's going to slam it should already be open.
Trying is the first step to success.