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
Help with looking at area
Romulator Offline
Not Tech Support ;-)

Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation: 195
#7
RE: Help with looking at area

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.

<CATEGORY Name="MessageAppear">
<Entry Name="MessageEntry_LookA">A</Entry>
<Entry Name="MessageEntry_LookB">B</Entry>
<Entry Name="MessageEntry_LookC">C</Entry>
<Entry Name="MessageEntry_LookD">D</Entry>
<Entry Name="MessageEntry_LookE">E</Entry>
<Entry Name="MessageEntry_LookF">F</Entry>
<Entry Name="MessageEntry_LookG">G</Entry>
<Entry Name="MessageEntry_LookH">H</Entry>
<Entry Name="MessageEntry_LookI-J">I-J</Entry>
<Entry Name="MessageEntry_LookK">K</Entry>
<Entry Name="MessageEntry_LookM">M</Entry>
</CATEGORY>



SetEntityPlayerLookAtCallback
Spoiler below!

This is how the SetEntityPlayerLookAtCallback works:

PHP Code: (Select All)
SetEntityPlayerLookAtCallback(stringasNamestringasCallbackbool abRemoveWhenLookedAt);

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.
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.

So the example I will use is this:
PHP Code: (Select All)
SetEntityPlayerLookAtCallback("ScriptArea_A""ShowMessageA"true); 

Which would go in the OnStart() function in script.

PHP Code: (Select All)
OnStart()
{
SetEntityPlayerLookAtCallback("ScriptArea_A""ShowMessageA"true);



Making the message appear
Spoiler below!

The message is read with the SetMessage() function, which works like this.

SetMessage(string& asTextCategory, string& asTextEntry, float afTime);

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:
PHP Code: (Select All)
void ShowMessageA(string &in asEntityint alState)
 {
 
SetMessage("MessageAppear""MessageEntry_LookA"0.0f);
 } 

So in your extra_english.lang file, you need your messages. In your .lang file, you already have them declared in a category named MessageAppear:
<CATEGORY Name="MessageAppear">
And your messages organised as MessageEntry_Look(x) where x is a letter.

So the correct way to do this is to fix your SetMessage() to show these.
PHP Code: (Select All)
SetMessage("MessageAppear""MessageEntry_LookA"0.0f); 

Then place it into your script.
PHP Code: (Select All)
void ShowMessageA(string &in asEntityint alState)
 {
 
SetMessage("MessageAppear""MessageEntry_LookA"0.0f);
 } 

So your script should look like this in order just to get the first to work.

PHP Code: (Select All)
OnStart()
{
SetEntityPlayerLookAtCallback("ScriptArea_A""ShowMessageA"true);
}

void ShowMessageA(string &in asEntityint alState)
 {
 
SetMessage("MessageAppear""MessageEntry_LookA"0.0f);
 } 


Repeat for the rest
Spoiler below!

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.

PHP Code: (Select All)
OnStart()
{
SetEntityPlayerLookAtCallback("ScriptArea_A""ShowMessageA"true);
SetEntityPlayerLookAtCallback("ScriptArea_B""ShowMessageB"true);
SetEntityPlayerLookAtCallback("ScriptArea_C""ShowMessageC"true);
SetEntityPlayerLookAtCallback("ScriptArea_D""ShowMessageD"true);
...
SetEntityPlayerLookAtCallback("ScriptArea_M""ShowMessageM"true);
}

void ShowMessageA(string &in asEntityint alState)
 {
 
SetMessage("MessageAppear""MessageEntry_LookA"0.0f);
 }

void ShowMessageB(string &in asEntityint alState)
 {
 
SetMessage("MessageAppear""MessageEntry_LookB"0.0f);
 }

void ShowMessageC(string &in asEntityint alState)
 {
 
SetMessage("MessageAppear""MessageEntry_LookC"0.0f);
 }
...
void ShowMessageM(string &in asEntityint alState)
 {
 
SetMessage("MessageAppear""MessageEntry_LookM"0.0f);
 } 


Discord: Romulator#0001
[Image: 3f6f01a904.png]
05-26-2013, 08:56 AM
Find


Messages In This Thread
Help with looking at area - by Wank - 05-26-2013, 01:38 AM
RE: Help with looking at area - by Wank - 05-26-2013, 01:58 AM
RE: Help with looking at area - by Wank - 05-26-2013, 02:08 AM
RE: Help with looking at area - by Romulator - 05-26-2013, 08:56 AM



Users browsing this thread: 1 Guest(s)