Jump to content

What are the most important sounds for you while using JSRS?  

179 members have voted

  1. 1. What are the most important sounds for you while using JSRS?

    • The weapon sounds!
    • The vehicle sounds!
    • Environmental sounds!
    • Explosions, Soniccracks, Bullethits, the sound of danger!
    • The script features like the "distance sounds"!
    • Everything combined! The whole Mod itself is important.


Recommended Posts

Does anyone know if J.S.R.S has to be on the server to use it? I mean, is it possible to only have it client side and put the keys on my server? And then use it on my client?

Share this post


Link to post
Share on other sites

It's only client side. Regarding keys: You can either disable all addons on server , disable=don't allow them, or you allow specific ones(enabling signature check), then you put the keys , i guess jsrs.bikey , into the servers key folder, so it will check every client, or you simply allow all addons=disable signature check. But regarding your question, simply use it as client.

Share this post


Link to post
Share on other sites
Does anyone know if J.S.R.S has to be on the server to use it? I mean, is it possible to only have it client side and put the keys on my server? And then use it on my client?

Doesn't need to be on the server, only the .bikey file in the keys folder.

It's a purely client-side mod.

Share this post


Link to post
Share on other sites

Ok guys,

I have some terrible weeks behind me. There was no time to do anything. So you had to wait for some info, I'm sry.

I will fully concentrate on JSRS the following week and will aim for a release next weekend. JSRS is in a good condition and we have to do some tests, fixing the last few errors and adding some small stuff.

JSRS 1.5 will be the last version most likely, so no JSRS 1.6 or something like that. I wont work further to another "new version". I will aim troubleshooting, and for other addons or mods and will provide my work to those who may need sounds for their work.

JSRS wont be dead, no no. If you receive errors or issues I will fix them with patches as usual for sure. I will try to support JSRS as long as possible, but only to the release of Arma 3, since I will try to fully focus on that one.

To make a release next weekend possible I need to leave out some features I wanted to implement. For example the dynamic echo, the Gau8 on distance script (Not sure yet), inside building sounds (for weapons), gear depending gear sounds (only soldier class depending sounds yet). For those feature to be done I need massiv work of professional scripter and those are really rare in this forum as we know. So I will wait with those feature for a later release maybe and will provide them as a patch.

Ok, I will keep you updated on the testing we'll about to start today.

Thanks for staying with us ;)

LJ

Edited by LordJarhead

Share this post


Link to post
Share on other sites

Great news LJ, I hope the testing goes well, you know where to find another large number of testers if needed ;-)

What are these features wich you want to leave out for?

Inside Bulding Sounds? Is it as cool as I think it is?

Share this post


Link to post
Share on other sites
Great news LJ, I hope the testing goes well, you know where to find another large number of testers if needed ;-)

What are these features wich you want to leave out for?

Inside Bulding Sounds? Is it as cool as I think it is?

Yes, it is a gun-sound that only get played being inside a building. So when standing inside a building you hear a loud hard echo... from being inside a building and shooting your gun there^^ Problem is, I dunno how to create that script (bounding box system or something) and Robalo has all hands full with other stuff... so I wont be able to get this done in time....

LJ

Share this post


Link to post
Share on other sites
Yes, it is a gun-sound that only get played being inside a building. So when standing inside a building you hear a loud hard echo... from being inside a building and shooting your gun there^^ Problem is, I dunno how to create that script (bounding box system or something) and Robalo has all hands full with other stuff... so I wont be able to get this done in time....

LJ

That sounds very interesting, I think ACE_SM is going to implement this and HARCP (was it called like that?) already had this. Maybe you should contact the makers of these addons.

Share this post


Link to post
Share on other sites

looking forward to teh release jarhead. do you think you'll continue with sound modding in arma3?

Share this post


Link to post
Share on other sites
...Problem is, I dunno how to create that script (bounding box system or something)...

Maybee i can help you again a little bit by doing this. ;)

I have new ideas and a little bit time too. If i will found the needed time i make contact with you until next thursday.

regards

Share this post


Link to post
Share on other sites
-Psycho-;2243293']Maybee i can help you again a little bit by doing this. ;)

I have new ideas and a little bit time too. If i will found the needed time i make contact with you until next thursday.

regards

That sounds dynamite ;)

LJ

Share this post


Link to post
Share on other sites
Yes, it is a gun-sound that only get played being inside a building. So when standing inside a building you hear a loud hard echo... from being inside a building and shooting your gun there^^ Problem is, I dunno how to create that script (bounding box system or something) and Robalo has all hands full with other stuff... so I wont be able to get this done in time....

LJ

I put together a script which detects if you're inside a building for you. I originally tried using the bounding box for houses but found it unreliable. The script uses the lineIntersects and lineIntersectsWith scripting commands to draw lines from your head every time you fire. If they are interupted, it will tell you how high the ceiling is (different sounds for different room sizes?) and also if there are any objects in proximity to you. It also returns what the objects are. (If you wanted to calculate dynamic echo based on what kind of objects are near you). I added in the check for objects around you as you might be in a ruined church (on Utes for example) and not have a roof, but still have walls around you. There was a problem where being under a tree made the script think you were in a building, but I've eliminated that problem.

It's just a proof of concept, but I hope it helps. Please feel free to use or modify it if you want to. The only problem I can find is that it can't detect the roof of the mosque (no classname). It is possible to workaround that, but I haven't checked it out yet.

Here's a video of it in use. Watch in 720 to read the hint panel:

6x6ASMLfL4Q

CODE:

Add a fired eventhandler to the player unit:

0 = this addEventHandler ["fired", {_this execVM "building.sqf"}];

And contents of building.sqf:

// fired array [unit, weapon, muzzle, mode, ammo, magazine, projectile]

private ["_player","_eyePos","_obAbove","_obLeft","_obRight","_obFront","_obRear","_nameLeft","_nameRight","_nameFront","_nameRear"];

_player = _this select 0;

// get position of players eyes (very close to the players ears)

_eyePos = eyePos _player;

// detect if a line drawn from the players head is broken by a roof above it.  If so, how high is the roof?  Also, detect if objects are within 5m of the player.

_obAbove = (lineIntersectsWith [_eyePos, _player modelToWorld [0, 0, (_eyePos select 2) +30], _player]) select 0;
_obLeft = (lineIntersectsWith [_eyePos, _player modelToWorld [-5, 0, _eyePos select 2], _player]) select 0;
_obRight = (lineIntersectsWith [_eyePos, _player modelToWorld [5, 0, _eyePos select 2], _player]) select 0;
_obFront = (lineIntersectsWith [_eyePos, _player modelToWorld [0, 5, _eyePos select 2], _player]) select 0;
_obRear = (lineIntersectsWith [_eyePos, _player modelToWorld [0, -5, _eyePos select 2], _player]) select 0;

_nameLeft = getText (configFile >> "CfgVehicles" >> typeOf _obLeft >> "displayName");
_nameRight = getText (configFile >> "CfgVehicles" >> typeOf _obRight >> "displayName");
_nameFront = getText (configFile >> "CfgVehicles" >> typeOf _obFront >> "displayName");
_nameRear = getText (configFile >> "CfgVehicles" >> typeOf _obRear >> "displayName");

switch (true) do
{
case (lineIntersects [_eyePos, _player modelToWorld [0, 0, (_eyePos select 2) + 1], _player] and _obAbove isKindOf "All"):
{
	hint format ["Ceiling is less than ONE meter above your head.  \n\nLeft: %1 \n\nRight: %2 \n\nFront: %3 \n\nRear: %4", _nameLeft, _nameRight, _nameFront, _nameRear];
};
case (lineIntersects [_eyePos, _player modelToWorld [0, 0, (_eyePos select 2) + 4], _player] and _obAbove isKindOf "All"):
{
	hint format ["Ceiling is less than FOUR meters above your head.  \n\nLeft: %1 \n\nRight: %2 \n\nFront: %3 \n\nRear: %4", _nameLeft, _nameRight, _nameFront, _nameRear];
};
case (lineIntersects [_eyePos, _player modelToWorld [0, 0, (_eyePos select 2) + 10], _player] and _obAbove isKindOf "All"):
{
	hint format ["Ceiling is less than TEN meters above your head.  \n\nLeft: %1 \n\nRight: %2 \n\nFront: %3 \n\nRear: %4", _nameLeft, _nameRight, _nameFront, _nameRear];
};
case (lineIntersects [_eyePos, _player modelToWorld [0, 0, (_eyePos select 2) + 20], _player] and _obAbove isKindOf "All"):
{
	hint format ["Ceiling is less than TWENTY meters above your head.  \n\nLeft: %1 \n\nRight: %2 \n\nFront: %3 \n\nRear: %4", _nameLeft, _nameRight, _nameFront, _nameRear];
};
default
{
	hint format ["You are Outside.  \n\nLeft: %1 \n\nRight: %2 \n\nFront: %3 \n\nRear: %4", _nameLeft, _nameRight, _nameFront, _nameRear];
};
};

You could modify it to get a better stereo picture of what the ear hears (adding more lines drawn from the players head or change the angles they are fired off at). There doesn't seem to be much overhead for this script.

If you want it, here is the code for calculating if player is in a building using boundingBox scripting command but as I mentioned, it's pretty crappy. Sometimes, it seems to register when you are outside of buildings as well as inside them. Also, it won't detect some buildings properly. (Probably my crappy coding skills).

private ["_xrange","_yrange","_player","_nBuilding","_dims","_worldDimsMin","_worldDimsMax","_xmin","_ymin","_zmin","_xmax","_ymax","_zmax","_posx","_posy","_posz"];

_player = _this select 0;

///////////////////////////////////////////////////////////////////
//  CHECKING IF IN BOUNDING BOX

_nBuilding = nearestBuilding _player;

_player sideChat format [ "houses %1", typeOf _nBuilding];

if (getNumber (configFile >> "CfgVehicles" >> typeOf _nBuilding >> "scope") != 1) exitWith {hint "not a building!!!"};

_dims = boundingBox _nBuilding;

_worldDimsMin = _nBuilding modelToWorld (_dims select 0);
_worldDimsMax = _nBuilding modelToWorld (_dims select 1);


_xmin = _worldDimsMin select 0;
_ymin = _worldDimsMin select 1;
_zmin = _worldDimsMin select 2;

_xmax = _worldDimsMax select 0;
_ymax = _worldDimsMax select 1;
_zmax = _worldDimsMax select 2;

_posx = getPosATL _player select 0;
_posy = getPosATL _player select 1;
_posz = getPosATL _player select 2;

if ( _xmin > _xmax) then {_xrange = [_xmax, _xmin]} else {_xrange = [_xmin, _xmax];};
if ( _ymin > _ymax) then {_yrange = [_ymax, _ymin]} else {_yrange = [_ymin, _ymax];};

if (
(_posx > _xrange select 0) and
(_posx < _xrange select 1) and
(_posy > _yrange select 0) and
(_posy < _yrange select 1) and
(_posz > _zmin) and
(_posz < _zmax)
) then 
{
hint "in building";
} else
{
hint "not in building";
};

I put this together last night, but I couldn't upload to YT, hence the late reply.

Share this post


Link to post
Share on other sites
I put together a script which detects if you're inside a building for you. I originally tried using the bounding box for houses but found it unreliable. The script uses the lineIntersects and lineIntersectsWith scripting commands to draw lines from your head every time you fire. If they are interupted, it will tell you how high the ceiling is (different sounds for different room sizes?) and also if there are any objects in proximity to you. It also returns what the objects are. (If you wanted to calculate dynamic echo based on what kind of objects are near you). I added in the check for objects around you as you might be in a ruined church (on Utes for example) and not have a roof, but still have walls around you. There was a problem where being under a tree made the script think you were in a building, but I've eliminated that problem.

It's just a proof of concept, but I hope it helps. Please feel free to use or modify it if you want to. The only problem I can find is that it can't detect the roof of the mosque (no classname). It is possible to workaround that, but I haven't checked it out yet.

I put this together last night, but I couldn't upload to YT, hence the late reply.

Good buy "dream of a better JSRS", welcome immense work, welcome 1 TB JSRS! :D

Thank you so much DasAttorney! This is awesome. Will work with that asap and see what I can do, I might even need your help further, is it ok to PM you later with some questions?

Well, pretty awesome man. Thanks alot again ;)

Main quesion would be, how to connect it with sounds, and how will this work? Is it like playing a sound from the left when an object is to my left or is it more like a code you will need to play what ever sound like: "Ceiling=OpenArea, Front=0, Rear=0, Right=0, Left=Ural} play sound= UralLeftOnly", so that a certain set of constellation gets a certain set of sound samples?

It would be interesting to see how this can select a sound buy having certain informations....

LJ

Edited by LordJarhead

Share this post


Link to post
Share on other sites

Be my guest :) Gonna be AFK for some of tonight, but have the day off tomorrow so will focus on this properly then if okay?

I'm happy to help, your mod is awesomesauce!

Share this post


Link to post
Share on other sites
Be my guest :) Gonna be AFK for some of tonight, but have the day off tomorrow so will focus on this properly then if okay?

I'm happy to help, your mod is awesomesauce!

Cheers mate ;)

LJ

Share this post


Link to post
Share on other sites

The script, made by myself, is ready. (and a little bit smarter ;-)

This one can only check if you are realy inside a building. But a sound reflection are also become if you are close to bigger objects (like tanks or walls) or if you stay byside a wall. And it can check if you are inside a small backyard.

You can get it tommorw, LJ.

regards

Edited by [TcB]-Psycho-

Share this post


Link to post
Share on other sites

Awesome, sounds really good.

No hard feelings this end, glad something's in the works to help LJ :)

Share this post


Link to post
Share on other sites
-Psycho-;2243624']The script' date=' made by myself, is ready. (and a little bit smarter ;-)

This one can only check if you are realy inside a building. But a sound reflection are also become if you are close to bigger objects (like tanks or walls) or if you stay byside a wall. And it can check if you are inside a small backyard.

You can get it tommorw, LJ.

regards[/quote']

Sounds good man!

Maybe we can even combine both ideas if needed. The greatest goal would be the best solution between Sound and Performance ;)

LJ

PS: All these new ideas will (of course) change the ETA of the release again most likely. If we can implement those features, why shouldn't we wait a bit longer and get it done right right away, right? Right!

Edited by LordJarhead

Share this post


Link to post
Share on other sites

Yes, maybee we can compare both a little bit. I will have a look on it tomorrow.

Share this post


Link to post
Share on other sites
Sounds good man!

Maybe we can even combine both ideas if needed. The greatest goal would be the best solution between Sound and Performance ;)

LJ

PS: All these new ideas will (of course) change the ETA of the release again most likely. If we can implement those features, why shouldn't we wait a bit longer and get it done right right away, right? Right!

Damn right!

Share this post


Link to post
Share on other sites

Here are my scripts. I had compared my scripts with these from Das Attorney and hopefully picked up the benefits from both.

init.sqf:

diag_log format ["############################# %1 #############################", missionName];

if (!isNil "tcb_init_started") exitWith {};
tcb_init_started = true;
enableSaving [false,false];
enableTeamswitch false;

#define __ccppfln(file1) call compile preprocessFileLineNumbers #file1
__ccppfln(common_functions.sqf);

if (local player) then {execVM "object_finder.sqf"};

common_functions.sqf:

// get all enterable building within a range of 100metres around a given object or position
// input 
// output: array of objects, from class "houese"
jsrs_fnc_getEnterableHousesinRange = {
private ["_enterable_houses","_allhouses", "_pos"];
_enterable_houses = [];
_pos = _this select 0;
_pos = if ((typeName _pos == "ARRAY") && (count _pos >= 2)) then {_pos} else {position _pos};
_allhouses = nearestObjects [_pos, ["House"], 100];
if (!isNil "_allhouses" && count _allhouses > 0) then {
	{
		if (((_x buildingPos 0) select 0) != 0) then {_enterable_houses set [count _enterable_houses, _x]};
	} foreach _allhouses;
};
_enterable_houses
};

// check for an buidling near a given object, otional especialy for given classname and returns true if its found or false if not and the object self
// use a logic "place" in the editor is the best way to use this function
// vars: [this] call jsrs_fnc_nearestBuilding;
// output: object
jsrs_fnc_nearestBuilding = {
private ["_obj"];
_obj = nearestBuilding (_this select 0);
_obj
};

// check for an buidling near a given object, otional especialy for given classname and returns true if its found or false if not and the object self
// use a logic "place" in the editor is the best way to use this function
// vars: [this, "classname"] call jsrs_fnc_nearestBuilding;
// output: array, [bool, object]
jsrs_fnc_nearestObject = {
private ["_obj","_list"];
_list = [];
_list = nearestObjects [(_this select 0), ["House","Walls","Tank"],40];
if (count _list > 0) then {
	_obj = _list select 0;
	_obj = if (_obj isKindOf "StreetLamp") then {Nil} else {_obj};
} else {
	_obj = objNull;
};
_obj
};

// put one array in another
// input: []array1, array2]
// output: array1, compared with array2
jsrs_fnc_arrayPushStack = {
{(_this select 0) set [count (_this select 0), _x]} foreach (_this select 1);
(_this select 0)
};

// get height of object
// _height = tank1 call jsrs_fnc_getHeightATL;
jsrs_fnc_getHeightATL = {getPosATL _this select 2};

jsrs_fnc_getPosY = {position _this select 1};

jsrs_fnc_getPosX = {position _this select 0};

// checks the box min/max ranges and give out true if you are in range of a box
jsrs_fnc_checkBox = {
private ["_box","_player","_worldDimsMin","_worldDimsMax","_bool","_xrange","_yrange","_obj"];
_box = _this select 0;
_player = _this select 1;
_obj = _this select 2;
_worldDimsMin = _obj modelToWorld (_box select 0);
_worldDimsMax = _obj modelToWorld (_box select 1);

_xrange = if (_worldDimsMin select 0 > _worldDimsMax select 0) then {[((_worldDimsMax select 0) + 5), ((_worldDimsMin select 0) + 5)]} else {[((_worldDimsMin select 0) + 5), ((_worldDimsMax select 0) + 5)]};
_yrange = if (_worldDimsMin select 1 > _worldDimsMax select 1) then {[((_worldDimsMax select 1) + 0), ((_worldDimsMin select 1) + 0)]} else {[((_worldDimsMin select 1) + 0), ((_worldDimsMax select 1) + 0)]};

_bool = if ((((getPosATL _player select 0) + 0) > _xrange select 0) && (((getPosATL _player select 0) - 0) < _xrange select 1) && (((getPosATL _player select 1) + 0) > _yrange select 0) && (((getPosATL _player select 1) - 0) < _yrange select 1)) then {true} else {false};
_bool
};

// check if you are between two close objects
jsrs_fnc_lineCheck = {
private ["_eyePos","_player","_obLeft","_obRight","_obFront","_obRear","_bool"];
_player = _this select 0;
_eyePos = [getPosASL _player select 0, getPosASL _player select 1, getPosASL _player select 2];

_obLeft = lineIntersects [_eyePos, _player modelToWorld [-5, 0, _eyePos select 2], player];
_obLeftb = lineIntersects [_eyePos, _player modelToWorld [-5, -5, _eyePos select 2], player];
_obLeftf = lineIntersects [_eyePos, _player modelToWorld [-5, 5, _eyePos select 2], player];
_obRight = lineIntersects [_eyePos, _player modelToWorld [5, 0, _eyePos select 2], player];
_obRightb = lineIntersects [_eyePos, _player modelToWorld [5, -5, _eyePos select 2], player];
_obRightf = lineIntersects [_eyePos, _player modelToWorld [5, 5, _eyePos select 2], player];
_obFront = lineIntersects [_eyePos, _player modelToWorld [0, 5, _eyePos select 2], player];
_obRear = lineIntersects [_eyePos, _player modelToWorld [0, -5, _eyePos select 2], player];

_bool = if (_obLeft || _obLeftb || _obLeftf || _obRight || _obRightb || _obRightf || _obFront || _obRear) then {true} else {false};
_bool
};

// check if you are close to a object with lineintersects
// more precise as fnc above but also more performant
jsrs_fnc_lineCheck2 = {
private ["_player","_pos","_radius","_angle","_intersect","_eyePos","_distanceBetweenRoadBarriers","_count","_step","_a","_b","_pos_rad","_post"];
_player = _this select 0;
_pos = [getPosASL _player select 0, getPosASL _player select 1, getPosASL _player select 2];;
_radius = 5;
_angle = 360;
_intersect = false;
_eyePos = [getPosASL _player select 0, getPosASL _player select 1, getPosASL _player select 2];

_distanceBetweenRoadBarriers = 3;
_count = round ((2 * 3.14592653589793 * _radius) / _distanceBetweenRoadBarriers);
_step = 360 / _count;

for "_x" from 0 to _count do {
	_a = (_pos select 0) + (sin (_angle) * _radius);
	_b = (_pos select 1) + (cos (_angle) * _radius);
	_pos_rad = [_a,_b, _pos select 2];
	_angle = _angle + _step;
	_obLeft = lineIntersects [_eyePos, _pos_rad, player];
	if (_obLeft) exitWith {_intersect = true};
};
_intersect
};

object_finder.sqf:

// by Psycho
private ["_p", "_pos", "_can_see_the_sky"];

if (!local player) exitWith {};
_p = player;
_pos = position player;

jsrs_holder_z = "HeliHEmpty" createVehicleLocal [0,0,0];


while {true} do {
sleep 0.2;
_building = [_p] call jsrs_fnc_nearestObject;

if (!isNil "_building") then {
	_box = boundingBox _building;
	_range = if (((_box select 1) select 0) > ((_box select 1) select 1)) then {((_box select 1) select 0)} else {((_box select 1) select 1)};

	if (_building isKindOf "Tank") then {
		if (_p distance _building < (_range + 3)) then {
			if (vehicle _p == _p) then {
				hintSilent "sound is reflected";
			};
		};
	} else {
		if (_p distance _building < (_range + 5)) then {
			_building_high = (_box select 1) select 2;
			_player_altitude = (_p call jsrs_fnc_getHeightATL) + 1;

			if (([_box, _p, _building] call jsrs_fnc_checkBox) || ([_p] call jsrs_fnc_lineCheck2)) then {
				if (_building_high < _player_altitude) then {
					jsrs_holder_z setPosATL [(getPos _p select 0),(getPos _p select 1),((getPosATL _p select 2)  + 50)];
					_can_see_the_sky = if (lineIntersects [eyePos _p, position jsrs_holder_z]) then {false} else {true};
					if !(_can_see_the_sky) then {
						hintSilent "sound is reflected";
					};
				} else {
					hintSilent "sound is reflected";
				};
			};
		} else {
			if ([_p] call jsrs_fnc_lineCheck2) then {
				hintSilent "sound is reflected";
			};
		};
	};
} else {
	if ([_p] call jsrs_fnc_lineCheck2) then {
		hintSilent "sound is reflected";
	};
};
sleep 0.3;
hintSilent "";
};

You can test it in the Editor. Simply create the 3 files above and start the map.

I have detected sometime problems with walls. Also sometime the detection failed at building corners where a bad compositions of two or more buildings are placed. (especialy if a very big building close to some small around)

The code are not triggered by the fired event cause i think this will make some problems running missions and overlap with the shoots self.

So the code can set a players global var to knows the players position before he is shooting.

The loop can slow down in the final version to save performance.

regards

Share this post


Link to post
Share on other sites
-Psycho-;2243919']Here are my scripts. I had compared my scripts with these from Das Attorney and hopefully picked up the benefits from both.

init.sqf:

diag_log format ["############################# %1 #############################", missionName];

if (!isNil "tcb_init_started") exitWith {};
tcb_init_started = true;
enableSaving [false,false];
enableTeamswitch false;

#define __ccppfln(file1) call compile preprocessFileLineNumbers #file1
__ccppfln(common_functions.sqf);

if (local player) then {execVM "object_finder.sqf"};

common_functions.sqf:

// get all enterable building within a range of 100metres around a given object or position
// input 
// output: array of objects, from class "houese"
jsrs_fnc_getEnterableHousesinRange = {
private ["_enterable_houses","_allhouses", "_pos"];
_enterable_houses = [];
_pos = _this select 0;
_pos = if ((typeName _pos == "ARRAY") && (count _pos >= 2)) then {_pos} else {position _pos};
_allhouses = nearestObjects [_pos, ["House"], 100];
if (!isNil "_allhouses" && count _allhouses > 0) then {
	{
		if (((_x buildingPos 0) select 0) != 0) then {_enterable_houses set [count _enterable_houses, _x]};
	} foreach _allhouses;
};
_enterable_houses
};

// check for an buidling near a given object, otional especialy for given classname and returns true if its found or false if not and the object self
// use a logic "place" in the editor is the best way to use this function
// vars: [this] call jsrs_fnc_nearestBuilding;
// output: object
jsrs_fnc_nearestBuilding = {
private ["_obj"];
_obj = nearestBuilding (_this select 0);
_obj
};

// check for an buidling near a given object, otional especialy for given classname and returns true if its found or false if not and the object self
// use a logic "place" in the editor is the best way to use this function
// vars: [this, "classname"] call jsrs_fnc_nearestBuilding;
// output: array, [bool, object]
jsrs_fnc_nearestObject = {
private ["_obj","_list"];
_list = [];
_list = nearestObjects [(_this select 0), ["House","Walls","Tank"],40];
if (count _list > 0) then {
	_obj = _list select 0;
	_obj = if (_obj isKindOf "StreetLamp") then {Nil} else {_obj};
} else {
	_obj = objNull;
};
_obj
};

// put one array in another
// input: []array1, array2]
// output: array1, compared with array2
jsrs_fnc_arrayPushStack = {
{(_this select 0) set [count (_this select 0), _x]} foreach (_this select 1);
(_this select 0)
};

// get height of object
// _height = tank1 call jsrs_fnc_getHeightATL;
jsrs_fnc_getHeightATL = {getPosATL _this select 2};

jsrs_fnc_getPosY = {position _this select 1};

jsrs_fnc_getPosX = {position _this select 0};

// checks the box min/max ranges and give out true if you are in range of a box
jsrs_fnc_checkBox = {
private ["_box","_player","_worldDimsMin","_worldDimsMax","_bool","_xrange","_yrange","_obj"];
_box = _this select 0;
_player = _this select 1;
_obj = _this select 2;
_worldDimsMin = _obj modelToWorld (_box select 0);
_worldDimsMax = _obj modelToWorld (_box select 1);

_xrange = if (_worldDimsMin select 0 > _worldDimsMax select 0) then {[((_worldDimsMax select 0) + 5), ((_worldDimsMin select 0) + 5)]} else {[((_worldDimsMin select 0) + 5), ((_worldDimsMax select 0) + 5)]};
_yrange = if (_worldDimsMin select 1 > _worldDimsMax select 1) then {[((_worldDimsMax select 1) + 0), ((_worldDimsMin select 1) + 0)]} else {[((_worldDimsMin select 1) + 0), ((_worldDimsMax select 1) + 0)]};

_bool = if ((((getPosATL _player select 0) + 0) > _xrange select 0) && (((getPosATL _player select 0) - 0) < _xrange select 1) && (((getPosATL _player select 1) + 0) > _yrange select 0) && (((getPosATL _player select 1) - 0) < _yrange select 1)) then {true} else {false};
_bool
};

// check if you are between two close objects
jsrs_fnc_lineCheck = {
private ["_eyePos","_player","_obLeft","_obRight","_obFront","_obRear","_bool"];
_player = _this select 0;
_eyePos = [getPosASL _player select 0, getPosASL _player select 1, getPosASL _player select 2];

_obLeft = lineIntersects [_eyePos, _player modelToWorld [-5, 0, _eyePos select 2], player];
_obLeftb = lineIntersects [_eyePos, _player modelToWorld [-5, -5, _eyePos select 2], player];
_obLeftf = lineIntersects [_eyePos, _player modelToWorld [-5, 5, _eyePos select 2], player];
_obRight = lineIntersects [_eyePos, _player modelToWorld [5, 0, _eyePos select 2], player];
_obRightb = lineIntersects [_eyePos, _player modelToWorld [5, -5, _eyePos select 2], player];
_obRightf = lineIntersects [_eyePos, _player modelToWorld [5, 5, _eyePos select 2], player];
_obFront = lineIntersects [_eyePos, _player modelToWorld [0, 5, _eyePos select 2], player];
_obRear = lineIntersects [_eyePos, _player modelToWorld [0, -5, _eyePos select 2], player];

_bool = if (_obLeft || _obLeftb || _obLeftf || _obRight || _obRightb || _obRightf || _obFront || _obRear) then {true} else {false};
_bool
};

// check if you are close to a object with lineintersects
// more precise as fnc above but also more performant
jsrs_fnc_lineCheck2 = {
private ["_player","_pos","_radius","_angle","_intersect","_eyePos","_distanceBetweenRoadBarriers","_count","_step","_a","_b","_pos_rad","_post"];
_player = _this select 0;
_pos = [getPosASL _player select 0, getPosASL _player select 1, getPosASL _player select 2];;
_radius = 5;
_angle = 360;
_intersect = false;
_eyePos = [getPosASL _player select 0, getPosASL _player select 1, getPosASL _player select 2];

_distanceBetweenRoadBarriers = 3;
_count = round ((2 * 3.14592653589793 * _radius) / _distanceBetweenRoadBarriers);
_step = 360 / _count;

for "_x" from 0 to _count do {
	_a = (_pos select 0) + (sin (_angle) * _radius);
	_b = (_pos select 1) + (cos (_angle) * _radius);
	_pos_rad = [_a,_b, _pos select 2];
	_angle = _angle + _step;
	_obLeft = lineIntersects [_eyePos, _pos_rad, player];
	if (_obLeft) exitWith {_intersect = true};
};
_intersect
};

object_finder.sqf:

// by Psycho
private ["_p", "_pos", "_can_see_the_sky"];

if (!local player) exitWith {};
_p = player;
_pos = position player;

jsrs_holder_z = "HeliHEmpty" createVehicleLocal [0,0,0];


while {true} do {
sleep 0.2;
_building = [_p] call jsrs_fnc_nearestObject;

if (!isNil "_building") then {
	_box = boundingBox _building;
	_range = if (((_box select 1) select 0) > ((_box select 1) select 1)) then {((_box select 1) select 0)} else {((_box select 1) select 1)};

	if (_building isKindOf "Tank") then {
		if (_p distance _building < (_range + 3)) then {
			if (vehicle _p == _p) then {
				hintSilent "sound is reflected";
			};
		};
	} else {
		if (_p distance _building < (_range + 5)) then {
			_building_high = (_box select 1) select 2;
			_player_altitude = (_p call jsrs_fnc_getHeightATL) + 1;

			if (([_box, _p, _building] call jsrs_fnc_checkBox) || ([_p] call jsrs_fnc_lineCheck2)) then {
				if (_building_high < _player_altitude) then {
					jsrs_holder_z setPosATL [(getPos _p select 0),(getPos _p select 1),((getPosATL _p select 2)  + 50)];
					_can_see_the_sky = if (lineIntersects [eyePos _p, position jsrs_holder_z]) then {false} else {true};
					if !(_can_see_the_sky) then {
						hintSilent "sound is reflected";
					};
				} else {
					hintSilent "sound is reflected";
				};
			};
		} else {
			if ([_p] call jsrs_fnc_lineCheck2) then {
				hintSilent "sound is reflected";
			};
		};
	};
} else {
	if ([_p] call jsrs_fnc_lineCheck2) then {
		hintSilent "sound is reflected";
	};
};
sleep 0.3;
hintSilent "";
};

You can test it in the Editor. Simply create the 3 files above and start the map.

I have detected sometime problems with walls. Also sometime the detection failed at building corners where a bad compositions of two or more buildings are placed. (especialy if a very big building close to some small around)

The code are not triggered by the fired event cause i think this will make some problems running missions and overlap with the shoots self.

So the code can set a players global var to knows the players position before he is shooting.

The loop can slow down in the final version to save performance.

regards

Oo ... ok. Thats looks promising so far. Got it to run on Zargabad. I'm not familiar with scripting stuff. Still, I know. Is this script about to be placed in a missions folder like the one from Das Attorney? And if so, how to implement it into the already existing JSRS script?

So, the "sound get reflected" means, that another, extra sound file we can place somewhere within the script will be played at that moment of shooting? And how to get a sound into the script now to easily test this. That would be really interesting....

To me personal the only thing I would like to archive now is an sound from inside a building. Doesn't matter what kind of building, the script should just recognize when the player is inside a room. So I would just need this script to play a sound which is mixed over the normal shot-sounds when being inside a building. And I guess its easily possible with your version, right?

Thanks alot for your efforts man! Much appreciated!

LJ

Share this post


Link to post
Share on other sites

It is beautiful to see you cooperate together, guys.

Thank you very much for all the effort in this great project.

Share this post


Link to post
Share on other sites

Make a normal mission folder, f.e. with a saved mission at zargabad. Next create three .sqf files and name it like my spoiler headers. If you had made this step simply c&p the content into them and start the mission.

The implementation into the existing jsrs structures... let this be my problem.

This example is only for you to test the environment of the script. If it do what you want we can put it into the strucutures and play a sound with it.

The script checks only the environment and give a true/false output for what ever we want to do with it. All following things are another one.

If you want to mix another sound over existing or play a complete other sound is possible.

btw: If i have to implemnet it in the existing structure you have to send me again the needed files to do so.

Since i had a new SSD all old files from jsrs edititng are away. ;-) Pls per email.

regards

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

×