01-03-2015, 12:55 PM
I make a script, when door must open automaticly. It din't work. Working only sound.
.hps file:
void OnStart()
{
AddEntityCollideCallback("Player", "quest1", "Memento1", true, 1);
AddEntityCollideCallback("Player", "DoorScriptArea1", "EventDoor", true, 1);
}
void Memento1(string &in asParent, string &in asChild, int alState)
{
AddQuest("area", "quest1");
}
void EventDoor(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("DoorScripted1", false, false);
SetSwingDoorDisableAutoClose("DoorScripted1", true);
PlaySoundAtEntity("creak", "joint_door_move_special.snt", "DoorScripted1", 1, false);
AddTimer("", 2, "TimerStopSound");
AddTimer("DoorScripted1", 0, "TimerMoveDoor");
}
void TimerMoveDoor(string &in asTimer)
{
if(GetLocalVarInt("VarDoor") == 10) return;
AddLocalVarInt("VarDoor", 1);
AddTimer(asTimer, 0.03, "TimerMoveDoor");
AddPropForce(asTimer, -70, 0, 0, "world");
}
void TimerStopSound(string &in asTimer)
{
StopSound("creak", 0.4);
}
.hps file:
void OnStart()
{
AddEntityCollideCallback("Player", "quest1", "Memento1", true, 1);
AddEntityCollideCallback("Player", "DoorScriptArea1", "EventDoor", true, 1);
}
void Memento1(string &in asParent, string &in asChild, int alState)
{
AddQuest("area", "quest1");
}
void EventDoor(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("DoorScripted1", false, false);
SetSwingDoorDisableAutoClose("DoorScripted1", true);
PlaySoundAtEntity("creak", "joint_door_move_special.snt", "DoorScripted1", 1, false);
AddTimer("", 2, "TimerStopSound");
AddTimer("DoorScripted1", 0, "TimerMoveDoor");
}
void TimerMoveDoor(string &in asTimer)
{
if(GetLocalVarInt("VarDoor") == 10) return;
AddLocalVarInt("VarDoor", 1);
AddTimer(asTimer, 0.03, "TimerMoveDoor");
AddPropForce(asTimer, -70, 0, 0, "world");
}
void TimerStopSound(string &in asTimer)
{
StopSound("creak", 0.4);
}