Frictional Games Forum (read-only)
Adding text to PlayerLookAt - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: Adding text to PlayerLookAt (/thread-18376.html)



Adding text to PlayerLookAt - danimora2012 - 09-16-2012

I think this is where i post errors and stuff
So...here is the problem...

My player looks at a statue...wich i want him to...but i also want text to apear when that occurs...
What do i need to add?...Also the sound is not working..why...
That makes 2 Problems...
1. I want to make text apear
2. The sound to start when player is looking
Can you help me out? Blush

Here's my script...



PlayMusic("Scary.ogg", true, 0.9, 1.0, 1, true);
AddEntityCollideCallback("Player", "lookarea1", "look", true, 1);
}

void look(string &in asParent, string &in asChild, int alState)
{
SetPlayerActive(false);
StartPlayerLookAt("stephano_1", 3.0f, 5.0f, "");
AddTimer("timer01", 2.5f, "StopLook");
PlaySoundAtEntity("", "Letsgetthem.snt", "Player", 0, false);
}

void StopLook(string &in asTimer)
{
StopPlayerLookAt();
SetPlayerActive(true);
}

////////////////////////////
// Run when leaving map
void OnLeave()
{
StopMusic(1 , 1);
}


RE: Adding text to PlayerLookAt - Your Computer - 09-16-2012

You post all scripting issues in DEVELOPMENT SUPPORT, not technical support.

If you want to play a sound the moment the player looked at the object you forced him to look at, you need to provide a callback for the StartPlayerLookAt function and in that callback play the sound. If you want text to appear on screen for the player, use SetMessage.


RE: Adding text to PlayerLookAt - danimora2012 - 09-16-2012

(09-16-2012, 09:37 PM)Your Computer Wrote: You post all scripting issues in DEVELOPMENT SUPPORT, not technical support.

If you want to play a sound the moment the player looked at the object you forced him to look at, you need to provide a callback for the StartPlayerLookAt function and in that callback play the sound. If you want text to appear on screen for the player, use SetMessage.
GOD DANGIT!! Ok thank you...


RE: Adding text to PlayerLookAt - i3670 - 09-17-2012

You can create an area around the statue that dissappears after use. This depends on how far away the statue is though. I think there's a box called PlayerLookAtCallback, just fill that in with the desired callback name e.g. "AreaLookAtStatue" or something.

You could also add another timer like 1.5f or 1.0f that when that triggers the message shows.

Is the sound a custom sound? If so, how did you convert it to .ogg? simply renaming it .ogg won't do it. I use Audacity when making sounds and then export them as .ogg