Dark88
Junior Member
Posts: 48
Threads: 6
Joined: Dec 2010
Reputation:
0
|
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 |
|
Chilton
Member
Posts: 138
Threads: 9
Joined: Sep 2010
Reputation:
0
|
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 |
|
Dark88
Junior Member
Posts: 48
Threads: 6
Joined: Dec 2010
Reputation:
0
|
RE: Making Player Look at Multiple Targets
That worked perfectly Chilton. 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 |
|
Chilton
Member
Posts: 138
Threads: 9
Joined: Sep 2010
Reputation:
0
|
RE: Making Player Look at Multiple Targets
Glad i could help
|
|
12-02-2010, 05:48 AM |
|
Pandemoneus
Senior Member
Posts: 328
Threads: 2
Joined: Sep 2010
Reputation:
0
|
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 |
|
Chilton
Member
Posts: 138
Threads: 9
Joined: Sep 2010
Reputation:
0
|
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 |
|
Pandemoneus
Senior Member
Posts: 328
Threads: 2
Joined: Sep 2010
Reputation:
0
|
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 |
|
|