Frictional Games Forum (read-only)

Full Version: Show message when you try to open a locked door?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi, I'm working on my map again and I'm trying to make a message show on the screen when the player tries to open a door and it is locked.

Here's my whole script...
Spoiler below!

void OnStart()
{
GiveSanityDamage(25.0f, true);
AddEntityCollideCallback("Player", "False", "FalseChase", true, 0);
SetPlayerLampOil(0.0f);
}

void FalseChase(string &in asParent, string &in asChild, int alState)
{
SetPlayerActive(false);
GiveSanityDamage(25.0f, true);
StartEffectFlash(1.0f, 1.0f, 1.0f);
AddTimer("FalseChaseTimer", 1.0f, "FalseChaseTimed");
}

void FalseChaseTimed(string &in asTimer)
{
SetPlayerActive(true);
SetEntityActive("servant_grunt_1", true);
StartPlayerLookAt("servant_grunt_1", 7, 50, "");
SetEnemyIsHallucination("servant_grunt_1", true);
ShowEnemyPlayerPosition("servant_grunt_1");
AddTimer("FalseChaseEnd", 0.5f, "StopLookAtEnemy");
}

void StopLookAtEnemy(string &in asTimer)
{
StopPlayerLookAt();
}

void InteractClosedDoor(string &in asEntity)
{
AddTimer("Door", 0.5f, "DoorLockedMessage");
}

void DoorLockedMessage(string &in asTimer)
{
SetMessage("LockedDoor-Brute", "BruteDoorLocked", 7.0f);
}



Here is my whole extra_english.lang file...

Spoiler below!

<LANGUAGE>
<RESOURCES>
</RESOURCES>
<CATEGORY Name="CustomStoryMain">
<Entry Name="Description">Good luck.</Entry>
</CATEGORY>
<CATEGORY Name="Inventory">
<Entry Name="ItemName_DungeonKeyOne">DungeonKey</Entry>
<Entry Name="ItemDesc_DungeonKeyOne">A key that leads to the dungeon below.</Entry>
</CATEGORY>
<CATEGORY Name="Journal">
<Entry Name="Note_AlphaOne_Name">Operation Alpha I</Entry>
<Entry Name="Note_AlphaOne_Text">It seems that no one has found the purpose of the glowing rocks. They will lead us to our
doom.[br][br]The only way to get the Light is to pursue the Darkness.</Entry>
</CATEGORY>
<CATEGORY Name ="Message">
<Entry Name="BruteDoorLocked">Firmly locked, looks like no human could open it.</Entry>
</CATEGORY>
</LANGUAGE>


Is this correct? Because I try to open the door in the game and nothing shows up on screen.

In the Level Editor, when I click on the door to show the message when it's locked, here are the fields in the Entity tab...

(checked)CastShadows
(unchecked)StaticPhysics
(unchecked)IsAffectedByDecal

CallbackFunc (blank)
ConnectedProps (blank)
ConnectionStateChangeCallback (blank)

(checked)FullGameSave

PlayerLookAtCallback (blank)

(unchecked)PlayerLookAtCallbackAutoRemo...

PlayerInteractCallback "InteractClosedDoor"

(unchecked)PlayerInteractCallbackAutoRemo...
(checked)Locked
OpenAmount - 0
(unchecked)DisableBreakable

Thanks!
I think, try changing

SetMessage("LockedDoor-Brute", "BruteDoorLocked", 7.0f);

to

SetMessage("Message", "BruteDoorLocked", 7.0f);

Seeing as "Message" is the category BruteDoorLocked is in, not LockedDoor-Brute
(08-27-2011, 09:06 AM)Kurton Wrote: [ -> ]I think, try changing

SetMessage("LockedDoor-Brute", "BruteDoorLocked", 7.0f);

to

SetMessage("Message", "BruteDoorLocked", 7.0f);

Seeing as "Message" is the category BruteDoorLocked is in, not LockedDoor-Brute

Ohhh. Okay. Thanks! Gah, sometimes I just don't know what's wrong.
That happens to all scripters, even to experienced ones Smile
Also, why are you putting the message on a timer exactly? Wouldn't it be easier to put it right in the Interact command? Huh
Correction:
The category is "Messages."

A small "S" can make it still not show up Smile

If your still having trouble, do that.

Also, Why do you have a timer? Just use an interact command.