Frictional Games Forum (read-only)
[SCRIPT] Automatic open door script - 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 - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: [SCRIPT] Automatic open door script (/thread-28948.html)



Automatic open door script - MaksoPL - 01-03-2015

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);
}



RE: Automatic open door script - G510s - 01-03-2015

its possible that you didn't match the names of something. did you match up "DoorScripted1" with whats in you hpl?


RE: Automatic open door script - Romulator - 01-03-2015

Change this
PHP Code:
AddTimer("DoorScripted1"0"TimerMoveDoor"); 
to this
PHP Code:
AddTimer("DoorScripted1"0.05"TimerMoveDoor"); 

This line here:
PHP Code:
AddPropForce(asTimer, -7000"world"); 
This is correct, but make sure of a few things:

1. asTimer here would mean that your door would be named TimerMoveDoor in the Level Editor. If not, then make sure it is! Tongue
2. The numbers may need to be tweaked, depending on which way your door faces. Try these alterations as well:
PHP Code:
AddPropForce(asTimer7000"world");
AddPropForce(asTimer00, -70"world");
AddPropForce(asTimer0070"world"); 



RE: Automatic open door script - MaksoPL - 01-03-2015

(01-03-2015, 01:54 PM)Romulator Wrote: Change this
PHP Code:
AddTimer("DoorScripted1"0"TimerMoveDoor"); 
to this
PHP Code:
AddTimer("DoorScripted1"0.05"TimerMoveDoor"); 

This line here:
PHP Code:
AddPropForce(asTimer, -7000"world"); 
This is correct, but make sure of a few things:

1. asTimer here would mean that your door would be named TimerMoveDoor in the Level Editor. If not, then make sure it is! Tongue
2. The numbers may need to be tweaked, depending on which way your door faces. Try these alterations as well:
PHP Code:
AddPropForce(asTimer7000"world");
AddPropForce(asTimer00, -70"world");
AddPropForce(asTimer0070"world"); 

It din't work.


RE: Automatic open door script - DnALANGE - 01-03-2015

Quote:AddPropForce(asTimer, 70, 0, 0, "world");
AddPropForce(asTimer, 0, 0, -70, "world");
AddPropForce(asTimer, 0, 0, 70, "world");
Try more!!!
I had HAVE this as well everytime..
Some doors just wont get to move from it's hinges..
You could add MORE force, i have doors witch need for examplé;
PHP Code:
AddPropForce(asTimer005000"world"); 
---
Try using ridiculous numbers to see if it is actually working!
Then lower it's values..
FIRST you need to see if it is going open to the RIGHT direction.
Good luck, this specific question needs to be tested by the user itself, THIS time a little more then other questions.


RE: Automatic open door script - Daemian - 01-03-2015

Yep, 70 is almost nothing.

or use the Impulse one instead of Force


RE: Automatic open door script - PutraenusAlivius - 01-04-2015

Yeah, Force with the quantity of 70 is worthless. The all-mighty wiki said that to use quantities from 1000 to 10000.

EDIT:
Or you could just use Impulse, but 70 is way too much. An quantity of 1 - 10 is enough.