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

Set unit names according to their faction #2804

Merged
merged 11 commits into from
Aug 19, 2023

Conversation

MadBender
Copy link

What type of PR is this.

  1. Bug
  2. Change
  3. Enhancement

What have you changed and why?

All units used to have Greek names regardless of their faction. Now unit names depend on their faction. NATO units have Western names, CSAT will have Chinese/Iranian names etc. Names were customized for vanilla, RHS and CUP factions, other faction will still use Greek names, this can be fixed later.

A3A_fnc_createUnit now always sets the unit's identity to ensure that each unit has his identity configured. There was a bug when faction identity did not apply to rebel garrisons and maybe in some other cases.

Please verify the following and ensure all checks are completed.

  1. Have you loaded the mission in LAN host?
  2. Have you loaded the mission on a dedicated server?

Is further testing or are further changes required?

  1. No
  2. Yes (Please provide further detail below.)

How can the changes be tested?

Steps:

Find a field, look to the north and run

private _pos = getPos player;

private _fnc_makeSafe = {
    params ["_group"];
    _group setCombatMode "BLUE"; 
    _group setBehaviourStrong "CARELESS"; 
    {
        _x disableAI "TARGET";  
        _x disableAI "AUTOTARGET"; 
        _x stop true; 
        _x setCaptive true; 
    } forEach units _group;
};

private _fnc_getSquad = {
    params ["_type"];
    (_type splitString "_") select 0;
};

private _fnc_spawnFaction = {
    params ["_faction", "_side", "_prefix", "_pos"];
    private _group = createGroup _side;
    private _loadouts = keys(_faction get "loadouts");
    _loadouts sort true;
    private _lastSquad = "";
    {
        private _squad = _x call _fnc_getSquad;
        private _offset = switch (_lastSquad) do {
            case (""): {0};
            case (_squad): {2};
            default {4};
        };
        _pos = _pos vectorAdd [_offset, 0, 0];

        private _loadout = format["loadouts_%1_%2", _prefix, _x];
        [_group, _loadout, _pos] call A3A_fnc_createUnit;
        _lastSquad = _squad;
    } forEach _loadouts;
    _group call _fnc_makeSafe;
    _group;
};

private _rebels = [A3A_faction_reb, resistance, "reb", _pos vectorAdd[0, 5, 0]] call _fnc_spawnFaction;
{
    [_x, _x getVariable "unitType"] call A3A_fnc_FIAinit;
} forEach units _rebels;

private _occupants = [A3A_faction_occ, west, "occ", _pos vectorAdd[0, 10, 0]] call _fnc_spawnFaction;
{
    _x call A3A_fnc_NATOinit;
} forEach units _occupants;

private _invaders = [A3A_faction_inv, east, "inv", _pos vectorAdd[0, 15, 0]] call _fnc_spawnFaction;
{
    _x call A3A_fnc_NATOinit;
} forEach units _invaders;

[A3A_faction_civ, civilian, "civ", _pos vectorAdd[0, 20, 0]] call _fnc_spawnFaction;

@Bob-Murphy
Copy link

Hey, cheers for the PR.
Small question:
The name lists you added, where are they from?
Are all name lists added to vanilla templates in vanilla Arma, all RHS-template related lists from the RHS mods and so on?
I for example doubt that TakistaniMen is available in vanilla Arma but it's applied to Vanilla_AI_CSAT_Arid.sqf. Sounds like a CUP list.

@MadBender
Copy link
Author

Names are taken from configfile >> "CfgWorlds" >> "GenericNames"

image

Normally, these names are referenced via genericNames parameter in the unit class, e.g. configfile >> "CfgVehicles" >> "B_Soldier_A_F" >> "genericNames". I placed different units in the editor and checked their genericNames and put what I found into the faction templates.

Mods can declare their own name lists or use vanilla lists, for example all US-based factions use NATOMen from vanilla. TakistaniMen is also from vanilla.

@Bob-Murphy Bob-Murphy added this to the 3.3 milestone Jul 1, 2023
Copy link

@Lazejun Lazejun left a comment

Choose a reason for hiding this comment

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

Why did you unmute the Civs?

Your Whole PR talks about Setting names and changing a few Functions, while you are silently unmuting Civs.

@Lazejun Lazejun added the Change requested A change has been requested, and this can't be merged until it's done. label Jul 2, 2023
@MadBender
Copy link
Author

@Lazejun since civilian factions don't have voices defined, createRandomIdentity will set NoVoice for them, and they will remain muted

https://github.com/MadBender/A3-Antistasi/blob/e16c1f9fb938f25e317133a7ce18affaf1ce9b2d/A3A/addons/core/functions/Utility/fn_createRandomIdentity.sqf#L39-L45

@MadBender MadBender requested a review from Lazejun July 2, 2023 10:51
Copy link

@Lazejun Lazejun left a comment

Choose a reason for hiding this comment

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

"this can be fixed later."

Well yes, if you add a Placeholder.

["attributesVehicles", []] call _fnc_saveToTemplate;

"GreekMen" call _fnc_saveNames;

else you are gonna get for each faction thats not done yet:

12:57:30 Error in expression <tity getOrDefault ["lastName", ""];
if (_firstName != "" || _lastName != "") the>
12:57:30   Error position: <_firstName != "" || _lastName != "") the>
12:57:30   Error Undefined variable in expression: _firstname
12:57:30 File \x\A3A\addons\core\functions\Utility\fn_setIdentityLocal.sqf [A3A_fnc_setIdentityLocal]..., line 29
12:57:30  ➥ Context: 	[] L29 (\x\A3A\addons\core\functions\Utility\fn_setIdentityLocal.sqf [A3A_fnc_setIdentityLocal])

@MadBender
Copy link
Author

set default voices, faces and names for all factions, so the code may assume they are always present

@MadBender MadBender requested a review from Lazejun July 3, 2023 13:16
@Bob-Murphy Bob-Murphy modified the milestones: 3.3, 3.4 Jul 15, 2023
@Lazejun Lazejun added Ready for merge and removed Change requested A change has been requested, and this can't be merged until it's done. Review pending labels Jul 18, 2023
Copy link

@jaj22 jaj22 left a comment

Choose a reason for hiding this comment

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

Code looks good and moving the identity-selection code to createUnit is an improvement. My one caveat is that you're passing more data over the network unnecessarily with the hashmap-parameters. It's probably negligible compared to other costs of creating units (esp. with our template system) but Arma's so inefficient at passing SQF data over the network that it makes me nervous.

On balance I think merge as-is and maybe optimize the parameter passing later if I get the urge. Should probably have been in the 3.3 test but that caught me a bit cold.

Co-authored-by: Jouni Järvinen <[email protected]>
@jaj22
Copy link

jaj22 commented Jul 26, 2023

Probably needs updating for the new templates (RHS chdkz, various SPE stuff, did I miss anything?). If you don't have SPE then I'll deal with it.

@Bob-Murphy
Copy link

New templates need to be adapted as well.

@MadBender
Copy link
Author

Sorry for delay, don't have much time for ARMA right now.

I never intended to configure all factions in a single PR, I don't even have most of paid DLCs. So I made this configuration optional. Unconfigured factions will work as before and can be configured later.

If this is the only problem then I suggest to merge to unstable and test with many players. We can make small PRs for other factions later

@jaj22
Copy link

jaj22 commented Aug 9, 2023

Yeah checked, it uses the template defaults to set greek voice/face/name, so it shouldn't break anything badly on new templates and should be good for merge.

@Bob-Murphy Bob-Murphy merged commit cddec7c into official-antistasi-community:unstable Aug 19, 2023
@Bob-Murphy Bob-Murphy added the Added to changelog Added to changelog label Nov 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants