Jump to content
donpachiyarou

Playing Sounds by specific key input possible?

Recommended Posts

Hi

im running Dominaton 4.55 on my server (Donpachi Field)and i want to implement a new function as the title says

what i want to do is

1.player enter specific key ( i think  "Custom Action 1~20" which player can decide what key to assign wolud be best)

2.Custom Action 1~20 plays specific sounds like 1:Give me Ammo 2:Revive me 3:Fire in the Hole 4:Enemy Submarine Spotted 5:Negative

3.player who entered specific key and the player around him can hear that sound

 

is this idea possile? playing sounds via trigger,radio alpha~juliet is already possible on simple test mission but this method has limit,that only 10 sounds can be played

plz consider that Domination is extremely complex mission and i know almost nothing about scripting, what i did on this mission is

1.addaction to MHQ(Teleport to Base,Arsenal,Heal)

2.change cars spawns from MHQ

3.change CSAT's gear/behaivor to weeken AI

4.make player strong by reduce damage 1/6

only this,i just copy&pasted those usefull topix found on this forum.none of them are my idea

plz give me a great ideas

thanks!

 

Share this post


Link to post
Share on other sites

*

Edited by Maff
Ignore - Post got messed up!

Share this post


Link to post
Share on other sites
59 minutes ago, donpachiyarou said:

what i want to do is

1.player enter specific key ( i think  "Custom Action 1~20" which player can decide what key to assign wolud be best)

2.Custom Action 1~20 plays specific sounds like 1:Give me Ammo 2:Revive me 3:Fire in the Hole 4:Enemy Submarine Spotted 5:Negative

3.player who entered specific key and the player around him can hear that sound


I have no time to play around in Arma but off the top of my head you could...
Detect key presses with displayAddEventHandler "KeyDown", though I'm not sure how to detect Custom action 1-20.

You can reference DIK_KeyCodes, and use playSound3D to play the required sound.

This is not tested. It is just a rough idea to get you started.

#include "\a3\ui_f\hpp\definedikcodes.inc"

DON_testKeyPress_A =
findDisplay 46 displayAddEventHandler
[
	"KeyDown",
	{
		params ["_ctrl","_button","_BtnShift","_BtnCtrl","_BtnAlt"];

		//	Play alarm sound when Number pad 5 key is pressed.
		if (_button isEqualTo DIK_NUMPAD5) then
		{
			playSound3D ["A3\Sounds_F\sfx\alarm_independent.wss", player]
		};
	}
];

Good luck!

 

Share this post


Link to post
Share on other sites

This is tested and working:

 

initPlayerLocal.sqf

private [ "_dummy", "_mission_display" ];

//wait for mission display (46)
waitUntil
{
 _mission_display = findDisplay 46;
 not isNull _mission_display
};

//code which is executed if a key gets pressed
private _code =
{
 params [ "", "_key" ];

 if (_key in actionKeys "User1") then { playSound3D [ getMissionPath "sfx\give_me_ammo.ogg", player ]; };
 false
};

//event handler for detecting a key down
_mission_display displayAddEventHandler ["KeyDown", _code];

 

between the "if" statement and the "false" just insert a line like this to get another sound played on another key press:

if (_key in actionKeys "User2") then { playSound3D [ getMissionPath "sfx\revive_me.ogg", player ]; };

The 20 custom Action Keys have a string representation from "User1" to "User20".

 

  • Like 2

Share this post


Link to post
Share on other sites

Works Fine!!!Thank you!!!!!!!!

What I did is just changing soundfile's name/directry!

this will make Domination more interesting! thank you again!

 

  • Like 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×