Facebook Twitter YouTube Frictional Games | Forum | Newsletter | Dev Blog | Dev Wiki | Support | Shelf | Store

Privacy Policy


Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Solved Forcing view of the player to look at a door when it slams shut
Author Message
DrDean Offline
Junior Member

Posts: 27
Joined: Jun 2008
Reputation: 1
Post: #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 all posts by this user Quote this message in a reply
Darkaroth Offline
Junior Member

Posts: 11
Joined: Feb 2012
Reputation: 0
Post: #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 http://wiki.frictionalgames.com/hpl2/amn...s#general2 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 all posts by this user Quote this message in a reply
DrDean Offline
Junior Member

Posts: 27
Joined: Jun 2008
Reputation: 1
Post: #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 all posts by this user Quote this message in a reply
Prelauncher Offline
Senior Member

Posts: 392
Joined: May 2011
Reputation: 11
Post: #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();
}

Calories (noun): Tiny creatures that live in your closet and sew your clothes a little bit tighter every night.
(This post was last modified: 02-12-2012 08:05 PM by Prelauncher.)
02-12-2012 08:03 PM
Find all posts by this user Quote this message in a reply
onv Offline
Member

Posts: 51
Joined: Feb 2012
Reputation: 2
Post: #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 all posts by this user Quote this message in a reply
DrDean Offline
Junior Member

Posts: 27
Joined: Jun 2008
Reputation: 1
Post: #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 all posts by this user Quote this message in a reply
onv Offline
Member

Posts: 51
Joined: Feb 2012
Reputation: 2
Post: #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 all posts by this user Quote this message in a reply
Myselium Offline
Junior Member

Posts: 3
Joined: Feb 2012
Reputation: 0
Post: #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 all posts by this user Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)