Jump to content
LSValmont

vDog Patrol and VDog Feral Multiplayer Scripts [v1.9 - updated 05/18/2020]

Recommended Posts

It was Patrol Dogs on the new GM DLC, using AI border guards.

One AI guard with the Dog Patrol scripting, the dog found & injured player, me, when I tested it on my PC hosting, but on our Dedicated server the injury part did not seem to happen everything else did inc sounds.

Will do some more testing....

 

===================================================================

Re tested & it does seem to be a Dedicated server problem. worked  fine when hosted, was injured, required a heal. On the dedicated don't seem to be hurt/injured at all by the dog.

 

  • Like 1

Share this post


Link to post
Share on other sites
On 5/8/2019 at 5:19 PM, jgaz-uk said:

It was Patrol Dogs on the new GM DLC, using AI border guards.

One AI guard with the Dog Patrol scripting, the dog found & injured player, me, when I tested it on my PC hosting, but on our Dedicated server the injury part did not seem to happen everything else did inc sounds.

Will do some more testing....

 

===================================================================

Re tested & it does seem to be a Dedicated server problem. worked  fine when hosted, was injured, required a heal. On the dedicated don't seem to be hurt/injured at all by the dog.

 

 

Please replace your current script with this one and let me know if it works now:

Spoiler



if (!isServer) exitWith {};
waitUntil {sleep 1; time > 2};
Sleep (2 + (random 2));

params ["_dogOwner", "_dogBreed", "_dogsAmount"];

private _dogOwner = _this select 0;
private _dogBreed = _this select 1;
private _dogsAmount = _this select 2;
private _dogSide = side _dogOwner;
private _dogGrp = creategroup _dogSide;

waitUntil {Sleep (2 + (random 2)); simulationEnabled _dogOwner && alive _dogOwner};

for "_i" from 1 to _dogsAmount do
{
	private _chosenBreed = "Alsatian_Random_F";
	switch (_dogBreed) do {
		case "Alsatian_Random_F":
		{
		_chosenBreed = "Alsatian_Random_F";
		};
		case "Fin_random_F":
		{
		_chosenBreed = "Fin_random_F";
		};
		default 
		{ 
		_chosenBreed = "Fin_random_F";
		};
	};
	_dog = _dogGrp createUnit [_chosenBreed, getPos _dogOwner, [], 5, "CAN_COLLIDE"];
	_dog setVariable ["BIS_fnc_animalBehaviour_disable", true];
	//[_dog] join _dogGrp;

	0 = [_dog,_dogOwner] spawn 
	{
		params ["_dog","_dogOwner"];
		_dog = _this select 0;
		_dogOwner = _this select 1;

		_dog setVariable ["BIS_fnc_animalBehaviour_disable", true];
		_dog setSpeaker "NoVoice";
		_dog setBehaviour "CARELESS";
		_dog setAnimSpeedCoef 3;
		_dog disableAI "ALL";
		_dog setSkill 0;
		//[_dog] join (group _dogOwner);

		_last_anim = "";
		while {alive _dog} do 
		{
			if (simulationEnabled _dogOwner) then {
			_nearHumans = [];
			_targetHumans = [];
			_dogCheckDist = 100;
			_closestHuman = objNull;
			_nearHumans = nearestObjects [getPos _dog, ["man"], 100];
			_dog setAnimSpeedCoef 5;
			
			{
				if ((side _dogOwner) getFriend (side _x) < 0.6 && alive _x && !isNull _x) then {_targetHumans = _targetHumans + [_x]; _dog knowsabout _x; _dogOwner knowsabout _x;}
			}forEach _nearHumans;
			
			_targetsAmount = count _targetHumans;
			if (_dog distance _dogOwner > 120) then {_targetsAmount = 0;};

			if (_targetsAmount > 0) then
			{
				private _closestHuman = _targetHumans select 0;
				if (_dogOwner distance _closestHuman > 120) then {_targetsAmount = 0;};
				if (_dogOwner distance _closestHuman < 120) then {
				private _dogCheckDist = (_dog distance _closestHuman);
				_dog setspeedmode "FULL";

				if (_dogCheckDist > 75 && _dogCheckDist < 100) then 
				{
					if (_dog distance _dogOwner < 5) then 
					{
						_dog dowatch _closestHuman;
						_dog setDir ([getposatl _dog, getposatl _closestHuman] call BIS_fnc_dirTo);	
						_barkType = round(random 2);
						switch (_barkType) do {
							case 0:
							{
							[_dog, "bark1"] remoteExec ["say3D"];
							};
							case 1:
							{
							[_dog, "bark2"] remoteExec ["say3D"];
							};
							case 2:
							{
							[_dog, "bark1"] remoteExec ["say3D"];
							};
						};
						sleep (1 + (random 1));
					};
					if (_dog distance _dogOwner > 5) then 
					{
						_dog setDir ([getposatl _dog, getposatl _dogOwner] call BIS_fnc_dirTo);
						if !(_last_anim == "Dog_Run") then { _dog playMove "Dog_Run"; _last_anim = "Dog_Run";};
						sleep (2 + (random 2));
						if !(_last_anim == "Dog_Stop" && _dog distance _dogOwner < 5) then { _dog playMove "Dog_Stop"; _last_anim = "Dog_Stop";};	
					};
				};			

				if (_dogCheckDist > 50 && _dogCheckDist < 75) then 
				{
					_dog dowatch _closestHuman;
					_dog setDir ([getposatl _dog, getposatl _closestHuman] call BIS_fnc_dirTo);
					sleep (0.5 + (random 0.5));
					//_dog moveTo getPos _closestHuman;
					sleep (0.5 + (random 0.5));
					if !(_last_anim == "Dog_Run") then { _dog playMove "Dog_Run"; _last_anim = "Dog_Run";};
					_barkType = round(random 2);
					switch (_barkType) do {
						case 0:
						{
						[_dog, "bark1"] remoteExec ["say3D"];
						};
						case 1:
						{
						[_dog, "bark2"] remoteExec ["say3D"];
						};
						case 2:
						{
						[_dog, "bark3"] remoteExec ["say3D"];
						};
					};
				sleep (1 + (random 1));	
				};

				if (_dogCheckDist > 25 && _dogCheckDist < 50) then 
				{
				_dog dowatch _closestHuman;
				_dog setDir ([getposatl _dog, getposatl _closestHuman] call BIS_fnc_dirTo);
				sleep (0.5 + (random 0.5));				
				//_dog moveTo getPos _closestHuman;
				sleep (0.5 + (random 0.5));
				if !(_last_anim == "Dog_Sprint") then { _dog playMove "Dog_Sprint"; _last_anim = "Dog_Sprint";};
				_barkType = round(random 2);
					switch (_barkType) do {
						case 0:
						{
						[_dog, "bark1"] remoteExec ["say3D"];
						};
						case 1:
						{
						[_dog, "bark2"] remoteExec ["say3D"];
						};
						case 2:
						{
						[_dog, "bark3"] remoteExec ["say3D"];
						};
					};
				sleep (1 + (random 1));	
				};

				if (_dogCheckDist > 15 && _dogCheckDist < 25) then 
				{
				_dog dowatch _closestHuman;
				_dog setDir ([getposatl _dog, getposatl _closestHuman] call BIS_fnc_dirTo);
				sleep (0.5 + (random 0.5));							
				//_dog moveTo getPos _closestHuman;
				sleep (0.5 + (random 0.5));
				if !(_last_anim == "Dog_Sprint") then { _dog playMove "Dog_Sprint"; _last_anim = "Dog_Sprint";};
				_barkType = round(random 2);
					switch (_barkType) do {
						case 0:
						{
						[_dog, "bark1"] remoteExec ["say3D"];
						};
						case 1:
						{
						[_dog, "bark2"] remoteExec ["say3D"];
						};
						case 2:
						{
						[_dog, "bark3"] remoteExec ["say3D"];
						};
					};
				};

				if (_dogCheckDist > 5 && _dogCheckDist < 15) then 
				{
					_barkType = round(random 1);
						switch (_barkType) do {
							case 0:
							{
							[_dog, "bark2"] remoteExec ["say3D"];
							};
							case 1:
							{
							[_dog, "dogGrowl"] remoteExec ["say3D"];
							};
						};
					_dog dowatch _closestHuman;
					_dog setDir ([getposatl _dog, getposatl _closestHuman] call BIS_fnc_dirTo);
					sleep (0.5 + (random 0.5));									
					//_dog moveTo getPos _closestHuman;
					sleep (0.5 + (random 0.5));
					if !(_last_anim == "Dog_Sprint") then { _dog playMove "Dog_Sprint"; _last_anim = "Dog_Sprint";};
				};

				if (_dogCheckDist > 2.5 && _dogCheckDist < 5) then 
				{
					_barkType = round(random 1);
						switch (_barkType) do {
							case 0:
							{
							[_dog, "bark3"] remoteExec ["say3D"];
							};
							case 1:
							{
							[_dog, "dogGrowl"] remoteExec ["say3D"];
							};
						};
					_dog dowatch _closestHuman;
					_dog setDir ([getposatl _dog, getposatl _closestHuman] call BIS_fnc_dirTo);
					sleep (0.5 + (random 0.5));									
					//_dog moveTo getPos _closestHuman;
					if !(_last_anim == "Dog_Sprint") then { _dog playMove "Dog_Sprint"; _last_anim = "Dog_Sprint";};
				};

				if (_dogCheckDist < 2.5) then {
					if (vehicle _closestHuman isKindOf "CAManBase") then 
					{
						if ((getposatl _closestHuman distance _dog) <= 2.5 && (!isNull _closestHuman) && (alive _closestHuman)) then
						{ 
							_vel = velocity _dog;
							_vel = [10,1,1];
							if (alive _closestHuman and !isNull _closestHuman) then
							{
								_dog setpos ([_closestHuman, 1.5, ([getpos _closestHuman, getpos _dog] call BIS_fnc_dirTo)] call BIS_fnc_relPos);
								_dog setDir ([getposatl _dog, getposatl _closestHuman] call BIS_fnc_dirTo);
							};
						};
						
						if !(_last_anim == "Dog_Stop") then { _dog playMove "Dog_Stop"; _last_anim = "Dog_Stop";};
						[_dog, "dogBite"] remoteExec ["say3D"];
						_rdmBiteDamage = selectRandom [0.1,0.2,0.3];
						//_closestHuman setHitPointDamage ["hitLegs", _rdmBiteDamage];
						_humanDmgCheck = _closestHuman getHitPointDamage "hitLegs";
						_biteDamage =  _humanDmgCheck + _rdmBiteDamage;
						if (isMultiplayer) then {
						[_closestHuman, ["hitLegs", _biteDamage]] remoteExec ["setHitPointDamage", _closestHuman];
						[_closestHuman, true] remoteExec ["setUnconscious", _closestHuman];
						}else{
						_closestHuman setHitPointDamage ["hitLegs", _biteDamage];
						_closestHuman setUnconscious true;
						};
						has_mod_ACE3 = isClass (configFile >> "CfgPatches" >> "ace_common"); // ACE3 
						if(has_mod_ACE3 && isClass(configfile >> "CfgPatches" >> "ace_medical"))then{
							if (isMultiplayer) then {
							[[_closestHuman], "scripts\aceBiteDamage.sqf"] remoteExec ["execVM", _closestHuman, true];
							}else{
							[_closestHuman] execVM "scripts\aceBiteDamage.sqf";
							};
						};
						[_closestHuman, "dogVictim"] remoteExec ["say3D"];
						_dog dowatch _closestHuman;
						_dog setDir ([getposatl _dog, getposatl _closestHuman] call BIS_fnc_dirTo);
						sleep (1 + (random 1));
						_closestHuman setUnconscious false;
						sleep (8 + (random 5));
						_dog dowatch _closestHuman;
						_dog setDir ([getposatl _dog, getposatl _closestHuman] call BIS_fnc_dirTo);
						//_closestHuman switchMove "";
						_biteDamage = "";
						if !(_last_anim == "Dog_Run") then { _dog playMove "Dog_Run"; _last_anim = "Dog_Run";};
					};
				};
			  };	
			};
			if (_targetsAmount < 1) then
			{
			if (alive _dogOwner) then {
				if (_dog distance _dogOwner > 500 && (isNull objectParent _dogOwner)) then
				{
				_dog setPos (getPos _dogOwner);
				};
				
				if (_dog distance _dogOwner > 8) then 
				{
					_dog setspeedmode "FULL";
					_dog dowatch _dogOwner;
					_dog setDir ([getposatl _dog, getposatl _dogOwner] call BIS_fnc_dirTo);
					sleep (1 + (random 1));
					if !(_last_anim == "Dog_Sprint") then { _dog playMove "Dog_Sprint"; _last_anim = "Dog_Sprint";};
				};			
				
				if (_dog distance _dogOwner > 3 && _dog distance _dogOwner < 8) then 
				{
					_dog setspeedmode "NORMAL";
					_dog dowatch _dogOwner;
					_dog setDir ([getposatl _dog, getposatl _dogOwner] call BIS_fnc_dirTo);
					sleep (1 + (random 1));
					if !(_last_anim == "Dog_Run") then { _dog playMove "Dog_Run"; _last_anim = "Dog_Run";};
				};

				if (_dog distance _dogOwner < 3) then {
					if !(_last_anim == "Dog_Idle_Stop") then { _dog playMove "Dog_Idle_Stop"; _last_anim = "Dog_Idle_Stop";};
				};
			} else {
			if (alive _dog && !alive _dogOwner) exitWith {_dog playMove "Dog_Idle_Stop";};
			};
		   };
		  }; 
		 };
		if (!alive _dog) exitWith 
		{
		_dogGrpSideLogic = createGroup sideLogic;
		_deadDogLogic = _dogGrpSideLogic createUnit ["logic", getPos _dog, [], 0, "none"];
		[_deadDogLogic, "dogCry"] remoteExec ["say3D"];
		sleep 5;
		deleteVehicle _deadDogLogic;
		};
		if (alive _dogOwner && !(simulationEnabled _dogOwner)) then {[_dog, false] remoteExec ["enableSimulationGlobal",2]; sleep (10 + (random 10));} else {[_dog, true] remoteExec ["enableSimulationGlobal",2];};
	};
};

Sleep (5 + (random 5));
_dogGrp enableDynamicSimulation true;


 

 

Share this post


Link to post
Share on other sites

Ok will try & do that,  think I've copied it all.

 

======================================================

Copied & replaced the script in the vDogPatrol.sqf with the above contents, and no Dog spawned in at all, either in the editor when testing, or on the server when I uploaded it.😧

 

 

  • Confused 1

Share this post


Link to post
Share on other sites

Any further thoughts on the Dedicated server problem. The dog does all the right things, find, chase, bite, with the sounds, its just that the player is not injured?

 

Not the first time things don't work on dedicated, which is a pain in the Arse!

 

 

Share this post


Link to post
Share on other sites

Think I've found a solution it worked once on our Dedicated (just one player so far) dog brought me to the ground, & second dog bite the need heal came up.  💃   Will let you know if it works with other players on the server....

 

Solution I tried was; changed the first line From;

 

if (!isServer) exitWith {};

 

To;

 

if (!isDedicated) then {

 

enclosing all the remaining original "vDogPatrol" script as is

 

putting the  removed } in at the end of all the script.

 

}

Share this post


Link to post
Share on other sites

BUT:  There always seems to be a But with A3!     Dedicated server, scripting for injury now works, but getting a dog for every player who joins (dedicated) the server, so you can get one guard with 10 dogs! Anyone know a way to stop this?

 

Since the last bis update  " if (!isServer)" seems to be buggy or not work in scripting for coop & dedicated servers.

 

Trying various changes, but so far its either damage working & a dog for every player, or it's 1 dog & no damage (on a Dedicated server that is)

  • Like 1

Share this post


Link to post
Share on other sites

Great script!

But every time the dogs bite me,there will be an error about ACE medic system.

 

scripts\aceBiteDamage.sqf line2

'..."] call ace_medical_fnc_addDamageToUnit;|#|'

Error

 

Looking to your reply!

Share this post


Link to post
Share on other sites
7 hours ago, luminous815 said:

Great script!

But every time the dogs bite me,there will be an error about ACE medic system.

 

scripts\aceBiteDamage.sqf line2

'..."] call ace_medical_fnc_addDamageToUnit;|#|'

Error

 

Looking to your reply!

 

I am in the process of updating all my scripts very soon! Will look up for that error. Did not happen before so it must be a change in ACE perhaps...

 

In fact ACE has been on a MEDICAL rewrite process for a long time now.

Share this post


Link to post
Share on other sites

Good news Dog lovers!

 

Version 1.5 of the vDog script has been released!

 

Spoiler

vDogs.jpg

 

Changelog:


- General Optimization: Dogs will only work if there are players near and if the server FPS is greater than 15.

- Dogs will no longer attack enemies they cannot see! (This is a game changer!)

- Greatly reduced the chance of dogs going through walls and objects! (No more Ghost Dogs!)

- Dogs will no longer target enemies in vehicles.

- Patrol Dogs will no longer target unarmed or INCAPACITATED enemies.

- Patrol Dogs now work with Human Players too!

- Feral Dogs will still attack unarmed or INCAPACITATED enemies!

 

Download Link:

https://drive.google.com/open?id=1Kc7n_nWQMD6lyJwUBOypyq40Kshn5koy

  • Like 2

Share this post


Link to post
Share on other sites
On 4/25/2020 at 9:06 AM, LSValmont said:

Good news Dog lovers!

 

Version 1.5 of the vDog script has been released!

 

  Hide contents

vDogs.jpg

 

Changelog:


- General Optimization: Dogs will only work if there are players near and if the server FPS is greater than 15.

- Dogs will no longer attack enemies they cannot see! (This is a game changer!)

- Greatly reduced the chance of dogs going through walls and objects! (No more Ghost Dogs!)

- Dogs will no longer target enemies in vehicles.

- Patrol Dogs will no longer target unarmed or INCAPACITATED enemies.

- Patrol Dogs now work with Human Players too!

- Feral Dogs will still attack unarmed or INCAPACITATED enemies!

 

Download Link:

https://drive.google.com/open?id=1Kc7n_nWQMD6lyJwUBOypyq40Kshn5koy

Nice to hear this!So is this script compatible with ACE medical system now?

  • Like 1

Share this post


Link to post
Share on other sites
8 hours ago, luminous815 said:

Nice to hear this!So is this script compatible with ACE medical system now?

 

I believe so yes, I updated the commands it used previously so it should work now unless the ACE team changed something again after the medical rewrite.

 

If you do manage to test it please confirm that it works as intended 😉 

Share this post


Link to post
Share on other sites
2 hours ago, LSValmont said:

 

I believe so yes, I updated the commands it used previously so it should work now unless the ACE team changed something again after the medical rewrite.

 

I you do manage to test it please confirm that it works as intended 😉 

I will use this script in my next mission.If there are any bugs, I will reply to you, thanks again for your efforts

  • Thanks 1

Share this post


Link to post
Share on other sites

Hey there!

For starters: this is a great idea, that is well executed (without mods)! I don't think I have encountered any bugs with the script itself.

However, I do have two feedback points

a) Your test mission, as of now (vDogPatrolv15.VR), has an external mod dependency on. I am pretty sure it's because you had DynaSound loaded when you were editing it, and the mission file accidentally got "contaminated". 
Note for players: you can easily remove this from the mission.sqm file using a text editor. 

b) Even with the single victim in the test mission, the ONE victim sound ("aaaaaahhhhH!!") very quickly got on my nerves. I will happily supply you with several short .ogg "ahs" and grunts so you can mix up the sounds a little.

Again, fantastic script, and I will use it with pleasure! 

Game on, sir!  
 

  • Thanks 1

Share this post


Link to post
Share on other sites

Great update LSValmont.

48 minutes ago, Melody_Mike said:

b) Even with the single victim in the test mission, the ONE victim sound ("aaaaaahhhhH!!") very quickly got on my nerves. I will happily supply you with several short .ogg "ahs" and grunts so you can mix up the sounds a little.

Note you can also use JBOY_PainGrunt to randomly play vanilla pain sounds.

 

If you want to add a little more immersion, you can have the dog handler unit say "Attack!" via JBOY_Speak when the dog attack condition is fired off:

[_dogHandler, selectRandom ['Attack_1','Attack_2']] call JBOY_Speak;

Other useful vanilla dog voice commands you could add in are Halt, FormOnMe, Stay,. (if your script has any of these dog behaviors implemented).

  • Like 2

Share this post


Link to post
Share on other sites

vDog Patrol and vDog Feral Scripts version 1.6 "PLAYER CONTROLED DOGS" RELEASED! (04/27/20)

 

Release highlights/Changelog:

 

- Players can now control their patrol dogs by assigning them to different TEAM COLORS!
Dogs on TEAM RED will attack enemies at will.
Dogs on TEAM GREEN will stay on their position.
Dogs on any other TEAM COLOR will follow their owner without engaging enemies.

Special Thanks to @johnnyboy for the suggestion of giving players more control over their pets 😃 

 

- Dogs can now potentially resist small firearms shots, specially the FERAL ones.

- Feral Dogs now play different sounds compared to regular Patrol Dogs.

- Dogs now have footstep sounds and are specially audible when they are running or sprinting.

- Several new death sounds for the Dogs.

- Human Victims will no longer play the same scream over and over again when attacked by the dogs.
(More than 30 sounds can now be played when attacked by a dog)

- Fixed unintended mission dependencies (Thank you @Melody_Mike)

 

version 1.6 DOWNLOAD LINK:

https://drive.google.com/open?id=1RhLABXHLpR-VdY5-YQdNC3gOm6HWOXfR

 

PS: This release was a little rushed, so please let me know if anything breaks 😉

 

Have fun guys!

  • Like 2
  • Thanks 1

Share this post


Link to post
Share on other sites
7 hours ago, LSValmont said:

- Players can now control their patrol dogs by assigning them to different TEAM COLORS!
Dogs on TEAM RED will attack enemies at will.
Dogs on TEAM GREEN will stay on their position.
Dogs on any other TEAM COLOR will follow their owner without engaging enemies.

Special Thanks to @johnnyboy for the suggestion of giving players more control over their pets 😃 

 

Thanks dude.  And I think its brilliant to use Team Color assignment for command purposes.  And once again, it would be fairly simple to add in the Vanilla voice commands for those 3 command modes (FormOnMe, Attack, Halt), and also corresponding hand signals.  Also love the footstep sounds.  If you want to pull any sounds (panting, growling, etc.) from JBOY_Dog,  go for it.

 

Another idea to play around with is attaching dog to invisible human.  @haleks made fast running rabbits using this technique.  This allows you to move the invisible human unit instead of the dog (while playing the walk, run, stop animations on dog so it looks good).  One big advantage of this is the dog can then run much faster (it always annoyed the hell out of me that a human could outrun a dog).  Another possibility is to set the invisible unit's side, and reveal the unit to the enemies.  Then you can get enemy AI to fire on the dog (i.e., target the invisible unit that the dog is attached to).  For this you would want invisible unit to be in crouch stance, so AI not shooting over dog all the time.  If you're interested, let me know, and I will dig up a proof of concept on this I have somewhere (I had a script for boars chasing player I was playing around with).

 

Also, feel free to use my dog wound textures and/or handleDamage eventhandlers (code lines below taken from my JBOY_dog_create.sqf.).

Spoiler

// **************************************************************************
// Add damage eventhandler to dog so it takes X shots to kill it.  And apply
// Bullet hole textures to dog when hit.  
// **************************************************************************
_dog allowdamage false;
_dog  setVariable ["vOriginalTexture", (getObjectTextures _dog select 0), true];
_dog addEventHandler ["HandleDamage", 
{
    private ["_return"];
    _dog = _this select 0; 
    _selection = _this select 1; 
    _passedDamage = _this select 2; 
    _source	= _this select 3; 
    _projectile = _this select 4; 
	_handler = _dog getVariable "vHandler";
	_maxHits = 5; // Player controlled dog's maximum hits is 5.  Want player's dog to be harder to kill.
	if (!isPlayer _handler) then
	{
		_maxHits = selectRandom [2,3,4,4,4];  // AI controlled dogs and Feral Dogs take less hits to kill.  Exact hits per dog randomly assigned.
	};
  //diag_log["damage",_dog,_selection,_passedDamage,_source,_projectile];
    // log who hurt the dog
	if (_dog getVariable "vAllowDamage") then 
	{
		if (_source isKindOf "Man") then
		{
			_dog setVariable ["vWhoHurtDog", _source, true];
		};
		// Do not damage dog if source of damage is dog itself (which appears to be collision damage when dog pushed at target),
		// or projectile is empty string (fall damage).
		if ((_projectile != '') and !(isnull _source )) then  
		{
			_hits = _dog getVariable "vHits";
			//diag_log [_dog, "Dog hits:",_hits];
			 
			
			if (_hits == 0) then 
			{
				// Add action to heal dog
				//player sidechat "b4 add heal action";
				// You can't create actions on animals, so create an object and attach it to the dog
				//_dogProxy =  "Steel_Plate_S_F" createVehicle [0,0,0];
				//_dogProxy attachTo [_dog, [0,0,.5]];
				//_dogProxy setposatl getposatl _dog;

			//object addAction [title, script, arguments, priority, showWindow, hideOnUse, shortcut, condition, radius, unconscious, selection]     
				//waitUntil {sleep 2; isNull attachedTo _dog or !alive _dog};
				if (alive _dog) then
				{
				_HealAction      = _handler addAction ["Heal dog",   // action title
					{   _dog=_this select 3 select 0;   
						_healer = _this select 3 select 1; 
						if ((_healer distance _dog) < 2.5 and 
							 ("Medikit" in (items _healer + assignedItems _healer)  or
							  "FirstAidKit" in (items _healer + assignedItems _healer) ) 
						   ) then
						{
							_dog playMove "Dog_Stop";
							_healer playActionNow "MedicOther";  
							sleep 4.5;  
							_dog setVariable ["vHits", 0, true];
							_dog setObjectTextureGlobal [0,_dog getVariable "vOriginalTexture"];
							//hint format ["_HealAction=%1",_healer getVariable "vHealActionID"];
							_healer removeAction (_healer getVariable "vHealActionID");
							_healer setVariable ["vHealActionID", -1,true];
							if !("Medikit" in (items _healer + assignedItems _healer)) then { _healer removeItem "FirstAidKit"};
						} else
						{
							hint "You must have a medkit or first aid kit to heal dog";
							sleep 4;
							hint "";
						};
					}, // script
					[_dog,_handler], //arguments
					6, // priority
					true, //showWindow
					true, //hideOnUse
					"",//shortcut
					"(player distance (player getVariable ""vDog"")) < 2.5 and isNull attachedTo (player getVariable ""vDog"")",//condition player is close and dog not in vehicle
					20 //radius
					];  
					
				_handler setVariable ["vHealActionID", _HealAction,true];
				};
			};
			_hits = _hits + 1;
		   _dog setVariable ["vHits", _hits, true];

			if (typeOf _dog in ["Fin_tricolour_F","Fin_blackwhite_F","Fin_ocherwhite_F","Alsatian_Sandblack_F","Alsatian_Sand_F","Alsatian_Black_F"]) then 
			{
				if (_hits <= _maxHits) then {dummy= [_dog, 0, ([ "boomerYelp", "boomerYelp2"] call BIS_fnc_arrayShuffle) select 0, ""] execVM "JBOY_Dog\delaySay.sqf";};
				if (_hits <= _maxHits) then
				{
					if (((getObjectTextures _dog select 0) find "dogBloodNeck2Hole")==-1) then
					{
						if (((getObjectTextures _dog select 0) find "dogbloodneck")>=0) then
						{
							_dog setobjecttextureGlobal [0,"JBOY_Dog\Textures\dogBloodNeck2Hole" + (typeOf _dog)+".jpg"]; // neck blood + bullet holes
						} else {
							_dog setobjecttextureGlobal [0,"JBOY_Dog\Textures\dogBulletHole2" + (typeOf _dog)+".jpg"]; // bullet holes only
						};
					};
				};
			 };
			 if (_hits > _maxHits) then {
			   _dog setdamage 1;
			   // Delete attached enemy dude that draws fire (
			   _n=[_dog] spawn 
			   {   params["_dog"];
				   sleep 5;
					{
					  detach _x;
					  deleteVehicle _x;
					} forEach attachedObjects _dog;
			   };
			 };
		};
	};
    _return = 0;
   _return
}];
// ***********************************************************************
// Continually loop if dog hit and yelp until healed.
// ***********************************************************************
_n=[_dog] spawn
{
    params["_dog"];
	_handler = _dog getVariable "vHandler";
	if !(_handler isEqualTo objnull) then 
	{
		if (isPlayer _handler) then
		{
			while {alive _dog} do
			{
				if (_dog getVariable "vHits" > 0) then
				{
					dummy= [_dog, 0, ([ "boomerYelp", "boomerYelp2"] call BIS_fnc_arrayShuffle) select 0, ""] execVM "JBOY_Dog\delaySay.sqf";
					sleep (3 + random 7);
				};
			};
		};
	};
};

 

Note there are different wound textures for the two types of dogs (pastor and alsatian), and also "blood on mouth" textures for the two dog types.  The "blood on mouth" textures are not set in damage event handlers, but are set when dog bites an enemy the first time.  So "blood on mouth" is not an injury, but visual confirmation that dog has bitten someone (and it looks cool and mean!!!).

  • Like 2
  • Thanks 1

Share this post


Link to post
Share on other sites
2 hours ago, johnnyboy said:

Thanks dude.  And I think its brilliant to use Team Color assignment for command purposes.  And once again, it would be fairly simple to add in the Vanilla voice commands for those 3 command modes (FormOnMe, Attack, Halt), and also corresponding hand signals.  Also love the footstep sounds.  If you want to pull any sounds (panting, growling, etc.) from JBOY_Dog,  go for it.

 

Another idea to play around with is attaching dog to invisible human.  @haleks made fast running rabbits using this technique.  This allows you to move the invisible human unit instead of the dog (while playing the walk, run, stop animations on dog so it looks good).  One big advantage of this is the dog can then run much faster (it always annoyed the hell out of me that a human could outrun a dog).  Another possibility is to set the invisible unit's side, and reveal the unit to the enemies.  Then you can get enemy AI to fire on the dog (i.e., target the invisible unit that the dog is attached to).  For this you would want invisible unit to be in crouch stance, so AI not shooting over dog all the time.  If you're interested, let me know, and I will dig up a proof of concept on this I have somewhere (I had a script for boars chasing player I was playing around with).

 

Also, feel free to use my dog wound textures and/or handleDamage eventhandlers (code lines below taken from my JBOY_dog_create.sqf.).

  Reveal hidden contents


// **************************************************************************
// Add damage eventhandler to dog so it takes X shots to kill it.  And apply
// Bullet hole textures to dog when hit.  
// **************************************************************************
_dog allowdamage false;
_dog  setVariable ["vOriginalTexture", (getObjectTextures _dog select 0), true];
_dog addEventHandler ["HandleDamage", 
{
    private ["_return"];
    _dog = _this select 0; 
    _selection = _this select 1; 
    _passedDamage = _this select 2; 
    _source	= _this select 3; 
    _projectile = _this select 4; 
	_handler = _dog getVariable "vHandler";
	_maxHits = 5; // Player controlled dog's maximum hits is 5.  Want player's dog to be harder to kill.
	if (!isPlayer _handler) then
	{
		_maxHits = selectRandom [2,3,4,4,4];  // AI controlled dogs and Feral Dogs take less hits to kill.  Exact hits per dog randomly assigned.
	};
  //diag_log["damage",_dog,_selection,_passedDamage,_source,_projectile];
    // log who hurt the dog
	if (_dog getVariable "vAllowDamage") then 
	{
		if (_source isKindOf "Man") then
		{
			_dog setVariable ["vWhoHurtDog", _source, true];
		};
		// Do not damage dog if source of damage is dog itself (which appears to be collision damage when dog pushed at target),
		// or projectile is empty string (fall damage).
		if ((_projectile != '') and !(isnull _source )) then  
		{
			_hits = _dog getVariable "vHits";
			//diag_log [_dog, "Dog hits:",_hits];
			 
			
			if (_hits == 0) then 
			{
				// Add action to heal dog
				//player sidechat "b4 add heal action";
				// You can't create actions on animals, so create an object and attach it to the dog
				//_dogProxy =  "Steel_Plate_S_F" createVehicle [0,0,0];
				//_dogProxy attachTo [_dog, [0,0,.5]];
				//_dogProxy setposatl getposatl _dog;

			//object addAction [title, script, arguments, priority, showWindow, hideOnUse, shortcut, condition, radius, unconscious, selection]     
				//waitUntil {sleep 2; isNull attachedTo _dog or !alive _dog};
				if (alive _dog) then
				{
				_HealAction      = _handler addAction ["Heal dog",   // action title
					{   _dog=_this select 3 select 0;   
						_healer = _this select 3 select 1; 
						if ((_healer distance _dog) < 2.5 and 
							 ("Medikit" in (items _healer + assignedItems _healer)  or
							  "FirstAidKit" in (items _healer + assignedItems _healer) ) 
						   ) then
						{
							_dog playMove "Dog_Stop";
							_healer playActionNow "MedicOther";  
							sleep 4.5;  
							_dog setVariable ["vHits", 0, true];
							_dog setObjectTextureGlobal [0,_dog getVariable "vOriginalTexture"];
							//hint format ["_HealAction=%1",_healer getVariable "vHealActionID"];
							_healer removeAction (_healer getVariable "vHealActionID");
							_healer setVariable ["vHealActionID", -1,true];
							if !("Medikit" in (items _healer + assignedItems _healer)) then { _healer removeItem "FirstAidKit"};
						} else
						{
							hint "You must have a medkit or first aid kit to heal dog";
							sleep 4;
							hint "";
						};
					}, // script
					[_dog,_handler], //arguments
					6, // priority
					true, //showWindow
					true, //hideOnUse
					"",//shortcut
					"(player distance (player getVariable ""vDog"")) < 2.5 and isNull attachedTo (player getVariable ""vDog"")",//condition player is close and dog not in vehicle
					20 //radius
					];  
					
				_handler setVariable ["vHealActionID", _HealAction,true];
				};
			};
			_hits = _hits + 1;
		   _dog setVariable ["vHits", _hits, true];

			if (typeOf _dog in ["Fin_tricolour_F","Fin_blackwhite_F","Fin_ocherwhite_F","Alsatian_Sandblack_F","Alsatian_Sand_F","Alsatian_Black_F"]) then 
			{
				if (_hits <= _maxHits) then {dummy= [_dog, 0, ([ "boomerYelp", "boomerYelp2"] call BIS_fnc_arrayShuffle) select 0, ""] execVM "JBOY_Dog\delaySay.sqf";};
				if (_hits <= _maxHits) then
				{
					if (((getObjectTextures _dog select 0) find "dogBloodNeck2Hole")==-1) then
					{
						if (((getObjectTextures _dog select 0) find "dogbloodneck")>=0) then
						{
							_dog setobjecttextureGlobal [0,"JBOY_Dog\Textures\dogBloodNeck2Hole" + (typeOf _dog)+".jpg"]; // neck blood + bullet holes
						} else {
							_dog setobjecttextureGlobal [0,"JBOY_Dog\Textures\dogBulletHole2" + (typeOf _dog)+".jpg"]; // bullet holes only
						};
					};
				};
			 };
			 if (_hits > _maxHits) then {
			   _dog setdamage 1;
			   // Delete attached enemy dude that draws fire (
			   _n=[_dog] spawn 
			   {   params["_dog"];
				   sleep 5;
					{
					  detach _x;
					  deleteVehicle _x;
					} forEach attachedObjects _dog;
			   };
			 };
		};
	};
    _return = 0;
   _return
}];
// ***********************************************************************
// Continually loop if dog hit and yelp until healed.
// ***********************************************************************
_n=[_dog] spawn
{
    params["_dog"];
	_handler = _dog getVariable "vHandler";
	if !(_handler isEqualTo objnull) then 
	{
		if (isPlayer _handler) then
		{
			while {alive _dog} do
			{
				if (_dog getVariable "vHits" > 0) then
				{
					dummy= [_dog, 0, ([ "boomerYelp", "boomerYelp2"] call BIS_fnc_arrayShuffle) select 0, ""] execVM "JBOY_Dog\delaySay.sqf";
					sleep (3 + random 7);
				};
			};
		};
	};
};

 

Note there are different wound textures for the two types of dogs (pastor and alsatian), and also "blood on mouth" textures for the two dog types.  The "blood on mouth" textures are not set in damage event handlers, but are set when dog bites an enemy the first time.  So "blood on mouth" is not an injury, but visual confirmation that dog has bitten someone (and it looks cool and mean!!!).

 

Just Wow @johnnyboy, not only this script wouldn't not have been possible without your input but your ideas are what move me forward too! Thank you for sharing your knowledge and resources!

 

First I am flattered that you are enjoying the mod and second I would love to have your ideas implemented, can you help me?

 

1) Love the idea of an invisible unit, it bothers the hell out of me to have such slow dogs!

2) My dream is to make my vDogs work exactly like @haleks zombies really. Those Ai consume next to no resources and work like a charm. I believe they are agents and I have very little experience with agents. I don't know if we could do what haleks did with scripts alone... but I do wan't to keep this as a script rather than a mod as much as possible.

3) Wound textures and/or handleDamage eventhandlers is exactly what the vDogs need right now!

 

As far as I am concerned you are as much owner of the vDogs as I am so please feel free to make any changes to them, as long as they are multiplayer compatible and don't eat too much resources it shall be added!

  • Like 1

Share this post


Link to post
Share on other sites

I'm happy to contribute.  Due to limited time I won't be actually modifying your code, but I can provide snippets of code that you can hopefully tweak to your needs for some features.

1 hour ago, LSValmont said:

3) Wound textures and/or handleDamage eventhandlers is exactly what the vDogs need right now

With the code snippet I gave you in previous post, plus the dog textures found in JBOY Dog demo mission folder JBOY_Dog\Textures\, you should have everything you need to get wound textures going.  Feel free to remove commented code, and non-useful code from the damage handler snippet.  For example, you could remove the code relevant to healing dogs from that snippet.  And there may be references to object variables you don't need, etc.

1 hour ago, LSValmont said:

1) Love the idea of an invisible unit, it bothers the hell out of me to have such slow dogs!

2) My dream is to make my vDogs work exactly like @haleks zombies really. Those Ai consume next to no resources and work like a charm. I believe they are agents and I have very little experience with agents. I don't know if we could do what haleks did with scripts alone... but I do wan't to keep this as a script rather than a mod as much as possible.

 

I think the invisible unit could also be an agent.  He only needs to follow doMove commands, and needs no other abilities (I think).  I took a quick look at my "animal attached to invisible units" script and they're pretty messy.  So I think I will stream line it to make a working dog-friendly example, then post it here.  You can then evaluate if its adaptable to your needs.  Give me a day or two.

 

Keep up the great work!

  • Thanks 1

Share this post


Link to post
Share on other sites
1 hour ago, johnnyboy said:

I took a quick look at my "animal attached to invisible units" script and they're pretty messy.  So I think I will stream line it to make a working dog-friendly example, then post it here.  You can then evaluate if its adaptable to your needs.  Give me a day or two.

 

Keep up the great work!

 

That would be awesome, thank you!

 

Already working on the EH you provided me with!

  • Like 1

Share this post


Link to post
Share on other sites
On 4/27/2020 at 11:49 AM, LSValmont said:

 

PS: This release was a little rushed, so please let me know if anything breaks 😉

 

Have fun guys!

 

Couple of issues with vDog Patrol when the dog is controlled by enemy AI (which is what I'd want to use this for)

 

1. When the player reveals themselves the dogs just stand there (tested on the included test mission). This seems to be because: 

if !(assignedTeam _dog isEqualTo "RED") then {_targetsAmount = 0;};

since assignedTeam will always return "" on AI-only groups.

 

2. I played around with adding "&& isPlayer _dogOwner" to the above condition and the dog started moving but only to it's owner. It still won't engage the player.

 

3. I might be missing something but when iterating over _nearHumans to find _targetHumans there's this: 

then {_targetHumans = _targetHumans + [_x]; _dog knowsabout _x; _dogOwner knowsabout _x;}

This seems more appropriate: pushBack is more efficient and since the knowsAbout value isn't used I'm guessing you wish to reveal the target to the group instead:

then {_targetHumans pushBack _x; group _dogOwner reveal _x; }

 

I'd also recommend splitting the AI and player versions of vDog patrol up into 2 separat scripts. It'd would help minimize running code that isn't needed for each use case and help simplify troubleshooting for you as well.

It might even be worth pulling the dog move code into it's own routine and have the dogs and let it act on some given parameters that could be controlled by the other scripts.

It makes sense (to me anyway) that the locomotion of the dogs ought to be the same no matter if they are controlled by a player, an AI or are feral. Makes it easier to update and maintain even if you decide to change stuff around with their movement.

 

Anyway that's my 2 cents.

Great work so far! Carry on.

  • Like 2

Share this post


Link to post
Share on other sites

When I was bitten, there was an error message

 

Sound dogGrowl2 not found

 

Apart from this, the script works very well

  • Like 1

Share this post


Link to post
Share on other sites
4 hours ago, luminous815 said:

When I was bitten, there was an error message

 

Sound dogGrowl2 not found

 

Apart from this, the script works very well

 

I am in the process of rewriting much of the script for more features and better performance! Give me a day or two 😉

 

12 hours ago, mrcurry said:

 

Couple of issues with vDog Patrol when the dog is controlled by enemy AI (which is what I'd want to use this for)

 

1. When the player reveals themselves the dogs just stand there (tested on the included test mission). This seems to be because: 


if !(assignedTeam _dog isEqualTo "RED") then {_targetsAmount = 0;};

since assignedTeam will always return "" on AI-only groups.

 

2. I played around with adding "&& isPlayer _dogOwner" to the above condition and the dog started moving but only to it's owner. It still won't engage the player.

 

3. I might be missing something but when iterating over _nearHumans to find _targetHumans there's this: 


then {_targetHumans = _targetHumans + [_x]; _dog knowsabout _x; _dogOwner knowsabout _x;}

This seems more appropriate: pushBack is more efficient and since the knowsAbout value isn't used I'm guessing you wish to reveal the target to the group instead:


then {_targetHumans pushBack _x; group _dogOwner reveal _x; }

 

I'd also recommend splitting the AI and player versions of vDog patrol up into 2 separat scripts. It'd would help minimize running code that isn't needed for each use case and help simplify troubleshooting for you as well.

It might even be worth pulling the dog move code into it's own routine and have the dogs and let it act on some given parameters that could be controlled by the other scripts.

It makes sense (to me anyway) that the locomotion of the dogs ought to be the same no matter if they are controlled by a player, an AI or are feral. Makes it easier to update and maintain even if you decide to change stuff around with their movement.

 

Anyway that's my 2 cents.

Great work so far! Carry on.

 

Wow, this is the kind of feedback that I love! Thank you @mrcurry!

 

I have rewritten the whole script from scratch so that Dogs consume less resources while having even more features. In the process I have fixed all your issues and also made the script modular so player vDogs are the only ones able to obey to commands/team color.

 

Will release the new version soon!

  • Like 4

Share this post


Link to post
Share on other sites

A little preview of what is to come for version 1.7: "The johnnyboy update!".

 

First, I would like to thank JohnnyBoy for his continued support and his kind donation of assets making this update possible.

 

Also @Melody_Mike, @mrcurry, @luminous815 and @GEORGE FLOROS GR for their quick and often in deep bugs and suggestions reports.

 

At some point during development of version 1.7 I realized that in order to support all the features donated by JohnnyBoy would require a major rewrite of the current scripts.

 

The main issue was that when all the new features were added the resource consumption of each vDog Increased significantly.

I identified that a lot of that was related to the vDogs being units instead of agents.

 

In my experiments I later found that spawning the vDogs as Agents instead of units would consume 25% of the resources a single regular unit consumed.

And so a comprehensive rewrite began.

 

Now, with the new Agents system I can spawn two agents attached to each other and still get ~50% less FPS reduction compared to what a single Unit would reduce.

 

The only setback really is that Patrol vDogs no longer join the player group but there are work arounds for that.

 

In the end the new system and rewrite plus the input and donations from JohnnyBoy allowed me to add the following features:

 

- 50% reduction in FPS impact of the whole script. (20 active Dogs will set you back around +/- 5 FPSs while before the FPS impact was ~10).
- Regular Ai will now react to and fire at the vDogs! (Still in development but is a massive improvement in immersion for an also resource intensive feature)
- There is now a chance for regular Ai to be scared by and therefore run away from a charging dog!
- vDogs now have wounded textures! (Thanks to JohnnyBoy!)
- Player controlled vDogs can now be healed by their owners! (Thanks to JohnnyBoy!)
- Player controlled vDogs now change behavior based on their owner's team color. (Workaround for vDogs no longer in same group as player) (In development)
- JohnnyBoy's donations now allow player units to say "Dog Attack", "Dog Stay" and "Dog Track" based on team color changes. (Track is due to the lack of a follow me voice voice recording).
- Several new barking and howling sounds added to the dog's repertoire courtesy of JohnnyBoy.
- When healing a vDog there is a chance for the player to pet the dog and say: "Good Boy"! (Thanks JohnnyBoy).


As you can see there are still some features in development and those might not end up being doable but expect a release very soon with at least 90% of the features.

 

After this upcoming mayor update to the script it will be most likely "Feature Complete". (As further features might compromise the performance and multiplayer compatibility this script is all about). 

 

From then on I will be focusing on bug fixing and mod support for a few more days as my quarantine time is about to be over.

  • Like 4
  • Thanks 2

Share this post


Link to post
Share on other sites

vDog Patrol and vDog Feral MULTIPLAYER Scripts version 1.7 "THE JOHNNYBOY UPDATE!" RELEASED! (04/30/20)

 

Release highlights/Changelog:

 

- Extensive rewrite of the whole script package to accommodate the massive new features introduced in version 1.7 while performing even better than before.

- Dog Ai UNITS were replaced effectively by AGENT units. The effect was an astoundingly increase of performance while loosing no functionally whatsoever. (Also freed up mission Groups in the process).

- Dogs can now be targeted and shot by REGULAR Ai UNITS (This is a first for Arma 3 in the Multiplayer Department!). It can be enabled or disabled when the scripts are EXEC. (Enabled by default)

- You can now command the Dogs to "ATTACK" or "STAY" via the Arma 3 RADIO MENU (0-0).

- The Dogs now feature new sounds and wounded textures courtesy of @johnnyboy!

- You can now heal your wounded Dog Patrol Dogs! (Only one dog per player, but you can add more than one to Ai units in your squad for example)

- Charging dogs can now cause nearby Enemy Ai units to flee in terror!

- Updated the DEMO mission to showcase the new features better.

- Fixed all the bugs and issues reported by the community.

 

version 1.7 DOWNLOAD LINK:

https://drive.google.com/open?id=13a0tmoySShdRU6VcguneH748cK_Un-k_

 

PS: This was the biggest update that the script has received to date after I worked more than 50 hours on this update alone. 😉 Hopefully the mayor breakthroughs achieved by the vDogs regarding Agent utilization, targeting and general script optimization will serve the Arma community well!

 

PS2: I can't wait for some of you guys to convert this Dogs into menacing Wolves, Boars, Bears, Velociraptors, Monsters or even better, ALIENS! 🤑

 

It is also worth mentioning that @johnnyboy is working on a workaround to make the dogs faster and that feature might be implemented in future versions but I can't promise anything since my quarantine time is almost over and the vDogs are already feature complete as of version 1.7.

 

Have fun guys, endure this pandemic and we will come up stronger than before! GAME ON and finally enjoy fully featured Dogs for your MP missions! 😃 

  • Like 3
  • Thanks 1

Share this post


Link to post
Share on other sites
7 hours ago, LSValmont said:

PS2: I can't wait for some of you guys to convert this Dogs into menacing Wolves, Boars, Bears, Velociraptors, Monsters or even better, ALIENS! 🤑

 

That would be great !

Keep on the good work @LSValmont !

  • Thanks 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

×