Jump to content
Sign in to follow this  
davidoss

"killed" eventhandler

Recommended Posts

This is next attempt to trying understand why "killed" eventhandler is not working right for me.

//executed on server
{{[_x] call INS_fnc_ckcivEH} foreach (units _x)} foreach _civ_groups;

INS_fnc_ckcivEH server side

//executed on server 	
params ["_unit", "_ehkilledIdx"];

	_ehkilledIdx = _unit addEventHandler ["killed", {

		params ["_cvictim", "_ckiller"];
		
		["Unnecessary civilian casualties detected!", "systemChat"] call BIS_fnc_MP;
		
               [[_cvictim, _ckiller], "INS_fnc_ckMP", WEST, false, false] call BIS_fnc_MP; 
	}];

INS_fnc_ckMP global

//executed on player
params ["_cvictim", "_ckiller"];

[str _cvictim + "is the victim", "systemChat"] call BIS_fnc_MP;
[str _ckiller + "is the killer", "systemChat"] call BIS_fnc_MP;
diag_log format ["%1 -is the victim ### %2 -is the killer", _cvictim, _ckiller];

And after i kill some civilians  this is returning:

22:22:31 "C Alpha 1-3:2 -is the victim ### C Alpha 1-3:2 -is the killer"
22:22:40 "C Alpha 1-3:4 -is the victim ### C Alpha 1-3:4 -is the killer"
22:22:59 "C Alpha 1-3:3 -is the victim ### C Alpha 1-3:3 -is the killer"
22:23:04 "C Alpha 2-3:2 -is the victim ### C Alpha 2-3:2 -is the killer"
22:23:10 "C Alpha 2-1:1 -is the victim ### C Alpha 2-1:1 -is the killer"

Why?

Share this post


Link to post
Share on other sites

Where do you get the parameter "_ehkilledIdx" from in your "params" array?

I take a look at it when I am sober :P

Share this post


Link to post
Share on other sites

What are you asking? if you want to display the name of the units, use 

name (veriable)

to show the display name of the unit.

Share this post


Link to post
Share on other sites

What are you asking? if you want to display the name of the units, use

name (veriable)
to show the display name of the unit.

22:22:31 "C Alpha 1-3:2 -is the victim ### C Alpha 1-3:2 -is the killer"
it should be returned

22:22:31 "C Alpha 1-3:2 -is the victim ### B Alpha 1-1:1 (DaVidoSS) -is the killer"

Share this post


Link to post
Share on other sites

You have damn right! ACE 3 is causing this madness

 

 

"C Alpha 2-3:3 -is the victim ### B Alpha 1-1:1 (DaVidoSS) -is the killer"

Share this post


Link to post
Share on other sites

Where do you get the parameter "_ehkilledIdx" from in your "params" array?

I take a look at it when I am sober :P

 

This is just private variable.

 

Private variables can be joined into params array in  right order (passed first).

params ["_passedparam0", "_passedparam1", "_private", "_private1"];

_private = 0;
_private1 = 1;

 

Look this at bottom KK says.

 

Man i have spend more than 20 hours trying to figure out why the event handler not fire.

It was the ACE 3 causing this. Ehh

Share this post


Link to post
Share on other sites

Just checked the MPKilled eventhandler. The same result as well.

Share this post


Link to post
Share on other sites

Hi,

 

Maybe you have an error here:

 

{{[_x] call INS_fnc_ckcivEH} foreach (units _x)} foreach _civ_groups;

 

Try to change it by:

 

{_group = _x;

{[_x] call INS_fnc_ckcivEH} forEach units _group;

} orEach _civ_groups;

 

And see what happens...

Share this post


Link to post
Share on other sites

No need. No errors are given.

Without ace works perfect

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
Sign in to follow this  

×