User Tools

Site Tools


ArmA 2 addPublicVariableEventhandler

Quick addPublicVariableEventhandler example.

This was done to have marker placed on map when aircraft crashes.

If you are client, you get this marker, but if you JIP after this has been created, you wont see it.


"PMC_Downed_Aircraft" addPublicVariableEventhandler
	private ["_markerobj", "_m"];
	_m = format ["PMC_Aircraft_%1", (round random 1000)];
	_markerobj = createMarkerLocal [_m, getPos (_this select 1)];
	_markerobj setMarkerTypeLocal "mil_pickup";
	_markerobj setMarkerColorLocal "ColorBlue";
	_markerobj setMarkerTextLocal format ["%1", _m];
	hint "Downed Aircraft Marker Placed!\n\nCheck map.";
	[_m] spawn { sleep 1800; (_this select 0) setMarkerColorLocal "ColorBlack"; sleep 1800; deleteMarker (_this select 0); };

Then just call it by giving the variable the aircraft vehicle name and publicVariable it, like this:

PMC_Downed_Aircraft = _vcl;
publicVariable "PMC_Downed_Aircraft";

Put that somewhere that detects the aircraft being shot down, perhaps in killed eventhandler or other script.


ArmA 2 Global Broadcast

"PMC_Hint" addPublicVariableEventHandler
	hint format["%1", (_this select 1)];

Then use it like:

PMC_Hint = "Hello world!";

And hello world is displayed as hint on every client. Very simple way to show hints from server to clients.

arma2/scripting/addpublicvariableeventhandler.txt · Last modified: 2015-05-31 23:04 (external edit)