+- 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: Help with looking at area (/thread-21620.html)
When the player looks at a certain script area I want it to say something. I assume the script you use has to do with "PlayerLookAtCallback" The area is called "Look".
This is the "voluntary" code. This means that the Player isn't being forced to look at this.
Code:
void OnStart()
{
SetEntityPlayerLookAtCallback("Look", "MessageAppear", true); //Change true to false if you want the message to appear over and over again.
}
void MessageAppear(string &in asEntity, int alState)
{
SetMessage("MessageCategory", "MessageEntry", 0); //Change 0 to how long you want the message to appear. 0 means it will count how many strings it have and calculate the time.
}
(05-26-2013, 01:53 AM)JustAnotherPlayer Wrote: This is the "voluntary" code. This means that the Player isn't being forced to look at this.
Code:
void OnStart()
{
SetEntityPlayerLookAtCallback("Look", "MessageAppear", true); //Change true to false if you want the message to appear over and over again.
}
void MessageAppear(string &in asEntity, int alState)
{
SetMessage("MessageCategory", "MessageEntry", 0); //Change 0 to how long you want the message to appear. 0 means it will count how many strings it have and calculate the time.
}
What do I do for "Message Category" and "Message Entry"? This is a script area so...
(05-26-2013, 01:53 AM)JustAnotherPlayer Wrote: This is the "voluntary" code. This means that the Player isn't being forced to look at this.
Code:
void OnStart()
{
SetEntityPlayerLookAtCallback("Look", "MessageAppear", true); //Change true to false if you want the message to appear over and over again.
}
void MessageAppear(string &in asEntity, int alState)
{
SetMessage("MessageCategory", "MessageEntry", 0); //Change 0 to how long you want the message to appear. 0 means it will count how many strings it have and calculate the time.
}
What do I do for "Message Category" and "Message Entry"? This is a script area so...
You want a text to appear when the Player is looking at the area, right? The Message Category is the category of the message you want and Message Entry is the entry of the message in the same category earlier.
(05-26-2013, 01:53 AM)JustAnotherPlayer Wrote: This is the "voluntary" code. This means that the Player isn't being forced to look at this.
Code:
void OnStart()
{
SetEntityPlayerLookAtCallback("Look", "MessageAppear", true); //Change true to false if you want the message to appear over and over again.
}
void MessageAppear(string &in asEntity, int alState)
{
SetMessage("MessageCategory", "MessageEntry", 0); //Change 0 to how long you want the message to appear. 0 means it will count how many strings it have and calculate the time.
}
What do I do for "Message Category" and "Message Entry"? This is a script area so...
You want a text to appear when the Player is looking at the area, right? The Message Category is the category of the message you want and Message Entry is the entry of the message in the same category earlier.
I still don't fully understand. I have 11 areas likes this. Here is my code- (Oh and sorry for not understanding ) So basiclly I want them to say what they are named so "A, B, C" blah blah blah.
void OnStart ()
{
SetEntityPlayerLookAtCallback("LookA", "MessageAppear", false);
SetEntityPlayerLookAtCallback("LookB", "MessageAppear", false);
SetEntityPlayerLookAtCallback("LookC", "MessageAppear", false);
SetEntityPlayerLookAtCallback("LookD", "MessageAppear", false);
SetEntityPlayerLookAtCallback("LookE", "MessageAppear", false);
SetEntityPlayerLookAtCallback("LookF", "MessageAppear", false);
SetEntityPlayerLookAtCallback("LookG", "MessageAppear", false);
SetEntityPlayerLookAtCallback("LookH", "MessageAppear", false);
SetEntityPlayerLookAtCallback("LookI-J", "MessageAppear", false);
SetEntityPlayerLookAtCallback("LookK", "MessageAppear", false);
SetEntityPlayerLookAtCallback("LookM", "MessageAppear", false);
}
void MessageAppear(string &in asEntity, int alState)
{
SetMessage("Message", "MessageEntry", 0); //Change 0 to how long you want the message to appear. 0 means it will count how many strings it have and calculate the time.
}
(05-26-2013, 02:08 AM)Wank Wrote:
(05-26-2013, 02:06 AM)JustAnotherPlayer Wrote:
(05-26-2013, 01:58 AM)Wank Wrote:
(05-26-2013, 01:53 AM)JustAnotherPlayer Wrote: This is the "voluntary" code. This means that the Player isn't being forced to look at this.
Code:
void OnStart()
{
SetEntityPlayerLookAtCallback("Look", "MessageAppear", true); //Change true to false if you want the message to appear over and over again.
}
void MessageAppear(string &in asEntity, int alState)
{
SetMessage("MessageCategory", "MessageEntry", 0); //Change 0 to how long you want the message to appear. 0 means it will count how many strings it have and calculate the time.
}
What do I do for "Message Category" and "Message Entry"? This is a script area so...
You want a text to appear when the Player is looking at the area, right? The Message Category is the category of the message you want and Message Entry is the entry of the message in the same category earlier.
I still don't fully understand. I have 11 areas likes this. Here is my code- (Oh and sorry for not understanding ) So basiclly I want them to say what they are named so "A, B, C" blah blah blah.
void OnStart ()
{
SetEntityPlayerLookAtCallback("LookA", "MessageAppear", false);
SetEntityPlayerLookAtCallback("LookB", "MessageAppear", false);
SetEntityPlayerLookAtCallback("LookC", "MessageAppear", false);
SetEntityPlayerLookAtCallback("LookD", "MessageAppear", false);
SetEntityPlayerLookAtCallback("LookE", "MessageAppear", false);
SetEntityPlayerLookAtCallback("LookF", "MessageAppear", false);
SetEntityPlayerLookAtCallback("LookG", "MessageAppear", false);
SetEntityPlayerLookAtCallback("LookH", "MessageAppear", false);
SetEntityPlayerLookAtCallback("LookI-J", "MessageAppear", false);
SetEntityPlayerLookAtCallback("LookK", "MessageAppear", false);
SetEntityPlayerLookAtCallback("LookM", "MessageAppear", false);
}
void MessageAppear(string &in asEntity, int alState)
{
SetMessage("Message", "MessageEntry", 0); //Change 0 to how long you want the message to appear. 0 means it will count how many strings it have and calculate the time.
}
OK, I did some extra english stuff also. Still doesn't work..
Extra english-
<LANGUAGE>
<CATEGORY Name="CustomStoryMain">
<Entry Name="Description">You find yourself in the mansion of a deranged artist and musician. Could he be hiding something in this hidious house?</Entry>
</CATEGORY>
<CATEGORY Name="Journal">
<Entry Name="Note_letterone_Name">A quick note to self</Entry>
<Entry Name="Note_letterone_Text">So I don't forget- The key to the study is hidden behind the painting in my piano room!</Entry>
<Entry Name="Note_noteenvelope_Name">To Costa De Luca</Entry>
<Entry Name="Note_noteenvelope_Text">You are invited to show your work at the Bergam Art Museum! Bring any artwork pieces as you wish, and we will see you there! (1834, October 16th)</Entry>
<Entry Name="Note_diarypaperone_Name">Journal entry page one</Entry>
<Entry Name="Note_diarypaperone_Text">1834, October 16th. Now that I have been invited to Bergam, I can bring my master piece! It is almost prepared, I just need a few more parts.</Entry>
<Entry Name="Note_diarypapertwo_Name">Journal entry page two</Entry>
<Entry Name="Note_diarypapertwo_Text">1834, October 17th. The showcase is in two weeks, so I need to prepare more quickly. I am just missing one more thing, which is hard to get.[br]Heading down to the library now.</Entry>
<Entry Name="Note_notelibrary_Name">A Riddle in Rhyme</Entry>
<Entry Name="Note_notelibrary_Text">The first one is at K, and don't be too slow.[br]
The next one is at M, but you arleady know.[br]
The last one you need is in B, as you can see. [br]
Now you know my secret, so come and find me.[br]</Entry>
</CATEGORY>
For the .lang file, I'm gonna wait for someone else to give an explanation. That doesn't mean that I don't know it, but I don't know how to explain it. Btw, they all have the same function.
RE: Help with looking at area - Romulator - 05-26-2013
This is a very long post. So I will place it into spoilers to save room.
Fixing your .lang
Spoiler below!
Well, first thing's first, we need to fix your extra_english.lang file. Make some placeholder text and put a </CATEGORY> at the end.
asName - internal name asCallback - function to call abRemoveWhenLookedAt - determines whether the callback should be removed when the player looked at the entity
Change the following.
Code:
asName What the player is looking at in order to show the text.
asCallback The name of the script (I'll come back to that).
abRemove... Either true or false. False means that no matter how many times you look, the message appears.
You also need to remove the string& and bool. Place any strings in quotation marks ("example"). And asName should be the name of what the player is looking at in the Level Editor.
asTextCategory The category name in the extra_english.lang to read from
asTextEntry The entry from the category above to display on screen
afTime Time in seconds to display.
You have your code correctly done, but I am changing the function to ShowMessageA for the time being:
Now it simply comes down to messing around with the code further to change what happens when you look at the other ones.
Where you see ..., you need to fill that in with your other lines of code. I cannot do it because I do not have that much patience and my text box is starting to lag on me.