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
Script Help SetEntityPlayerLookAtCallback issues
gbstrcl Offline
Junior Member

Posts: 3
Threads: 2
Joined: Apr 2020
Reputation: 0
#1
SetEntityPlayerLookAtCallback issues

I do two callbacks, one inside the other. In onstart I do an interact callback
between the player and the door which then leads to a look at call back between the player and the Brute enemy. The callback is ignored and the brute begins pursuit without being looked at.

void OnInteractDoor()
{
    SetEntityPlayerLookAtCallback("Brute", "ActivateBrute", true);
}


void Onstart()
{
   SetEntityPlayerInteractCallback("Door", "OnInteractDoor", true);
}
    
    

void ActivateBrute(string &in asEntity, int alState)
{
    
    SetEntityActive(asEntity, true);
    ShowEnemyPlayerPosition(asEntity);
}
.
04-07-2020, 12:57 AM
Find
0roboro Offline
Junior Member

Posts: 9
Threads: 1
Joined: Jan 2017
Reputation: 0
#2
RE: SetEntityPlayerLookAtCallback issues

I found that the Onstart function is the problem, so I tried directly activating the OnInteractDoor function through interacting with a door within the level and it worked fine. So try removing the Onstart function and adding the OnInteractDoor callback directly to the door.


How it should work is that the player interacts with the door and as soon the player looks at the ActivateBrute area, The Brute should spawn and know the player position.


I hope this helps a little. I don't normally do this and I'm not the best at coding but I just wanted to help.
04-07-2020, 06:36 AM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#3
RE: SetEntityPlayerLookAtCallback issues

You must capitalize it properly as OnStart. You have a lower case S.

04-07-2020, 05:37 PM
Find
0roboro Offline
Junior Member

Posts: 9
Threads: 1
Joined: Jan 2017
Reputation: 0
#4
RE: SetEntityPlayerLookAtCallback issues

I didn't even notice the "s" wasn't capitalized but within my file, it is and it still didn't work.

I'm not sure what they using to trigger the callbacks but I tried using areas for both callbacks and that didn't work but when using an entity like a door and removed the first function, it worked fine. 

I got the area to turn on after opening the door and then spawned the brute after looking at the area. I think the first function isn't working with areas or we're just missing something.
04-07-2020, 10:49 PM
Find
gbstrcl Offline
Junior Member

Posts: 3
Threads: 2
Joined: Apr 2020
Reputation: 0
#5
RE: SetEntityPlayerLookAtCallback issues

Yes my bad. The 's' was capitalized in my code though so that wasn't the issue. It turns out I had a naming conflict with some other functions I forgot about. I managed to fix it. Thanks for the help though.
04-07-2020, 11:11 PM
Find
0roboro Offline
Junior Member

Posts: 9
Threads: 1
Joined: Jan 2017
Reputation: 0
#6
RE: SetEntityPlayerLookAtCallback issues

Your welcome, it nice to see people still working on making new content for Amnesia. 
Have a good day and don't forget to close the thread, don't want people posting on old questions.
04-08-2020, 12:48 AM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#7
RE: SetEntityPlayerLookAtCallback issues

Alright, closing!

04-08-2020, 10:30 AM
Find




Users browsing this thread: 2 Guest(s)