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
Make player look at entity?
Datguy5 Offline
Senior Member

Posts: 629
Threads: 25
Joined: Dec 2011
Reputation: 12
#1
Make player look at entity?

I want that the player turns around and looks at entity when he picks up an item and after that a message appears in the screen saying something like 'You will never be free!' and then the credits would start.How would i do that?
Heres my hps file
////////////////////////////
// Run when the map starts
void OnStart()
{
AddUseItemCallback("", "And", "Locked", "KeyOnDoor", true);
SetEntityCallbackFunc("And", "OnPickup");
SetEntityCallbackFunc("Antidote", "OnPickup2");
AddEntityCollideCallback("Player", "Message_1", "Message1", true, 1);
AddEntityCollideCallback("Player", "End", "Message2", true, 1);
}


void Message1(string &in asChild, string &in asParent, int alState)
{
SetMessage("Messages", "Popup1", 0);
}
void Message2(string &in asChild, string &in asParent, int alState)
{
SetMessage("Messages", "Popup2", 0);
}
void OnPickup(string &in asEntity, string &in type)
{
SetEntityActive("grunt_1", true);
}
void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("Locked", false, true);
PlaySoundAtEntity("", "explosion_rock_large.snt", "Locked", 0, false);
RemoveItem("And");
}
void OnPickup2(string &in asEntity, string &in type)
{
SetEntityActive("Master", true);
}
////////////////////////////
// Run when entering map
void OnEnter()
{
}
////////////////////////////
// Run when leaving map
void OnLeave()
{
}

(This post was last modified: 02-03-2012, 10:29 PM by Datguy5.)
02-01-2012, 07:53 PM
Find
SilentStriker Offline
Posting Freak

Posts: 950
Threads: 26
Joined: Jul 2011
Reputation: 43
#2
RE: Make player look at entity?

You use a
SetEntityPlayerInteractCallback(string& asName, string& asCallback, bool abRemoveOnInteraction);

then in the void you use

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

and AddTimer
(string& asName, float afTime, string& asFunction);

then on the void from the timer you use
SetMessage(string& asTextCategory, string& asTextEntry, float afTime);

then maby another timer and then in the other timer void you use
StartCredits(string& asMusic, bool abLoopMusic, string& asTextCat, string& asTextEntry, int alEndNum);


void OnStart()
{
SetEntityPlayerInteractCallback("NAMEOFENTITY", "NAMEOFCALLBACK", true);
}

void NAMEOFCALLBACK(string &in asEntity)
{
StartPlayerLookAt("NAMEOFWHATHESHOULDLOOKAT", 3, 5, "");
AddTimer("", 1, "Message_func")
}

void Message_func(string &in asTimer)
{
SetMessage("CATEGORY", "ENTRY", 2);
AddTimer("", 2, "CreditStart);
}

void CreditStart(string &in asTimer)
{
StartCredits("NAMEOFMUSIC.ogg", LOOP? true or false, string& asTextCat, string& asTextEntry, int alEndNum);
//Starts the end credits screen.    asMusic - the music to play (including .ogg)
  abLoopMusic - determines whether the music should loop
  asTextCat - the category to be used in the .lang file (must be “Ending”)
  asTextEntry - the entry in the .lang file (must be “MainCredits”)
  alEndNum - Amnesia has 3 different endings and displays a code  at the bottom. Determines which code is displayed. 0-2 will display  codes, any other integer will not.//
}

(This post was last modified: 02-01-2012, 08:09 PM by SilentStriker.)
02-01-2012, 08:03 PM
Find
Datguy5 Offline
Senior Member

Posts: 629
Threads: 25
Joined: Dec 2011
Reputation: 12
#3
RE: Make player look at entity?

(02-01-2012, 08:03 PM)SilentStriker Wrote: You use a
SetEntityPlayerInteractCallback(string& asName, string& asCallback, bool abRemoveOnInteraction);

then in the void you use

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

and AddTimer
(string& asName, float afTime, string& asFunction);

then on the void from the timer you use
SetMessage(string& asTextCategory, string& asTextEntry, float afTime);

then maby another timer and then in the other timer void you use
StartCredits(string& asMusic, bool abLoopMusic, string& asTextCat, string& asTextEntry, int alEndNum);


void OnStart()
{
SetEntityPlayerInteractCallback("NAMEOFENTITY", "NAMEOFCALLBACK", true);
}

void NAMEOFCALLBACK(string &in asEntity)
{
StartPlayerLookAt("NAMEOFWHATHESHOULDLOOKAT", 3, 5, "");
AddTimer("", 1, "Message_func")
}

void Message_func(string &in asTimer)
{
SetMessage("CATEGORY", "ENTRY", 2);
AddTimer("", 2, "CreditStart);
}

void CreditStart(string &in asTimer)
{
StartCredits("NAMEOFMUSIC.ogg", LOOP? true or false, string& asTextCat, string& asTextEntry, int alEndNum);
//Starts the end credits screen.    asMusic - the music to play (including .ogg)
  abLoopMusic - determines whether the music should loop
  asTextCat - the category to be used in the .lang file (must be “Ending”)
  asTextEntry - the entry in the .lang file (must be “MainCredits”)
  alEndNum - Amnesia has 3 different endings and displays a code  at the bottom. Determines which code is displayed. 0-2 will display  codes, any other integer will not.//
}
Ok,lets test!

Aww not working.Crash report says something about unexpected end of file. Heres my hps file

////////////////////////////
// Run when the map starts
void OnStart()
{
AddUseItemCallback("", "And", "Locked", "KeyOnDoor", true);
SetEntityCallbackFunc("And", "OnPickup");
SetEntityCallbackFunc("Antidote", "OnPickup2");
SetEntityPlayerInteractCallback("Antidote", "Win", true);
AddEntityCollideCallback("Player", "Message_1", "Message1", true, 1);
AddEntityCollideCallback("Player", "End", "Message2", true, 1);
}


void Message1(string &in asChild, string &in asParent, int alState)
{
SetMessage("Messages", "Popup1", 0);
}
void Message2(string &in asChild, string &in asParent, int alState)
{
SetMessage("Messages", "Popup2", 0);
}
void OnPickup(string &in asEntity, string &in type)
{
SetEntityActive("grunt_1", true);
}
void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("Locked", false, true);
PlaySoundAtEntity("", "explosion_rock_large.snt", "Locked", 0, false);
RemoveItem("And");
}
void OnPickup2(string &in asEntity, string &in type)
{
SetEntityActive("Master", true);
}
void Win(string &in asEntity)
{
StartPlayerLookAt("Master", 3, 5, "");
AddTimer("", 1, "Message_func")
}
void Message_func(string &in asTimer)
{
SetMessage("Messages", "Popup3", 2);
AddTimer("", 2, "CreditStart);
}
void CreditStart(string &in asTimer)
{
StartCredits("ending_daniel.ogg", true, , "Ending", 1);
}
////////////////////////////
// Run when entering map
void OnEnter()
{
}
////////////////////////////
// Run when leaving map
void OnLeave()
{
}

(This post was last modified: 02-02-2012, 03:13 PM by Datguy5.)
02-01-2012, 08:10 PM
Find
FinBanana Offline
Junior Member

Posts: 29
Threads: 4
Joined: Jan 2012
Reputation: 0
#4
RE: Make player look at entity?


I think the AddTimer line needs a ';'
Example below:
void Win(string &in asEntity)
{
StartPlayerLookAt("Master", 3, 5, "");
AddTimer("", 1, "Message_func");
}




I'm not 100 % sure if this works, but I'd give it a try.

02-01-2012, 09:29 PM
Find
SilentStriker Offline
Posting Freak

Posts: 950
Threads: 26
Joined: Jul 2011
Reputation: 43
#5
RE: Make player look at entity?

(02-01-2012, 09:29 PM)FinBanana Wrote: I think the AddTimer line needs a ';'
Example below:
void Win(string &in asEntity)
{
StartPlayerLookAt("Master", 3, 5, "");
AddTimer("", 1, "Message_func");
}




I'm not 100 % sure if this works, but I'd give it a try.
It should have a ; I forgot it when making the code for him xD



02-01-2012, 09:33 PM
Find
Datguy5 Offline
Senior Member

Posts: 629
Threads: 25
Joined: Dec 2011
Reputation: 12
#6
RE: Make player look at entity?

Ohh lets see that then Big Grin
Still not working >.< it still says unexpected end of file.
////////////////////////////
// Run when the map starts
void OnStart()
{
AddUseItemCallback("", "And", "Locked", "KeyOnDoor", true);
SetEntityCallbackFunc("And", "OnPickup");
SetEntityCallbackFunc("Antidote", "OnPickup2");
SetEntityPlayerInteractCallback("Antidote", "Win", true);
AddEntityCollideCallback("Player", "Message_1", "Message1", true, 1);
AddEntityCollideCallback("Player", "End", "Message2", true, 1);
}


void Message1(string &in asChild, string &in asParent, int alState)
{
SetMessage("Messages", "Popup1", 0);
}
void Message2(string &in asChild, string &in asParent, int alState)
{
SetMessage("Messages", "Popup2", 0);
}
void OnPickup(string &in asEntity, string &in type)
{
SetEntityActive("grunt_1", true);
}
void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("Locked", false, true);
PlaySoundAtEntity("", "explosion_rock_large.snt", "Locked", 0, false);
RemoveItem("And");
}
void OnPickup2(string &in asEntity, string &in type)
{
SetEntityActive("Master", true);
}
void Win(string &in asEntity)
{
StartPlayerLookAt("Master", 3, 5, "");
AddTimer("", 1, "Message_func");
}
void Message_func(string &in asTimer)
{
SetMessage("Messages", "Popup3", 2);
AddTimer("", 2, "CreditStart);
}
void CreditStart(string &in asTimer)
{
StartCredits("ending_daniel.ogg", true, , "Ending", 1);
}
////////////////////////////
// Run when entering map
void OnEnter()
{
}
////////////////////////////
// Run when leaving map
void OnLeave()
{
}


(This post was last modified: 02-02-2012, 07:42 PM by Datguy5.)
02-02-2012, 03:01 PM
Find
Datguy5 Offline
Senior Member

Posts: 629
Threads: 25
Joined: Dec 2011
Reputation: 12
#7
RE: Make player look at entity?

Help would be appreciated!
This is the last obstacle in my custom story.When i solve this i can finally release it!

(This post was last modified: 02-02-2012, 07:32 PM by Datguy5.)
02-02-2012, 05:51 PM
Find
Datguy5 Offline
Senior Member

Posts: 629
Threads: 25
Joined: Dec 2011
Reputation: 12
#8
RE: Make player look at entity?

Still not solved Sad

02-03-2012, 06:01 PM
Find
Inurias Offline
Junior Member

Posts: 20
Threads: 0
Joined: Jan 2012
Reputation: 2
#9
RE: Make player look at entity?

By taking a short look I noticed two things:

fix:
AddTimer("", 2, "CreditStart);
to:
AddTimer("", 2, "CreditStart");

And add a third parameter to this:
StartCredits("ending_daniel.ogg", true, , "Ending", 1);

-Inurias
02-03-2012, 06:12 PM
Find
Datguy5 Offline
Senior Member

Posts: 629
Threads: 25
Joined: Dec 2011
Reputation: 12
#10
RE: Make player look at entity?

Now it says expected expression value.
Wtf?!

02-03-2012, 06:59 PM
Find




Users browsing this thread: 2 Guest(s)