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
Forcing view of the player to look at a door when it slams shut
DrDean Offline
Junior Member

Posts: 28
Threads: 7
Joined: Jun 2008
Reputation: 1
#1
Forcing view of the player to look at a door when it slams shut

Hi, I'm trying to do exactly what the thread title states. I got the door slam part down, but I'm having difficulty having the view change work. I should probably mention that I have no programming background, so this is all new to me.

Looking at the script functions list on the Wiki, it seems like this is exactly what I need:
void StartPlayerLookAt(string& asEntityName, float afSpeedMul, float afMaxSpeed, string& asAtTargetCallback);
void StopPlayerLookAt();

However, I have absolutely no idea how to plop it into my current door-slam script. Where should I put it? What variables am I changing? I'm not asking you to do my work for me, but I need a push.

This is what I currently have:

void OnStart()
{
AddEntityCollideCallback("Player", "pooarea", "func_slam", true, 1);
}


void func_slam(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("mansion_1", true, true);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare", "Player", 0, false); PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);
GiveSanityDamage(5.0f, true);
}


Thanks in advance, guys.
(This post was last modified: 02-12-2012, 08:12 PM by DrDean.)
02-12-2012, 07:05 PM
Find
Darkaroth Offline
Junior Member

Posts: 11
Threads: 2
Joined: Feb 2012
Reputation: 0
#2
RE: Forcing view of the player to look at a door when it slams shut

use StartPlayerLookAt(string& asEntityName, float afSpeedMul, float afMaxSpeed, string& asAtTargetCallback);

go to [url]http://wiki.frictionalgames.com/hpl2/amn...s#general2[/url] and search for the command it should say what to fill in where.
then put it below void func_slam. next to setswingdoorclosed ect.
(This post was last modified: 02-12-2012, 07:26 PM by Darkaroth.)
02-12-2012, 07:24 PM
Find
DrDean Offline
Junior Member

Posts: 28
Threads: 7
Joined: Jun 2008
Reputation: 1
#3
RE: Forcing view of the player to look at a door when it slams shut

I'm trying this, but it's giving me curly bracket errors.


void OnStart()
{
AddEntityCollideCallback("Player", "pooarea", "func_slam", true, 1); //Func for door slam/player look
}




void func_slam(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("mansion_1", true, true);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare", "Player", 0, false); PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);
GiveSanityDamage(5.0f, true);
}


void StartPlayerLookAt(string& mansion_1, 1, 1, string& func_slam);
{ //Gives the error here
}
void StopPlayerLookAt();
{ //And here
}

If I'm doing this correctly, which I'm obviously not, the player's view should shift to the door (mansion_1) when they enter the script area (pooarea aka func_slam)
(This post was last modified: 02-12-2012, 07:34 PM by DrDean.)
02-12-2012, 07:32 PM
Find
Prelauncher Offline
Senior Member

Posts: 451
Threads: 11
Joined: May 2011
Reputation: 13
#4
RE: Forcing view of the player to look at a door when it slams shut

You should put the "StartPlayerLookAt" under the "func_slam" function. The computer doesn´t call that function in the script´s current state. You should also add a timer which after an aproperiate time call the function, for example; addtimer("StopLook", 3, "NoLooking");

void NoLooking(string &in as Timer)
{
StopPlayerLookAt();
}

Socialism (noun): A great way to run out of other people's money.
(This post was last modified: 02-12-2012, 08:05 PM by Prelauncher.)
02-12-2012, 08:03 PM
Find
onv Offline
Member

Posts: 51
Threads: 12
Joined: Feb 2012
Reputation: 2
#5
RE: Forcing view of the player to look at a door when it slams shut

Use this :


void OnStart()
{
AddEntityCollideCallback("Player", "pooarea", "func_slam", true, 1);
}

void func_slam(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("mansion_1", true, true);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare", "Player", 0, false);
PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);

GiveSanityDamage(5.0f, true);
SetPlayerActive(false);
StartPlayerLookAt("mansion_1", 3.0f, 5.0f, "");
AddTimer("timer01", 1.5f, "StopLook");

void StopLook(string &in asTimer)
{
StopPlayerLookAt();
SetPlayerActive(true);
}
(This post was last modified: 02-12-2012, 08:13 PM by onv.)
02-12-2012, 08:10 PM
Find
DrDean Offline
Junior Member

Posts: 28
Threads: 7
Joined: Jun 2008
Reputation: 1
#6
RE: Forcing view of the player to look at a door when it slams shut

Yes! I got it. This is fun. Thanks, man.
02-12-2012, 08:12 PM
Find
onv Offline
Member

Posts: 51
Threads: 12
Joined: Feb 2012
Reputation: 2
#7
RE: Forcing view of the player to look at a door when it slams shut

Having fun scaring your friends ! Big Grin


Note: i just saw that there is an error , in the wiki script (so , in yours too)


Add ".snt" at the end of "react_scare" like so :


PlaySoundAtEntity("", "react_scare.snt", "Player", 0, false);
(This post was last modified: 02-12-2012, 08:16 PM by onv.)
02-12-2012, 08:15 PM
Find
Myselium Offline
Junior Member

Posts: 3
Threads: 0
Joined: Feb 2012
Reputation: 0
#8
RE: Forcing view of the player to look at a door when it slams shut

Doesn't work for me... Sad

EDIT: Nevermind, got it working! Big Grin
(This post was last modified: 02-22-2012, 07:20 PM by Myselium.)
02-22-2012, 06:52 PM
Find




Users browsing this thread: 1 Guest(s)