Jump to content
Sign in to follow this  
M.Evans

I44 Cricket Sound Globally executed

Recommended Posts

Alright so I have been reading up on PVEH and this other thread in which a guy tried to create a cricket sound. I want to have this be multiplayer compatible, aka some guy clicks once, and can respond with two clicks, and everyone around the area would hear the clicks, enemy or friendly. I would like it to be focused around the say3d command if possible. So here is what I have so far

2 sound files (might only need one cricket click, could just play it twice if I wanted to only use one file. one file is one click, and the other is the return two clicks.)

Addaction in unit init:

this addaction ["Use Cricket","click.sqf"]

Not sure if this is what I need, but I have a click.sqf

player say3D "Clicker2" ;// replace with sound command

_grp = _this select 0;

_p_units=[];

{_p_units = _p_units+[_x]} foreach units group _grp;

_arraymen = nearestObjects [player,["man"],50] - _p_units ;

{if (side _x != west) then { _arraymen=_arraymen -[_x]}} foreach _arraymen;

player say3D "Clicker2" ;// replace with sound command

sleep 2 + random 3;// reply with random delay

player say3D "Clicker2"// replace with sound command

sleep 0.5;

player say3D "Clicker2"// replace with sound command

I think there needs to be something about globally executing the variable, and when I read up on that it just confused me pretty bad. I understand that the code could be used in multiple situations, I just was not sure how to go about using it.

Here is the thread I am referencing,

http://forums.bistudio.com/showthread.php?136476-vehicle-player-say3d-quot-sound-quot-not-global

If anyone can help me out with this it would be very much appreciated.

Share this post


Link to post
Share on other sites

Since I44 needs CBA, you can use :

https://dev-heaven.net/docs/cba/files/network/fnc_globalSay3d-sqf.html#CBA_fnc_globalSay3d

[player, "Clicker2""] call CBA_fnc_globalSay3d;

Obviously as you say, you can also do it by creating a custom PVEH but if you are using CBA itsn't needed.

Didn't knew that I44 included the clicker sound, i created a similar ""script"" long ago just for this, we used it on some missions, it was really cool :P. I can share it if anyone wants it it included the clicker object( needed for the action) and the sound.

Edited by columdrum

Share this post


Link to post
Share on other sites

That would be great I always enjoy looking at other missions that people make. Also it might help me with the problem. And you said the cricket was an item you can actually have in your inventory?

And would I just stick that line for the CBA function in the init line of the player or the init file in the mission. Setup for global things have always messed me up in the past.

Share this post


Link to post
Share on other sites

Here is a way how I play custom sounds without a CBA on all clients in multiplayer. I really don't remember where I got this script, I'm sorry.

I have this executed in client files:

fn_netSay3D = compile preprocessFileLineNumbers "\z\addons\dayz_code\timCompile\fn_netSay3D.sqf";

if (isNil "PVEH_netSay3D") then {
	PVEH_NetSay3D = [objNull,0];
};

"PVEH_netSay3D" addPublicVariableEventHandler {
	private["_array"];
	_array = _this select 1;
	(_array select 0) say3D (_array select 1);
};  

fn_netSay3D.sqf:

private ["_obj","_snd"];

_obj = _this select 0;    //object
_snd = _this select 1;    //sound

// broadcast PV
PVEH_netSay3D = [_obj,_snd];
publicVariable "PVEH_netSay3D";

// run on current machine also if not dedi server
if (not isDedicated) then {_obj say3D _snd};

true  

This is what I have in cfgSounds. db+100 is a volume and 2500 is range. You need to play around these to get the right distance, it depends alot of volume of sound file.

	class timz_crashSiteExplosion {
	name = "timz_crashSiteExplosion";
	sound[] = {"\dayz_sfx\effects\timz_crashSiteExplosion.ogg", db+100, 1, 2500};
	titles[] = {0, ""};
};

Soundfile is .ogg, using Vorbis 1.0. 22kHz, mono. I used Audacity to create it, it's a free, open source program.

This is how I call sound, I have it on serverfiles:

nul = [_crash,"timz_crashSiteExplosion"] call fn_netSay3D; 

_crash is an object.

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
Sign in to follow this  

×