Skip to content

Common - Add more loadout randomization options - #1783

Open
DartRuffian wants to merge 19 commits into
CBATeam:masterfrom
DartRuffian:loadout-randomization
Open

Common - Add more loadout randomization options#1783
DartRuffian wants to merge 19 commits into
CBATeam:masterfrom
DartRuffian:loadout-randomization

Conversation

@DartRuffian

Copy link
Copy Markdown
Contributor

When merged this pull request will:

Comment thread addons/common/fnc_randomizeLoadout.sqf Outdated
@DartRuffian
DartRuffian marked this pull request as draft July 26, 2025 17:34
@DartRuffian
DartRuffian marked this pull request as ready for review July 26, 2025 17:43
Comment thread addons/common/fnc_fixAnimation3DEN.sqf Outdated
Comment thread addons/common/XEH_init3DEN.sqf Outdated
Comment thread addons/common/fnc_fixAnimation3DEN.sqf Outdated
Comment thread addons/common/fnc_randomizeLoadout.sqf
Comment thread addons/common/fnc_randomizeLoadout.sqf
Comment thread addons/common/fnc_setIdentity3DEN.sqf Outdated
Comment thread addons/common/fnc_setIdentity3DEN.sqf
Comment thread addons/common/fnc_setIdentity3DEN.sqf
Comment thread addons/common/fnc_setIdentity3DEN.sqf
DartRuffian and others added 7 commits October 29, 2025 13:21
}] call CBA_fnc_addEventHandler;

// Check missionTime so Eden placed units don't have their loadouts randomized twice
["CAManBase", "InitPost", { if (CBA_missionTime > 0.1) then { call CBA_fnc_randomizeLoadout } }] call CBA_fnc_addClassEventHandler;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if there's a more proper way to do this

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

xeh_postInit won't run on 3den (for now at least)

@DartRuffian DartRuffian Dec 5, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The check is so units spawned in Eden don't have their kits randomized again, but units spawned later (e.g. script / zeus) do

Without the missionTime check Eden placed units would have their loadouts randomized on mission start

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ToDo: Should just be called from CuratorObjectPlaced eh

Comment thread addons/common/fnc_getRandomizedEquipment.sqf Outdated
Comment thread addons/common/fnc_randomizeLoadout.sqf
Add delay to eden fixAnimation call to not change animations when creating editorPreviews.
Comment thread addons/common/fnc_randomizeLoadout.sqf Outdated
@DartRuffian

DartRuffian commented Apr 21, 2026

Copy link
Copy Markdown
Contributor Author

Been over a year since this was opened, could some take a look again?

@DartRuffian

Copy link
Copy Markdown
Contributor Author

@PabstMirror

// Loadout randomization
GVAR(randomLoadoutUnits) = createHashMap;
if (is3DEN) then {
add3DENEventHandler ["OnEditableEntityAdded", {

@PabstMirror PabstMirror Jul 25, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will only work for new missions

take existing mission and CBA_facewearList[] gets ignored

because the unit wasn't placed in 3den
and the InitPost runs at mission time 0

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like that's probably fine. Could add a special case where units that only have facewear list get randomized at mission start too but I feel like that'd cause more unexpected behavior for people editing kits

// CBA's frame functions don't work in Eden
_unit spawn {
sleep 0.01;
save3DENInventory [get3DENEntityID _this];

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we have any way to tell if this has been run,
so it's probably best to just not touch 3den loadout and just run in xeh

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It you randomize at mission start you lose any changes made in efen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants