Jump to content
Tuliq

[SCRIPT]Basic killticker

Recommended Posts

They should be located at the very bottom of the script. Make sure you have the latest version found in this thread! :)

I just added the same change to the OP. I think it should work better that way for dedicated servers.

Share this post


Link to post
Share on other sites
They should be located at the very bottom of the script. Make sure you have the latest version found in this thread! :)

I just added the same change to the OP. I think it should work better that way for dedicated servers.

Great, it works, thank you for this fast fix.

I had a old one of the "killTicker.sqf" from this link and didnt know that is diffrent.

http://www.armaholic.com/page.php?id=19101

Share this post


Link to post
Share on other sites

The version located on these forums will always be the most recent one. From time to time I will realize what stupid little mistakes I've made, fix them, and upload them here. Right now though, things look stable, so it will be a while until I decide to change anything.

Share this post


Link to post
Share on other sites

Can you change the background color? The background should be transparent!

zxj9f4xj.png

Share this post


Link to post
Share on other sites

No, the script uses the hint function to display the lines. The hint background is always dark and I don't think there is anything I can do about that. For the next version I will try to use fnc_bis_dynamicText to display the lines, which will give a transparent bg.

Share this post


Link to post
Share on other sites

Hey thanks for the great script, i have a question, how would i get this to just display in the center of the screen and not at the top right. i just want a quick display of "you killed Ai" in the center like it currently does without the same showing top right? failing that which bit do i need to edit to change the time it displays top right so it will just flash quickly ( i end up with it taking over my screen sometimes). i'm totally brand new to this scripting business, just want to make use of this for my own personal games with friends. thanks if you can help

Share this post


Link to post
Share on other sites
[] spawn tlq_killList;

Just remove that bit from the top. :)

Share this post


Link to post
Share on other sites

Hi, great script! I got it working with showing distance and weapon except any grenade or mine shows as them being killed with the weapon in hand (rifle or handgun). Also vehicles are not registered when killed. is this normal? if so can it be done? Many thanks.

Share this post


Link to post
Share on other sites
... Also vehicles are not registered when killed. is this normal? if so can it be done? Many thanks...

That would be awesome indeed.

Share this post


Link to post
Share on other sites

Would like to get this working with the EOS script... has anyone managed to do this?

Share this post


Link to post
Share on other sites

Hi, first off I'd like to thank the author I really like this script, but this thread seems to have gone a little cold but I thought I'd share my edited code. I have managed to get it to work with the GlobalChat format so it now appears in the bottom left hand corner.

How to use: place the following code in you mission init.sqf

null = execVM "killTicker.sqf";

Then place a rabbit found under side:Ambient life within the mission editor somewhere on the map.

Name it

observer

and add

this allowdamage false

to the rabbits initialization box. Be sure to use the edited code below, I have also added the Kill Weapon and distance. Enjoy :cool:

killTicker.sqf

tlq_killTicker = { 

_this addMPEventHandler ['MPKilled',{

	_unit = _this select 0;
	_killer = _this select 1;

	_newKill = [_unit,_killer];

	if (count tlq_killArray > 100) then {tlq_killArray = []};

	tlq_killArray set [count tlq_killArray,_newKill call tlq_parseKill];

	[] spawn tlq_killList;
	if (player == _killer) then {_newKill spawn tlq_killPopUp};


}
];

};



tlq_parseKill = {

_line = "";
_killerName = "";
_victimName = "";
_killerString = "";
_victimString = "";
_killerColor = "#99D5FF";
_victimColor = "#99D5FF";


_victim = _this select 0;
_killer = _this select 1;

if (!(isplayer _killer)) then {
	_killerName = getText (configFile >> "CfgVehicles" >> format["%1",typeOf _killer] >> "Displayname");
	if(vehicle _killer != _killer) then {_killerName = getText (configFile >> "CfgVehicles" >> format["%1 crew",typeof vehicle _killer] >> "Displayname")};
	}else{_killerName = name _killer};

if (!(isplayer _victim)) then {
	_victimName = getText (configFile >> "CfgVehicles" >> format["%1",typeOf _victim] >> "Displayname");
	if(vehicle _victim != _victim) then {_victimName = getText (configFile >> "CfgVehicles" >> format["%1 crew",typeof vehicle _victim] >> "Displayname")};
	}else{_victimName = name _victim};

if ((_killer==player) or (_killer == vehicle player)) then
	{
	_killerColor = "#ffff00"; //yellow
	}
	else
	{
	_killerColor = side group _killer call BIS_fnc_sideColor;

		_r = _killerColor select 0;
		_g = _killerColor select 1;
		_b = _killerColor select 2;

	_killerColor = [_r+0.1,_g+0.1,_b+0.1];

	_killerColor = _killerColor call BIS_fnc_colorRGBtoHTML;

	};

if (_victim==player) then
	{
	_victimColor = "#ffff00"; //yellow
	}
	else
	{
	_victimColor = side group _victim call BIS_fnc_sideColor;

		_r = _victimColor select 0;
		_g = _victimColor select 1;
		_b = _victimColor select 2;

	_victimColor = [_r+0.1,_g+0.1,_b+0.1];

	_victimColor = _victimColor call BIS_fnc_colorRGBtoHTML;

	};

_killerString = format[_killerName];
_victimString = format[_victimName];
_killweapon = getText(configFile >> "CfgWeapons" >> format ["%1",currentWeapon _killer] >> "displayname");
       _dist = round (_victim distance _killer);

//the line which shows the final formatted kill
_line = switch(true) do {
	case(_killer == _victim): {observer globalchat format ["%1 killed themselves",_killerString]};
	case(isNull _killer): {observer globalchat format ["Bad luck for %1",_victimString]};
	default {observer globalchat format ["%1 killed %2 with %3 from %4 meters",_killerString,_victimString,_killWeapon,_dist]};
};

_line;

};


tlq_killPopUp = {

_victim = _this select 0;
_killer = _this select 1;


_victimName = "";	
_victimString = "";
_victimColor = "#99D5FF";


if (!(isplayer _victim)) then {
	_victimName = getText (configFile >> "CfgVehicles" >> format["%1",typeOf _victim] >> "Displayname");
if(vehicle _victim != _victim) then {_victimName = getText (configFile >> "CfgVehicles" >> format["%1 crew",typeof vehicle _victim] >> "Displayname")};
	}else{_victimName = name _victim};

_victimColor = (side group _victim call BIS_fnc_sideColor) call BIS_fnc_colorRGBtoHTML;

_victimString = format["<t color='%1'>%2</t>",_victimColor,_victimName];

_line = if ((_killer == player) and (_victim == player)) then {
	"<t size='0.5'>You killed yourself</t>";
} else {
	format ["<t size='0.5'>You killed %1</t>",_victimString];
};	

	[_line,0,0.8,2,0,0,7017] spawn bis_fnc_dynamicText;

};



tlq_killList = {


//flush kills and  show most recent
if (time - tlq_killTime > 37) then {
	tlq_displayedKills = [];
};


tlq_displayedKills set [count tlq_displayedKills, tlq_killArray select (count tlq_killArray - 1)];



_tickerText = "";


_c = 0;
for "_i" from (count tlq_displayedKills) to 0 step -1 do{

	_c = _c + 1;

	_tickerText = format ["%1<br />%2",tlq_displayedKills select _i,_tickerText];

	if (_c > 8) exitWith{};

};

hintsilent parsetext _tickerText;

//["<t size='0.4' align='right'>" + _tickerText + "</t>",safeZoneX,safeZoneY,10,0,0,7016] call bis_fnc_dynamicText;


tlq_killTime = time;

};



//declare global variables

tlq_killArray = [];
tlq_displayedKills = [];
tlq_killTime = 0;

//start kill registration for player
if (!isNull player) then {
player spawn tlq_killTicker;
};

if (isServer) then {
//ai
{
	if (!(isPlayer _x)) then {
		_x spawn tlq_killTicker};
} forEach allUnits;
};

Edited by WinstonSmith

Share this post


Link to post
Share on other sites

don't know if this thead is dead , but theres a fix for colo,r if anyone has noticed in there server log files.

change this call BIS_fnc_colorRGBtoHTML;

to call BIS_fnc_colorRGBAtoHTML;

also might be good to define colors like this:

#define COLOR_orange {1,0.322,0.027,1}

#define HTMLCOLOR_orange '#FF5207'

#define RGB_orange "#FF5207"

#define COLOR_blue {0.435,0.502,0.635,1}

#define HTMLCOLOR_blue '#6F80A2'

#define RGB_blue "#6F80A2"

#define COLOR_red {1,0,0,1}

#define HTMLCOLOR_red '#FF0000'

#define RGB_red "#FF0000"

#define COLOR_yella {0.675,0.647,0.275,1}

#define HTMLCOLOR_yella '#ACA546'

#define RGB_yella "#ACA546"

Share this post


Link to post
Share on other sites

I would say it was dead considering the last post was over a year ago...

Share this post


Link to post
Share on other sites

Dead or not, the script is still working. I'm using it in my mission but have an issue with it. As I said the script is working fine -> with units placed on the map in the Editor. My issue is that death messages of units created/spawned after the mission start are not reported.

For example if I spawn an enemy group with 'Zeus' or 'MCC sandbox' when the mission is already running, kill messages will not work for that group.

Is it possible to make automatic kill detection of units during the mission, without need to manually running the command:

yourunitName spawn tlq_killTicker;

(actually even running that command doesnt make kill messages work with the newly spawned units)

This is my init.sqf

null = execVM "killTicker.sqf";

I have ambient 'rabbit' placed on the map with name 'observer' and init line:

this allowdamage false;

and my killticker.sqf

tlq_killTicker = { 

_this addMPEventHandler ['MPKilled',{

	_unit = _this select 0;
	_killer = _this select 1;

	_newKill = [_unit,_killer];

	if (count tlq_killArray > 100) then {tlq_killArray = []};

	tlq_killArray set [count tlq_killArray,_newKill call tlq_parseKill];

	[] spawn tlq_killList;
	if (player == _killer) then {_newKill spawn tlq_killPopUp};


}
];

};



tlq_parseKill = {

_line = "";
_killerName = "";
_victimName = "";
_killerString = "";
_victimString = "";
_killerColor = "#99D5FF";
_victimColor = "#99D5FF";


_victim = _this select 0;
_killer = _this select 1;

if (!(isplayer _killer)) then {
	_killerName = getText (configFile >> "CfgVehicles" >> format["%1",typeOf _killer] >> "Displayname");
	if(vehicle _killer != _killer) then {_killerName = getText (configFile >> "CfgVehicles" >> format["%1 crew",typeof vehicle _killer] >> "Displayname")};
	}else{_killerName = name _killer};

if (!(isplayer _victim)) then {
	_victimName = getText (configFile >> "CfgVehicles" >> format["%1",typeOf _victim] >> "Displayname");
	if(vehicle _victim != _victim) then {_victimName = getText (configFile >> "CfgVehicles" >> format["%1 crew",typeof vehicle _victim] >> "Displayname")};
	}else{_victimName = name _victim};

if ((_killer==player) or (_killer == vehicle player)) then
	{
	_killerColor = "#ffff00"; //yellow
	}
	else
	{
	_killerColor = side group _killer call BIS_fnc_sideColor;

		_r = _killerColor select 0;
		_g = _killerColor select 1;
		_b = _killerColor select 2;

	_killerColor = [_r+0.1,_g+0.1,_b+0.1];

	_killerColor = _killerColor call BIS_fnc_colorRGBtoHTML;

	};

if (_victim==player) then
	{
	_victimColor = "#ffff00"; //yellow
	}
	else
	{
	_victimColor = side group _victim call BIS_fnc_sideColor;

		_r = _victimColor select 0;
		_g = _victimColor select 1;
		_b = _victimColor select 2;

	_victimColor = [_r+0.1,_g+0.1,_b+0.1];

	_victimColor = _victimColor call BIS_fnc_colorRGBtoHTML;

	};

_killerString = format[_killerName];
_victimString = format[_victimName];
_killweapon = getText(configFile >> "CfgWeapons" >> format ["%1",currentWeapon _killer] >> "displayname");
       _dist = round (_victim distance _killer);

//the line which shows the final formatted kill
_line = switch(true) do {
	case(_killer == _victim): {observer globalchat format ["%1 killed themselves",_killerString]};
	case(isNull _killer): {observer globalchat format ["Bad luck for %1",_victimString]};
	default {observer globalchat format ["%1 killed %2 with %3 from %4 meters",_killerString,_victimString,_killWeapon,_dist]};
};

_line;

};


tlq_killPopUp = {

_victim = _this select 0;
_killer = _this select 1;


_victimName = "";	
_victimString = "";
_victimColor = "#99D5FF";


if (!(isplayer _victim)) then {
	_victimName = getText (configFile >> "CfgVehicles" >> format["%1",typeOf _victim] >> "Displayname");
if(vehicle _victim != _victim) then {_victimName = getText (configFile >> "CfgVehicles" >> format["%1 crew",typeof vehicle _victim] >> "Displayname")};
	}else{_victimName = name _victim};

_victimColor = (side group _victim call BIS_fnc_sideColor) call BIS_fnc_colorRGBtoHTML;

_victimString = format["<t color='%1'>%2</t>",_victimColor,_victimName];

_line = if ((_killer == player) and (_victim == player)) then {
	"<t size='0.5'>You killed yourself</t>";
} else {
	format ["<t size='0.5'>You killed %1</t>",_victimString];
};	

	[_line,0,0.8,2,0,0,7017] spawn bis_fnc_dynamicText;

};



tlq_killList = {


//flush kills and  show most recent
if (time - tlq_killTime > 37) then {
	tlq_displayedKills = [];
};


tlq_displayedKills set [count tlq_displayedKills, tlq_killArray select (count tlq_killArray - 1)];



_tickerText = "";


_c = 0;
for "_i" from (count tlq_displayedKills) to 0 step -1 do{

	_c = _c + 1;

	_tickerText = format ["%1<br />%2",tlq_displayedKills select _i,_tickerText];

	if (_c > 8) exitWith{};

};

hintsilent parsetext _tickerText;

//["<t size='0.4' align='right'>" + _tickerText + "</t>",safeZoneX,safeZoneY,10,0,0,7016] call bis_fnc_dynamicText;


tlq_killTime = time;

};



//declare global variables

tlq_killArray = [];
tlq_displayedKills = [];
tlq_killTime = 0;

//start kill registration for player
if (!isNull player) then {
player spawn tlq_killTicker;
};

if (isServer) then {
//ai
{
	if (!(isPlayer _x)) then {
		_x spawn tlq_killTicker};
} forEach allUnits;
};

Edited by helldesign

Share this post


Link to post
Share on other sites
don't know if this thead is dead , but theres a fix for colo,r if anyone has noticed in there server log files.

change this call BIS_fnc_colorRGBtoHTML;

to call BIS_fnc_colorRGBAtoHTML;

i have tried this... but then the color in the hintbox is black instead of the teamcolor

also might be good to define colors like this:

#define COLOR_orange {1,0.322,0.027,1}

#define HTMLCOLOR_orange '#FF5207'

#define RGB_orange "#FF5207"

#define COLOR_blue {0.435,0.502,0.635,1}

#define HTMLCOLOR_blue '#6F80A2'

#define RGB_blue "#6F80A2"

#define COLOR_red {1,0,0,1}

#define HTMLCOLOR_red '#FF0000'

#define RGB_red "#FF0000"

#define COLOR_yella {0.675,0.647,0.275,1}

#define HTMLCOLOR_yella '#ACA546'

#define RGB_yella "#ACA546"

where should we put this and what is the benefit?

i thought about to get rid of the logerrors by hardcoding the color for each team... without the RGBtoHTML function...

any suggestions?

Share this post


Link to post
Share on other sites

i have tried to hardcode the colors for the teams but then it doesnt recognize it correctly if someone changes the team and shows him with the previous color sometimes

Share this post


Link to post
Share on other sites
ahh very nice. Learn something new every day. I also "borrowed" a line from another mission I played where you get the distance. Added that to the text and it looks pretty spiffy. Like you, I agree the pictures make it look... blech. However with weapon name/distance it looks nice and gets the point across.

For those wanting the extra lines...

just add

_dist = round (_victim distance _killer);

then change {format ["%1 killed %2 with %3 from %4 meters",_killerString,_victimString,_weaponName,_dist]};

and you get

"Bob killed Bob with peashooter from 600 meters"

all i get now is

x killed y with dagger from scalar NAN meters

killer, victim and weapon is shown right... but the distance is fucked up...

any clue?

Share this post


Link to post
Share on other sites

If you're directly copying the code you've quoted there's a typo in the format line, at the end _d ist should be _dist.

Share this post


Link to post
Share on other sites

yeah i corrected that when i added it...

and i already fixed it... i inserted it a few lines to early ^^

i moved it down after the killer and victim strings are defined and it works now...

now we just need to fix these rgbtohtml errors and we are good to go ^^

Share this post


Link to post
Share on other sites

ok guys... i have made some improvement..

to get rid of the rpt errors caused by the bis functions

with this version the colors are hardcoded for every team to exactly these colors which are delivered by the bis functions... so no more need for them and no more errors from them ^^

tlq_killTicker = { 

_this addMPEventHandler ['MPKilled',{

	_unit = _this select 0;
	_killer = _this select 1;

	_newKill = [_unit,_killer];

	if (count tlq_killArray > 100) then {tlq_killArray = []};

	tlq_killArray set [count tlq_killArray,_newKill call tlq_parseKill];

	[] spawn tlq_killList;
	if (player == _killer) then {_newKill spawn tlq_killPopUp};


}
];

};



tlq_parseKill = {

_line = "";
_killerName = "";
_victimName = "";
_killerString = "";
_victimString = "";
_killerColor = "#99D5FF";
_victimColor = "#99D5FF";


_victim = _this select 0;
_killer = _this select 1;

if (!(isplayer _killer)) then {
	_killerName = getText (configFile >> "CfgVehicles" >> format["%1",typeOf _killer] >> "Displayname");
	if(vehicle _killer != _killer) then {_killerName = getText (configFile >> "CfgVehicles" >> format["%1 crew",typeof vehicle _killer] >> "Displayname")};
	}else{_killerName = name _killer};

if (!(isplayer _victim)) then {
	_victimName = getText (configFile >> "CfgVehicles" >> format["%1",typeOf _victim] >> "Displayname");
	if(vehicle _victim != _victim) then {_victimName = getText (configFile >> "CfgVehicles" >> format["%1 crew",typeof vehicle _victim] >> "Displayname")};
	}else{_victimName = name _victim};

if ((_killer==player) or (_killer == vehicle player)) then
	{
	_killerColor = "#ffff00"; //yellow
	}
	else
	{
		if (side group _killer == west) then {_killerColor = "#1a66b3";};
		if (side group _killer == east) then {_killerColor = "#991a1a";};
		if (side group _killer == resistance) then {_killerColor = "#1a991a";};
		if (side group _killer == civilian) then {_killerColor = "#801a99";};
	};

if (_victim==player) then
	{
	_victimColor = "#ffff00"; //yellow
	}
	else
	{
		if (side group _victim == west) then {_victimColor = "#1a66b3";};
		if (side group _victim == east) then {_victimColor = "#991a1a";};
		if (side group _victim == resistance) then {_victimColor = "#1a991a";};
		if (side group _victim == civilian) then {_victimColor = "#801a99";};
	};

_killerString = format["<t color='%1'>%2</t>",_killerColor ,_killerName];
_victimString = format["<t color='%1'>%2</t>",_victimColor,_victimName];
_killweapon = getText(configFile >> "CfgWeapons" >> format ["%1",currentWeapon _killer] >> "displayname");
_dist = round (_victim distance _killer);

//the line which shows the final formatted kill
_line = switch(true) do {
	case(_killer == _victim): {format ["%1 killed themselves",_killerString]};
	case(isNull _killer): {format ["Bad luck for %1",_victimString]};
	default {format ["%1 killed %2 with %3 from %4 meters",_killerString,_victimString,_killWeapon,_dist]};
};

_line;

};


tlq_killPopUp = {

_victim = _this select 0;
_killer = _this select 1;


_victimName = "";	
_victimString = "";
_victimColor = "#99D5FF";


if (!(isplayer _victim)) then {
	_victimName = getText (configFile >> "CfgVehicles" >> format["%1",typeOf _victim] >> "Displayname");
if(vehicle _victim != _victim) then {_victimName = getText (configFile >> "CfgVehicles" >> format["%1 crew",typeof vehicle _victim] >> "Displayname")};
	}else{_victimName = name _victim};

if (side group _victim == west) then {_victimColor = "#1a66b3";};
if (side group _victim == east) then {_victimColor = "#991a1a";};
if (side group _victim == resistance) then {_victimColor = "#1a991a";};
if (side group _victim == civilian) then {_victimColor = "#660080";};

_victimString = format["<t color='%1'>%2</t>",_victimColor,_victimName];

_line = if ((_killer == player) and (_victim == player)) then {
	"<t size='0.5'>You killed yourself</t>";
} else {
	format ["<t size='0.5'>You killed %1</t>",_victimString];
};	

	[_line,0,0.8,2,0,0,7017] spawn bis_fnc_dynamicText;

};



tlq_killList = {


//flush kills and  show most recent
if (time - tlq_killTime > 37) then {
	tlq_displayedKills = [];
};


tlq_displayedKills set [count tlq_displayedKills, tlq_killArray select (count tlq_killArray - 1)];



_tickerText = "";


_c = 0;
for "_i" from (count tlq_displayedKills) to 0 step -1 do{

	_c = _c + 1;

	_tickerText = format ["%1<br />%2",tlq_displayedKills select _i,_tickerText];

	if (_c > 8) exitWith{};

};

hintsilent parsetext _tickerText;

//["<t size='0.4' align='right'>" + _tickerText + "</t>",safeZoneX,safeZoneY,10,0,0,7016] call bis_fnc_dynamicText;


tlq_killTime = time;

};



//declare global variables

tlq_killArray = [];
tlq_displayedKills = [];
tlq_killTime = 0;

//start kill registration for player
if (!isNull player) then {
player spawn tlq_killTicker;
};

if (isServer) then {
//ai
{
	if (!(isPlayer _x)) then {
		_x spawn tlq_killTicker};
} forEach allUnits;
};

tried it with a switch side before... which didnt work...

but now it works...

if you have better code or more improvements... feel free to post...

Share this post


Link to post
Share on other sites

Great script. I have used this on my "LAN party" missions. But now i have Problem. It dosent work with ACE3. I believe that its got something to do with wounding system. If someone fix this and get it work with ACE3, that would be awesome. Thanks anyway.

Share this post


Link to post
Share on other sites

Please help somebody! My killTicker doesnt make kill messages with spawned bots during the mission. 

Share this post


Link to post
Share on other sites

Please help somebody! My killTicker doesnt make kill messages with spawned bots during the mission. 

 

Me too.

When player killed spawned AI it not show message.

But when AI killed player or player kill yourself it show.

How to fix?

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

×