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
setEntityPlayerLookAtCallback problems
Rahmerh Offline
Member

Posts: 66
Threads: 7
Joined: Jun 2015
Reputation: 3
#1
setEntityPlayerLookAtCallback problems

Hey!

I'm having a (probably) very stupid problem with the lookatcallback.
I'm trying to make a message pop up when a player looks at an entity, but it's not working.
Here's my code:

void OnStart(){
SetEntityPlayerLookAtCallback("wriggle_prison_bar_obj_dyn_1", "barLoose", false);
}

void barLoose(string &in asEntity, int alState){
    SetMessage("Messages", "barloose", 2);
}

I also tried it through the hpl editor, but that doesn't work either. Does anyone have an ideas? I tried this with a script area and the entity. Thanks in advance!
(This post was last modified: 06-26-2015, 01:30 PM by Rahmerh.)
06-26-2015, 01:28 PM
Find
Romulator Offline
Not Tech Support ;-)

Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation: 195
#2
RE: setEntityPlayerLookAtCallback problems

Could you also post your extra_english.lang file? There may be an issue with that, considering that one error in that causes the whole language file to screw up - including your messages Smile

Discord: Romulator#0001
[Image: 3f6f01a904.png]
06-26-2015, 01:32 PM
Find
Rahmerh Offline
Member

Posts: 66
Threads: 7
Joined: Jun 2015
Reputation: 3
#3
RE: setEntityPlayerLookAtCallback problems

Yeah I just found out it was my .lang file... Forgot the capital E in 'Entry'... I'm pretty stupid sometimes... Tongue
06-26-2015, 01:34 PM
Find
Romulator Offline
Not Tech Support ;-)

Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation: 195
#4
RE: setEntityPlayerLookAtCallback problems

Ahh, no problem! Things like this happen. Also remember that nothing when you code or what you do is "stupid" coding. Every small mistake helps you become just that little bit better.

Let us know if you have any more problems!

Discord: Romulator#0001
[Image: 3f6f01a904.png]
06-26-2015, 01:36 PM
Find
Rahmerh Offline
Member

Posts: 66
Threads: 7
Joined: Jun 2015
Reputation: 3
#5
RE: setEntityPlayerLookAtCallback problems

Will do! Another quick question though, when I look at the area, it displays the message, but when I look away from it, it shows again. Is there a way to make it so it only appears when you look at it, not when you look away from it?
06-26-2015, 01:39 PM
Find
Romulator Offline
Not Tech Support ;-)

Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation: 195
#6
RE: setEntityPlayerLookAtCallback problems

Yep! We use an if conditional here.

Try this:
PHP Code: (Select All)
void barLoose(string &in asEntityint alState)
{
    if(
alState == 1)               //Check if we're looking AT. -1 for Looking away.
    
{
        
SetMessage("Messages""barloose"2);
    }


Discord: Romulator#0001
[Image: 3f6f01a904.png]
06-26-2015, 01:44 PM
Find
Rahmerh Offline
Member

Posts: 66
Threads: 7
Joined: Jun 2015
Reputation: 3
#7
RE: setEntityPlayerLookAtCallback problems

Thank you very much! Big Grin
06-26-2015, 01:46 PM
Find
Romulator Offline
Not Tech Support ;-)

Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation: 195
#8
RE: setEntityPlayerLookAtCallback problems

(06-26-2015, 01:46 PM)Rahmerh Wrote: Thank you very much! Big Grin

No problem! Good luck! Big Grin
Edit: It's actually a topic stuck in my head since I had that problem two days ago :3

Discord: Romulator#0001
[Image: 3f6f01a904.png]
(This post was last modified: 06-26-2015, 01:48 PM by Romulator.)
06-26-2015, 01:47 PM
Find




Users browsing this thread: 1 Guest(s)