Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
SetSwingDoorClosed Script Not Shutting The Door *Fixed*
Atilla280 Offline
Junior Member

Posts: 24
Threads: 6
Joined: Jul 2012
Reputation: 1
#1
SetSwingDoorClosed Script Not Shutting The Door *Fixed*

Hello, I have followed THIS tutorial and The door will not shut. I have everything correct I collide with the area because the sounds and things go off but the door stays wide open. Here is my full script.


void OnStart()
{
SetEntityPlayerInteractCallback("lantern_1", "Lantern", true);
AddUseItemCallback("OpenDoor", "key1", "JacobsCloset", "UsedKeyOnDoor1", true);
AddUseItemCallback("OpenDoor", "key2", "EmilysCloset", "UsedKeyOnDoor2", true);
AddUseItemCallback("OpenDoor", "key3", "JacobsRoom ", "UsedKeyOnDoor3", true);
AddUseItemCallback("OpenDoor", "key4", "EmilysRoom", "UsedKeyOnDoor4", true);
AddUseItemCallback("OpenDoor", "key5", "Dungeon", "UsedKeyOnDoor5", true);
// ("OpenDoor", "NameOfItem", "NameOfObjectItemWillBeUsedOn", "Function", True)
}

void Lantern(string &in asEntity)

{
SetSwingDoorLocked("Explode1", false, false);
SetMessage("Messages", "FoundLantern", 0);
AddEntityCollideCallback("Player", "SlamDoor", "SlamDoor", true, 1);
}

void SlamDoor(string &in asParent, string &in asChild, int alState)
{
StartPlayerLookAt("Explode1", 0.5f, 0.5f, "");
SetSwingDoorClosed("Exlode1", true, true);
PlaySoundAtEntity("", "react_breath_slow", "Player", 0, false);
PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);
GiveSanityDamage(5.0f, true);
AddEntityCollideCallback("Player", "StopLooking", "StopLooking", true, 1);
}

void StopLooking(string &in asParent, string &in asChild, int alState)
{
StopPlayerLookAt();
SetEntityPlayerInteractCallback("key3", "KeyPickup", true);
}

void KeyPickup(string &in asEntity)
{
AddEntityCollideCallback("Player", "LightsOut1", "LightsOut1", true, 1);
}

void LightsOut1 (string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "scare_walk_stomp.snt", "Player", 0, false);
PlaySoundAtEntity("", "scare_walk_ghost.snt", "Player", 0, false);
PlaySoundAtEntity("", "scare_haunting.snt", "Player", 0, false);
GiveSanityDamage(5.0f, true);
SetEntityPlayerInteractCallback("Explode1", "Explode1", true);
}

void Explode1(string &in asEntity)
{
StopPlayerLookAt();
SetEntityActive("servant_grunt_1", true);
SetPropHealth("Explode1", 0.0f);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare", "Player", 0, false);
PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);
GiveSanityDamage(5.0f, true);
}

void UsedKeyOnDoor1(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("JacobsCloset", false, true);
//("NameOfDoor", Locked/OrNot, Effects)
PlaySoundAtEntity("", "unlock_door", "JacobsCloset", 0, false);
//("", "SoundFile", "Entity", Fade, KeepPlaying)
RemoveItem("key1");
}

void UsedKeyOnDoor2(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("EmilysCloset", false, true);
PlaySoundAtEntity("", "unlock_door", "EmilysCloset", 0, false);
RemoveItem("key2");
}

void UsedKeyOnDoor3(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("JacobsRoom", false, true);
PlaySoundAtEntity("", "unlock_door", "JacobsRoom", 0, false);
RemoveItem("key3");
}

void UsedKeyOnDoor4(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("EmilysRoom", false, true);
PlaySoundAtEntity("", "unlock_door", "EmilysRoom", 0, false);
RemoveItem("key4");
}

void UsedKeyOnDoor5(string &in asItem, string &in asEntity)
{
SetLevelDoorLocked("LevelDoor1", false);
PlaySoundAtEntity("", "unlock_door", "LevelDoor1", 0, false);
RemoveItem("key5");
}
// end

void OnEnter()
{

}
// end

void OnLeave()
{

}
// end
(This post was last modified: 07-09-2012, 03:49 PM by Atilla280.)
07-08-2012, 09:46 AM
Find
JMFStorm Offline
Member

Posts: 205
Threads: 8
Joined: Aug 2011
Reputation: 28
#2
RE: SetSwingDoorClosed Script Not Shutting The Door.

So you start looking at object named: "Explode1" but SetSwingDoorClosed goes to object named: "Exlode1". MY GOD YOU SHOULD EVEN CHECK THE NAMES BEFORE POSTING.

07-08-2012, 10:12 AM
Find
Atilla280 Offline
Junior Member

Posts: 24
Threads: 6
Joined: Jul 2012
Reputation: 1
#3
RE: SetSwingDoorClosed Script Not Shutting The Door.

The door is named Explode1. I have it so when I grab my lantern it unlocks the door, then I have to go get a key, on key pickup it activates SlamDoor and LightsOut, then when I walk out of the room where the key is it slams the door (or should but the door stays wide open), then walk a little further and the lights go out, you walk up to the door (I will have a message that will make the player do that), when the player clicks to open the slammed door, the door explodes and then a servant grunt hallucination comes running out.
07-08-2012, 03:57 PM
Find
Traggey Offline
is mildly amused

Posts: 3,257
Threads: 74
Joined: Feb 2012
Reputation: 185
#4
RE: SetSwingDoorClosed Script Not Shutting The Door.

Wrong forum, moved.
07-08-2012, 05:00 PM
Find
Atilla280 Offline
Junior Member

Posts: 24
Threads: 6
Joined: Jul 2012
Reputation: 1
#5
RE: SetSwingDoorClosed Script Not Shutting The Door.

Quote: So you start looking at object named: "Explode1" but SetSwingDoorClosed goes to object named: "Exlode1". MY GOD YOU SHOULD EVEN CHECK THE NAMES BEFORE POSTING
I see this I fixed it but it still doesn't work.
07-08-2012, 05:58 PM
Find




Users browsing this thread: 2 Guest(s)