Jonssonsson 0 Posted February 16, 2023 I have been trying to think of a way to execute a script (playSound or say3d so nothing fancy) each time a player controlled unit plants an explosive in a MP scenario. Could this be done with the event handler? I was thinking that maybe doing this with AnimChanged, but the animation for planting an explosive might be used for other actions... Also, this should be ACE compatible and I know ACE has it own system for planting explosives so it might make a difference. Any ideas? Share this post Link to post Share on other sites
_foley 192 Posted February 16, 2023 ACE has this cool event you can hook into: [ "ace_explosives_place", { params ["_explosive", "_dir", "_pitch", "_unit"]; hint str _this; } ] call CBA_fnc_addEventHandler; Can't remember whether it fires on each machine or just for player placing the explosive. 1 Share this post Link to post Share on other sites
Jonssonsson 0 Posted February 16, 2023 A stupid question perhaps, but how would I use that script in practice? Also, that would only work when using ACE and I want this feature to work with and without ACE. Share this post Link to post Share on other sites
POLPOX 778 Posted February 17, 2023 For vanIlla, Fired EH can happen everytime one fires, including plant or throw. 1 Share this post Link to post Share on other sites
Jonssonsson 0 Posted February 17, 2023 Thanks for the tips _foley and POLPOX. I dabbled with ace_explosives_place and Fired EH and I think i got it working according to my expectations. Fired EH did it for vanilla, but it did not work with ACE. At first, ace_explosives_place did not seem to work with ACE at all, but then I realized that the script does not fire when placing an explosive but rather when you are setting the trigger to the explosive (only if you set a detonator as the trigger, does not work for timer for some reason). So I placed this to unit's init for which I want my script to fire each time the unit plants an explosive (in vanilla) or sets a trigger to an explosive (with ACE): this addeventhandler ["fired", {if((_this select 1) in ["Put"]) then { this say3D "mysound"; }; }]; [ "ace_explosives_place", { params ["_explosive", "_dir", "_pitch", "_unit"]; this say3D "mysound"; } ] call CBA_fnc_addEventHandler; This at least seem to work according to my fairly limited testing. Share this post Link to post Share on other sites