Jump to content

[Release] Ranks by hambeast and Evan Black


Swash

Recommended Posts

This simple Rank script is for those that RP a military, paramilitary, or militia type groups, and would like to set a specific group rank for individuals on log in.

I've used so many great scripts from this community, it's nice that I can make a small contribution of my own.

Very special thanks to hambeast for the original script example and helpful tips for making it better.
Without this guidance I may have never gotten this far.

Please copy, steal, modify, and/or share this script.
Just consider giving credit to hambeast and myself for this effort.
Thank you.

INSTALLATION:

1. Go to your MPMission folder and unpack your map pbo (ex. epoch.Chernarus.pbo)

2. In the folder look for init.sqf. If you do not have one you can create and empty file and name init.sqf

3. Add the following to the bottom of your init.sqf and save it.

//Ranks by hambeast and Evan Black
[]execVM "scripts\ranks.sqf";

4. Create a folder called "scripts" (in the same place as init.sqf). If you already have this folder skip this step.

5. Open the scripts folder and create empty file called "ranks.sqf".

6. Add the following to the ranks.sqf file.

//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 comma
Ranks_CORPORAL        =    [];
Ranks_SERGEANT        =    [];
Ranks_LIEUTENANT      =    [];
Ranks_CAPTAIN         =    [];
Ranks_MAJOR           =    [];
Ranks_COLONEL         =    [];

_playerUID = getPlayerUID player; //get player UID

//check to see if our player matches
switch (true) do {
    case (_playerUID in Ranks_CORPORAL)   : { player setRank "CORPORAL"; }; //setRank to CORPORAL for everyone in the CORPORAL list.
    case (_playerUID in Ranks_SERGEANT)   : { player setRank "SERGEANT"; };
    case (_playerUID in Ranks_LIEUTENANT) : { player setRank "LIEUTENANT"; };
    case (_playerUID in Ranks_CAPTAIN)    : { player setRank "CAPTAIN"; };
    case (_playerUID in Ranks_MAJOR)      : { player setRank "MAJOR"; };
    case (_playerUID in Ranks_COLONEL)    : { player setRank "COLONEL"; };

    default { player setRank "PRIVATE"; }; //setting default rank for all others    
};

7. Add the UIDs as per the example in script.

Note no trailing comma for each ID line and don't forget the quotes for each ID. This is important.

 

You can now repack your epoch.(Map) folder to pbo, Although most servers will run with it unpacked for testing.
No BE Script adjustments needed as far as my testing.

 

Ranks is based from hambeast's original script example responce from

 

Please send a like if you enjoy this script!

Link to comment
Share on other sites

Yes 1Man, I have been looking at this for a few days and have come to realize this would be nice for those great community members that like to help new players, giving them a higher rank or for clan leaders etc.

Redoing my server for the last day or so and will be adding this into the mix.

thanks for the hard work guys

Link to comment
Share on other sites

So I would have to manually add in the IDs?

Yes, but only for those you want to set a rank to automatically. All others will be set to private. (like non-military folk or new recruits)

 

Add the IDs like so.

Ranks_CORPORAL        =    ["7656xxxxxxxxxxxxxx","7656xxxxxxxxxxxxxx","7656xxxxxxxxxxxxxx","7656xxxxxxxxxxxxxx"];
Ranks_SERGEANT        =    ["7656xxxxxxxxxxxxxx"];

Note no trailing comma for each ID line and don't forget the quotes for each ID. This is important.

 

Quick tip to get IDs.

You can get IDs in just one or two steps.

Open a player's steam profile page and look at the URL.

If it ends in numbers like http://steamcommunity.com/profiles/7656xxxxxxxxxxxxxxxxx/

That number is their ID and you are done.

 

If it is a name like http://steamcommunity.com/id/EvanBlack/

Enter the URL at http://steamidconverter.com/

You will get a steamID64 conversion. This is their ID.

 

I hope this helps!

Link to comment
Share on other sites

Can i do it like this ? 
 


//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 comma
Ranks_OWNER        =    [];
Ranks_Admin        =    [];
Ranks_Moderator      =    [];
Ranks_Pro-Donator           =    [];
Ranks_Donator         =    [];
Ranks_Helper         =    [];
 
_playerUID = getPlayerUID player; //get player UID
 
//check to see if our player matches
switch (true) do {
    case (_playerUID in Ranks_OWNER)   : { player setRank "OWNER"; }; //setRank to CORPORAL for everyone in the CORPORAL list.
    case (_playerUID in Ranks_Admin)   : { player setRank "Admin"; };
    case (_playerUID in Ranks_Moderator) : { player setRank "Moderator"; };
    case (_playerUID in Ranks_Pro-Donator)    : { player setRank "Pro-Donator"; };
    case (_playerUID in Ranks_Donator)      : { player setRank "Donator"; };
    case (_playerUID in Ranks_COLONEL)    : { player setRank "Helper"; };
 
    default { player setRank "PRIVATE"; }; //setting default rank for all others    
};
Link to comment
Share on other sites

 

Can i do it like this ? 

 

//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 comma
Ranks_OWNER        =    [];
Ranks_Admin        =    [];
Ranks_Moderator      =    [];
Ranks_Pro-Donator           =    [];
Ranks_Donator         =    [];
Ranks_Helper         =    [];
 
_playerUID = getPlayerUID player; //get player UID
 
//check to see if our player matches
switch (true) do {
    case (_playerUID in Ranks_OWNER)   : { player setRank "OWNER"; }; //setRank to CORPORAL for everyone in the CORPORAL list.
    case (_playerUID in Ranks_Admin)   : { player setRank "Admin"; };
    case (_playerUID in Ranks_Moderator) : { player setRank "Moderator"; };
    case (_playerUID in Ranks_Pro-Donator)    : { player setRank "Pro-Donator"; };
    case (_playerUID in Ranks_Donator)      : { player setRank "Donator"; };
    case (_playerUID in Ranks_COLONEL)    : { player setRank "Helper"; };
 
    default { player setRank "PRIVATE"; }; //setting default rank for all others    
};

 

I don't know if you just quickly changed it or not, but watch the "COLONEL" at the very bottom. Probably needs to be "Helper". Nice idea, I hope that works! :D

Link to comment
Share on other sites

 

Can i do it like this ? 

 


//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 comma
Ranks_OWNER        =    [];
Ranks_Admin        =    [];
Ranks_Moderator      =    [];
Ranks_Pro-Donator           =    [];
Ranks_Donator         =    [];
Ranks_Helper         =    [];
 
_playerUID = getPlayerUID player; //get player UID
 
//check to see if our player matches
switch (true) do {
    case (_playerUID in Ranks_OWNER)   : { player setRank "OWNER"; }; //setRank to CORPORAL for everyone in the CORPORAL list.
    case (_playerUID in Ranks_Admin)   : { player setRank "Admin"; };
    case (_playerUID in Ranks_Moderator) : { player setRank "Moderator"; };
    case (_playerUID in Ranks_Pro-Donator)    : { player setRank "Pro-Donator"; };
    case (_playerUID in Ranks_Donator)      : { player setRank "Donator"; };
    case (_playerUID in Ranks_COLONEL)    : { player setRank "Helper"; };
 
    default { player setRank "PRIVATE"; }; //setting default rank for all others    
};

 

 

I do not believe this is possible because none of those are "ranks" (see https://community.bistudio.com/wiki/setRank)

Description: Sets rank of given unit. Possible values: PRIVATE, CORPORAL, SERGEANT, LIEUTENANT, CAPTAIN, MAJOR or COLONEL.

 

 

You might want to look at Squad.xml for one possible solution. There is a "Remarks" section that you could put in anything you want.

Link to comment
Share on other sites

I got kicked for Battleye Restriction #21 :(

 

These types of posts will never get you any help without more information.

Right up there with "Help", "it's broke" and "teh no worky". lol

Devil is in the details.

1. What type of restriction? script, setvariable, publicvariable, ect

2. What does the log say for that script? (this will be in the .log file of the same name as the restriction type.)

3. Are you using stock BE scripts from epoch, or some modified set from another addon/script?

4. Are you attempting to run AI or other mods?

5. Did you follow the instructions exactly?

7. Are you trolling?

8. Did you notice I skipped 6?

9. Have you taken a look at

 

I've made zero changes to anything on or near script restriction #21, pure stock right there.

setRank has caused absolutely no errors for me and not sure why it would. Seems odd that BE would reject setRank, since it's pretty much meaningless game wise. Although it IS BE..... *cough* lol

No other reports of this happening for anyone else. So I'm inclined to think you are attempting another addon/script.

Fart wrong and get Script Restriction create vehicle FART projectile "sideways" #0.

This is going to be difficult for me to help you if I don't have relevant data (i.e. log files, or replication of issue)

IF you can get me more information, I will try to help.

Link to comment
Share on other sites

Hey guys,

I finally had time to implement this, did quick testing on myself as Colonel and my admins as Major's.

I did not get any errors on the script in rpt, yet with the nametags script I have going we are suppose to see the rank yet it does not show up. Everyone stays as Private no matter what order I load the two scripts.

Anyone else have a nametag script while trying this setrank script and having success?

Link to comment
Share on other sites

Hey guys,

I finally had time to implement this, did quick testing on myself as Colonel and my admins as Major's.

I did not get any errors on the script in rpt, yet with the nametags script I have going we are suppose to see the rank yet it does not show up. Everyone stays as Private no matter what order I load the two scripts.

Anyone else have a nametag script while trying this setrank script and having success?

 

I'm not familiar with the nametag script.

If your rank is not set after login (click M key and look at the top), something is wrong with Ranks script.

You can paste you Ranks script in a spoiler and I can take a look.

 

If the ranks are shown properly at the top when you click the M key after log in, then setRank is working properly.

Something might not be right with the nametag script. It's not grabbing ranks properly or something.

In this case you'll need to head to the person who wrote nametags script.

It might need to be set to wait until after Ranks script is loaded.

 

It wont matter which order you set them in, Ranks script will always wait 2 seconds after game load to activate.

You can comment out the sleep line and see what happens.

//sleep 2; //Optional delay to ensure script execution

If nametags runs without waiting for game load, you might want to try copying the wait code from Ranks script.

Add it to the top of nametags script and set it to sleep longer than Ranks.

// Wait for ingame
waitUntil {!isNuLL(uiNameSpace getVariable ["EPOCH_loadingScreen",displayNull])};
waitUntil {isNuLL(uiNameSpace getVariable ["EPOCH_loadingScreen",displayNull])};
sleep 3; //Optional delay to ensure script execution

Hope this gets you in the right direction.

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
  • Discord

×
×
  • Create New...