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


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Door messages and noises and memos in scripting?
MissMarilynn Offline
Member

Posts: 77
Threads: 23
Joined: Oct 2011
Reputation: 1
#1
Door messages and noises and memos in scripting?

Many questions, haha.

1. How do I get a message that says "This door is locked, you need a key to open it" when I interact with a locked door?

2. How do I get the noise when I use a key and unlock the door? Also: How do I get the "solved a puzzle" purple light and noise of accomplishment.

3. How can I create a memo to appear after interacting with a locked door? For instance, if I walk up to a door and it's locked I want the memo writing noise to sound and the little diary to light up and a little hint will be written in the journal.

If you can only answer one please do! I need all the help I can get.

Another random question: How can I get a rain sound to continually loop in the background?

Thanks!
10-17-2011, 10:18 PM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#2
RE: Door messages and noises and memos in scripting?

http://wiki.frictionalgames.com/hpl2/amn..._functions

(10-17-2011, 10:18 PM)MissMarilynn Wrote: 1. How do I get a message that says "This door is locked, you need a key to open it" when I interact with a locked door?

For level doors, you can specify the category and entry name in the entity tab when the level door is selected in the level editor.

For swing doors, you're going to need to add an interact callback to the door with SetEntityPlayerInteractCallback() and use conditional statements with GetSwingDoorLocked() to tell whether or not SetMessage() should be used.

(10-17-2011, 10:18 PM)MissMarilynn Wrote: 2. How do I get the noise when I use a key and unlock the door? Also: How do I get the "solved a puzzle" purple light and noise of accomplishment.

PlaySoundAtEntity()

GiveSanityBoostSmall() or GiveSanityBoost()

(10-17-2011, 10:18 PM)MissMarilynn Wrote: 3. How can I create a memo to appear after interacting with a locked door? For instance, if I walk up to a door and it's locked I want the memo writing noise to sound and the little diary to light up and a little hint will be written in the journal.

AddQuest()

(10-17-2011, 10:18 PM)MissMarilynn Wrote: Another random question: How can I get a rain sound to continually loop in the background?

There are multiple ways, but since you didn't really specify your intentions, i'm going to assume something like hearing the sound of rain when the player is near a window. In which case, placing a sound object that points to the rain sound in the level editor at the window should do the trick.

Tutorials: From Noob to Pro
10-17-2011, 10:55 PM
Website Find
MissMarilynn Offline
Member

Posts: 77
Threads: 23
Joined: Oct 2011
Reputation: 1
#3
RE: Door messages and noises and memos in scripting?

(10-17-2011, 10:55 PM)Your Computer Wrote: http://wiki.frictionalgames.com/hpl2/amn..._functions

(10-17-2011, 10:18 PM)MissMarilynn Wrote: 1. How do I get a message that says "This door is locked, you need a key to open it" when I interact with a locked door?

For level doors, you can specify the category and entry name in the entity tab when the level door is selected in the level editor.

For swing doors, you're going to need to add an interact callback to the door with SetEntityPlayerInteractCallback() and use conditional statements with GetSwingDoorLocked() to tell whether or not SetMessage() should be used.

(10-17-2011, 10:18 PM)MissMarilynn Wrote: 2. How do I get the noise when I use a key and unlock the door? Also: How do I get the "solved a puzzle" purple light and noise of accomplishment.

PlaySoundAtEntity()

GiveSanityBoostSmall() or GiveSanityBoost()

(10-17-2011, 10:18 PM)MissMarilynn Wrote: 3. How can I create a memo to appear after interacting with a locked door? For instance, if I walk up to a door and it's locked I want the memo writing noise to sound and the little diary to light up and a little hint will be written in the journal.

AddQuest()

(10-17-2011, 10:18 PM)MissMarilynn Wrote: Another random question: How can I get a rain sound to continually loop in the background?

There are multiple ways, but since you didn't really specify your intentions, i'm going to assume something like hearing the sound of rain when the player is near a window. In which case, placing a sound object that points to the rain sound in the level editor at the window should do the trick.
Could you be a bit more detailed and give a scripted example of 1 and 2 and 3?
10-17-2011, 11:04 PM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#4
RE: Door messages and noises and memos in scripting?

(10-17-2011, 11:04 PM)MissMarilynn Wrote: Could you be a bit more detailed and give a scripted example of 1 and 2 and 3?

Example for 1 and 3:

PHP Code: (Select All)
void OnStart()
{
     
SetEntityPlayerInteractCallback("door_name""IsItLocked"false);
}

void IsItLocked(string &in entity)
{
     if (
GetSwingDoorLocked(entity)
     && 
entity == "door_name")
     {
          
SetMessage("cat_name""entry_name"0);
          
// Category name: "Journal"; Entry name: "Quest_open_door_Text"
          
AddQuest("open_door_quest""open_door");
     }


Example for 2:

PHP Code: (Select All)
PlaySoundAtEntity("play_sound_at_door""unlock_door.snt" /* or filename.snt */"door_name"0false);

GiveSanityBoostSmall(); // or GiveSanityBoost(); 

Tutorials: From Noob to Pro
(This post was last modified: 10-17-2011, 11:25 PM by Your Computer.)
10-17-2011, 11:23 PM
Website Find
MissMarilynn Offline
Member

Posts: 77
Threads: 23
Joined: Oct 2011
Reputation: 1
#5
RE: Door messages and noises and memos in scripting?

(10-17-2011, 11:23 PM)Your Computer Wrote:
(10-17-2011, 11:04 PM)MissMarilynn Wrote: Could you be a bit more detailed and give a scripted example of 1 and 2 and 3?

Example for 1 and 3:

PHP Code: (Select All)
void OnStart()
{
     
SetEntityPlayerInteractCallback("door_name""IsItLocked"false);
}

void IsItLocked(string &in entity)
{
     if (
GetSwingDoorLocked(entity)
     && 
entity == "door_name")
     {
          
SetMessage("cat_name""entry_name"0);
          
// Category name: "Journal"; Entry name: "Quest_open_door_Text"
          
AddQuest("open_door_quest""open_door");
     }


Example for 2:

PHP Code: (Select All)
PlaySoundAtEntity("play_sound_at_door""unlock_door.snt" /* or filename.snt */"door_name"0false);

GiveSanityBoostSmall(); // or GiveSanityBoost(); 
How would I set up the .lang stuff for 1 and 3? Particularly the quests.

and how do I get a message to show up for a locked door that I don't want to be unlocked. For instance, I have a door that is blocked from the other side. How do I get text to appear that says "It's blocked on the other side. You need to go a different way."
(10-17-2011, 11:23 PM)Your Computer Wrote:
(10-17-2011, 11:04 PM)MissMarilynn Wrote: Could you be a bit more detailed and give a scripted example of 1 and 2 and 3?

Example for 1 and 3:

PHP Code: (Select All)
void OnStart()
{
     
SetEntityPlayerInteractCallback("door_name""IsItLocked"false);
}

void IsItLocked(string &in entity)
{
     if (
GetSwingDoorLocked(entity)
     && 
entity == "door_name")
     {
          
SetMessage("cat_name""entry_name"0);
          
// Category name: "Journal"; Entry name: "Quest_open_door_Text"
          
AddQuest("open_door_quest""open_door");
     }


Example for 2:

PHP Code: (Select All)
PlaySoundAtEntity("play_sound_at_door""unlock_door.snt" /* or filename.snt */"door_name"0false);

GiveSanityBoostSmall(); // or GiveSanityBoost(); 
Your scripting gave me a whole lotta trouble. It says: "officekey' is not declared" when I put it in the entity section.

SetEntityPlayerInteractCallback("officedoor", "IsItLocked", false);



void IsItLocked(string &in entity)
{
if (GetSwingDoorLocked(officekey)
&& entity == "officedoor")
{
SetMessage("Journal", "Quest_open_door_Text", 0);
}
}


(This post was last modified: 10-17-2011, 11:59 PM by MissMarilynn.)
10-17-2011, 11:39 PM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#6
RE: Door messages and noises and memos in scripting?

(10-17-2011, 11:39 PM)MissMarilynn Wrote: How would I set up the .lang stuff for 1 and 3? Particularly the quests.

and how do I get a message to show up for a locked door that I don't want to be unlocked. For instance, I have a door that is blocked from the other side. How do I get text to appear that says "It's blocked on the other side. You need to go a different way."

Example .lang:

<CATEGORY Name="Doors">
     <Entry Name="LockedDoor1">It's blocked on the other side. You need to go a different way.</Entry>
</CATEGORY>
<CATEGORY Name="Journal">
     <Entry Name="Quest_open_door_Text">Quest text goes here.</Entry>
</CATEGORY>

Relevant code:

PHP Code: (Select All)
AddQuest("open_door_quest""open_door");
SetMessage("Doors""LockedDoor1"0); 

Everything else is pretty much similar to the previous code i provided with a few changes. Looking at the examples i have provided and studying the wiki article i posted in the second post, you should be able to fill in the rest.



Concerning your edit: You replaced a variable with the entity name without using quotation marks.

Tutorials: From Noob to Pro
(This post was last modified: 10-18-2011, 12:02 AM by Your Computer.)
10-18-2011, 12:00 AM
Website Find
MissMarilynn Offline
Member

Posts: 77
Threads: 23
Joined: Oct 2011
Reputation: 1
#7
RE: Door messages and noises and memos in scripting?

(10-18-2011, 12:00 AM)Your Computer Wrote:
(10-17-2011, 11:39 PM)MissMarilynn Wrote: How would I set up the .lang stuff for 1 and 3? Particularly the quests.

and how do I get a message to show up for a locked door that I don't want to be unlocked. For instance, I have a door that is blocked from the other side. How do I get text to appear that says "It's blocked on the other side. You need to go a different way."

Example .lang:

It's blocked on the other side. You need to go a different way.


     Quest text goes here.

Relevant code:

PHP Code: (Select All)
AddQuest("open_door_quest""open_door");
SetMessage("Doors""LockedDoor1"0); 

Everything else is pretty much similar to the previous code i provided with a few changes. Looking at the examples i have provided and studying the wiki article i posted in the second post, you should be able to fill in the rest.



Concerning your edit: You replaced a variable with the entity name without using quotation marks.

What is the addquest "open_door" referring back too?


Oh! I feel silly now. I changed it.

10-18-2011, 12:10 AM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#8
RE: Door messages and noises and memos in scripting?

(10-18-2011, 12:10 AM)MissMarilynn Wrote: What is the addquest "open_door" referring back too?

The game automatically prefixes quests with "Quest_" and suffixes them with "_Text". Hence the entry name in the .lang file.

Tutorials: From Noob to Pro
10-18-2011, 12:14 AM
Website Find
MissMarilynn Offline
Member

Posts: 77
Threads: 23
Joined: Oct 2011
Reputation: 1
#9
RE: Door messages and noises and memos in scripting?

(10-18-2011, 12:00 AM)Your Computer Wrote:
(10-17-2011, 11:39 PM)MissMarilynn Wrote: How would I set up the .lang stuff for 1 and 3? Particularly the quests.

and how do I get a message to show up for a locked door that I don't want to be unlocked. For instance, I have a door that is blocked from the other side. How do I get text to appear that says "It's blocked on the other side. You need to go a different way."

Example .lang:

It's blocked on the other side. You need to go a different way.


     Quest text goes here.

Relevant code:

PHP Code: (Select All)
AddQuest("open_door_quest""open_door");
SetMessage("Doors""LockedDoor1"0); 

Everything else is pretty much similar to the previous code i provided with a few changes. Looking at the examples i have provided and studying the wiki article i posted in the second post, you should be able to fill in the rest.



Concerning your edit: You replaced a variable with the entity name without using quotation marks.


Is this correct? Nothing appeared when I went to the door but I didn't get an error. I'm positive my language file is correct. I just want the message to appear when I don't have the key. I want a message to appear when I do have the key that says "Double click the key in your inventory and use it on the door."


void IsItLocked(string &in entity)
{
if (GetSwingDoorLocked("officekey")
&& entity == "officedoor")
{
SetMessage("Doors", "LockedDoor1", 0);
AddQuest("open_door_quest", "open_door");
}
}

EDIT: I placed the "Quest text" part under the journals category in the .lang file. Is that messing something up?
(This post was last modified: 10-18-2011, 12:19 AM by MissMarilynn.)
10-18-2011, 12:17 AM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#10
RE: Door messages and noises and memos in scripting?

(10-18-2011, 12:17 AM)MissMarilynn Wrote: Is this correct? Nothing appeared when I went to the door but I didn't get an error. I'm positive my language file is correct.

Is "officekey" a door?

(10-18-2011, 12:17 AM)MissMarilynn Wrote: I just want the message to appear when I don't have the key. I want a message to appear when I do have the key that says "Double click the key in your inventory and use it on the door."

Then you're going to want something like this:

PHP Code: (Select All)
void IsItLocked(string &in entity)
{
     if (
GetSwingDoorLocked(entity)
     && 
entity == "door_name")
     {
          if (!
HasItem("key"))
               
SetMessage("cat_name""entry_name"0);
          else
               
SetMessage("cat_name""entry_name2"0);
     }


(10-18-2011, 12:17 AM)MissMarilynn Wrote: EDIT: I placed the "Quest text" part under the journals category in the .lang file. Is that messing something up?

If it looks like my example, then it shouldn't.

Tutorials: From Noob to Pro
10-18-2011, 12:37 AM
Website Find




Users browsing this thread: 1 Guest(s)