Grimm101
Junior Member
Posts: 12
Threads: 3
Joined: Dec 2011
Reputation:
0
|
It wont budge
Hey guys, I've got another question for you if you don't mind answering. I got what i wanted from the door but once it has slammed shut I want it to lock. I have done this but now when the player tries to open the door again I want it to say "It wont budge. I have managed to get it to say that but currently it says it when it is unlocked and when it is locked from the start. I need it to display the message AFTER it has been locked again when the area effects take place. My code is below :-) Thanks in advance.
//////////////////////////////// // Run when starting the map void OnStart() //////////////////////////////// // Entities { SetPlayerLampOil(25.0f); //Sets player lamp oil to 25% full from start AddUseItemCallback("", "Bedroom_Key", "Bedroom_Key_Door", "UsedKeyOnDoor", true); //Assigns the key to the door and sets the action of this as UsedKeyOnDoor AddEntityCollideCallback("Player", "DoorCloseArea1", "DoorCloseBang", true, 1); //Declaring when a player walks into an area called "DoorCloseArea1" Deletes the possibility of it happening again so it can only happen once: Number = 1 for player enters. -1 for when player leaves. 0 for both }
void UsedKeyOnDoor(string &in asItem, string &in asEntity) //Declaring the Key as a string { SetSwingDoorLocked("Bedroom_Key_Door", false, true); //Sets what door the key works on and it can only be used once PlaySoundAtEntity("", "unlock_door", "Bedroom_Key_Door", 0, false); //Plays sound when the key is used on the door RemoveItem("Bedroom_Key"); //Removes the key after it has been used }
void DoorCloseBang(string &in asParent, string &in asChild, int alState) //Sets up the variable for the door close bang entity { SetSwingDoorClosed("Bedroom_Key_Door", true, true); //Closes a swing door: Effects indicate true to see the door close SetSwingDoorLocked("Bedroom_Key_Door", true, true); //Locks the door once the player has entered the area after the slam PlaySoundAtEntity("", "03_amb_library", "Bedroom_Key_Door", 0, false); //Starts the sounds of someone being in a library making some book noises and movement PlaySoundAtEntity("", "24_bang", "Bedroom_Key_Door", 0, false); //Create banging on the door sound when the door shuts PlaySoundAtEntity("", "react_scare", "Bedroom_Key_Door", 0, false); //Player breathes heavily after this has taken place PlaySoundAtEntity("", "24_burn", "Bedroom_Key_Door", 0, false); //Creates a scream at the time of the door slamming and banging SetPlayerSanity(0.0f); //Makes player sanity 3 dots to add to a blur effect FadePlayerFOVMulTo(0.85f, 5.0f); //Zooms in the screen adding to the wobble effect FadePlayerAspectMulTo(0.85f, 1.0f); //Stretches the screen giving wobble effect FadeImageTrailTo(1.0f, 1.0f); //Adds blur making the wobble effect better StartPlayerLookAt("Bedroom_Key_Door", 10.0f, 10.0f, ""); //Makes the player look at the bedroom door AddTimer("", 2.0f, "StopLooking"); //timer to stop looking at the door after 2 seconds }
void StopLooking(string &in asTimer) //Sets a variable to stop the player looking { StopPlayerLookAt(); //Stop looking at the door FadePlayerFOVMulTo(1.0f, 5.0f); //Sets the players FOV Multiplier back to normal = 1 FadePlayerAspectMulTo(1.0f, 5.0f); //Sets the Aspect Multiplier back to normal = 1 FadeImageTrailTo(0.0f, 1.0f); //Removes blur SetPlayerSanity(100.0f); //Sets player sanity back to normal } void Locked0(string &in asEntity) { SetMessage("DoorMessages", "Locked_Door_Message", 0); }
//////////////////////////////// // Run when entering the map void OnEnter() { }
//////////////////////////////// // Run when leaving the map void OnLeave() {
}
(This post was last modified: 12-23-2011, 08:59 PM by Grimm101.)
|
|
12-23-2011, 08:58 PM |
|
Statyk
Schrödinger's Mod
Posts: 4,390
Threads: 72
Joined: Sep 2011
Reputation:
241
|
RE: It wont budge
Instead of setting the door to have an interact function, make a script area around the door and put "Locked0" in it's interact callback box instead (MAKE SURE AUTO REMOVE IS CHECKED! or not if you want the message to keep appearing... Set the script area inactive and name the area: "slamdoortouch". Then go into your script and copy and paste this in place:
//___________________________________________
//////////////////////////////// // Run when starting the map void OnStart() //////////////////////////////// // Entities { SetPlayerLampOil(25.0f); //Sets player lamp oil to 25% full from start AddUseItemCallback("", "Bedroom_Key", "Bedroom_Key_Door", "UsedKeyOnDoor", true); //Assigns the key to the door and sets the action of this as UsedKeyOnDoor AddEntityCollideCallback("Player", "DoorCloseArea1", "DoorCloseBang", true, 1); //Declaring when a player walks into an area called "DoorCloseArea1" Deletes the possibility of it happening again so it can only happen once: Number = 1 for player enters. -1 for when player leaves. 0 for both }
void UsedKeyOnDoor(string &in asItem, string &in asEntity) //Declaring the Key as a string { SetSwingDoorLocked("Bedroom_Key_Door", false, true); //Sets what door the key works on and it can only be used once PlaySoundAtEntity("", "unlock_door", "Bedroom_Key_Door", 0, false); //Plays sound when the key is used on the door RemoveItem("Bedroom_Key"); //Removes the key after it has been used }
void DoorCloseBang(string &in asParent, string &in asChild, int alState) //Sets up the variable for the door close bang entity { SetSwingDoorClosed("Bedroom_Key_Door", true, true); //Closes a swing door: Effects indicate true to see the door close SetSwingDoorLocked("Bedroom_Key_Door", true, true); //Locks the door once the player has entered the area after the slam PlaySoundAtEntity("", "03_amb_library", "Bedroom_Key_Door", 0, false); //Starts the sounds of someone being in a library making some book noises and movement PlaySoundAtEntity("", "24_bang", "Bedroom_Key_Door", 0, false); //Create banging on the door sound when the door shuts PlaySoundAtEntity("", "react_scare", "Bedroom_Key_Door", 0, false); //Player breathes heavily after this has taken place PlaySoundAtEntity("", "24_burn", "Bedroom_Key_Door", 0, false); //Creates a scream at the time of the door slamming and banging SetPlayerSanity(0.0f); //Makes player sanity 3 dots to add to a blur effect FadePlayerFOVMulTo(0.85f, 5.0f); //Zooms in the screen adding to the wobble effect FadePlayerAspectMulTo(0.85f, 1.0f); //Stretches the screen giving wobble effect FadeImageTrailTo(1.0f, 1.0f); //Adds blur making the wobble effect better StartPlayerLookAt("Bedroom_Key_Door", 10.0f, 10.0f, ""); //Makes the player look at the bedroom door AddTimer("", 2.0f, "StopLooking"); //timer to stop looking at the door after 2 seconds SetEntityActive("slamdoortouch", true); SetEntityInteractionDisabled("Bedroom_Key_Door", true); }
void StopLooking(string &in asTimer) //Sets a variable to stop the player looking { StopPlayerLookAt(); //Stop looking at the door FadePlayerFOVMulTo(1.0f, 5.0f); //Sets the players FOV Multiplier back to normal = 1 FadePlayerAspectMulTo(1.0f, 5.0f); //Sets the Aspect Multiplier back to normal = 1 FadeImageTrailTo(0.0f, 1.0f); //Removes blur SetPlayerSanity(100.0f); //Sets player sanity back to normal } void Locked0(string &in asEntity) { SetMessage("DoorMessages", "Locked_Door_Message", 0); }
//////////////////////////////// // Run when entering the map void OnEnter() { }
//////////////////////////////// // Run when leaving the map void OnLeave() {
}
I added:
void DoorCloseBang(string &in asParent, string &in asChild, int alState) //Sets up the variable for the door close bang entity
{
SetSwingDoorClosed("Bedroom_Key_Door", true, true); //Closes a swing door: Effects indicate true to see the door close
SetSwingDoorLocked("Bedroom_Key_Door", true, true); //Locks the door once the player has entered the area after the slam
PlaySoundAtEntity("", "03_amb_library", "Bedroom_Key_Door", 0, false); //Starts the sounds of someone being in a library making some book noises and movement
PlaySoundAtEntity("", "24_bang", "Bedroom_Key_Door", 0, false); //Create banging on the door sound when the door shuts
PlaySoundAtEntity("", "react_scare", "Bedroom_Key_Door", 0, false); //Player breathes heavily after this has taken place
PlaySoundAtEntity("", "24_burn", "Bedroom_Key_Door", 0, false); //Creates a scream at the time of the door slamming and banging
SetPlayerSanity(0.0f); //Makes player sanity 3 dots to add to a blur effect
FadePlayerFOVMulTo(0.85f, 5.0f); //Zooms in the screen adding to the wobble effect
FadePlayerAspectMulTo(0.85f, 1.0f); //Stretches the screen giving wobble effect
FadeImageTrailTo(1.0f, 1.0f); //Adds blur making the wobble effect better
StartPlayerLookAt("Bedroom_Key_Door", 10.0f, 10.0f, ""); //Makes the player look at the bedroom door
AddTimer("", 2.0f, "StopLooking"); //timer to stop looking at the door after 2 seconds
SetEntityActive("slamdoortouch", true);
SetEntityInteractionDisabled("Bedroom_Key_Door", true);
}
(This post was last modified: 12-23-2011, 09:12 PM by Statyk.)
|
|
12-23-2011, 09:11 PM |
|
Grimm101
Junior Member
Posts: 12
Threads: 3
Joined: Dec 2011
Reputation:
0
|
RE: It wont budge
Yeah OK that's probably a better idea anyway, thanks mate :-)
|
|
12-23-2011, 09:28 PM |
|
|