Jump to content
Sign in to follow this  
Khalashnikovf

Make a Civilians dangerous to a player

Recommended Posts

I would like to make this:

I have trigger circle named City.

And I would to:

civ countSide list City

This will count every civilian unit in town (but would like to not count vehicles,only men). They are not named!

Then I would like to Add them a Pistol (makarov or whatever) randomly to a for example 1 / 20 of all civilians.

And these armed Civilians would become EAST and would try to kill west player.

Then all of civilians would run onto a player. Just to annoy him and obstruct in his sight. And when player will kill one civilian all of the crowds would throwing rocks on him. And count every throw that some civilian do and make some possibility to hit player (some blur,little damage according to where civilian would hit, all random).

I know that this is too much.

Lets start with how to send all civilians in trigger area onto a player.

Then arm some of them.

Share this post


Link to post
Share on other sites

Hi :)

Making civis enemy

Best way (as far as i know) to to get civilians as enemies is to put a independent (guerillas) unit onto the map and group the civilians to it. Then you can deleteVehicle this the independent leader. You can add that right into the unit init line. The civis will now stay in the group and on the independent side.

In your case you can create some of these "fake-groups" so it looks better. One large group would look unrealistic. :)

To make them move to your player you can simply add a waypoint right onto your (player) unit. To make them move at the right time use a waypoint condition to a waypoint before that one on your player.

Now when they should get aggressive you can turn independent into an enemy faction. (I don't know how exactly that works, do some research on you own. I just know its possible, never used it...)

To arm "some of them", you can put this into the trigger activation:

{[_x] execVM "randomArm.sqf";} forEach (thisList);

randomArm.sqf:

_Random = random 100;
_Unit = _this select 0;

waitUntil {ArmThem};

if (_Random <= 33) then {
   _Unit addWeapon "Rocks?! :-)";
};

Now you just have to set ArmThem = true to start that.

<= 33 means % from the random 100...

I hope that helps. :)

Edit:

If you're using the independent side otherwise in the mission you can set east friendly at the beginning and group the civis to east units of course...

Edited by sxp2high

Share this post


Link to post
Share on other sites

So far so good.

Im working on this

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Script for using randomness to select which civilian is dangerous to a player and will try to hurt him somehow
// Script by: Khalashnikovf
// Thx for help to neokika for base script of revealing all certain units
// -----------------------------------------------------------------------------
// Example:	nul = [unit,distance] execVM "CivilianDanger.sqf";
//
// unit = name of unit
// distance = distance of danger area, recommended is 20
// -----------------------------------------------------------------------------
// Use: 	Place unit on map, place enemy unit with zero probality of existence and name it Eneminator
//
// Idea: 	Script will choose unit and says, if it is possible weapon holder, or stone thrower, or if he is just annoyer
//			There is 10% chance that possible weapon holder has got a gun, 40% for stone throwerer, and 80% for annoyer
//			Civilians with gun will just for sure shout Allah Agbar
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

private ["_unit","_distance","_mag","_wep"];

_unit = _this select 0;
_distance = _this select 1;
_mag = "";
_wep = "";

_targetsArray = nearestObjects [_unit, ["Man"], _distance]; 
{ 
  if ((side _x == CIVILIAN)and( alive _x)) then 
  { 
_unitType = ceil (random 3);
_unitProb = floor (random 101);
switch (_unitType) do { 
	case 1: { _unit sidechat "Armed Possible";
		if(_unitProb < 10) then {  _unit sidechat "Armed Is";
		_weaponType = ceil (random 6);
		switch (_weaponType) do
			{ 
			case 1: { _mag = "17Rnd_9x19_glock17"; _wep = "glock17_EP1";};	// Glock 17
			case 2: { _mag = "6Rnd_45ACP"; _wep = "revolver_EP1";};			// Revolver
			case 3: { _mag = "30Rnd_9x19_UZI"; _wep = "UZI_EP1";};			// UZI
			case 4: { _mag = "8Rnd_9x18_Makarov"; _wep = "Makarov";};		// Makarov
			case 5: { _mag = "7Rnd_45ACP_1911"; _wep = "Colt1911";};		// Colt 1911
			case 6: { _mag = "20Rnd_B_765x17_Ball"; _wep = "Sa61_EP1";};	// SA-61
			};
		[_x] JoinSilent Eneminator;
		//_x say3D "allahu";
		_x addMagazine _mag;
		_x addMagazine _mag;
		_x addWeapon _wep;
		_x selectWeapon _wep;
		_x SetUnitPos "Up";
		_x doTarget _unit;
		_x SetSpeedMode "Full";
		_x SetCombatMode "Red";
		_x reveal _unit;
		_x SetBehaviour "Careless";	


	};};
	case 2: {  _unit sidechat "Stone Possible";
		if(_unitProb < 40) then {  _unit sidechat "Stone Is";
		[_x] JoinSilent Eneminator;
		_x reveal _unit;
		_x addMagazine "HandGrenade_Stone";
		_x addMagazine "HandGrenade_Stone";
		_x selectWeapon "HandGrenade_Stone";
		_x doTarget LOG; // only try for attacking logUnit
		_x SetBehaviour "Careless";
		_x SetUnitPos "Up";
		_x SetSpeedMode "Full";
		_x SetCombatMode "Red";
		_x doFire _unit;

	};};
	case 3: {	 _unit sidechat "Runner Possible";
		if(_unitProb < 80) then {  _unit sidechat "Runner";
		_x doMove getPos _unit;
		_x SetBehaviour "Careless";
		_x SetUnitPos "Up";
		_x SetCombatMode "Red";
	};};
	};	  
  }; 
} forEach _targetsArray;

_unit sidechat "-------------------------------------------";

Description is in script. In short: It makes possible to arm any civilian anytime you launch this. I was trying to JoinSilent zero probability of existance unit OPFOR side. That certain unit in exactly right time only and wanted from it to attack player.

So I have got problem with switching weapon to a pistol which civilian gets, or Stone and then attack on him with that pistol, or throw a stone on a player.

--------------------------- E D I T --------------------------------------------

I made some little changes, this works fine, but there is big delay when AI is realising that it should attack on me.

Anyway functional code:

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Script for using randomness to select which civilian is dangerous to a player and will try to hurt him somehow
// Script by: Khalashnikovf
// Thx for help to neokika for base script of revealing all certain units
// -----------------------------------------------------------------------------
// Example:	nul = [unit,distance,10,40,80] execVM "CivilianDanger.sqf";
//
// unit = name of unit
// distance = distance of danger area, recommended is 20
// 10,40,80 is possibility of Actions: ArmedCiv,StoneCiv,RunCiv
// -----------------------------------------------------------------------------
// Use: 	Place unit on map, place enemy unit with zero probality of existence and name it Eneminator
//
// Idea: 	Script will choose unit and says, if it is possible weapon holder, or stone thrower, or if he is just annoyer
//			There is 10% chance that possible weapon holder has got a gun, 40% for stone throwerer, and 80% for annoyer
//			Civilians with gun will just for sure shout Allah Agbar
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

private ["_unit","_distance","_mag","_wep"];

_unit = _this select 0;
_distance = _this select 1;
_posArm = _this select 2;
_posSto = _this select 3;
_posRun = _this select 4;
_mag = "";
_wep = "";

_targetsArray = nearestObjects [_unit, ["Man"], _distance]; 
{ 
  if ((side _x == CIVILIAN)and( alive _x)) then 
  { 
_unitType = ceil (random 3);
_unitProb = floor (random 101);
switch (_unitType) do { 
	case 1: {
		if(_unitProb < _posArm) then {  _unit sidechat "Possible armed threat";
		_weaponType = ceil (random 6);
		switch (_weaponType) do
			{ 
			case 1: { _mag = "17Rnd_9x19_glock17"; _wep = "glock17_EP1";};	// Glock 17
			case 2: { _mag = "6Rnd_45ACP"; _wep = "revolver_EP1";};			// Revolver
			case 3: { _mag = "30Rnd_9x19_UZI"; _wep = "UZI_EP1";};			// UZI
			case 4: { _mag = "8Rnd_9x18_Makarov"; _wep = "Makarov";};		// Makarov
			case 5: { _mag = "7Rnd_45ACP_1911"; _wep = "Colt1911";};		// Colt 1911
			case 6: { _mag = "20Rnd_B_765x17_Ball"; _wep = "Sa61_EP1";};	// SA-61
			};
		[_x] JoinSilent Eneminator;
		//_x say3D "allahu";
		_x setskill 0.6; 
		_x reveal _unit;
		_x addMagazine _mag;
		_x addMagazine _mag;
		_x addWeapon _wep;
		_x selectWeapon _wep;
		_x doTarget _unit;
		_x SetBehaviour "Careless";
		_x SetUnitPos "Up";
		_x SetSpeedMode "Full";
		_x SetCombatMode "Red";
		_x doFire _unit;

	};};
	case 2: {
		if(_unitProb < _posSto) then {
		[_x] JoinSilent Eneminator;
		_x setskill 1;
		_x reveal _unit;
		_x addMagazine "HandGrenade_Stone";
		_x addMagazine "HandGrenade_Stone";
		_x selectWeapon "HandGrenade_Stone";
		_x doTarget _unit;
		_x SetBehaviour "Careless";
		_x SetUnitPos "Up";
		_x SetSpeedMode "Full";
		_x SetCombatMode "Red";
		_x doFire _unit;

		//_x fire ["throw","HandGrenade_Stone","HandGrenade_Stone"];

	};};
	case 3: {
		if(_unitProb < _posRun) then {
		_x doMove getPos _unit;
		_x SetBehaviour "Careless";
		_x SetUnitPos "Up";
		_x SetCombatMode "Red";
	};};
	};	  
  }; 
} forEach _targetsArray;

Next Thing I will put simple thing for smoking soldier out of his position, something like that civilian throw there instead of stone one Smokeshell :) , or maybe with really little percentage a grenade.

Little demo mission: CivilianDanger.zarghabad there is a hint when some civilian will be armed.

Edited by Khalashnikovf

Share this post


Link to post
Share on other sites

Hi, Im working on my civilian script. But now I have got stucked on this thing.

This is for checking how many civilians are in area around suspicious person.

and command my units to target random one of them.

_stalker = _this select 0; //Unit who is somehow dangerous to a group
_radius = _this select 1; //checking area
_disarmSide = _this select 2; // side who can check and disarm civilian
_Armed = _this select 3; // kind of stuff that civilian handle ("IED","ARM")


// ------------ CHECK FOR OTHER CIVILIANS IN CLOSEST AREA OF DANGER ONE ------
while { Wiseman distance _stalker > _radius } do {

_PatrolArray = nearestObjects [_stalker, ["man"], _radius];
_civiliansArray = [];

{
if ((side _x == CIVILIAN)and(alive _x)) then {
	_civiliansArray = _civiliansArray + [_x];
	};
} forEach _PatrolArray;

{
if ((side _x == _disarmSide)and(alive _x)) then {
	_RndCiv = floor (random (count _civiliansArray));
	_targetX = _civiliansArray select _RndCiv;
	_x doTarget _targetX;
	};
} forEach _PatrolArray;


sleep 1.5;	
};

checkCivilian =  _stalker addAction ["Check Civilian", "CivilianDangerArea\CivilianCheck.sqf",[_stalker,_Armed]];

Then its addAction for check suspicios civilian.

But here is problem for now.

This script is launched for every unit who get order to deploy IED. So every unit should be able to addAction Check Civilian. Indeed it is. But: Because of still same Check Civilian Action, it is added somehow to every civilian person who is IED carrier.

This is Action script in short:

_array = _this select 3;
_stalker = _array select 0;
_Armed = _array select 1;

_stalker removeAction checkCivilian;

if (_Armed == "IED") then {

_stalker doTarget Wiseman;
sleep 1.5;
_stalker doWatch Wiseman; 
_stalker playMove "AmovPercMstpSnonWnonDnon_idle68boxing";


};

Is there any way how to make this action Unique for every single Civilian?

Thx for replies.

-------------------------------------------------------------------------

EDIT: the first script is called:

nul = [_x,10,_enemySide,"IED"] execVM "CivilianDangerArea\CivilianDisarming.sqf";

So it is called directly from forEach array.

Edited by Khalashnikovf

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  

×