Jump to content
  • 0

Assassination mission on players


FragZ

Question

I though of something earlier today.

I know there is a mission in WAI that you need to assassinate the mayor, what if, every restart, you would get the same type of deal but for a player? There is also a mission in ISLAND LIFE which assassins can get assassination jobs which create an AI to kill. Is something like that do-able as a player target?

Let me explain myself.



If you would to get all players UIDs, and then randomise and get one of them, and put a bounty on him say 50oz gold or something, how could such thing be possible

 

EDIT 1: First creation (just a scratch of ideas and questions...)
Code:

if (isPlayer) then{
_uid = getPlayerUID player;
_ListOfPlayers= _ListOfPlayers + [_uid];  // Or maybe I should use _ListOfPlayers set [ count _ListOfPlayers, [_uid]];  ???
};
uisleep 30;
_Uptime = (floor(serverTime/3600));
_rnd = floor (random (count _ListOfPlayers));
VIPTargetUID = _ListOfPlayers select _rnd;

if (_uid in VIPTargetUID) then {
titleText [format ["%1, you are the target!! Survive 1 hour to get the reward..",name player], "PLAIN DOWN", 3];
player setVariable ["VIPTarget", true]; //Is something like this working? Any ways to do it?
VIPTargetName = name player; //Define the name of the target?? Since its in the UID portion of assassination?
//How would I define VIPTarget (see the marker part to see what im talking about, I want to attach the market to his position)
//Is there any way to create a marker that sticks to the target?
} else {
//Any way to find the name of the Assassination mission by his UID? I am lost here.
tittleText [format["%1 is now the target! Kill him to get the money!",VIPTargetName],"PLAIN DOWN", 3];
};
//Mark target on map
_markerobj = createMarker ["targetmarker",[0,0]];                                                                                
_markername= "targetmarker";                                                                                                                        
_markerobj setMarkerShape "ICON";                                
"targetmarker" setMarkerType "Marker";                                        
"targetmarker" setMarkerColor "ColorRed";                                                                                                                        
"targetmarker" setMarkerText "Assassination target";                                
_markername SetMarkerPos _start;
"targetmarker" setmarkerpos getpos VIPtarget;

/**Identify killer**/
_VIPKiller = _victim getVariable["AttackedByName", "nil"]; //How can you identify the killer?
/**Finish the mission**/
if (!alive VIPTarget && alive VIPKiller) exitWith { //Would this verify if the player is alive or no? How would such thing work!?
            
             _VIPKiller addMagazineCargo "ItemBriefCase50oz";
             hint "Good job! He deserved to die anyways.";
        };
if (_Uptime == 1 && alive VIPTarget) exitWith {
            hint "You survived the hunt. You keep the money.";
            _VIPKiller addMagazineCargo "ItemBriefCase50oz";
};
Link to comment
Share on other sites

18 answers to this question

Recommended Posts

  • 0

DZAI has randomized ai attacks mayb u can modify the code to fit your needs,

 

also arma 2 has missions built in systems like kill the target , and other things built in to the barracks training , would be cool to get thos missions for players 

Link to comment
Share on other sites

  • 0

DZAI has randomized ai attacks mayb u can modify the code to fit your needs,

 

also arma 2 has missions built in systems like kill the target , and other things built in to the barracks training , would be cool to get thos missions for players 

Indeed, it makes me wonder. I am lookign into that atm.

 

In Islandlife, it gets this:

VIPtarget = _group createUnit ["Functionary1_EP1", _pos, [], _radius, "FORM"];

Which create an AI named VIPtarget, and at the end there is this:

if (!alive VIPtarget and alive player) exitWith

    

        {

"server globalchat ""The VIP target has been killed!"";" call broadcast;

};

Link to comment
Share on other sites

  • 0

All player controlled playable units (the example at the end):

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

 

To randomize (select a random one from the array of all):

_unit = Array_with_all_players call BIS_fnc_selectRandom;

 

In dayz_server/compile/server_player_died.sqf you see how that works to identify the killer who then should get the bounty.

 

Have a look how other events work to start this...you also need to check in the loop of the event if the target player logs out or already died before (on his own) I guess.

Link to comment
Share on other sites

  • 0

All player controlled playable units (the example at the end):

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

 

To randomize (select a random one from the array of all):

_unit = Array_with_all_players call BIS_fnc_selectRandom;

 

In dayz_server/compile/server_player_died.sqf you see how that works to identify the killer who then should get the bounty.

 

Have a look how other events work to start this...you also need to check in the loop of the event if the target player logs out or already died before (on his own) I guess.

To make an array of all players, would something like this work?

if (isPlayer) then{

_uid = getPlayerUID player;

_ListOfPlayers= _ListOfPlayers + [_uid];  // Or maybe I should use _ListOfPlayers set [ count _ListOfPlayers, [_uid]];  ???

};

Link to comment
Share on other sites

  • 0

First creation (With alot of questions to answer...)

 

if (isPlayer) then{
_uid = getPlayerUID player;
_ListOfPlayers= _ListOfPlayers + [_uid];  // Or maybe I should use _ListOfPlayers set [ count _ListOfPlayers, [_uid]];  ???
};
uisleep 30;
_Uptime = (floor(serverTime/3600));
_rnd = floor (random (count _ListOfPlayers));
VIPTargetUID = _ListOfPlayers select _rnd;

if (_uid in VIPTargetUID) then {
titleText [format ["%1, you are the target!! Survive 1 hour to get the reward..",name player], "PLAIN DOWN", 3];
player setVariable ["VIPTarget",true]; //Is something like this working? Any ways to do it?
VIPTargetName = name player; //Define the name of the target?? Since its in the UID portion of assassination?
//How would I define VIPTarget (see the marker part to see what im talking about, I want to attach the market to his position)
//Is there any way to create a marker that sticks to the target?
} else {
//Any way to find the name of the Assassination mission by his UID? I am lost here.
tittleText [format["%1 is now the target! Kill him to get the money!",VIPTargetName],"PLAIN DOWN", 3];
};
//Mark target on map
_markerobj = createMarker ["targetmarker",[0,0]];                                                                                
_markername= "targetmarker";                                                                                                                        
_markerobj setMarkerShape "ICON";                                
"targetmarker" setMarkerType "Marker";                                        
"targetmarker" setMarkerColor "ColorRed";                                                                                                                        
"targetmarker" setMarkerText "Assassination target";                                
_markername SetMarkerPos _start;
"targetmarker" setmarkerpos getpos VIPtarget;

/**Identify killer**/
_VIPKiller = _victim getVariable["AttackedByName", "nil"]; //How can you identify the killer?
/**Finish the mission**/
if (!alive VIPTarget && alive VIPKiller) exitWith { //Would this verify if the player is alive or no? How would such thing work!?
            
             _VIPKiller addMagazineCargo "ItemBriefCase50oz";
             hint "Good job! He deserved to die anyways.";
        };
if (_Uptime == 1 && alive VIPTarget) exitWith {
            hint "You survived the hunt. You keep the money.";
            _VIPKiller addMagazineCargo "ItemBriefCase50oz";
};

If people can help me resolve the parts in comments, I would appreciate it,

Link to comment
Share on other sites

  • 0

I know that Dami has something like this in his AH called a manhunt.

 

It creates a marker at the selected persons location, informs the server, and updates the players position every 10 minutes.

 

You could probably ask him, but he'll just say no then ddos your server then wipe your DB.

Link to comment
Share on other sites

  • 0

Have the whole concept worked out for this sort of thing but will be developing for our E3 Dominion mod rather than A2.

 

Having said that....

 

What about making the reward based on the targets humanity ?.   The player on the server with the least / most humanity becomes the target  (depending if the hunter is a bandit / hero).

 

1. Get all playable units

2. Check they are actually players with isplayer

3. Loop through them and

3.1 Get players humanity (getvariable)

3.2 Get players PlayerUID

3.3 Store in to an array.

4. Sort array by Humanity.

5. get the First / Last entry depending on highest / lowest humanity required.

6. Put a bounty on their head (something like the killboard could be used at the Hero / Bandit traders).

7. Monitor if the target player logs off / gets killed and if so select another target.

 

I would get the server to do the searching for a target and then update the clients via PV / Event handler to update the bounty message boards).  You could even 'tag' the target player object with something like bounty = true and search for it in the scripts that deal with player logoff / killed which if they find it, PV the server to tell it the target is not longer valid.  The server could then send a PV to the clients to get them to wipe their bounty boards until the next cycle or until the same player logs in again.

Link to comment
Share on other sites

  • 0

@FragZ: as in the link I've send:

_allPlayers = [];

{

if (isPlayer _x) then {

_allPlayers pushBack _x;

};

} forEach playableUnits;

 

All real players (not AI) are in the array _allPlayers. If these are alive can be checked with (alive _x) ... so if ((isPlayer _x) && (alive _x)) then

pushBack only works in ArmA 3.

Link to comment
Share on other sites

  • 0

It is still at a concept phase, so everything is welcome. Thanks for the replies but indeed, I read that Pushback works only in A3.

I mostly need help on how to assign a variable to the Designed player (designed by the random UID selection) and I need some people to help me fix any potential errors...


I had a lot of questions in the first creation post for a reason, it is just a scratch.

Link to comment
Share on other sites

  • 0

@StiflersM0M: ah yes. then

_allPlayers set [count _allPlayers, _x];

 

 

So:

 

_allPlayers = [];

{

if ((isPlayer _x) && (alive _x)) then {

_allPlayers set [count _allPlayers, _x];

};

} forEach playableUnits;

But wouldn't that not just count the player? Is it better to do it the UID way (Like I did) so it identifies the player after?

Link to comment
Share on other sites

  • 0

That way grabs the player objects. 

 

The player object can be used to get the players SteamID but the SteamID is just a unique reference to a player and not to their player object. 

 

It is better to have the player object recorded as it is the representation of the player in the game world and everything is or can be linked from it to do with the player (ie. steamID) or the players object (ie. inventory, blood level, health state, location). 

Link to comment
Share on other sites

  • 0

That way grabs the player objects. 

 

The player object can be used to get the players SteamID but the SteamID is just a unique reference to a player and not to their player object. 

 

It is better to have the player object recorded as it is the representation of the player in the game world and everything is or can be linked from it to do with the player (ie. steamID) or the players object (ie. inventory, blood level, health state, location). 

So that means it will calculate and put in every stats I need in order for this mission to work?

I am kinda dumb and not understand english all the time, mind explaining a bit?

And what about the rest of the script? Am I on the right way>?

Link to comment
Share on other sites

  • 0

Hi,

 

thought i'd throw something in to:

Version 1:

private ["_targetsArr","_targetRand","_validTarget","_target"];

_targetsArr = ["123","456","789"];
_targetRand = _targetsArr select floor random count _targetsArr;
_validTarget = false;
_target = objNull;

{
	if (!isAgent _x) then {
		_validTarget = alive _x && (getPlayerUID _x) == _targetRand;
		if (_validTarget) exitWith {_target = _x};
	};
} count allUnits;

waitUntill {!isNull _target};

//Do something with _target

 

Version 2:

private ["_targetsArr","_targetRand","_validTarget"];

_targetsArr = [];
_target = objNull;

{
	if (!isAgent _x) then {
		_targetsArr set [count _targetsArr, _x];
	};
} count allUnits;

_targetRand = _targetsArr select floor random count _targetsArr;

while {true} do {
	_validTarget = alive _targetRand;
	sleep 60;
};

if (!_validTarget) then {
	//Has been Killed... 
};

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...