EDIT: Thanks mod
I've been messing with attaching sounds to bullets and the like, but am coming across some trouble with it in some cases in multiplayer.
For example, I've got a D30 with a firedEH attached to it. When the FiredEH is triggered, it will locate the shell via Nearobjects and use the Say command.
This is what it looks like:
_bullet = nearestObject [getpos _this select 0, _this select 4];
while {alive _bullet} do
{
_bullet say "Sound";
sleep 10;
};
;
That works perfectly fine for players near the firing gun, but for players who are far away, the fired EH won't even activate.
I've tried a number of things, such as:
_bullet setvehicleinit "[this] execVM 'makenoise.sqf'; "; processinitcommands;
That doesn't work, as SVI only works on units, not shells.
"ShellInFlight" addPublicVariableEventHandler {[_this select 1] execVM "makenoise.sqf"; };
ShellInFlight = _bullet;
publicvariable "ShellInFlight";
for some reason, if run locally on the firer, the firer will see ShellInFlight as 234123: Shell.P3D, but other clients will see <NULL-OBJECT>, if they are a large distance away.
The most successful way of getting sounds to play on a shell in flight, regardless of the client's distance from the firer, is by creating a gamelogic or invisable H, forcing that to play the sound, and continously setposing it to the location of the shell in the air. However, that removes the doppler effect, and sounds kind of akward.
Do any of you guys have suggestions to get all clients on a server to hear the sound of a bullet, even if the bullet is out of visual range?
Thanks in advance.