Un-hardcode rebel tactical loadout system so it can be expanded upon via config#1968
Un-hardcode rebel tactical loadout system so it can be expanded upon via config#1968ToallaNova-O2D wants to merge 5 commits into
Conversation
Fixed an uncommented line (689)
Fixed wrong position.
Cleaning LWTraces used for debugging.
bb811d8 to
e740565
Compare
|
Why are you doing this? What about this issue is so important to you that you want to implement it no matter what? |
|
Your title was way overloaded with information. The PR's draft state is better conveyed through the intended flag, and a related issue can be linked through the sidebar, under Development. I hope I'm not giving you false hope, because this is probably the most anyone's willing to look at this PR. |
I was browsing through the issue list, i found this one and said "let's see if it can be handled", i gave it a go, refactored the chance issue, passed it through LLM to see how to un-hardcode the loadout part, tested it on some cases and it worked, so i proposed it as a fix. It's not an issue that is close to my heart or anything else.
I appreciate your feedback on the issue, and thank you for your honesty. If no one is willing to look at it just because it was passed through an LLM, so be it. At least it helps to change the standard loadouts for rebel soldiers and give them more than 12 fixed options, and the solution is there for anyone to see if it's worth adding it. |
For starters, i ask forgiveness to all devs for the headaches of these two days, i'm just re-learning some things and produced a lot of hiccups on how to create, load, modify and commit changes. Also, for clarity: This code is AI based, but refined through testing and debugging so it doesn't produce problems. As such, is marked as DRAFT, so i can take feedback and keep on refining it.
Addresses #1680 and un-hardcodes rebel loadouts from LW_Overhaul.uc, allowing ini configurations through LW_Overhaul.ini.
NEW:
1.Defines 6 config array variables:
1.1 REBEL_WEAPON_CATEGORIES for storing Weapons, ordered by category, reads from INI.
1.2 REBEL_OFFENSIVE_ITEMS for storing Offensive items, reads from INI.
1.3 REBEL_DEFENSIVE_ITEMS for storing Defensive items, reads from INI.
1.4 REBEL_UTILITY_ITEMS for storing Utility items, reads from INI.
1.5 REBEL_ALWAYS_EQUIP for storing permanent equipment, reads from INI.
1.6 REBEL_UTILITY_ARCHETYPES for storing different archetypes, reads from INI.
Creates two structures:
2.1 RebelWeaponCategoryEntry for storing an array of different tiers of a same category.
2.2 RebelUtilityArchetype for storing different loadouts for each inventory slot.
Uses 4 new helper functions:
3.1. RollRebelWeaponTier validates the requirements for each tier, and calculates the chance for each level.
3.2 GetWeaponForTier reads RebelWeaponCategoryEntry and gets the associated weapon for the tier.
3.3 GetUtilityPool reads RebelUtilityArchetype and loads the array of values defined in that type (OFF,DEF,UTIL).
3.4. RollLegacyLoadout as a fallback to legacy (using static loadouts with concatenated strings) in case there are no values defined in INI.
CHANGES:
4. Modifies CreateRebelSoldier function: Currently, the tier and weapon category is calculated inside the function, and the loadout is created by concatenating the result at the end on ApplyLoadout. Now, each calculation is made on different functions.
4.1 Validates that the arrays for weapons and archetypes are not empty, and fallbacks to legacy in case they are.
4.2 Weapon category gets chosen for equal chances between those defined in INI. (RAND(REBEL_WEAPON_CATEGORIES.length)
4.3 Item Archetype gets chosen for equal chances between those defined in INI. (RAND(REBEL_UTILITY_ARCHETYPES.length))
4.4 Each slot chooses an item from the previous archetype, with equal chances between them (RAND(Array.length)).
4.5 Always equipped items are loaded at the end.
Compiled against latest master (20260530), tested for rendezvous mission, see video, images and log info attached.
2AE0F1_1.mp4