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
How do I make timers trigger when I enter a specific area?
Author Message
HeadyBoy Offline
Junior Member

Posts: 45
Joined: Jul 2012
Reputation: 0
Post: #1
How do I make timers trigger when I enter a specific area?
I don't know if this is possible but I really want to see if I can do it.
In my custom story the guy you play as has a conversation with somebody at the other side of the door before he opens a door for you.


I want vocals from the guy you play as to come out at the player and I want the vocals from the other character to come out at the other side of the wall and afterwards, the guy behind the door is going to pull a lever to open up door for you to go through.

Does anybody know how to do this? Can it be done?

Voice Actor - Male, British Accent, Mid-teens, Adaptable
Custom Stories - "The Heist: Amnesia" (In production)
(This post was last modified: 07-22-2012 12:22 AM by HeadyBoy.)
07-21-2012 08:07 PM
Find all posts by this user Quote this message in a reply
i3670 Offline
Senior Member

Posts: 432
Joined: Oct 2011
Reputation: 11
Post: #2
RE: How to trigger one thing after another
Timers and PlaySoundAtEntity?

"There is but one philosophical problem. Suicide." - Camus

The Dreamstride WIP
07-21-2012 10:15 PM
Find all posts by this user Quote this message in a reply
HeadyBoy Offline
Junior Member

Posts: 45
Joined: Jul 2012
Reputation: 0
Post: #3
RE: How to trigger one thing after another
I'm a bit of a newibe. Thanks, I'll try and do something with that

(Doublepost)

I am looking for tutorials on how make timers. Could somebody give me a basic script for when a player enters an area that triggers a timer that plays a sound?

Pretty please<3

Voice Actor - Male, British Accent, Mid-teens, Adaptable
Custom Stories - "The Heist: Amnesia" (In production)
(This post was last modified: 07-21-2012 11:38 PM by HeadyBoy.)
07-21-2012 11:18 PM
Find all posts by this user Quote this message in a reply
Mackiiboy Offline
Member

Posts: 101
Joined: Jan 2012
Reputation: 11
Post: #4
RE: How to trigger one thing after another
(07-21-2012 11:18 PM)HeadyBoy Wrote:  I am looking for tutorials on how make timers. Could somebody give me a basic script for when a player enters an area that triggers a timer that plays a sound?

Pretty please<3
.
Check the Engine Script page and you will learn how to do it. I have written down everything you will need, below:

void OnStart()
{
    AddEntityCollideCallback("Player", "NameOfYourArea", "TriggerFunc", true, 1);
}

void TriggerFunc(string &in asParent, string &in asChild, int alState)
{
    AddTimer("", 3.0f, "SoundTimer");
}

void SoundTimer(string &in asTimer)
{
    PlaySoundAtEntity("", "NameOfYourSoundFile.snt", "NameOfTheEntityToCreateTheSoundAt", 0, false);
}

/////////////////////////////////////////
////// From the Engine Scripts:
////////////////////////////////////////

void AddEntityCollideCallback(string& asParentName, string& asChildName, string& asFunction, bool abDeleteOnCollide, int alStates);


Calls a function when two entites collide.
Callback syntax: void MyFunc(string &in asParent, string &in asChild, int alState)

alState: 1 = enter, -1 = leave
asParentName - internal name of main object
asChildName - internal name of object that collides with main object (asterix (*) NOT supported!)
asFunction - function to call
abDeleteOnCollide - determines whether the callback after it was called
alStates - 1 = only enter, -1 = only leave, 0 = both


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

Creates a timer which calls a function when it expires.
Callback syntax: void MyFunc(string &in asTimer)

asName - the name of the timer
afTime - time in seconds
asFunction - the function to call


void PlaySoundAtEntity(string& asSoundName, string& asSoundFile, string& asEntity, float afFadeTime, bool abSaveSound);

Creates a sound on an entity.

asSoundName - internal name
asSoundFile - the sound to use + extension .snt
asEntity - the entity to create the sound at, can be “Player”
afFadeTime - time in seconds the sound needs to fade
abSaveSound - determines whether a sound should “remember” its
state. If true, the sound is never attached to the entity! Also note
that saving should on be used on looping sounds!
07-22-2012 02:43 AM
Visit this user's website Find all posts by this user Quote this message in a reply
HeadyBoy Offline
Junior Member

Posts: 45
Joined: Jul 2012
Reputation: 0
Post: #5
RE: How do I make timers trigger when I enter a specific area?
I will give that a try once I get my voices done. Thank you ever so much.

Voice Actor - Male, British Accent, Mid-teens, Adaptable
Custom Stories - "The Heist: Amnesia" (In production)
07-22-2012 02:51 PM
Find all posts by this user Quote this message in a reply
Post Reply 




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