Jump to content
thirith

Intel gathering: add action to all civilians that is removed once used

Recommended Posts

I'm currently thinking of creating a mission where one team is tasked with gathering intel from the civilian population. The way this works in my mind is as follows: all the civilians in a Takistani village should have an action added (e.g. "Talk to civilian"); when it's used, a counter goes up by one and the action is removed from that particular civilian. Once the counter is higher than 3, a certain location is revealed.

 

I think I know how to do this in a heavy-handed way, adding it to each civilian manually - but I expect there'd be a smarter, more elegant way to script this. Any suggestions how best to get this done?

Share this post


Link to post
Share on other sites

Sketched up something, might do the trick:

 

//ask 3 civs, then remove action from everyone and reveal location
_civs = allUnits select {alive _x AND side _x isEqualTo civilian};

{
	_x linkItem "ItemRadio"; //so they can "talk" if they're editor placed civilian units

	_ID = _x addAction ["Talk to civilian",{

		params ["_object","_caller","_ID","_civs"];
		_reveal = (missionNamespace getVariable ["TAG_fnc_civsAsked",0]) >= 2;//will return true on the third unit
		if (_reveal) exitWith {
			_object globalChat "The bad guys are at grid 062262!";
			//remove all actions from the remaining civs
			{
				_x removeAction (_x getVariable ["TAG_fnc_revealActionID",-1]);
			} forEach _civs;
		};

	_randomAnswers = ["No idea what you're talking about!","Go bother someone else?","Oh look, a squirrel!","Behind you, a three headed monkey!"];
	_object globalChat selectRandom _randomAnswers;
	_counter = missionNamespace getVariable ["TAG_fnc_civsAsked",0];
	_counter = _counter + 1;
	missionNamespace setVariable ["TAG_fnc_civsAsked",_counter,true];
	_object removeAction _ID;


	},_civs];

	_x setVariable ["TAG_fnc_revealActionID",_ID];

} forEach _civs;

Will add an action to every civilian, you can also use specific units in the _civs array, action can only be used once.

Upon the third use of the action, the location will be revealed and all actions removed from every other civ.

 

Cheers

 

  • Like 2

Share this post


Link to post
Share on other sites

Brilliant, thanks! I'll try that out next time I work on the mission. (Also, love the random answers. Arma missions need more Monkey Island.)

 

The mission itself will be an asymmetrical versus mission: a squad is tasked with negotiating a truce with a couple of village leaders while a two-man sniper/spotter team is tasked with preventing this from happening. I don't know yet whether that'll actually work out, but I like the idea of asymmetrical versus missions as a nice change of pace from our usual coop fare.

  • Like 1

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

×