Jump to content
Sign in to follow this  
froggyluv

Any Tie-In to AI Auto Report?

Recommended Posts

 

 So i have hacky script which uses all kinds off stored Arrays of whose been spotted by whom to use a custom report dialogue but was wondering if im missing an easier way to just piggyback after an AI soldier makes a callout ie "Soldier 100m"

Share this post


Link to post
Share on other sites

Like these? This would just save you doing your own arrays, etc... As for the checking if AI auto reports, not sure if there is an EH. You'd have to have some kind of loop.

https://community.bistudio.com/wiki/targetKnowledge

https://community.bistudio.com/wiki/targetsQuery

// reset...

https://community.bistudio.com/wiki/forgetTarget

Share this post


Link to post
Share on other sites
1 hour ago, HazJ said:

Like these? This would just save you doing your own arrays, etc... As for the checking if AI auto reports, not sure if there is an EH. You'd have to have some kind of loop.

https://community.bistudio.com/wiki/targetKnowledge

https://community.bistudio.com/wiki/targetsQuery

// reset...

https://community.bistudio.com/wiki/forgetTarget

 

I find the new "targets" command is quite good

 

https://community.bistudio.com/wiki/targets

 

does roughly what "targetsQuery" does but without the baggage from backward compatibility

 

some AI event handlers would have been nice but alas, it was not to be in a3

  • Like 1

Share this post


Link to post
Share on other sites

A few things to keep in mind, targets are almost instantly shared within a group, so it's basically impossible to check which unit spotted an enemy, within the same frame the entire group knows about that target.

 

This is a watered down version of what I'm using to enhance high command, since it always annoyed me that high command group subordinates are dead silent:


GOM_fnc_monitorGroupTargets = [group1,group2];
GOM_fnc_targetReports = GOM_fnc_monitorGroupTargets apply {""};

GOM_fnc_reportNewTargets = {

	params ["_group"];

	GOM_fnc_targetReports set [GOM_fnc_monitorGroupTargets find _group,
	format ["Group %1\nNo targets\n",_group]
	];
	_currentTargets = [];
	while {count (units _group select {alive _x}) > 0} do {

		waitUntil {
			!((leader _group targets [true] select {_x getVariable ["GOM_fnc_newTarget",true]}) isEqualTo _currentTargets)};

		_newTargets = (leader _group targets [true] select {_x getVariable ["GOM_fnc_newTarget",true]}) - _currentTargets;

		//set report to display
		if (_newTargets isEqualTo []) then {

			GOM_fnc_targetReports set [GOM_fnc_monitorGroupTargets find _group,
			format ["Group %1\nNo new targets\n",_group]
			];
			_currentTargets = _newTargets;

		} else {
			GOM_fnc_targetReports set [GOM_fnc_monitorGroupTargets find _group,
			format ["Group %1\nNew targets: %2\n",_group,_newTargets]
			];
			_currentTargets = _newTargets;
			leader _group sidechat format ["Contact, %1 enemies!",count _newTargets];//adjust to your liking
			sleep random [1,3,4];
			_newTargets apply {_x setVariable ["GOM_fnc_newTarget",false]};

		};



	};
	GOM_fnc_targetReports set [GOM_fnc_monitorGroupTargets find _group,
			format ["Group %1\n-KIA-\n",_group,_newTargets]
			];
	systemchat format ["%1 has no more alive members",_group];


};

{[_x] spawn GOM_fnc_reportNewTargets} forEach GOM_fnc_monitorGroupTargets;
onEachFrame {

	_report = GOM_fnc_targetReports joinString "";

	hintSilent _report

};

This will make group leaders of predefined groups (group1, group2, etc) do a basic report on how many targets they spotted, every 1-4 seconds, or no report if no contact has been made.

Already spotted targets won't be reported again.

Also constantly shows a hint of the spotted units.

 

Should definitely get you started.

 

Cheers

  • Like 2

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  

×