Frictional Games Forum (read-only)
[SOLVED] Setting message on interacting with 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 (https://www.frictionalgames.com/forum/forum-35.html)
+--- Thread: [SOLVED] Setting message on interacting with entity (/thread-6266.html)



[SOLVED] Setting message on interacting with entity - Nye - 01-18-2011

EDIT: Tried to delete this, but can't and great reply posted, so I will try and re-type the question...

How do I set a collidecallback for the player interacting with a LOCKED door?


RE: [Question] Set Message on player interacting with LOCKED door - triadtimes - 01-18-2011

What you need to do is select your entity in the level editor and go to the entity tab, from there enter something into the PlayerInteractCallback field (like "InteractDoor")

Then go into your code for that level and type something like
Code:
void InteractDoor(string &in asEntity)
{
    if(GetLocalVarInt("Door") != 1)
    {
        SetMessage("Message", "Message", 0);
    }
    else
    {

    }
}

In the above example lets say the variable goes to 1 when the player picks up the key. Anytime he interacts with it before the key the message will show, and anytime he interacts with it and he has the key nothing will happen.


RE: [Question] Set Message on player interacting with LOCKED door - Nye - 01-18-2011

(01-18-2011, 12:59 AM)triadtimes Wrote: What you need to do is select your entity in the level editor and go to the entity tab, from there enter something into the PlayerInteractCallback field (like "InteractDoor")

Then go into your code for that level and type something like
Code:
void InteractDoor((string &in asEntity)
{
    if(GetLocalVarInt("Door") != 1)
    {
        SetMessage("Message", "Message", 0);
    }
    else
    {

    }
}

In the above example lets say the variable goes to 1 when the player picks up the key. Anytime he interacts with it before the key the message will show, and anytime he interacts with it and he has the key nothing will happen.

YAY! Thank you! Big Grin


RE: [SOLVED] Setting message on interacting with entity - Tony32 - 01-19-2011

Nice. Useful to me ^^ Thanks Smile


RE: [SOLVED] Setting message on interacting with entity - Tottel - 01-19-2011

Alternatively, you could also use if(HasItem("NameOfKey") == false)


RE: [SOLVED] Setting message on interacting with entity - Zirg - 02-22-2011

When I use this code, the message still shows when the door is opened. (and the used key destroyed)
i.e. when I open the door or close it, it still says (in my case): This door is closed.
How do I change this, when the key used to open the door is removed from my inventory?