Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Hold item on entity = text?
Storfigge Offline
Member

Posts: 101
Threads: 31
Joined: Sep 2012
Reputation: 0
#1
Hold item on entity = text?

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.

(This post was last modified: 07-07-2013, 04:30 PM by Storfigge.)
07-07-2013, 04:30 PM
Find
GoranGaming Offline
Member

Posts: 183
Threads: 30
Joined: Feb 2012
Reputation: 7
#2
RE: Hold item on entity = text?

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:

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:

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
{

}
}

Current projects:

The Dark Prison 85 % (Stopped working on this one)

Unnamed Project 7 %
(This post was last modified: 07-07-2013, 06:48 PM by GoranGaming.)
07-07-2013, 06:47 PM
Website Find
Storfigge Offline
Member

Posts: 101
Threads: 31
Joined: Sep 2012
Reputation: 0
#3
RE: Hold item on entity = text?

(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:

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:

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

07-07-2013, 10:12 PM
Find




Users browsing this thread: 1 Guest(s)