Frictional Games Forum (read-only)
Hold item on entity = text? - 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: Hold item on entity = text? (/thread-22059.html)



Hold item on entity = text? - Storfigge - 07-07-2013

Hey!
How do I do so that when I "hold" and item like after I've clicked on it in the inventory and then when I hold the item in front of an entity a text will appear like a sign.
Example, I hold a key on the door and it says "Use the key to open the door". I think I've seen this in a CS before.


RE: Hold item on entity = text? - GoranGaming - 07-07-2013

That's i,possible, if I'm right, unless you fiddle with the source code...

You can do it, but not when you double click the key in the inventory.

Example 1, in this case, the message shows up when you interact with the door:

Code:
void OnStart()
{
SetEntityPlayerInteractCallback("Door", "InteractDoor", false);
}

void InteractDoor(string &in asEntity)
{
if(HasItem("Door_Key_1") == true){
SetMessage("Category", "MessageThatSaysUseKeyOnDoor");
}
else
{
//Do nothing
}
}

Example 2, in this case the message shows up if the player has the key and approaches the door:

Code:
void OnStart()
{
AddEntityCollideCallback("Player", "CollideDoorArea", "CollideDoor", 0, 1);
}

void CollideDoor(string &in asParent, string &in asChild, int alState)
{
if(HasItem("Door_Key_1") == true){
SetMessage("Category", "MessageThatSaysUseKeyOnDoor");
}
else
{

}
}



RE: Hold item on entity = text? - Storfigge - 07-07-2013

(07-07-2013, 06:47 PM)GoranGaming Wrote: That's i,possible, if I'm right, unless you fiddle with the source code...

You can do it, but not when you double click the key in the inventory.

Example 1, in this case, the message shows up when you interact with the door:

Code:
void OnStart()
{
SetEntityPlayerInteractCallback("Door", "InteractDoor", false);
}

void InteractDoor(string &in asEntity)
{
if(HasItem("Door_Key_1") == true){
SetMessage("Category", "MessageThatSaysUseKeyOnDoor");
}
else
{
//Do nothing
}
}

Example 2, in this case the message shows up if the player has the key and approaches the door:

Code:
void OnStart()
{
AddEntityCollideCallback("Player", "CollideDoorArea", "CollideDoor", 0, 1);
}

void CollideDoor(string &in asParent, string &in asChild, int alState)
{
if(HasItem("Door_Key_1") == true){
SetMessage("Category", "MessageThatSaysUseKeyOnDoor");
}
else
{

}
}

Ok I will try the second example. Ty Smile