Swash Posted April 2, 2015 Report Share Posted April 2, 2015 I've been trying to find helpful information about setRank, but everything I found is vague or relies on global channel being active. Does anyone have any idea how I can set group rank on login? Maybe a BEC script to set a player's group rank based on ID? Or mission script? Any help or gentle nudging in the right direction would be most appreciated. Link to comment Share on other sites More sharing options...
0 hambeast Posted April 2, 2015 Report Share Posted April 2, 2015 first google result: https://community.bistudio.com/wiki/setRank You would call this within your script block. player setRank "COLONEL" If you're asking how to implement this in your mission file... You could hardcode your group members ranks by ID in your init.sqf or anywhere else in your mission file if you liked... something like this could work... no idea if it actually does what you want though... // ranks.sqf - called from init.sqf // we could have 1 big multi-dim array containing each users ID and Rank but... // that would make this harder to adjust in the future since this is a manual // process. If you were to load this data from a DB for instance, you might // want to keep it in a multi-dimensional array like: // [["1234","PRIVATE"],["231","General"]] Ranks_PRIVATE = [ "1234567", // Me "7654321" // No trailing ,! ]; Ranks_CORPORAL = []; Ranks_SERGEANT = []; Ranks_LIEUTENANT = []; Ranks_CAPTAIN = []; Ranks_MAJOR = []; Ranks_COLONEL = []; _playerUID = player getPlayerUID; _found = false; _rank = "PRIVATE"; // default private rank // check to see if our player matches while {!_found} do { if (_playerUID in Ranks_PRIVATE) then { _rank = "PRIVATE"; _found = true; // breaks us out of this while loop }; // ... and so on }; // finally set our players rank! player setRank _rank; Swash 1 Link to comment Share on other sites More sharing options...
0 Swash Posted April 3, 2015 Author Report Share Posted April 3, 2015 Thank you hambeast you are the best! I'll try this out tonight. first google result: https://community.bistudio.com/wiki/setRank This was one of the things I found in my search, but had no clue how to implement in sqf. I read all that page and was left saying "um... what??" lol I wish I could give this an extra like for posting comments in the script as well, wish everyone did this! This was more than a "gentle nudge" this was above and beyond what I expected. Thank you! btw great Mr. Reynholm avatar lol hambeast 1 Link to comment Share on other sites More sharing options...
0 Swash Posted April 3, 2015 Author Report Share Posted April 3, 2015 Thanks again hambeast for the scripting help. I'm not all that familiar with sqf, but I recognize coding patterns from other languages. I had to add in a wait for ingame and I did some other modifications to the script. With your permission I'd like to post the final script in the A3 Epoch Resources/Scripts for others to use. Original script credit to you of course. Here is the final script I intend to post. //ranks.sqf //Original Script by hambeast //Modified and Completed by Evan Black // Wait for ingame waitUntil {!isNuLL(uiNameSpace getVariable ["EPOCH_loadingScreen",displayNull])}; waitUntil {isNuLL(uiNameSpace getVariable ["EPOCH_loadingScreen",displayNull])}; sleep 2; //Optional delay to ensure script execution // Rank/UID list. Use Example Below. //UID Example: Ranks_CORPORAL = ["7656xxxxxxxxxxxxxx","7656xxxxxxxxxxxxxx"]; no trailing coma Ranks_CORPORAL = []; Ranks_SERGEANT = []; Ranks_LIEUTENANT = []; Ranks_CAPTAIN = []; Ranks_MAJOR = []; Ranks_COLONEL = []; _playerUID = getPlayerUID player; //get player UID // loop to check to see if our player matches _found = false; while {!_found} do { if (_playerUID in Ranks_CORPORAL) then { player setRank "CORPORAL"; _found = true; // endloop }else{ if (_playerUID in Ranks_SERGEANT) then { player setRank "SERGEANT"; _found = true; }else{ if (_playerUID in Ranks_LIEUTENANT) then { player setRank "LIEUTENANT"; _found = true; }else{ if (_playerUID in Ranks_CAPTAIN) then { player setRank "CAPTAIN"; _found = true; }else{ if (_playerUID in Ranks_MAJOR) then { player setRank "MAJOR"; _found = true; }else{ if (_playerUID in Ranks_COLONEL) then { player setRank "COLONEL"; _found = true; }else{ player setRank "PRIVATE"; //setting default rank for all others _found = true; }; }; }; }; }; }; }; hambeast and emmenboy 2 Link to comment Share on other sites More sharing options...
0 hambeast Posted April 3, 2015 Report Share Posted April 3, 2015 Thanks again hambeast for the scripting help. I'm not all that familiar with sqf, but I recognize coding patterns from other languages. I had to add in a wait for ingame and I did some other modifications to the script. With your permission I'd like to post the final script in the A3 Epoch Resources/Scripts for others to use. Original script credit to you of course. Here is the final script I intend to post. //ranks.sqf //Original Script by hambeast //Modified and Completed by Evan Black // Wait for ingame waitUntil {!isNuLL(uiNameSpace getVariable ["EPOCH_loadingScreen",displayNull])}; waitUntil {isNuLL(uiNameSpace getVariable ["EPOCH_loadingScreen",displayNull])}; sleep 2; //Optional delay to ensure script execution // Rank/UID list. Use Example Below. //UID Example: Ranks_CORPORAL = ["7656xxxxxxxxxxxxxx","7656xxxxxxxxxxxxxx"]; no trailing coma Ranks_CORPORAL = []; Ranks_SERGEANT = []; Ranks_LIEUTENANT = []; Ranks_CAPTAIN = []; Ranks_MAJOR = []; Ranks_COLONEL = []; _playerUID = getPlayerUID player; //get player UID // loop to check to see if our player matches _found = false; while {!_found} do { if (_playerUID in Ranks_CORPORAL) then { player setRank "CORPORAL"; _found = true; // endloop }else{ if (_playerUID in Ranks_SERGEANT) then { player setRank "SERGEANT"; _found = true; }else{ if (_playerUID in Ranks_LIEUTENANT) then { player setRank "LIEUTENANT"; _found = true; }else{ if (_playerUID in Ranks_CAPTAIN) then { player setRank "CAPTAIN"; _found = true; }else{ if (_playerUID in Ranks_MAJOR) then { player setRank "MAJOR"; _found = true; }else{ if (_playerUID in Ranks_COLONEL) then { player setRank "COLONEL"; _found = true; }else{ player setRank "PRIVATE"; //setting default rank for all others _found = true; }; }; }; }; }; }; }; Swash, I am so happy what I typed helped you out! I think we forget sometimes, just how hard it is to make the jump into Arma coding from other languages. But... once you get the basics, the rest will become clear. Swash 1 Link to comment Share on other sites More sharing options...
0 Swash Posted April 4, 2015 Author Report Share Posted April 4, 2015 A final release of a completed script has been posted to It is much cleaner and better. If it is approved, you should use that script. Thank you hambeast for all your help! Link to comment Share on other sites More sharing options...
0 emmenboy Posted April 6, 2015 Report Share Posted April 6, 2015 Hi, I used that script and it work fine with me! Ty, i hope that be implemented in future! Swash 1 Link to comment Share on other sites More sharing options...
0 PAR4NA Posted April 6, 2015 Report Share Posted April 6, 2015 Help me install! Link to comment Share on other sites More sharing options...
0 Swash Posted April 7, 2015 Author Report Share Posted April 7, 2015 Help me install! The final script is posted at It has step by step instructions on how to install. Hi, I used that script and it work fine with me! Ty, i hope that be implemented in future! A cleaner and faster script has been posted to Hope you like it! Link to comment Share on other sites More sharing options...
Question
Swash
I've been trying to find helpful information about setRank, but everything I found is vague or relies on global channel being active.
Does anyone have any idea how I can set group rank on login? Maybe a BEC script to set a player's group rank based on ID? Or mission script?
Any help or gentle nudging in the right direction would be most appreciated.
Link to comment
Share on other sites
8 answers to this question
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now