Jump to content
Violt

SetRank depending on role.

Recommended Posts

Hey guys, 

I'm working on my Mil-Sim mission and i'm working on the respawns now. 

But like very unit has is that there's many types of ranks. 

I'm using the Standard Arma 3 Respawn menu with the role and loadout

but in roles i want to have the name of the Arma 3 Ranks so Private, Corporal, Sergeant, Lieutenant, Captain, Major, Colonel.

And if you select that role you actually become that rank. So you are not the standard private rank. 

How do you do this?

I hope you guys know what i mean. 

(here's a screenshot of the respawn menu i mean with the roles menu: https://imgur.com/a/kxbY7B4)

Share this post


Link to post
Share on other sites
if ( roleDescription player find "private" > -1 ) then {
	//code to set rank here
};

Now do that for all roles or use a switch instead :)

(note that it's case-sensitive)

Share this post


Link to post
Share on other sites
20 hours ago, stanhope said:

if ( roleDescription player find "private" > -1 ) then {
	//code to set rank here
};

Now do that for all roles or use a switch instead :)

(note that it's case-sensitive)

I actually have no idea where to put this tbh.

Could you maybe tell me? 

Share this post


Link to post
Share on other sites

onPlayerRespawn.sqf would probably be the best place to put it.  Or in a separate file that you call/spawn/execute/whatever from onPlayerRespawn.

Share this post


Link to post
Share on other sites
Just now, stanhope said:

onPlayerRespawn.sqf would probably be the best place to put it.  Or in a separate file that you call/spawn/execute/whatever from onPlayerRespawn.

Hmm, but what i meant is that you have 7 roles Private, Corporal, Sergeant, Lieutenant, Captain, Major, Colonel in the respawn menu. 

And if you click on that and respawn on that role you become that rank.

Share this post


Link to post
Share on other sites
switch (true) do {
  case ( roleDescription player find "private" > -1 ): {
  	player setRank "private";
  };
  case ( roleDescription player find "corporal" > -1 ): {
  	player setRank "corporal";
  };

  ...

  default: {hint "Something went wrong while setting your ranks";};
};

Didn't test it as I'm in class at the moment.  You'll have to check whether in the role description the ranks are written with or without capital and change it accordingly.  So either put this in the onPlayerRespawn.sqf file in the main directory of your mission or in a seperate sqf file and call that from onPlayerRespawn. 

Share this post


Link to post
Share on other sites
Just now, stanhope said:

switch (true) do {
  case ( roleDescription player find "private" > -1 ): {
  	player setRank "private";
  };
  case ( roleDescription player find "corporal" > -1 ): {
  	player setRank "corporal";
  };

  ...

  default: {hint "Something went wrong while setting your ranks";};
};

Didn't test it as I'm in class at the moment.  You'll have to check whether in the role description the ranks are written with or without capital and change it accordingly.  So either put this in the onPlayerRespawn.sqf file in the main directory of your mission or in a seperate sqf file and call that from onPlayerRespawn. 

Thank you very much! 

I'll give you info about this later. 

Share this post


Link to post
Share on other sites
18 minutes ago, stanhope said:

switch (true) do {
  case ( roleDescription player find "private" > -1 ): {
  	player setRank "private";
  };
  case ( roleDescription player find "corporal" > -1 ): {
  	player setRank "corporal";
  };

  ...

  default: {hint "Something went wrong while setting your ranks";};
};

Didn't test it as I'm in class at the moment.  You'll have to check whether in the role description the ranks are written with or without capital and change it accordingly.  So either put this in the onPlayerRespawn.sqf file in the main directory of your mission or in a seperate sqf file and call that from onPlayerRespawn. 

and lets say i want the loadout to set the rank i can just do 

switch (true) do {
  case ( loadoutDescription player find "private" > -1 ): {
  	player setRank "private";
  };
  case ( loadoutDescription player find "corporal" > -1 ): {
  	player setRank "corporal";
  };

  ...

  default: {hint "Something went wrong while setting your ranks";};
};

right? 

Share this post


Link to post
Share on other sites
Just now, stanhope said:

Well no, loadoutDescription isn't a command, roleDescription is.  

ah alright. 

i'm actually having trouble with creating the roles them self. they are not showing up. 

this is what my description.ext looks like. 

author = "Sidemavv and Violt";
onLoadName = "AMTAC Mil-Sim" ;
onLoadMission = "AMTAC Mil-Sim";
onLoadIntro = "AMTAC Mil-Sim";
onLoadMissionTime = 1;
onLoadIntroTime = 1;
LoadScreen = "Loading.jpg";



 class CfgRoles
 {
      class Private
      {
           displayName = "Private";
           icon = "\A3\Ui_f\data\GUI\Cfg\Ranks\private_gs.paa";
      };
	class Corporal
	{
		displayName = "Corporal";
		icon = "\A3\Ui_f\data\GUI\Cfg\Ranks\corporal_gs.paa";
	};
		class Sergeant
	{
		displayName = "Sergeant";
		icon = "\A3\Ui_f\data\GUI\Cfg\Ranks\sergeant_gs.paa";
	};
		class Lieutenant
	{
		displayName = "Lieutenant";
		icon = "\A3\Ui_f\data\GUI\Cfg\Ranks\lieutenant_gs.paa";
	};
		class Captain
	{
		displayName = "Captain";
		icon = "\A3\Ui_f\data\GUI\Cfg\Ranks\captain_gs.paa";
	};
		class Major
	{
		displayName = "Major";
		icon = "\A3\Ui_f\data\GUI\Cfg\Ranks\major_gs.paa";
	};
		class Colonel
	{
		displayName = "Colonel";
		icon = "\A3\Ui_f\data\GUI\Cfg\Ranks\colonel_gs.paa";
	};
 };

What do i do now? 

 

 

Share this post


Link to post
Share on other sites

Can you upload everything you have to google drive or github or something because I'm confused as to what you do and don't have and know.

Share this post


Link to post
Share on other sites
4 minutes ago, stanhope said:

You don't have any loadouts defined anywhere?  Here you can find how to do that: https://community.bistudio.com/wiki/Arma_3_Respawn:_New_Respawn_Screen

 

And this is in init.sqf:
execVM"onPlayerKilled.sqf";
execVM"onPlayerRespawn.sqf";

 

But those 2 files aren't in the missions files.  

Alright thanks i thought that you didn't need any loadouts ready for the roles to show up. 

 

Share this post


Link to post
Share on other sites
14 minutes ago, stanhope said:

You don't have any loadouts defined anywhere?  Here you can find how to do that: https://community.bistudio.com/wiki/Arma_3_Respawn:_New_Respawn_Screen

 

And this is in init.sqf:
execVM"onPlayerKilled.sqf";
execVM"onPlayerRespawn.sqf";

 

But those 2 files aren't in the missions files.  

https://drive.google.com/drive/folders/12YMAsAiVKdt4uaCjmVWzo7xmKlG8X7gc?usp=sharing

is this alright?

Share this post


Link to post
Share on other sites

Does it work?  Because I have no way of testing it as I'm in class.

Share this post


Link to post
Share on other sites
13 minutes ago, stanhope said:

Does it work?  Because I have no way of testing it as I'm in class.

Nope... 

empty loadout and role menu

Share this post


Link to post
Share on other sites
On 4/23/2018 at 12:38 PM, stanhope said:

Does it work?  Because I have no way of testing it as I'm in class.

What do i do now? 

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×