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
Some Coding Questions
Adrianis Offline
Senior Member

Posts: 620
Threads: 6
Joined: Feb 2012
Reputation: 27
#8
RE: Some Coding Questions

(07-15-2013, 02:17 PM)Alex Ros Wrote: New question.

Is it possible to script areas so when a player just looks at them the voiced over monologue would be pronounced aloud? I mean free-roaming and free-looking. For example, if a player by himself will look at the window (just for example) and at the moment he will point his eyes at the window a voiced-over monologue would be triggered? Is that possible at all? Without touching anything, just by looking at some particular area.

I presume it's not possible. I suppose it's not possible with just a player looking at something. I suppose player should enter the area and that would trigger voice-script, no other way... or I am wrong and looking at the area is also could trigger scripted voice-over?

Yeh it's totally possible.

http://wiki.frictionalgames.com/hpl2/amn...s#entities

5th on the list for Entity related functions is SetEntityPlayerLookAtCallback, you can use a script area in place of the entity name. Then in the function that the LookAtCallback calls, you can use PlayMusic or whichever function suits for the sound files you have

Here's some sample code

void OnStart()
{
    SetEntityPlayerLookAtCallback("ScriptArea", "LookedAtWindow", true);
}

void LookedAtWindow(string &in strEntity, int inState)
{
    PlayMusic("Talking.ogg", false, 10, 0, 1, false);
}

I'm only using the PlayMusic function because it's the simplest, you'll only need the sound file in .ogg to use it. Check out the details for the parameters to give to PlayMusic so that it suits you're needs.

With the LookAtCallback, once you've implemeneted that test it to make sure it doesn't trigger through a wall, I've had issues with that before. You could potentially make the window into an Entity just for the purposes of using that function in case you have problems with the script area.


EDIT: ninja'd! scum! oh well. In addition to all that Alex, you may find it useful to take the time to read through the whole list of functions on the engine script page. You don't need to understand them all, or even know how to use them instantly, but it's really helpful just from the name & descriptions to know what is technically possible given the options there. Many people underestimate how important it is just to have a basic overview of everything first, before you get into specifics

(This post was last modified: 07-15-2013, 02:29 PM by Adrianis.)
07-15-2013, 02:26 PM
Find


Messages In This Thread
Some Coding Questions - by Alex Ros - 07-09-2013, 05:14 PM
RE: Some Coding Questions - by Streetboat - 07-09-2013, 05:37 PM
RE: Some Coding Questions - by Adrianis - 07-10-2013, 05:21 PM
RE: Some Coding Questions - by DnALANGE - 07-10-2013, 07:00 PM
RE: Some Coding Questions - by The chaser - 07-10-2013, 07:11 PM
RE: Some Coding Questions - by Alex Ros - 07-10-2013, 07:53 PM
RE: Some Coding Questions - by Kreekakon - 07-15-2013, 02:20 PM
RE: Some Coding Questions - by Alex Ros - 07-15-2013, 02:26 PM



Users browsing this thread: 2 Guest(s)