Jump to content
Tajin

[Release] directly controllabe dog

Recommended Posts

Just a little snippet that you can put in the init-field of a unit in oder to spawn a dog in its place.

The dog is actually attached to the unit and the unit is made invisible. Therefor you can simply play, command or remotecontrol the unit in order to move the dog.

 

Action menu (or the button to hold your breath) allows you to bark. If you go prone without moving, the dog will sit.

if (isServer) then {
	0 = [this,"Fin_random_F"] spawn {
		params ["_guy","_class","_act"];
		private ["_dog"]; 
		_dog = createAgent [_class, getPos _guy, [], 0, "CAN_COLLIDE"];
		_dog setVariable ["BIS_fnc_animalBehaviour_disable", true];
		_dog attachTo [_guy,[0,0,0]];
		_guy hideObjectGlobal true;

		[_guy,["Bark", {
			params["_me","_you","_id","_d"];
			_d playMoveNow "Dog_Idle_Bark";
			_me setVariable["bark",true,true];
			sleep 1.5;
			playSound3D [format["A3\Sounds_F\ambient\animals\dog%1.wss", ceil random 3], _me, false, getPosASL _me, 40, 1, 10];
			sleep 2;
			_me setVariable["bark",false,true];
		}, _dog, 0, false, true, "holdBreath", "_target isEqualTo _this", 0, false, ""]] remoteExec ["addAction", 0];

		while {alive _guy && alive _dog} do {
			if (speed _guy > 10) then {
				_dog playMoveNow "Dog_Sprint";
			} else {
				if (speed _guy > 6) then {
					_dog playMoveNow "Dog_Run";
				} else {
					if ((speed _guy > 2) || (speed _guy < -2)) then {
						_dog playMoveNow "Dog_Walk";
					} else {
						if !(_guy getVariable ["bark",false]) then {
							if ((stance _guy) == "STAND") then {
								_dog playMoveNow "Dog_Stop";
							} else {
								if ((stance _guy) == "PRONE") then {
									_dog playMoveNow "Dog_Sit";
								} else {
									_dog playMoveNow "Dog_Idle_Stop";
								};
							};	
						};
					};
				};
			};
			sleep 0.05;
		};
		deleteVehicle _guy;
	};
};

 

Note that this is not meant to feel like playing as a dog, it is just a tool for gamemasters to have some easily controllable dogs that they can use.

  • Like 7
  • Thanks 1

Share this post


Link to post
Share on other sites

Pretty neat and useful. Thanks for sharing. :icon14:

 

....might need to edit the code in the OP, It's almost a double post, copy and pasting what's there currently results in a double doggy spawn that are uncontrollable. 

  • Like 1

Share this post


Link to post
Share on other sites

oh, my bad. Made a little correction and accidentially pasted it twice xD

Its ok now.

  • Like 2

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

×