Page 1 of 1

Playing sound when touching a passable actor

Posted: Sun Jun 10, 2018 6:06 am
by Cherno
I have a bunch of jungle plants and I would like to play a "rustling leaves" sound when the player touches ( = goes through) the vegetation. The plant itself should be passable, of course. Is this possible? I don't want to create small sector lines around each plant with Linedefs actions.

Re: Playing sound when touching a passable actor

Posted: Sun Jun 10, 2018 7:50 am
by Apeirogon
In zscript, yes. You only need override can collide with virtual, like

Code: Select all

class bush : actor
{
override bool cancollidewith (actor other, bool passive)
{
if(other)
{
a_playsound(rustling leaves);
}
return false;
}

other actor stuff
} 
In decorate you need workaround. Like spawn harmless projectile in position on bush, which at "attack" play rustling leaves sound, or try to use acs and a_warp functions.