Frictional Games Forum (read-only)
[SCRIPT] Door - 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] Door (/thread-11280.html)

Pages: 1 2 3


Door - proshitness - 11-09-2011

How to do a door swing lock script?
the door is :castle_1
script area: Shut1
this is the script if you can help:


Code:
void OnStart(){    AddEntityCollideCallback("Player", "Shut1", "CloseDoors", true, 1);}
void OnEnter(){}
void OnLeave(){}
void CloseDoors(string &in asParent, bool abChild, bool abEffects){    setSwingDoorLocked("castle_1", true, true);}



RE: Door - flamez3 - 11-09-2011

void OnStart()
{
AddEntityCollideCallback("Player", "Shut1", "CloseDoors", true, 1);
}

void CloseDoors(string &in asParent, bool abChild, bool abEffects)
{
setSwingDoorLocked("castle_1", true, true);
}




That should work


RE: Door - Statyk - 11-09-2011


This should work. Includes the wind sound. If the sound does not play, you will have to make a Script Area near the door, title it something and change the name at: "PlaySoundAtEntity("", "general_wind_whirl.snt", "castle_1", 0, false);" to the name of the Script Area and it will work fine. Also, organizing your script with "Enter"s and "Tab"s can help a LOT.

Your issues(fixed):
- An entity collide does not have "bool abEffects", It is "int alState".
- SetSwingDoorLocked was spelled: "setSwingDoorLocked" again with the capitalizations buddy =]

Just copy and paste this all.

Code:
void OnStart()
{
AddEntityCollideCallback("Player", "Shut1", "CloseDoors", true, 1);
}
void OnEnter()
{
}
void OnLeave()
{
}

void CloseDoors(string &in asParent, bool abChild, int alState)
{
SetSwingDoorLocked("castle_1", true, true);
PlaySoundAtEntity("", "general_wind_whirl.snt", "castle_1", 0, false);
}






RE: Door - proshitness - 11-11-2011

the door didn't work =\



RE: Door - flamez3 - 11-11-2011

(11-11-2011, 01:24 PM)proshitness Wrote: the door didn't work =\
Didn't work? Are you talking about locking a closed door, or by slamming an open door shut and than lock the door?


RE: Door - proshitness - 11-11-2011

slamming an open door shut and than lock the door


RE: Door - flamez3 - 11-11-2011

(11-11-2011, 02:45 PM)proshitness Wrote: slamming an open door shut and than lock the door
well than you need to add propforce:

AddPropForce(string& asName, float afX, float afY, float afZ, string& asCoordSystem);
SetSwingDoorLocked(string& asName, bool abLocked, bool abEffects);




RE: Door - proshitness - 11-11-2011

Where to put it?


RE: Door - Unearthlybrutal - 11-11-2011

Use this instead of PropForce:

SetSwingDoorClosed("castle_1", true, true);

It's much easierSmile

Here is the full thing:


void OnStart()
{
AddEntityCollideCallback("Player", "Shut1", "CloseDoors", true, 1);
}

void CloseDoors(string &in asParent, bool abChild, bool abEffects)
{
SetSwingDoorClosed("castle_1", true, true);
SetSwingDoorLocked("castle_1", true, true);
}



RE: Door - proshitness - 11-11-2011

didn't work