Frictional Games Forum (read-only)
Click on entity for message - 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: Click on entity for message (/thread-20870.html)

Pages: 1 2


Click on entity for message - User01 - 03-04-2013

Okay I want to make that, when a character is in front of me that I need to click on him and then a message should appear, after a short time should another another message appear. And the second message should be repeated always when you click another time on him.
I hope you understand me well, and I have no idea how to make this, so I appeal for help. I also found nothing about "click on entity".


RE: Click on entity for message - darksky - 03-04-2013

make a scriptbox with an interact callback

int i = 0;

and in the callback

if (i==0) display first message
else display second message
i++;

edit:

better solution

bool first = true;

in callback
{
if (first) display firstmessage; addtimer with second message
else display second message;
}

and in the timer callback

display second message;
first = false;


RE: Click on entity for message - User01 - 03-04-2013

Sorry don't understand well. Can you or someone please write it more particularly?


RE: Click on entity for message - OriginalUsername - 03-04-2013

This should do it, just enter your own category, names, etc.

Code:
void OnStart()
{
    SetLocalVarInt("message", 0);
    SetEntityPlayerInteractCallback("Object", "function1", false);
}

void function1(string &in asEntity)
{
    if(GetLocalVarInt("message") == 1)
    {
        SetMessage("Category", "Entry2", 2);
    }
    else
    {
        SetMessage("Category", "Entry1", 2);
        AddTimer("", 2, "secondmessage");
    }
}

void secondmessage(string &in asTimer)
{
    SetMessage("Category", "Entry2", 2);
    AddLocalVarInt("message", 1);
}

Please correct me if I'm wrong.


RE: Click on entity for message - User01 - 03-04-2013

Have it now. Thank you Smile


RE: Click on entity for message - User01 - 03-04-2013

Oh is it possible that you only can click once till the message end?


RE: Click on entity for message - darksky - 03-04-2013

yes. there are multiple ways

1. use additional bool variable
2. make two script areas. first one displays first message & second message and deactivates itself. after the message activate the second script area, which will only show second message

...


RE: Click on entity for message - User01 - 03-04-2013

(03-04-2013, 09:52 PM)darksky Wrote: yes. there are multiple ways

1. use additional bool variable
..
Huh


RE: Click on entity for message - darksky - 03-04-2013

you can use a bool variable
if true, the messages are displayed, if false then not
just set variable to false when starting the message and to true when the message is finished.

without offense : you could do a bit more thinking Smile or improve programming in general, which will help you with coming up with certain solutions


RE: Click on entity for message - OriginalUsername - 03-04-2013

(03-04-2013, 09:52 PM)darksky Wrote: yes. there are multiple ways

1. use additional bool variable
2. make two script areas. first one displays first message & second message and deactivates itself. after the message activate the second script area, which will only show second message

...

Isnt that what I just did without scriptareas?

(03-04-2013, 09:41 PM)User01 Wrote: Oh is it possible that you only can click once till the message end?

I'll create the script for you when I'm back on my computer