Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: KyriakosCH on Fri 16/06/2017 10:20:09

Title: Simple (basic) question about global trigger for sound, tied to objects
Post by: KyriakosCH on Fri 16/06/2017 10:20:09
Hi, i would like to have a sound (asomething) play each time any object in any room is "looked at".

How do i script it? I know it will be very easy, but i am not aware of global commands tied to user actions (look at in this case), so pls help :=
Title: Re: Simple (basic) question about global trigger for sound, tied to objects
Post by: Gilbert on Fri 16/06/2017 10:31:20
Try to look up unhandled_event from the manual, but I think you still need to add the code to each instance when that event is "handled".
Title: Re: Simple (basic) question about global trigger for sound, tied to objects
Post by: KyriakosCH on Fri 16/06/2017 11:34:02
Thanks :) In that case i can (also) just add the asomething.Play() to each object, i was just hoping there was a way to tie ALL objects to this when looked at ^_^
Title: Re: Simple (basic) question about global trigger for sound, tied to objects
Post by: Snarky on Fri 16/06/2017 14:44:19
There is. You can add it in the on_mouse_click() handler. Check whether it's over an object (GetLocationType()), and check if the click was a look (exactly how depends on your UI), and if so, play the sound.
Title: Re: Simple (basic) question about global trigger for sound, tied to objects
Post by: KyriakosCH on Fri 16/06/2017 15:03:53
Ok (nod)