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
Making Player Look at Multiple Targets
Dark88 Offline
Junior Member

Posts: 48
Threads: 6
Joined: Dec 2010
Reputation: 0
#1
Making Player Look at Multiple Targets

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.

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.
12-02-2010, 04:39 AM
Find
Chilton Offline
Member

Posts: 138
Threads: 9
Joined: Sep 2010
Reputation: 0
#2
RE: Making Player Look at Multiple Targets

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
(This post was last modified: 12-02-2010, 05:21 AM by Chilton.)
12-02-2010, 05:19 AM
Find
Dark88 Offline
Junior Member

Posts: 48
Threads: 6
Joined: Dec 2010
Reputation: 0
#3
RE: Making Player Look at Multiple Targets

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.
12-02-2010, 05:30 AM
Find
Chilton Offline
Member

Posts: 138
Threads: 9
Joined: Sep 2010
Reputation: 0
#4
RE: Making Player Look at Multiple Targets

Glad i could help
12-02-2010, 05:48 AM
Find
Pandemoneus Offline
Senior Member

Posts: 328
Threads: 2
Joined: Sep 2010
Reputation: 0
#5
RE: Making Player Look at Multiple Targets

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

12-02-2010, 11:42 AM
Find
Chilton Offline
Member

Posts: 138
Threads: 9
Joined: Sep 2010
Reputation: 0
#6
RE: Making Player Look at Multiple Targets

(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
12-02-2010, 12:39 PM
Find
Pandemoneus Offline
Senior Member

Posts: 328
Threads: 2
Joined: Sep 2010
Reputation: 0
#7
RE: Making Player Look at Multiple Targets

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

12-02-2010, 09:29 PM
Find




Users browsing this thread: 1 Guest(s)