Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gravity sensor is not Eden Compatible #234

Open
butch2k opened this issue Oct 16, 2024 · 6 comments
Open

Gravity sensor is not Eden Compatible #234

butch2k opened this issue Oct 16, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@butch2k
Copy link

butch2k commented Oct 16, 2024

Gravity Sensor Create function is missing this bit:
`
params ["_sensor", "_sensorId"];

// If only one of the two parameter is passed (not authorized).
if ((!(isNil "_sensor") && (isNil "_sensorId")) || ((isNil "_sensor") && !(isNil "_sensorId"))) exitWith
{
"Missing one of the two parameters for 'fn_createGravitySensor.sqf'!" call BIS_fnc_error;
};

// If used during mission.
if ((isNil "_sensor") && (isNil "_sensorId")) then
{
player removeItem colsog_sensor_gravityInventoryItem;
_sensor = createVehicle [colsog_sensor_gravityInventoryItem, getPosATL player, [], 0.5, "CAN_COLLIDE"];

// Giving an idea to log it in records, this will give the ability to differentiate them.
COLSOG_sensorIdCounter = COLSOG_sensorIdCounter + 1;
_sensor setVariable ["COLSOG_sensorID", COLSOG_sensorIdCounter, true];
hintSilent format ["ID_" + str (COLSOG_sensorIdCounter)];
publicVariable "COLSOG_sensorIdCounter";

};

// If used in Eden Editor.
if (!(isNil "_sensor") && !(isNil "_sensorId")) then
{
_sensor setVariable ["COLSOG_sensorID", _sensorId, true];
};
`

As it is currently it can't be deployed in Eden as SensorId is not settable.

@gerard-sog
Copy link
Owner

Will take a look today or tomorrow 👍

@gerard-sog
Copy link
Owner

If you follow the step in 12.1 'Gunqhot' sensor, it should work:

[this, 25] execVM "functions\sensors\gunshot\fn_createGunshotSensor.sqf";

image

@gerard-sog
Copy link
Owner

20241016210433_1

@butch2k This works.

Only thing to keep in mind is that the ID of the sensor needs to be a high value. In my example I used 25 because player will not place more than 25 sensors. Else worst case, there will be two sensors with ID_25 (will not cause any issue).

CONCLUSION:

  • It can be deployed in Eden editor and sensorID needs to be fixed in 'init' section of the object in the Editor.

Issue will be closed later during the week

@butch2k
Copy link
Author

butch2k commented Oct 16, 2024

Nope it's the Gravity Sensor code which is not correct. If you check the code it lacks the same failsafes as the createGunshotSensor Function, it tries to initialize using the publicVariable and generate an error. I edited the code to have it working properly as underlined above else it generate errors like:

14:37:19 Error in expression < [0, 0, -5];
COLSOG_sensorIdCounter = COLSOG_sensorIdCounter + 1;
_sensor setV>
14:37:19 Error position: <COLSOG_sensorIdCounter + 1;
_sensor setV>
14:37:19 Error Undefined variable in expression: colsog_sensoridcounter
14:37:19 File mpmissions__cur_mp.cam_lao_nam\functions\sensors\gravity\fn_createGravitySensor.sqf..., line 10

@gerard-sog
Copy link
Owner

Ok will take a look for this during the weekend :)

@gerard-sog gerard-sog added the bug Something isn't working label Oct 20, 2024
@gerard-sog
Copy link
Owner

Sorry for long time , not on computer for several weeks due to trip in different country. Will work on it when back 🪖

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants