Frictional Games Forum (read-only)
Message Appears when you look at an entity - Printable Version

+- 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: Message Appears when you look at an entity (/thread-17305.html)



Message Appears when you look at an entity - Iyiyt - 07-28-2012

Sigh... need more help. I'm trying to make a message appear when I look at an entity. It's name and Callback Func in the Level Editor are JimmyOne. Here's my code;
Code:
void OnEnter()
{
ChangePlayerStateToNormal();
SetEntityPlayerLookAtCallback("JimmyOne", "JimmyOne", true);
}

void JimmyOne()
{
SetMessage("Message", "JimmyMessageOne", 6.0f);
}
In the LANG file, the category is Message and the name is JimmyMessageOne, so that isn't the problem.
Any help is always appreciated.


RE: Message Appears when you look at an entity - ElectricRed - 07-28-2012

Try this:

Code:
void OnEnter()
{
ChangePlayerStateToNormal();

SetEntityPlayerLookAtCallback("JimmyOne", "JimmyOne", true);
}

void JimmyOne(string &in asEntity, int alState)
{
SetMessage("Message", "JimmyMessageOne", 6.0f);
}



RE: Message Appears when you look at an entity - Iyiyt - 08-07-2012

Sorry, that isn't working. Can you think of another way I could do this? I notice there is a PlayerLookAtCallback on the entity on the level editor. I have that set as JimmyOne as well, but is there another script I could use to make it put up a message when I look at Jimmy? (On a side note, does the thing you look at have to be an entity you can interact with?)

Nevermind! I just stuck a hollow point needle in his chest (I was going to use one anyway), and named it JimmyOne (along with CallbackFunc and PlayerLookAt), and it worked when I looked at the needle. Thanks for your help.