Jump to content
Sign in to follow this  
JOHN007

Fixing EOD Mod Triggerman

Recommended Posts

Hello.

 

Everything works apart from the triggerman reaction. The civilian will draw the weapon but will not engage at the player? Which to be frank breaks the whole game seeing a civilian just stood there aiming at you?

 

I believe the civilian is not changing faction side from 'CIV' to 'EAST' as if you talk to the triggerman they seem polite.

 

Here is the Triggerman reaction script which is updated to actually make the civilian draw a weapon. (It was completely broken when I allocated this addon)

 

Suicide Bombers work.

IED's Work.

Triggerman will draw a weapon at you but will not fire.

 

// IED Detection and Disposal Mod
// 2011 by Reezo

if (!isServer) exitWith{};

private ["_triggerman","_nearestEnemy","_rnd"];
_triggerman = _this select 0;
_unitloc = [];
_listclose = [];
_listclosealive = [];
_weaponmag = "";
_target = "";
_target_side = civilian;
_target_type = false;
_done = false;
_grp = grpNull;
_victim = objNull;
_check = false;
if (typename _unit == "BOOL") then {_check = _unit};

if (animationState _triggerman == "AmovPercMstpSsurWnonDnon" OR _triggerman hasWeapon "ACE_APS" OR _triggerman hasWeapon "UZI_EP1") exitWith {};

_nearestEnemy =  if (count _this == 2) then { _this select 1 } else { _triggerman findNearestEnemy (getPos _triggerman) }; //Find the nearest enemy to the triggerman

_rnd = random 1;
_triggerman removeAllEventHandlers "firednear";

switch (true) do
{
	case (_rnd < 0.10) : //Surrenders
	{
		_triggerman playMoveNow "AmovPercMstpSsurWnonDnon";
		_triggerman disableAI "ANIM";
		_triggerman disableAI "MOVE";
		
		//player globalChat "REACTION: SURRENDER";
	};
	
	case (_rnd > 0.10 && _rnd < 0.55) : //Fights..
	{
		
		_triggerman enableAI "ANIM";
		_triggerman enableAI "MOVE";
		_triggerman enableAI "TARGET";
		_triggerman enableAI "AUTOTARGET";
		
		_rnd = random 1;
		
		if (_rnd < 0.5) then
		{
			_triggerman addMagazine "ACE_20Rnd_9x18_APS"; //..with a Makarov
			_triggerman addMagazine "ACE_20Rnd_9x18_APS";
			_triggerman addWeapon "ACE_APS";
		    _triggerman selectWeapon "ACE_APS";

		} else
		{
			_triggerman addMagazine "30Rnd_9x19_UZI"; //..with an Uzi
			_triggerman addMagazine "30Rnd_9x19_UZI";
			_triggerman addWeapon "UZI_EP1";
		    _triggerman selectWeapon "UZI_EP1";
		};
		
//GROUP CREATION
//Checking wether a side or an objectname was parsed

switch (typename _target1) do {
	case "SIDE": {
	_target_side = _target1;
	};
	case "OBJECT": {
	_target_side = side _target1;
	};
};

//creating a group hostile to the target.
switch (_target_side) do {
	case west: {_grp = createGroup east;};
	case east: {_grp = createGroup west;};
	case resistance: {if ((west getFriend resistance)>0.5)then{_grp = createGroup east;}else{_grp = createGroup west;}; };
	case civilian: {if ((west getFriend civilian)>0.5)then{_grp = createGroup east;}else{_grp = createGroup west;};};
	};
		
		_triggerman addRating -1000;
		
		_triggerman setBehaviour "COMBAT";
		_triggerman setCombatMode "RED";
		_triggerman setUnitPos "UP";
		
		if (!isNull _nearestEnemy) then
		{
			_triggerman doTarget _nearestEnemy;
			nul0 = _triggerman fireAtTarget [_nearestEnemy, currentWeapon _triggerman];
		};
		
		//player globalChat format["REACTION: FIGHT WITH %1 AGAINST %2",currentWeapon _triggerman, _nearestEnemy];
	};
	
	case (_rnd > 0.55) : //Runs away..
	{
		_triggerman enableAI "ANIM";
		_triggerman enableAI "MOVE";
		_triggerman enableAI "TARGET";
		_triggerman enableAI "AUTOTARGET";
		
		_rnd = random 1;

		if (_rnd < 0.5) then
		{
			_triggerman addMagazine "ACE_20Rnd_9x18_APS"; //..with a Makarov
			_triggerman addMagazine "ACE_20Rnd_9x18_APS";
			_triggerman addWeapon "ACE_APS";
		    _triggerman selectWeapon "ACE_APS";
		} else {
			_triggerman addMagazine "30Rnd_9x19_UZI"; //..with an Uzi
			_triggerman addMagazine "30Rnd_9x19_UZI";
			_triggerman addWeapon "UZI_EP1";
		    _triggerman selectWeapon "UZI_EP1";
		};
		
		_triggerman addRating -1000;
		
		private ["_grp"];
		_grp = group _triggerman;
			
		private ["_wp"];
		_wp = _grp addWaypoint [getPos _triggerman, 800];
		
		_wp setWaypointType "MOVE";
		_wp setWaypointBehaviour "SAFE";
		_wp setWaypointSpeed "FULL";
		_wp setWaypointStatements ["true", "_triggerman setUnitPos ""MIDDLE"""];
		_grp setCurrentWaypoint _wp;
		
		//player globalChat format["REACTION: ESCAPE WITH %1 TO DESTIONATION: %2",currentWeapon _triggerman, getWPPos _wp];
	};
};

Another update to add is that the Triggerman will sometimes surrender or draw a weapon and run away, that all works ok no problems there.

 

I set the random event parameters on the debug script to always ''Fight'' for testing purposes.

 

Its another slight error which we literally cannot work out. So close. SOS.

 

Thankyou for your time and hope to speak soon.

 

John. 

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  

×