Jump to content
mrempireman

Create task via a spotted target?

Recommended Posts

In the Tac ops DLC mission no reprieve, you can spot targets that create missions for eliminating them.  Is there any scripts that can do this? Thanks

Share this post


Link to post
Share on other sites

@R3vo I'm just wondering, is the script meant to be put in myscript.sqf or something in game such as the player init or a trigger. Also create task, how would this make a task? Would you put the variable name for your create task module and then in the script change it to  {//create task1}; .

Share this post


Link to post
Share on other sites
5 hours ago, mrempireman said:

@R3vo I'm just wondering, is the script meant to be put in myscript.sqf or something in game such as the player init or a trigger. Also create task, how would this make a task? Would you put the variable name for your create task module and then in the script change it to  {//create task1}; .

I would put (player knowsAbout _object) > 2) in the condition of a trigger. This trigger is then synced to a create task module.

Share this post


Link to post
Share on other sites
On 1/22/2018 at 7:48 AM, mrempireman said:

you can spot targets that create missions for eliminating them.

Could do something like..

//initPlayerLocal.sqf
waitUntil { time > 0 };	
findDisplay 46 displayAddEventHandler [ "KeyDown", {
	if ( inputAction "revealTarget" > 0 && { !isNull cursorObject && { typeOf cursorObject isKindOf "Man" }} ) then {
		_tskName = format[ "Tsk_Kill_%1", name cursorObject ];
		if !( [ _tskName ] call BIS_fnc_taskExists ) then {
			[
				side player,
				_tskName,
				[ format[ "Kill %1 %2", rank cursorObject, name cursorObject ], format[ "Kill %1", name cursorObject ], "" ],
				cursorObject,
				"Created",
				1,
				true,
				"kill"
			] call BIS_fnc_taskCreate;
		};
	};
}];

When you press the reveal button (controls > weapons > reveal target) it will create a task for the player's side to kill the spotted unit.

  • Like 4

Share this post


Link to post
Share on other sites

The good question is, what are the targets? Any enemy officers, any known/reveal enemy, some specific units in a scenario?

 

Share this post


Link to post
Share on other sites
3 minutes ago, pierremgi said:

The good question is, what are the targets? Any enemy officers, any known/reveal enemy, some specific units in a scenario?

 

Very nice! Are you using RscMapControl with heavily modified base defines for squad radar?

Share this post


Link to post
Share on other sites

A rscTitle with a radar backGround. Extract of code here:

_group_icon_radar = (uiNameSpace getVariable "Glasses_Grp_WtoS") displayCtrl 5000;
_group_icon_radar ctrlSetText "A3\ui_f\data\IGUI\cfg\Radar\radarbackground_ca.paa";

Then group player positioning, green to red health status, icons for typeof vehicle/units... At least you can see who is wounded, where your medic is or if someone has boarded an helo + some other settings. (created on oct 2014)

Share this post


Link to post
Share on other sites

@pierremgi - So no RscMapControl? I don't see how RscTitle would work for that... If it did, do you draw on it somehow? Seems like a ton of code for relative positioning. Or did you mean use that texture on RscMapControl?

Share this post


Link to post
Share on other sites

No i have some addActions toggling some displays like this one.

Here:

if (toggle_radar == 1) then {103 cutRsc ["group_WtoS_icon","PLAIN",0.2,false];
} else {
  103 cutRsc ["default","PLAIN"];
};

then in my config.cpp, where i describe all my displays (class rscTitles), I have this display (class group_Wtos_icon) and the associated controls: One for background (the mentioned paa), 12 for icons (limited to 12 guys, i must admit) and the range text one.

This starts like this:
 

Spoiler

 

    class group_WtoS_icon
    {
    idd = -1;
    duration = 100000;
    fadein = 0;
    fadeout = 0;
    name="group_WtoS";
       onLoad = "uiNamespace setVariable ['Glasses_Grp_WtoS', _this select 0]";
    controls[]=    {
            groupWtoS_radar,
            groupWtoS_range,
            groupWtoS1, groupWtoS101,
            groupWtoS2,    groupWtoS201,
            groupWtoS3,    groupWtoS301,
            groupWtoS4,    groupWtoS401,
            groupWtoS5,    groupWtoS501,
            groupWtoS6, groupWtoS601,
            groupWtoS7,    groupWtoS701,
            groupWtoS8,    groupWtoS801,
            groupWtoS9, groupWtoS901,
            groupWtoS10, groupWtoS1010,
            groupWtoS11, groupWtoS1011,
            groupWtoS12, groupWtoS1012
        };

        class groupWtoS_radar: RscPicture
         {
        idc = 5000;
        colorText[] = {1,1,1,0.2};
        };

        class groupWtoS1: RscPicture
         {
        idc = 5001;
        colorText[] = {1,1,0,0.5};
        };
        class groupWtoS101: Rsctext
         {
        idc = 5101;
        style=2;
        shadow = 2;
        SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 45))/ (getResolution select 5)";
        colorText[] = {1,1,0,0.5};
        };
        class groupWtoS2: RscPicture
         {
        idc = 5002;
        colorText[] = {1,1,0,0.5};
        };
        class groupWtoS201: Rsctext
         {
        idc = 5102;
        style=2;
        shadow = 2;
        SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 45))/ (getResolution select 5)";
        colorText[] = {1,1,0,0.5};
        };

...... and so on.

 

 

Of course it's inherited of the RscPicture, RscText, basic classes you must refer with #include a hpp , but I guess you already know that.

And yes, you "just" have to cope with the azimuth, distances of the units,...

but also the "thickness" of each controls (icons) starting to upper/left corner if I remember...

+ some getResolution and screen aspect ratio (if you don't script like a pig) to keep a circle for each resolution, and avoid an ellipse. That was before BI simplified the video display setting.

I'd probably script something slightly different, studying the Larrow's way for the new pixel grid, if I had to rework it, but I'm on another script right now.

.

 

Share this post


Link to post
Share on other sites
On ‎1‎/‎23‎/‎2018 at 10:19 AM, Larrow said:

Could do something like..


//initPlayerLocal.sqf
waitUntil { time > 0 };	
findDisplay 46 displayAddEventHandler [ "KeyDown", {
	if ( inputAction "revealTarget" > 0 && { !isNull cursorObject && { typeOf cursorObject isKindOf "Man" }} ) then {
		_tskName = format[ "Tsk_Kill_%1", name cursorObject ];
		if !( [ _tskName ] call BIS_fnc_taskExists ) then {
			[
				side player,
				_tskName,
				[ format[ "Kill %1 %2", rank cursorObject, name cursorObject ], format[ "Kill %1", name cursorObject ], "" ],
				cursorObject,
				"Created",
				1,
				true,
				"kill"
			] call BIS_fnc_taskCreate;
		};
	};
}];

When you press the reveal button (controls > weapons > reveal target) it will create a task for the player's side to kill the spotted unit.

Larrow,

 

Can I change the inputAction to any defined action I want from this list?

https://community.bistudio.com/wiki/inputAction/actions/bindings

 

For example a user defined input like "user1".

 

Also, in addition to isKindOf "man", how can I add objects or vehicles. Not specific objects or vehicles, but just under the cursor target as the script already does.

 

I am wanting the UAV soldier to spot targets in the air from a UAV and assign a few task with you script. The ability to pick out specific "Man" and/or objects and/or vehicles would open the possibilities of game play.

 

Nice script

 

Reed

 

Tried this and no joy

Spoiler

//initPlayerLocal.sqf
waitUntil { time > 0 };	
findDisplay 46 displayAddEventHandler [ "KeyDown", {
	if ( inputAction "User2" > 0 && { !isNull cursorObject && { typeOf cursorObject isKindOf "Man" or "Air" or "Land" or "Car" or "Plane" or "Helicopter" or "Land" or "Civilian"}} ) then {
		_tskName = format[ "Tsk_Kill_%1", name cursorObject ];
		if !( [ _tskName ] call BIS_fnc_taskExists ) then {
			[
				side player,
				_tskName,
				[ format[ "Kill %1 %2", rank cursorObject, name cursorObject ], format[ "Kill %1", name cursorObject ], "" ],
				cursorObject,
				"Created",
				1,
				true,
				"kill"
			] call BIS_fnc_taskCreate;
		};
	};
}];

 

 

After testing the task does not complete once the target is killed.

This also does not work in hosted.

Share this post


Link to post
Share on other sites
12 hours ago, Jnr4817 said:

Can I change the inputAction to any defined action I want from this list?

https://community.bistudio.com/wiki/inputAction/actions/bindings

 

For example a user defined input like "user1".

Yes. This page has a better list, it is split into the sections as used in the control options. Just makes looking for the action name needed easier.

 

12 hours ago, Jnr4817 said:

Also, in addition to isKindOf "man", how can I add objects or vehicles. Not specific objects or vehicles, but just under the cursor target as the script already does.

{ typeOf cursorObject isKindOf _x }count [ "Man", "Air", "LandVehicle", "Ship" ] > 0

Man will cover all units of any side including civilians.

Air will cover all things flyable, helicopters, planes etc

LandVehicle will cover all things driveable Cars, Tanks, APCs

Ship will cover all things water Boats, Sub

 

Spoiler


//initPlayerLocal.sqf
waitUntil { time > 0 };	
findDisplay 46 displayAddEventHandler [ "KeyDown", {
	if ( inputAction "User1" > 0 && { !isNull cursorObject && { { typeOf cursorObject isKindOf _x }count [ "Man", "Air", "LandVehicle", "Ship" ] > 0 }} ) then {
		[] params[
			[ "_tskName", "Tsk_%1_%2" ],
			"_tskDescription",
			"_tskTitle",
			"_tskIcon",
			[ "_target", cursorObject ],
			[ "_targetGrid", mapGridPosition cursorObject ]
		];
		
		if ( typeOf _target isKindOf "Man" ) then {
			_tskName = format[ _tskName, "Kill", _target call BIS_fnc_netId ];
			_tskDescription = format[ "Kill%1 %2, last seen at %3.",
				//Only supply unit details for non civilian
				[ format[ " %1 %2", getText( configFile >> "CfgVehicles" >> typeOf _target >> "displayName" ), rank _target ], "" ] select ( side _target isEqualTo civilian ),
				name _target,
				_targetGrid
			];
			_tskTitle = format[ "Kill %1", name _target ];
			_tskIcon = "kill";
		}else{
			_tskName = format[ _tskName, "Destroy", _target call BIS_fnc_netId ];
			_tskDescription = format[ "Destroy the %1, last seen at %2. Or atleast make sure the vehicle is inoperable.",
				getText( configFile >> "CfgVehicles" >> typeOf _target >> "displayName" ),
				_targetGrid
			];
			_tskTitle = format[ "Destroy %1", getText( configFile >> "CfgVehicles" >> typeOf _target >> "displayName" ) ];
			_tskIcon = "destroy";
		};
		
		if !( [ _tskName ] call BIS_fnc_taskExists ) then {
			[
				side player,
				_tskName,
				[ _tskDescription, _tskTitle, "" ],
				_target,
				"Created",
				1,
				true,
				_tskIcon
			] call BIS_fnc_taskCreate;
			
			//Handle Task completion monitoring on the server
			[ _tskName, _tskIcon, _target ] remoteExec [ "TAG_fnc_monitorTask", 2 ];
		};
	};
}];

//initServer.sqf
TAG_fnc_monitorTask = {
	params[ "_tskName", "_tskType", "_target" ];
	
	_target setVariable[ "taskName", _tskName ];
	
	switch ( _tskType ) do {
		
		case "kill" : {
			_target addEventHandler [ "Killed", {
				params[ "_killed" ];
				
				[ _killed getVariable "taskName", "Succeeded" ] call BIS_fnc_taskSetState;
			}];
		};
		
		case "destroy" : {
			_target addEventHandler [ "Dammaged", {
				params[ "_vehicle" ];
				
				if ( !alive _vehicle || { ( !canMove _vehicle && !canFire _vehicle ) } ) then {
					[ _vehicle getVariable "taskName", "Succeeded" ] call BIS_fnc_taskSetState;
					_vehicle removeEventHandler[ "Dammaged", _thisEventHandler ];
				};
			}];
		};
	};
};

 

 
 

 

  • Like 2

Share this post


Link to post
Share on other sites

Excellent work so far.

2 Issues I found.

I cannot get to work in hosted MP, only works in single player.

If you open editor and place a random OpFor (csat or independent) and you are in a group with AI, once you have assigned the kill task and kill the officer, completing the task. Your AI teammates tell you to stop shooting and kill you, as if you team killed.

 

Thanks for all the work so far, this is an excellent script and has a lot of potential.

 

Reed

Share this post


Link to post
Share on other sites
14 hours ago, Jnr4817 said:

I cannot get to work in hosted MP, only works in single player.

Just a timing issue. Change..

waitUntil { time > 0 };

to

waitUntil { time > 0 && { !isnull finddisplay 46 } };

 

14 hours ago, Jnr4817 said:

If you open editor and place a random OpFor (csat or independent) and you are in a group with AI, once you have assigned the kill task and kill the officer, completing the task. Your AI teammates tell you to stop shooting and kill you, as if you team killed.

Not seeing this behaviour at all. Tested in SP, MP and MP dedicated with me and AI teammates as a group of west versus task targets of side east.

Share this post


Link to post
Share on other sites
20 hours ago, Larrow said:

Just a timing issue. Change..


waitUntil { time > 0 };

to


waitUntil { time > 0 && { !isnull finddisplay 46 } };

 

Not seeing this behaviour at all. Tested in SP, MP and MP dedicated with me and AI teammates as a group of west versus task targets of side east.

 

Excellent, thanks. I'll test tomorrow.

Share this post


Link to post
Share on other sites

You can place down a trigger for task activation of your choice, then sync it to Set Task Destination module, which should be synched to the actual Create A Task module, and the last one should be synched to the object/AI that should be followed and tracked down. In Set Task Destination change the first option to "Synchronized object" and don't unmark the other one bellow. I am not sure if you need to change the Task marker in the Create A Task module from Disabled to Synchronized object or the third possible option. But you can test it in order to work. So in the trigger's condition you can use: player knowsabout _target > 2 (for example) and when you "encounter" and see the target a following task should appear. You can use another trigger with the same condition as a Skip Waypoint and "let" the target move if further waypoints are placed after the HOLD waypoint. Then you can follow the AI with a moving task marker above him. 🙂 Use a Set Task Condition to accomplish the task, for example to kill the AI. Good luck! 🙂

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

×