#I need a way to retrieve the classname

1 messages · Page 1 of 1 (latest)

tawny maple
#

post me a picture of your respawn menu as you want it atm

#

and post all of your relevant scripts via pastebin or short code blocks

open moon
#

why would I need to change the respawn menu?

tawny maple
#

you don't, i just want to see what you currently have

open moon
#

It's the same as it always was

tawny maple
#

now what 3CB classes do you want to use? i'll be in the process of downloading the mod

#

what units do you have placed down in the editor? what unit inventories do you want to replicate

#

like what is in blufor_squad, give me the whole array

open moon
#

This is the init:

call compileFinal preprocessFileLineNumbers "classnames.sqf";

uk3cbFoundWest = false;
uk3cbFoundEast = false;
private _infantryWest = blufor_squad;
private _infantryEast = opfor_squad;

{
    if ((toLower _x find "uk3cb") == 0 || (toLower _x find "uk3cb") == (count _x - count "uk3cb")) then {
        uk3cbFoundWest = true;
    } else {
        uk3cbFoundWest = false;
    };
} forEach _infantryWest;

{
    if ((toLower _x find "uk3cb") == 0 || (toLower _x find "uk3cb") == (count _x - count "uk3cb")) then {
        uk3cbFoundEast = true;
    } else {
        uk3cbFoundEast = false;
    };
} forEach _infantryEast;

// Client Functions
if (!isDedicated) then {
    [] spawn compileFinal preprocessFileLineNumbers "scripts\client\client_init.sqf";
};

// Create Loadouts
{
    [west, [_x]] call BIS_fnc_addRespawnInventory;
} forEach blufor_squad;

{
    [east, [_x]] call BIS_fnc_addRespawnInventory;
} forEach opfor_squad;
tawny maple
#

alright give me a sec to download the 3cb factions

#

i need to dig through their configs

open moon
#
opfor_faction_3cb_csatpacific = [
    [
        "UK3CB_CSAT_G_O_GL",
        "UK3CB_CSAT_G_O_RIF_1",
        "UK3CB_CSAT_G_O_RIF_2",
        "UK3CB_CSAT_G_O_SNI",
        "UK3CB_CSAT_G_O_TL",
        "UK3CB_CSAT_G_O_UAV",
        "UK3CB_CSAT_G_O_AR",
        "UK3CB_CSAT_G_O_JNR_OFF",
        "UK3CB_CSAT_G_O_MK",
        "UK3CB_CSAT_G_O_SL",
        "UK3CB_CSAT_G_O_MG",
        "UK3CB_CSAT_G_O_MD",
        "UK3CB_CSAT_G_O_LMG",
        "UK3CB_CSAT_G_O_LAT",
        "UK3CB_CSAT_G_O_HAT"
    ],
    [
        "UK3CB_CSAT_G_O_BMD1",
        "UK3CB_CSAT_G_O_BMD1K",
        "UK3CB_CSAT_G_O_BMD1P"
    ]
];

This is the first faction I am testing. opfor_squad = the first array in this array

tawny maple
#

my preemptive tells me that because of how that mod is made, which has a post init script that fills the inventory will either break everything else in that list, or it won't work for itself. all 3CB stuff has that. and its the main reason why I actually never use it

#

its really a mod for the layman, non modder. and its always annoying for modders

#

but hold out until i get it downloaded and i'll dig through their stuff

open moon
#

here's a snippet I have been using for reference

tawny maple
#

what main class is all of that under?

open moon
#

I already added an arsenal init script (the arsenal is populated only with items from the classes) that parses the custom configs.

#

let me check, it was a unit

tawny maple
#

ok so a unit. thats all i need

open moon
#

UK3CB_CSAT_G_O_RIF_1

#

this one specifically

#

3cb is certainly not a mod for the layman. You can't utilize the factions without intimate knowledge of how the mod works, which is why I question the design

#

I would make a patch if it was reasonable to attempt

tawny maple
#

first off, obfuscated - for not even a pvp mission/mod. straight dump. can get through it anyways, its just annoying to do.

secondly, I win:

#

you'll have to do your own function with the classname that I can get you though for post spawning adding of items. that's on you. I did the ui work lol

#

your loadout data will be saved in

`player getVariable "Rylan_LoadoutData"`

unpack it with:

private _loadoutData = player getVariable "Rylan_LoadoutData";
if (isNil "_loadoutData") exitWith {};

_loadoutData params ["_classname", "_displayName", "_config"];

// you now have _classname _displayName and _config to work with
#

@open moon

open moon
#

I'll look at it right now

#

If I put systemChat str _loadoutData; after line 64 the text should show the correct classname as the first element in the displayer array, or is that not the proper way to check its accuracy?

tawny maple
#

look in your log file, i used diag_log

#

and what you suggest will do the whole 3 element array

#

index 0 is the classname

open moon
#

I really hate to say it but it's wrong

#

a few of the classes produce a zero divisor error on line 51

#

it doesn't seem to update when you only select the left dropdown. Maybe my implementation is wrong. Probably that's it, I'll try and figure it out

#

tysm for having the patience to help me on this lol

#

I owe you one

tawny maple
#

it works for the 3 things I tested but that's all i tested

#

and if it errors, its not going to update anyways as the code is killed early

open moon
#

are those three units you tested in the same role?

tawny maple
#

1 is separate, 2 are in same

open moon
#

where did you execute the script from?

tawny maple
#

just had it in init.sqf

#

if it errored at 51, that means nothing was returned at index 1 from the metadata function. so something wasn't populated at some point. just add a check after that to make sure that index 1 exists

open moon
#

I'll do that. Seems the same classes always make it fail. LAT Riflemen, HAT Rifleman, Junior officer, and a few others. I don't see why that should happen, everything should be configured the same way as your test, in essence

tawny maple
#

give me the class names of those and ill test them

open moon
#
        "UK3CB_CSAT_G_O_GL",
        "UK3CB_CSAT_G_O_RIF_1",
        "UK3CB_CSAT_G_O_RIF_2",
        "UK3CB_CSAT_G_O_SNI",
        "UK3CB_CSAT_G_O_TL",
        //"UK3CB_CSAT_G_O_UAV",
        "UK3CB_CSAT_G_O_AR",
        "UK3CB_CSAT_G_O_JNR_OFF",
        "UK3CB_CSAT_G_O_MK",
        "UK3CB_CSAT_G_O_SL",
        "UK3CB_CSAT_G_O_MG",
        "UK3CB_CSAT_G_O_MD",
        "UK3CB_CSAT_G_O_LMG",
        "UK3CB_CSAT_G_O_LAT",
        "UK3CB_CSAT_G_O_HAT"

It might only happen when they are all added

#
        "UK3CB_CSAT_G_O_JNR_OFF",
        "UK3CB_CSAT_G_O_LAT",
        "UK3CB_CSAT_G_O_HAT"
#

I can check for all the ones that cause the fault

#

Oh and I commented the UAV class to see if that was the issue. It causes an error because of the role definition being bad so it switches to default. Removing it didn't seem to help

tawny maple
#

yeah those last 2 error for me. let me see what it is doing

open moon
#

all the other classes are incorrect as well. It doesn't look like they are shifted or anything though so idk what it might be

tawny maple
#

so the respawn menu is failing to add it to the metadata array... the JNR_OFF works though, the other 2 nope

open moon
#

For me everything after "Grenedier" in the rifleman role causes the error

tawny maple
#

kk sec

open moon
#

the error is gone but the classes are not associated correctly. Perhaps an issue with the order? Do the loadouts appear in your respawn menu in the same order they appear in your script?

tawny maple
#

ooo yeah i missed that since i used 2 riflemen

open moon
#
if (uk3cbFoundWest || uk3cbFoundEast) then {execVM "scripts\client\LoadoutClassCheck.sqf"};
// Create Loadouts
{
    [west, [_x]] call BIS_fnc_addRespawnInventory;
} forEach blufor_squad;

{
    [east, [_x]] call BIS_fnc_addRespawnInventory;
} forEach opfor_squad;

Perhaps this causes a discrepancy?

tawny maple
#

no its because the UI orders it in order of alphabetical, so i'll have to sort the array after that manually alphabetically. annoying lol

#

ill pick this up tomorrow, im headed to bed

open moon
#

Ok, sounds good. Thanks again

tawny maple
open moon
#

This appears to work entirely as expected

#

nice work, seriously

#

I appreciate it so much

#

thank you

#

One question though, do you know if the loadout variable updates when a player selects only something on the left, or simply doesn't select anything at all?

tawny maple
#

on role menu change (selects the default right after it populates) AND right loadout dropdown change