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


Post Reply 
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[SOLVED] Setting message on interacting with entity
Author Message
Nye Offline
Senior Member

Posts: 250
Joined: Jan 2011
Reputation: 2
Post: #1
[SOLVED] Setting message on interacting with entity

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?
(This post was last modified: 01-18-2011 01:43 AM by Nye.)
01-18-2011 12:51 AM
Find all posts by this user Quote this message in a reply
triadtimes Offline
Senior Member

Posts: 508
Joined: Jan 2011
Reputation: 21
Post: #2
RE: [Question] Set Message on player interacting with LOCKED door

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
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.

(This post was last modified: 01-18-2011 01:46 AM by triadtimes.)
01-18-2011 12:59 AM
Find all posts by this user Quote this message in a reply
Nye Offline
Senior Member

Posts: 250
Joined: Jan 2011
Reputation: 2
Post: #3
RE: [Question] Set Message on player interacting with LOCKED door

(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
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
01-18-2011 01:42 AM
Find all posts by this user Quote this message in a reply
Tony32 Offline
Junior Member

Posts: 26
Joined: Jan 2011
Reputation: 0
Post: #4
RE: [SOLVED] Setting message on interacting with entity

Nice. Useful to me ^^ Thanks Smile
01-19-2011 02:44 PM
Find all posts by this user Quote this message in a reply
Tottel Offline
Senior Member

Posts: 307
Joined: Nov 2010
Reputation: 0
Post: #5
RE: [SOLVED] Setting message on interacting with entity

Alternatively, you could also use if(HasItem("NameOfKey") == false)
(This post was last modified: 01-19-2011 03:07 PM by Tottel.)
01-19-2011 03:05 PM
Find all posts by this user Quote this message in a reply
Zirg Offline
Junior Member

Posts: 14
Joined: Feb 2011
Reputation: 0
Post: #6
RE: [SOLVED] Setting message on interacting with entity

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?
(This post was last modified: 02-22-2011 04:08 PM by Zirg.)
02-22-2011 04:03 PM
Find all posts by this user Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)