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
Touch an entity/item and something is triggered?
HeadyBoy Offline
Junior Member

Posts: 45
Threads: 16
Joined: Jul 2012
Reputation: 0
#1
Touch an entity/item and something is triggered?

I am a newbie at Amnesia story making and I have been only scripting for about 2 days now.
I'm trying to make, let's say, a sound happen (which I know how to do) for when I pick up maybe, a tinderbox. I'm not entirely sure on how to do this. See I've been using

AddEntityCollideCallback("Player","AREANAME","FUNCTION",true,1);


I have only been triggering sounds when a player goes into a new area but I havent wanted to experiment just in case I screw up something.

What would I do if I wanted to pick up a tinderbox and that triggered any kinda growl?
07-16-2012, 02:01 PM
Find
drunkmonk Offline
Member

Posts: 109
Threads: 7
Joined: Jun 2012
Reputation: 4
#2
RE: Touch an entity/item and something is triggered?

For the most part when you want something to happen when the player picks up an item, its basically the same concept you just need to use SetEntityPlayerInteractCallback("Name_of_Tinderbox", "Function", false);

Edit: the callback syntax is(string &in asEntity)
(This post was last modified: 07-16-2012, 02:07 PM by drunkmonk.)
07-16-2012, 02:05 PM
Find
Ongka Offline
Member

Posts: 225
Threads: 3
Joined: Nov 2010
Reputation: 20
#3
RE: Touch an entity/item and something is triggered?

void OnStart()
{
SetEntityCallbackFunc("ENTER_TINDERBOX_NAME", "FUNCTION_NAME");
}

void FUNCTION_NAME(string &in asEntity, string &in type)
{
PlaySoundAtEntity("growl", "notice.snt", "Player", 0, false);
GiveSanityDamage(7.0f, true);
}
This should do the job.
Change the names how you'd like them.

[Image: 18694.png]
(This post was last modified: 07-16-2012, 02:26 PM by Ongka.)
07-16-2012, 02:26 PM
Find
HeadyBoy Offline
Junior Member

Posts: 45
Threads: 16
Joined: Jul 2012
Reputation: 0
#4
RE: Touch an entity/item and something is triggered?

Thanks. It works awesomely
07-16-2012, 02:36 PM
Find




Users browsing this thread: 1 Guest(s)