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
[SOLVED] Setting message on interacting with entity
Nye Offline
Senior Member

Posts: 250
Threads: 8
Joined: Jan 2011
Reputation: 2
#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
triadtimes Offline
Senior Member

Posts: 508
Threads: 16
Joined: Jan 2011
Reputation: 21
#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
Nye Offline
Senior Member

Posts: 250
Threads: 8
Joined: Jan 2011
Reputation: 2
#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
Tony32 Offline
Junior Member

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

Nice. Useful to me ^^ Thanks Smile
01-19-2011, 02:44 PM
Find
Tottel Offline
Senior Member

Posts: 307
Threads: 9
Joined: Nov 2010
Reputation: 0
#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
Zirg Offline
Junior Member

Posts: 14
Threads: 4
Joined: Feb 2011
Reputation: 0
#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




Users browsing this thread: 1 Guest(s)