Page MenuHomeFeedback Tracker

Introduce BIS_DO_NOT_RANDOMIZE variable to disable unit/vehicle randomisation
Closed, ResolvedPublic

Description

By default a vehicle like Offroad for example will get randomised when spawned, i.e. driver door removed or not, cargo door removed or not + other random customisations (this includes military variant of offroad too). Civilians get random glasses hats etc added after unit spawn.

The way I see it there are 2 issues with this:

  1. If you add some code in unit init like

removeGoggles this

the unit might still have goggles because the randomiser script is executed after init and might well add goggles back.

  1. You might want default appearance of a vehicle i.e with all doors intact.

Proposed solution is very simple: Add

if (
!isNil "BIS_DO_NOT_RANDOMIZE" &&
{typeName BIS_DO_NOT_RANDOMIZE == typeName false} &&
{BIS_DO_NOT_RANDOMIZE}
) exitWith {};

to the top of every randomiser script. This will give mission designer an option to disable default randomisation behaviour by simply setting

BIS_DO_NOT_RANDOMIZE = true;

at the mission start or before spawning a unit or vehicle, then setting it back to

BIS_DO_NOT_RANDOMIZE = false;

if randomisation is once again required.

Details

Legacy ID
566860874
Severity
None
Resolution
Duplicate
Reproducibility
Always
Category
Feature Request
Steps To Reproduce

N/A

Event Timeline

Killzone_Kid edited Additional Information. (Show Details)
Killzone_Kid set Category to Feature Request.
Killzone_Kid set Reproducibility to Always.
Killzone_Kid set Severity to None.
Killzone_Kid set Resolution to Duplicate.
Killzone_Kid set Legacy ID to 566860874.May 7 2016, 5:24 PM

I have to elaborate on this further. lets take a look at B_G_Offroad_01_armed_F

It has the following init statement to call randomise script:

init = "(_this select 0) execVM ""\A3\Soft_F_Gamma\Offroad_01\scripts\randomize_IG.sqf""";

randomize_IG:

if (isServer) then {
_this execVM "\A3\soft_f_gamma\Offroad_01\scripts\randomize_doors.sqf";

_this animate [["HideBumper1","HideBumper2"] select floor random 2, 0];
_this animate ["HideBackpacks", 0];
_this animate ["HideConstruction", 0];
_this animate ["HidePolice", 1];
_this animate ["HideServices", 1];

_this setObjectTextureGlobal [0, "\A3\soft_f_gamma\Offroad_01\Data\Offroad_01_ext_IG01_CO.paa"];
_this setObjectTextureGlobal [1, "\A3\soft_f_gamma\Offroad_01\Data\Offroad_01_ext_IG01_CO.paa"];
};

randomize_doors.sqf

if (isServer) then {
_rnd2 = floor random 2;
if (_rnd2 == 1) then
{

		_rnd3 = floor random 3;
		_this animate [["HideDoor1","HideDoor2","HideDoor3"] select _rnd3, 1];
		if (_rnd3 == 1) then {_this animate ["HideGlass2", 1]};
		_this execVM "\A3\soft_F\Offroad_01\scripts\randomize_doors.sqf";

};
};

While I understand the need to hide various elements of offroad to give it military look in randomize_IG, calling randomize_doors IMO is unnecessary and badly implemented at that. Let me explain.

The use of execVM leads to unpleasant visual effect. Offroad spawns with all doors and then user can see the doors disappear in front of his eyes. Why? Because execVM works on its own time, it is up to the engine when to run execVM code, milliseconds or even seconds after command has been executed. Apart from unpleasant visual side effect there is this other thing.

If you want all doors back, there is no way of telling if execVM has finished and you can safely add doors back. You can wait for a second and add them, but if execVM took 1.0000001 seconds to execute the doors may get removed again after you added them.

Another issue is with design of the script. As you can see randomize_doors calls itself!!! This means that theoretically it can go on for a long time, hence making even more impossible to predict when execVM is done. I've had all 3 doors removal happened, this means that randomize_doors was called at least 3 times or more.

Thirdly, this randomisation is purely artistic decision, therefore this should not be hardcoded and imposed on the user. Please give us an option to disable randomisation at will, it is very simple to implement.

Thanks

These issues really are a mission makers worst nightmare.
It's nearly impossible to customize the looks of civilians because of this.
Upvoted.

Dupe of #7805.