Jump to content
  • 0

Gender Check?


Incar

Question

Trying to make my script check if a character is male or female before performing a certain task as the outcome would vary based on gender. Been searching and searching for over a day but am completely clueless as to how this can be done. Any help is appreciated.

Link to comment
Share on other sites

14 answers to this question

Recommended Posts

  • 0

have it check for the skin, i believe its SurvivorW2_DZ for female

Yup, there is no "gender" in game, it's just bunch of skins.

Make and check against array of female skins found on wiki. But by the looks of it, it lacks some original dayz skins

Link to comment
Share on other sites

  • 0

Trying to make my script check if a character is male or female before performing a certain task as the outcome would vary based on gender. Been searching and searching for over a day but am completely clueless as to how this can be done. Any help is appreciated.

 

you cannot do an actual gender check in arma since characters by default in arma does not have a defined sex, however the default skins in epoch are defined to be either male or female, so you can check in player_wearClothes.sqf how to check from config.

 

still i would say, a better and possibly faster check would be if you define what skins are males or female, and check from that

Link to comment
Share on other sites

  • 0

Ok, so far not achieving much success. Sorry if I seem a bit stupid where this is concerned. This here is a snippet of what I'm trying to get done, I've been trying to find examples of how to do this simple and going off guess work a bit. All that happens is I end up cancelling out the entire script.

private ["_object","_uniqueid","_model"];

if (dayz_combat == 1) then {
    titleText ["You can't select a class while in combat.", "PLAIN DOWN", 3];
    sleep 5;
    titleFadeOut 1;
} else {
    titleText ["Selecting class...", "PLAIN DOWN", 3];
    sleep 2;
    if (_model == "SurvivorW2_DZ") then {                                                         //HERE
        [dayz_playerUID,dayz_characterID,'SurvivorWpink_DZ'] spawn player_humanityMorph;          //HERE
    }else{                                                                                        //HERE
        [dayz_playerUID,dayz_characterID,'RU_Policeman_DZ'] spawn player_humanityMorph;           //HERE
    };                                                                                            //HERE
    sleep 2;
    showCommandingMenu '';

    removeAllWeapons player;
    removeAllItems player;
    removeBackpack player;
    reload player;

    sleep 5;
    titleFadeOut 1;
};

Trying to get a simple method working to reduce mission file size and make things easier to track in future instead of having to leave tons of notes. If anyone can explain why this doesn't work, and possibly lead me in the right direction it would be appreciated.

 

Edit: Forgot to add a ; after a }. Still it doesn't change skin, but now atleast other changes take effect.

Link to comment
Share on other sites

  • 0

I am not sure if this is whole script you posted, but from the looks of it, you haven't told engine what _model variable is actually, since it's defined as private here.

If you look at humanityMorph script, you will see that _model is defined as passed variable from player_humanityMorph:

_model 		= _this select 2; // selects the third variable passed (0,1,2), which will be pink skin in your case

and because of underscore in front, this variable can't be seen from your script as it's private, so you need to define it again.

So lets say we want to check against female skins, then we create an array and compare it to current player skin:

_model = ["BanditW1_DZ","BanditW2_DZ","SurvivorW2_DZ","SurvivorW3_DZ","SurvivorWcombat_DZ","SurvivorWdesert_DZ","SurvivorWurban_DZ"]; //create an array of female skins
if (typeOF player in _model) then { //check our new array against what player is currently wearing
[dayz_playerUID,dayz_characterID,'SurvivorWpink_DZ'] spawn player_humanityMorph; // pass 3 variables and morph
};
Link to comment
Share on other sites

  • 0

 

I am not sure if this is whole script you posted, from the looks of it, you havent told engine what _model variable is actually, since it's defined as private here.

If you look at humanityMorph script, you will see what I mean.

 

So lets say we want to check against female skins, then we create an array and compare it to player skin:

_model = ["BanditW1_DZ","BanditW2_DZ","SurvivorW2_DZ","SurvivorW3_DZ","SurvivorWcombat_DZ","SurvivorWdesert_DZ","SurvivorWurban_DZ"]; //create an array of female skins
if (typeOF player in _model) then { //check array against what player is wearing
[dayz_playerUID,dayz_characterID,'SurvivorWpink_DZ'] spawn player_humanityMorph; // morph into pink female
};

 

It was the entire script (minus gear given to character to reduce space) for that sqf. It's for class selection on fresh spawn which works through a series of sqfs, have my humanity checks and other crap in other files. Thanks for that example though, helps a lot. First time I looked at that stuff in other scripts I was clueless what it was for. Gonna go see if I can get this working now.

Link to comment
Share on other sites

  • 0

Sorry didn't notice your reply, I've edited post explaining background process a little more.

No problem, your post was a load of help. Got it working perfect now, thanks a lot for the help. Now to move on to trying to make it select from 1 of 3 sets of gear randomly

Link to comment
Share on other sites

  • 0

Here you go:
 

_model = ["BanditW1_DZ","BanditW2_DZ","SurvivorW2_DZ","SurvivorW3_DZ","SurvivorWcombat_DZ","SurvivorWdesert_DZ","SurvivorWurban_DZ"];
_randomSkin = _model select (floor (random (count _model)));
[dayz_playerUID,dayz_characterID,_randomSkin] spawn player_humanityMorph;
Link to comment
Share on other sites

  • 0

 

Here you go:

 

_model = ["BanditW1_DZ","BanditW2_DZ","SurvivorW2_DZ","SurvivorW3_DZ","SurvivorWcombat_DZ","SurvivorWdesert_DZ","SurvivorWurban_DZ"];
_randomSkin = _model select (floor (random (count _model)));
[dayz_playerUID,dayz_characterID,_randomSkin] spawn player_humanityMorph;

 

My bad, meant items not skin. It removes/adds gear with

    removeAllWeapons player;
    removeAllItems player;
    removeBackpack player;
    player addWeapon 'Remington870_lamp';
    player selectWeapon 'Remington870_lamp';
    player addWeapon 'glock17_EP1';
    player addMagazine '17Rnd_9x19_glock17';
    player addMagazine '17Rnd_9x19_glock17';
    player addMagazine '8Rnd_B_Beneli_74Slug';
    player addMagazine '8Rnd_B_Beneli_74Slug';
    player addMagazine 'ItemBandage';
    player addMagazine 'ItemBandage';
    player addMagazine 'FoodNutmix';
    player addMagazine 'ItemSodaClays';
    player addWeapon 'ItemGPS';
    player addWeapon 'ItemFlashlightRed';
    player addWeapon 'ItemRadio';
    player addBackpack 'DZ_TerminalPack_EP1';
    reload player;

I want to setup 3 different possible setups to be chosen at random. I've attempted stuff like...

_num = floor(random 3);
switch (_num) do {
case 0: {
Loadout crap
};
case 1: {
Loadout crap
};
case 2: {
Loadout crap
};
};

also tried

_random = round(random(2));
switch (_random) do {
 
and
 
switch (round(random 2)) do {

but came up short on luck.

Link to comment
Share on other sites

  • 0

Ah I get what you mean. I believe you can also add array inside of an array (think its called nested array?)

_array1 = [0,1,2,3];
_array2 = [0,1,2,3];
_array3 = [0,1,2,3];

_array4 = [_array1,_array2,_array3];

_randomArray = _array4 select (floor (random (count _array4)));
_randomArraySelect = _randomArray select (floor (random (count _randomArray)));

I am pretty sure this can be simplified or random check written with single line, but hope you get the idea.

 

Then there's BIS_fnc_selectRandom

Link to comment
Share on other sites

  • 0

Ah I get what you mean. I believe you can also add array inside of an array (think its called nested array?)

_array1 = [0,1,2,3];
_array2 = [0,1,2,3];
_array3 = [0,1,2,3];

_array4 = [_array1,_array2,_array3];

_randomArray = _array4 select (floor (random (count _array4)));
_randomArraySelect = _randomArray select (floor (random (count _randomArray)));

I am pretty sure this can be simplified or random check written with single line, but hope you get the idea.

 

Then there's BIS_fnc_selectRandom

I'll do some reading on it a bit later, gotta hop away from pc for now. Thanks again for the help though, will help me remove well over a dozen sqf files that just over complicated things.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...