Frictional Games Forum (read-only)

Full Version: setEntityPlayerLookAtCallback problems
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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:

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!
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
Yeah I just found out it was my .lang file... Forgot the capital E in 'Entry'... I'm pretty stupid sometimes... Tongue
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!
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?
Yep! We use an if conditional here.

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

Thank you very much! Big Grin
(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