Frictional Games Forum (read-only)
Making Player Look at Multiple Targets - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods (https://www.frictionalgames.com/forum/forum-35.html)
+--- Thread: Making Player Look at Multiple Targets (/thread-5599.html)



Making Player Look at Multiple Targets - Dark88 - 12-02-2010

I tried searching the forums to see if this has been answered before but I couldn't find anything so here's my question.

I'm trying to write the script where a monster spawns behind the player after entering a hallway and he turns around and looks then after 1.5 seconds or so another one spawns down the hall and he looks at that one for 1.5 seconds or so before the player 'regains' control and is forced to run to the map exit at the opposite end of the hall. Unfortunately with the code I have now he just looks at the second monster.

Code:
void MonsterFunc (string &in asParent , string &in asChild , int alState)
{
    SetEntityActive("servant_brute_3", true);
    AddEnemyPatrolNode("servant_brute_3", "PathNodeArea_2", 0.0f, "");
    AddEnemyPatrolNode("servant_brute_3", "PathNodeArea_1", 0.0f, "");
    StartPlayerLookAt("servant_brute_3", 5, 5, "");
    AddTimer("donelook_4", 1.5f, "TimerDoneLookAt_1");
    SetEntityActive("servant_brute_2", true);
    AddEnemyPatrolNode("servant_brute_2", "PathNodeArea_1", 0.0f, "");
    StartPlayerLookAt("servant_brute_2", 5, 5, "");
    AddTimer("donelook_5", 1.5f, "TimerDoneLookAt_1");
}

The TimerDoneLookAt_1 is just a simple StopPlayerLookAt().

This is my first time ever attempting my own mod for a game before. It's certainly very satisfying experience so far. If I can get this to work and after a few more additions and tweaks I was going to release a small WIP demo so to speak of just my first map once I got everything working to see what everyone thought about my first attempt at modding. In advance I would like to give my appreciation for any help in this matter.


RE: Making Player Look at Multiple Targets - Chilton - 12-02-2010

DISCLAIMER: This is all pseudo script
Ill have *s to mark things you need to fill in yourself

void MonsterFunc (string &in asParent , string &in asChild , int alState)
{
SetEntityActive("servant_brute_3", true);
AddEnemyPatrolNode("servant_brute_3", "PathNodeArea_2", 0.0f, "");
AddEnemyPatrolNode("servant_brute_3", "PathNodeArea_1", 0.0f, "");
StartPlayerLookAt("servant_brute_3", 5, 5, "");
AddTimer("donelook_4", 1.5f, "TimerDoneLookAt_1");
}

void TimerDoneLookAt_1(*Timer Syntax*)
{
StopPlayerLookAt();
Continue();
}

void Continue();
{
SetEntityActive("servant_brute_2", true);
AddEnemyPatrolNode("servant_brute_2", "PathNodeArea_1", 0.0f, "");
StartPlayerLookAt("servant_brute_2", 5, 5, "");
AddTimer("donelook_5", 1.5f, "TimerDoneLookAt_2");
}

void TimerDoneLookAt_2(*Timer Syntax*)
{
StopPlayerLookAt();
}


Ill add in the actual scripts if you need it, but you should be able to do that;
If you cant, then i can; Im just tired, so youd have to check for typos yourself

Once the Syntaxes are added, this should hypothetically work


RE: Making Player Look at Multiple Targets - Dark88 - 12-02-2010

That worked perfectly Chilton. Big Grin Thank you very much! I appreciate the quick response.

I should have a WIP demo and some screenshots of my first map sometime in the next week.


RE: Making Player Look at Multiple Targets - Chilton - 12-02-2010

Glad i could help


RE: Making Player Look at Multiple Targets - Pandemoneus - 12-02-2010

Although it's already sufficent to do one TimerDoneLookAt and call it 2 times.


RE: Making Player Look at Multiple Targets - Chilton - 12-02-2010

(12-02-2010, 11:42 AM)Pandemoneus Wrote: Although it's already sufficent to do one TimerDoneLookAt and call it 2 times.

No, you need him to look at one, stop looking at it, then look at the other one.
Note how the first stop moves it to void Continue

It isnt the same function each time


RE: Making Player Look at Multiple Targets - Pandemoneus - 12-02-2010

Ah you are right, my mistake, but I'd make events with timers or switch/case anyway.