Jump to content

Recommended Posts

I use a rating system that gives you rating or takes it away depending on who you kill. not sure where i got it from.

 

Rating.sqf

Spoiler

// Rating System to improve your standings within the world.

 

null =
 [] spawn {
  while {true} do {
    sleep 2;
    {
      if (isNil {_x getVariable "oldSide"}) then {
        _x setVariable ["oldSide",side _x];
      }
    } forEach allUnits;
  }
};


if (isServer) then {
addMissionEventHandler  ["Entitykilled", {
   params ["_victim","_killer","_zombie"];


   if (!isPlayer _killer or _victim == _killer) exitWith {};

   if (_victim getVariable "oldSide" == west) exitWith {
      [_killer,{_this addRating -3000}] remoteExec ["call",_killer];
      parseText "<t color = '#ff9900'>You just killed a friendly unit!<t/>" remoteExec ["hintsilent",_killer];
    };
    if (_victim getVariable "oldSide" == civilian) exitWith {
      [_killer,{_this addRating -1000}] remoteExec ["call",_killer];
      parseText "<t color = '#A990D4'>You just killed an innocent!<t/>" remoteExec ["hintsilent",_killer];
    };
    if (_victim getVariable "oldSide" == east) exitWith {
      [_killer,{_this addRating 50}] remoteExec ["call",_killer];
      parseText "<t color = '#ff0000'>You just killed an Enemy Man<t/>" remoteExec ["hintsilent",_killer];
    };
    if ((_this select 2) isEqualTo player) then {
      [_killer,{_this addRating 10}] remoteExec ["call",_killer];
//      parseText "<t color = '#ff0000'>You just killed a Zombie<t/>" remoteExec ["hintsilent",_killer];
    };
}];
};
 

 

Added the zombie part with help form Haleks. Ravage mod.

 

Added with one a couple i have made. A script that checks your rating and promotes or demotes you depending on your rating

 

Rank.sqf

Spoiler


[] spawn {
while {alive player} do {

waitUntil {sleep .5; (rating player == 1000)};
if (rating player == 1000) then {[]execVM "Scripts\Rank\Promoted.sqf";};

 

waitUntil {sleep .5; (rating player == -1000)};
if (rating player == -1000) then {[]execVM "Scripts\Rank\demoted.sqf";};

}forEach allUnits;
};
 

 

Promoted.sqf

Spoiler

PromoteUnit = {
    private _rks = ["PRIVATE", "CORPORAL", "SERGEANT", "LIEUTENANT", "CAPTAIN", "MAJOR", "COLONEL"];
    private _old = rankId _this;
    if (count _rks - _old > 1) then {
        _this setUnitRank (_rks select _old + 1);
        systemChat format ["Unit %1 promoted to %2", _this, rank _this];
    }
};
player call PromoteUnit;
 

 

Demoted.sqf

Spoiler

DemoteUnit = {
    private _rks = ["PRIVATE", "CORPORAL", "SERGEANT", "LIEUTENANT", "CAPTAIN", "MAJOR", "COLONEL"];
    private _old = rankId _this;
    if (count _rks - _old > 1) then {
        _this setUnitRank (_rks select _old - 1);
        systemChat format ["Unit %1 demoted to %2", _this, rank _this];
    }
};
player call DemoteUnit;

 

Now the problem i have encounted and cant seem to fix is that the rank.sqf only fires one time. As in you will be promoted one rank or demoted one rank. So you can go form private to corporal but not any higher. Then you can go back from corporal to private. If you get demoted back to private you can still get promoted up to corporal again.

 

The problem may lie in the fact that if you get promoted or demoted your rating goes back to 0. You can also start the game as a Sargent and get promoted once and demoted once.

Not sure what is going on. The promote and demote scripts work fine one there own but the rank.sqf is what im having problems with.

 

Any help would be awesome thank you

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites
On 23/1/2019 at 12:57 PM, Chuc said:

Any help would be awesome thank you

 

I think after our private chat everything now it's ready to publish !  :thumb:

 

What is your plan ?!!  :ftvsmilie2:

Share this post


Link to post
Share on other sites

yeah sorry. If you reckon its ready go for it

  • Thanks 1

Share this post


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

If you reckon its ready go for it

 

Ok Chuck !

 

This shall be done !!!  :f:

Share this post


Link to post
Share on other sites

Hello there to Everyone !

 

 

Custom Rank and experience point system based on kills , with 3d icons available option  :

 

BgImkjT.png

 

available soon !

Share this post


Link to post
Share on other sites

Looks good! Is there a way to give more points for killing tanks or planes?  Or completing a task?  Or give points to the complete side? I know, i m asking too much...sorry 🙂

  • Like 1

Share this post


Link to post
Share on other sites
17 minutes ago, Texeiro said:

Looks good!

 

Hello there and thanks Texeiro !

 

This script isn't still published , unfortunately i have a lot of work that stays in my pc !

Your idea is very nice and if i continue sometime this script i will check this as well.

 

For more news generally , you can follow here :

 

 

PS : + if you remind me this again i can definitely check it.

Share this post


Link to post
Share on other sites
On 4/4/2019 at 10:51 PM, GEORGE FLOROS GR said:

PS : + if you remind me this again i can definitely check it.

 

Somebody else did , so here is what  i 've got so far :

+GF_Ranks_Script.VR.zip

File created: 2020-01-25 11:00:24 PM   |   File expires in: 29 days 21:59:02   |   File Size: 12.8 KB   |

have fun !

 

GF_Draw3D.sqf

Spoiler




//________________  Author : GEORGE FLOROS [GR] ___________ 24.01.19 _____________

/*
________________	GF Ranks Script - Mod	________________

Not yet published

Please keep the Credits or add them to your Diary

https://community.bistudio.com/wiki/SQF_syntax
Don't try to open this with the simple notepad.
For everything that is with comment  //  in front  or between /*
means that it is disabled , so there is no need to delete the extra lines.

You can open this ex:
with notepad++
https://notepad-plus-plus.org/

ArmA 3 | Notepad ++ SQF tutorial
https://www.youtube.com/watch?v=aI5P7gp3x90

and also use the extra pluggins
(this way will be better , it will give also some certain colors to be able to detect ex. problems )
http://www.armaholic.com/page.php?id=8680

or use any other program for editing .

For the Compilation List of my GF Scripts , you can search in:
https://forums.bohemia.net/forums/topic/215850-compilation-list-of-my-gf-scripts/
*/


GF_Rank_allPlayers = allUnits select {isPlayer _x && {!(_x isKindOf "HeadlessClient_F")}};


//________________	Settings	________________
//________________	Set true or false	________________

GF_Rank_Show 			= allunits;		//	allunits or GF_Rank_allPlayers	(Players only)




GF_Rank_Color = {

	_unit = _this select 0;
	_Health = round ((1 - (damage _unit)) * 100);

		
	//________________ Colors ________________
	//	https://www.rapidtables.com/web/color/RGB_Color.html
	
	_color_Default		= [1,1,1,1];
	_color_Blue			= [0,0,255,1];
	_color_Blue_light	= [0,144,255,1];
	_color_Green		= [0,128,0,1];
	_color_Yellow		= [255,255,0,1];
	_color_Red			= [255,0,0,1];
	
	
	//________________ Changing Color based on health  ________________
	
	_Health_color = _color_Default;
	
	switch true do {
		case(_Health >= 80) : {_Health_color = _color_Blue;};
		case((_Health >= 60) && (_Health < 80)) : {_Health_color = _color_Blue_light;};
		case((_Health >= 40) && (_Health < 60)) : {_Health_color = _color_Green;};
		case((_Health >= 20) && (_Health < 40)) : {_Health_color = _color_Yellow;};
		case((_Health >= 1) && (_Health < 20)) : {_Health_color = _color_Red;};
		case(_Health < 1) : {_Health_color = _color_Default;};
	};	

	_Health_color
};


GF_Rank_Rating = {

	_unit = _this select 0;
	_rating = rating _unit;
	
	_Rank = "";
	switch true do {

		case(_Rating < GF_Rank_FUGITIVE) : {_Rank = "FUGITIVE";};
		case((_Rating >= GF_Rank_PRIVATE) && (_Rating < GF_Rank_CORPORAL)) : {_Rank = "PRIVATE";};
		case((_Rating >= GF_Rank_CORPORAL) && (_Rating < GF_Rank_SERGEANT)) : {_Rank = "CORPORAL";};
		case((_Rating >= GF_Rank_SERGEANT) && (_Rating < GF_Rank_LIEUTENANT)) : {_Rank = "SERGEANT";};
		case((_Rating >= GF_Rank_LIEUTENANT) && (_Rating < GF_Rank_CAPTAIN)) : {_Rank = "LIEUTENANT";};
		case((_Rating >= GF_Rank_CAPTAIN) && (_Rating < GF_Rank_MAJOR)) : {_Rank = "CAPTAIN";};
		case((_Rating >= GF_Rank_MAJOR) && (_Rating < GF_Rank_COLONEL)) : {_Rank = "MAJOR";};
		case(_Rating > GF_Rank_COLONEL) : {_Rank = "COLONEL";};
	};	

	_Rank_picture = "";
	if(_Rank isEqualTo "FUGITIVE")then{
		_Rank_picture = "";
		}else{
		_Rank_picture = format["\A3\Ui_f\data\GUI\Cfg\Ranks\%1_gs.paa",_Rank];
	};
		
	_Rank_picture
};


addMissionEventHandler  ["Draw3D", {
		
	{	
	if((player!=_x) && ((side _x) isEqualto playerSide)) then {
		if(_x distance player < 1000) then {
			if((((vehicle _x)!=_x)&&(_x isEqualto effectiveCommander (vehicle _x)))||((vehicle _x) isEqualto _x)) then {
				
				drawIcon3D [
					
					[_x] call GF_Rank_Rating,
					[_x] call GF_Rank_Color,
					
					//	Position
					if(((vehicle _x)!=_x)&&(_x isEqualto effectiveCommander (vehicle _x))) then {(vehicle _x) modelToWorld [0,0,3]
					
					} else {
					
					if((vehicle _x)isEqualto _x) then {_x modelToWorld [0,0,2.3]}},
					
					// Width
					if(_x distance player > 500) then {
						0.05					
					} else { 
					
					if(_x distance player > 100) then{
						0.10
					
					} else { 					
						0.40}
					},
					
					// Height
					if(_x distance player > 500) then {
						0.05 
					} else { 
					if(_x distance player > 100) then { 
						0.10 
					} else { 
						0.40}
					},
					
					// Angle
					0,
	
					// Text
	
					if(_x distance player > 500 ) then{""} else{
					if(((_x getHitPointDamage "HitHead") >0.1) || ((_x getHitPointDamage "HitBody") >0.1) || ((_x getHitPointDamage "HitHands") >0.1) || ((_x getHitPointDamage "HitLegs") >0.1)) then {
						format ["%1[Injured]",name _x]}else{name _x}},
					
					// Shadow
					1,
	
					// Text size
					if(_x distance player > 250) then { 
						0.01 
						
						} else {
						
						if(_x distance player > 100) then { 
							0.02
							} else {0.04}
						},
					
					// Font
					"PuristaMedium"
					];
					
					};
				};
			};
	}forEach GF_Rank_Show;
}];

 

 

GF_Ranks.sqf

Spoiler




//________________  Author : GEORGE FLOROS [GR] ___________ 24.01.19 _____________

/*
________________	GF Ranks Script - Mod	________________

Not yet published

Please keep the Credits or add them to your Diary

https://community.bistudio.com/wiki/SQF_syntax
Don't try to open this with the simple notepad.
For everything that is with comment  //  in front  or between /*
means that it is disabled , so there is no need to delete the extra lines.

You can open this ex:
with notepad++
https://notepad-plus-plus.org/

ArmA 3 | Notepad ++ SQF tutorial
https://www.youtube.com/watch?v=aI5P7gp3x90

and also use the extra pluggins
(this way will be better , it will give also some certain colors to be able to detect ex. problems )
http://www.armaholic.com/page.php?id=8680

or use any other program for editing .

For the Compilation List of my GF Scripts , you can search in:
https://forums.bohemia.net/forums/topic/215850-compilation-list-of-my-gf-scripts/
*/


//________________	Settings	________________
//________________	Set true or false	________________

GF_Rank_Notification 		= true;

GF_Rank_Rating_Civilian 	= -4000;	//	Civilian Killing Penalty
GF_Rank_Rating_West 		= -2000;	//	Friendy Killing Penalty	for a mission with the west side friendy
GF_Rank_Rating_East 		= 10;		//	add rating
GF_Rank_Rating_Zombie		= 5;		//	add rating


//________________	Set your Rank rating 	________________

GF_Rank_PRIVATE 			= 2000;
GF_Rank_CORPORAL 			= 4000;
GF_Rank_SERGEANT 			= 6000;
GF_Rank_LIEUTENANT 			= 8000;
GF_Rank_CAPTAIN 			= 10000;
GF_Rank_MAJOR 				= 12000;
GF_Rank_COLONEL 			= 14000;



//________________	GF_Rank_Zombie_List	________________

GF_Rank_Zombie_List = [
	
	//	Ravage zombies
	"zombie_bolter",
	"zombie_runner",
	"zombie_walker"
	]; 


// add this in the initserver
addMissionEventHandler ["EntityKilled", {

	params ["_killed", "_killer", "_instigator"];
	
	_side = side group _killed;
	_sideColor = [_side, true] call BIS_fnc_sideColor;

	if (!isPlayer _killer or _killed == _killer) exitWith {};

	
	//________________	civilian	________________
	
	if (
		(side group _killed isEqualTo civilian)
		&& (!((typeOf _killed) in GF_Rank_Zombie_List)) 
		)exitWith{
			[_killer,{_this addRating GF_Rank_Rating_Civilian}] remoteExec ["call",_killer];
			
			if(GF_Rank_Notification)then {
			//	parseText "<t color = '#A990D4'>You just killed an innocent!<t/>" remoteExec ["hintsilent",_killer];
			systemchat "You killed an innocent!";
			};
			
			};
			
						
	//________________	west	________________
	
	if (
		(side group _killed isEqualTo west)
		&& (!((typeOf _killed) in GF_Rank_Zombie_List)) 
		)exitWith{
			[_killer,{_this addRating GF_Rank_Rating_West}] remoteExec ["call",_killer];
			
			if(GF_Rank_Notification)then {
			//	parseText "<t color = '#ff9900'>You just killed a friendly unit!<t/>" remoteExec ["hintsilent",_killer];
			systemchat "You killed a friendly!";
			};
			
			};

			
	//________________	east	________________
	
	if (
		(side group _killed isEqualTo east)
		&& (!((typeOf _killed) in GF_Rank_Zombie_List)) 
		) exitWith{
			[_killer,{_this addRating GF_Rank_Rating_East}] remoteExec ["call",_killer];
			
			if(GF_Rank_Notification)then {
			//	parseText "<t color = '#ff0000'>You just killed an Enemy<t/>" remoteExec ["hintsilent",_killer];
			systemchat "Enemy Kill";
			};
			
			};
			
			
	//________________	GF_Zombie_List	________________
	
	if (
		((typeOf _killed) in GF_Rank_Zombie_List) 
		)exitWith{
			[_killer,{_this addRating 10}] remoteExec ["call",_killer];
			
			if(GF_Rank_Notification)then {
			//	parseText "<t color = '#ff6000'>You just killed a Zombie<t/>" remoteExec ["hintsilent",_killer];
			systemchat "Zombie Kill";
			};
			
			};	

	
}];




//________________	_Rank	________________

GF_Rank_Rank_color				= [1,1,1,1];
GF_Rank_Rank_position			= [16,13,25];	
GF_Rank_Rank_width				= 1;
GF_Rank_Rank_height				= 1;
GF_Rank_Rank_angle				= 0;
GF_Rank_Rank_shadow				= 2;
GF_Rank_Rank_textSize			= 0.05;
GF_Rank_Rank_font				= "PuristaMedium";


//________________	_Rating	________________

GF_Rank_Rating_color			= [1,1,1,1];
GF_Rank_Rating_position			= [15,12,25];	
GF_Rank_Rating_width			= 1;
GF_Rank_Rating_height			= 1;
GF_Rank_Rating_angle			= 0;
GF_Rank_Rating_shadow			= 2;
GF_Rank_Rating_textSize			= 0.05;
GF_Rank_Rating_font				= "PuristaMedium";


//________________	addMissionEventHandler	________________

addMissionEventHandler ["Draw3D", {

	
	//________________	_Rank	________________
	
	
	_rating = rating player;
	
	_Rank = "PRIVATE";


    switch true do {

    case((_rating >= 0) && (_rating < GF_Rank_PRIVATE)) : {_Rank = "PRIVATE";};
    case((_rating >= GF_Rank_PRIVATE) && (_rating < GF_Rank_CORPORAL)) : {_Rank = "CORPORAL";};
    case((_rating >= GF_Rank_CORPORAL) && (_rating < GF_Rank_SERGEANT)) : {_Rank = "SERGEANT";};
    case((_rating >= GF_Rank_SERGEANT) && (_rating < GF_Rank_LIEUTENANT)) : {_Rank = "LIEUTENANT";};
    case((_rating >= GF_Rank_LIEUTENANT) && (_rating < GF_Rank_CAPTAIN)) : {_Rank = "CAPTAIN";};
    case((_rating >= GF_Rank_CAPTAIN) && (_rating < GF_Rank_MAJOR)) : {_Rank = "MAJOR";};
    case(_rating > GF_Rank_COLONEL) : {_Rank = "COLONEL";};
    };


	
	
	_Rank_picture = format["\A3\Ui_f\data\GUI\Cfg\Ranks\%1_gs.paa",_Rank];
	_Rank_format = format ["RANK: %1",_Rank];
	_Rank_Pos = positionCameraToWorld GF_Rank_Rank_position;		
			
	drawIcon3D [
	
		_Rank_picture, 
		GF_Rank_Rank_color, 			//	color
		_Rank_Pos,					//	pos
		GF_Rank_Rank_width,			//	width
		GF_Rank_Rank_height,			//	height
		GF_Rank_Rank_angle,			//	angle
		_Rank_format,				//	text
		GF_Rank_Rank_shadow,			//	shadow
		GF_Rank_Rank_textSize,		//	textSize
		GF_Rank_Rank_font			//	font
	];
	
	
	//________________	_Rating	________________
	
	_Rating_format = format ["Rating: %1",rating player];
	_Rating_Pos = positionCameraToWorld GF_Rank_Rating_position;		
			
	drawIcon3D [
	
		"", 
		GF_Rank_Rating_color, 		//	color
		_Rating_Pos,				//	pos
		GF_Rank_Rating_width,		//	width
		GF_Rank_Rating_height,		//	height
		GF_Rank_Rating_angle,		//	angle
		_Rating_format,				//	text
		GF_Rank_Rating_shadow,		//	shadow
		GF_Rank_Rating_textSize,		//	textSize
		GF_Rank_Rating_font			//	font
	];
	
}];

 

 

 

 

  • Thanks 1

Share this post


Link to post
Share on other sites

This is just fine and functional, but how should it be added [player, ranks?] call BIS_fnc_setUnitInsignia? would appear even, if the player changed uniform.

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

×