05-26-2013, 01:38 AM
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".
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.
}
(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...
(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.
(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.
}
<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(string& asName, string& asCallback, bool abRemoveWhenLookedAt);
asName - internal name
asCallback - function to call
abRemoveWhenLookedAt - determines whether the callback should be removed when the player looked at the entity
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.
SetEntityPlayerLookAtCallback("ScriptArea_A", "ShowMessageA", true);
OnStart()
{
SetEntityPlayerLookAtCallback("ScriptArea_A", "ShowMessageA", true);
}
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.
void ShowMessageA(string &in asEntity, int alState)
{
SetMessage("MessageAppear", "MessageEntry_LookA", 0.0f);
}
<CATEGORY Name="MessageAppear">
SetMessage("MessageAppear", "MessageEntry_LookA", 0.0f);
void ShowMessageA(string &in asEntity, int alState)
{
SetMessage("MessageAppear", "MessageEntry_LookA", 0.0f);
}
OnStart()
{
SetEntityPlayerLookAtCallback("ScriptArea_A", "ShowMessageA", true);
}
void ShowMessageA(string &in asEntity, int alState)
{
SetMessage("MessageAppear", "MessageEntry_LookA", 0.0f);
}
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 asEntity, int alState)
{
SetMessage("MessageAppear", "MessageEntry_LookA", 0.0f);
}
void ShowMessageB(string &in asEntity, int alState)
{
SetMessage("MessageAppear", "MessageEntry_LookB", 0.0f);
}
void ShowMessageC(string &in asEntity, int alState)
{
SetMessage("MessageAppear", "MessageEntry_LookC", 0.0f);
}
...
void ShowMessageM(string &in asEntity, int alState)
{
SetMessage("MessageAppear", "MessageEntry_LookM", 0.0f);
}