[Simple Tutorial] Dogs on Taviana

marvel

Member
I would like to share with you how to install dogs on Taviana. All credits for this go to PiXel. I took the code from his DayZ addins 2.1 (http://opendayz.net/threads/dayz-mission-addin-serverside-scripts.7840/). I say Taviana but it should work on any other map but I run it on Taviana. I felt like it was better to create a seperate tutorial for this since a lot of people want dogs on their server but they don't want the other stuff.

I will also explain how to add dogs if you run Base Building because some steps are a bit different then.

For people that don't know the dog features are:
  • Follow the leader.
  • Sit/Stay.
  • Find animals.
  • Kill zombies.
  • Ride with you in any vehicle.
All this is tested and confirmed working by me.

Ok so first open init.sqf in your mission file. Find this:

Code:
if (isServer) then {

And right below that add:

Code:
dogOwner = [];

Then find this:

Code:
_id = player addEventHandler ["Respawn", {_id = [] spawn player_death;}];
_playerMonitor =[] execVM "\z\addons\dayz_code\system\player_monitor.sqf";

Change it to this:

Code:
_id = player addEventHandler ["Respawn", {_id = [] spawn player_death; _nul = [] execVM "addin\plrInit.sqf";}];
//_id = player addEventHandler ["Respawn", {_id = [] spawn player_death;}];
_playerMonitor =[] execVM "\z\addons\dayz_code\system\player_monitor.sqf";
_nul = [] execVM "addin\plrInit.sqf";
Now if you don't use Base Building open up description.ext in your mission file and search for class RscPicture. Below that section (so after };) paste this code. If you do use Base building then add this code to your defines.hpp also under class RscPicture and don't touch description.ext
Code:
class CfgSounds
{
sounds[] =
{
bark,growl,whistleFollow,whistleStay,whistleFind,whistleNon
};
class bark
{
name="bark";
sound[]={addin\fx\bark.ogg,0.4,1};
titles[] = {};
};
class growl
{
name="growl";
sound[]={addin\fx\growl.ogg,0.5,1};
titles[] = {};
};
class whistleFollow
{
name="whistleFollow";
sound[]={addin\fx\whistleFollow.ogg,0.8,1};
titles[] = {};
};
class whistleStay
{
name="whistleStay";
sound[]={addin\fx\whistleStay.ogg,0.8,1};
titles[] = {};
};
class WhistleFind
{
name="WhistleFind";
sound[]={addin\fx\whistleFind.ogg,0.8,1};
titles[] = {};
};
class whistleNon
{
name="whistleNon";
sound[]={addin\fx\whistleNon.ogg,0.9,1};
titles[] = {};
};
};
That's the installation now you need to add the dog houses. To find the coordinates for the dog houses you need to make use of the single player editor. So not ALT+E or the multiplayer editor, you need the single player editor or it won't work.

The single player editor only works if you don't load Day Z. To do this start arma without dayz so e.g. run the executable.
Code:
C:\Program Files (x86)\Steam\steamapps\common\Arma 2 Operation Arrowhead\Expansion\beta\arma2oa.exe
The problem now is that you won't have Taviana. So what you need to do is copy the Taviana map to your arma 2 directory so you can open it in the single player editor.
So copy:
Arma 2 Operation Arrowhead\@Taviana\Addon\taviana.pbo, tavi.pbo and the matching bisign files to common\arma 2\AddOns. Now Taviana should be available as single player without loading Dayz.
Once you loaded the map in the editor, hit F6 and choose map markers where you want to have the dog houses. Just name them 1,2,3...etc. Once your done save it and you will have the coordinates. (You can add as many as you want).
Now go to your My Documents Folder, there's a either a map BIS Core Engine or Arma 2 Other files, in it is a map missions and then a folder with the name of the mission you just saved. In their should be a SQM file.
The important part is the class markers, those are your coordinates:
Code:
class Markers
{
items=6;
class Item0
{
position[]={7445.0386,34.657547,4612.6265};
name="1";
type="Empty";
};
class Item1
{
position[]={9535.8896,194.222,7786.3647};
name="2";
type="Empty";
};
class Item2
{
position[]={3874.8286,36.095501,7068.4648};
name="3";
type="Empty";
};
class Item3
{
position[]={16219.069,35.599899,13690.921};
name="4";
type="Empty";
};
class Item4
{
position[]={10830.677,6,18934.564};
name="5";
type="Empty";
};
class Item5
{
position[]={11641.861,13.375018,774.50256};
name="6";
type="Empty";
};
};
These coordinates look like this on the Taviana map. Feel free to use them if you're too lazy to add your own dog houses ;)
http://postimg.org/image/jasafi4x9/
Now open up mission.sqm in your mission file and search for class vehicles. It should say how many items you have there.
Code:
class Vehicles
{
items=31;
class Item0
Now, if you added let's say 6 dog houses, you'll have to increase items= to 37. If you add 12 you have to increase it to 43 etc. etc. Now go to the very last item of the class vehicles and below it add the code for the dog houses and put it the coordinates you got from the single player editor so it looks like this:
Code:
class Item26
{
position[]={7445.0386,34.657547,4612.6265};
//placement=70;
id=27;
side="EMPTY";
vehicle="Land_psi_bouda";
text="dog_1";
init="_nul = [this]execVM ""addin\dogInit.sqf""; _dogSound = createSoundSource [""Sound_LittleDog"", getPosATL this, [], 0];";
};
class Item27
{
position[]={9535.8896,194.222,7786.3647};
//placement=100;
id=28;
side="EMPTY";
vehicle="Land_psi_bouda";
text="dog_2";
init="_nul = [this]execVM ""addin\dogInit.sqf""; _dogSound = createSoundSource [""Sound_LittleDog"", getPosATL this, [], 0];";
};
class Item28
{
position[]={3874.8286,36.095501,7068.4648};
//placement=70;
id=29;
side="EMPTY";
vehicle="Land_psi_bouda";
text="dog_3";
init="_nul = [this]execVM ""addin\dogInit.sqf""; _dogSound = createSoundSource [""Sound_LittleDog"", getPosATL this, [], 0];";
};
class Item29
{
position[]={16219.069,35.599899,13690.921};
//placement=100;
id=30;
side="EMPTY";
vehicle="Land_psi_bouda";
text="dog_4";
init="_nul = [this]execVM ""addin\dogInit.sqf""; _dogSound = createSoundSource [""Sound_LittleDog"", getPosATL this, [], 0];";
};
class Item30
{
position[]={10830.677,6,18934.564};
//placement=70;
id=31;
side="EMPTY";
vehicle="Land_psi_bouda";
text="dog_5";
init="_nul = [this]execVM ""addin\dogInit.sqf""; _dogSound = createSoundSource [""Sound_LittleDog"", getPosATL this, [], 0];";
};
class Item31
{
position[]={11641.861,13.375018,774.50256};
//placement=70;
id=32;
side="EMPTY";
vehicle="Land_psi_bouda";
text="dog_6";
init="_nul = [this]execVM ""addin\dogInit.sqf""; _dogSound = createSoundSource [""Sound_LittleDog"", getPosATL this, [], 0];";
};
Don't forget to change the class Itemnumber for every dog house. Just follow up from the number of your last vehicle. The value for 'id' is your class item + 1.
I remarked placement, because if you use that it will move the dog houses in a random radius from your coordinates (in meters) so it's your choice if you want that or not. I personally don't like it.
If you're done save the file. If you want more dog houses just copy paste one code block, name it dog_7, up the item and id and you're done.
If you want you can add one more customization to increase or decrease the distance from which dogs can find animals. Open dog.sqf and on line 57 you'll see this:
Code:
_animals = nearestObjects [_dog, ["Hen","Cock","Cow04","Cow03","Cow02","Cow01","Goat","Sheep","WildBoar"],400];
400 is the radius in which the dog will look for animals. Feel free to change it to whatever you want.
Done!! :)
If people have other customizations, like finding humans or other stuff please share! Thanks!
 
awesome dude gonna try this, do you know how to get the "sit on back of vehicles" bit from pixels tut?

That's not very hard to do.

Download this:

http://www.mediafire.com/download/z4214zepv8xeu5j/addin_sitonback.rar

Extract it to your mission file.

Then in your init.sqf at the bottom add:

Code:
//vehicle climb
_nul = [] execVM "addin\vehInit.sqf";

Or if you want to keep it all together you can put it at the bottom in addin\plrInit.sqf (the one from the dog code).

That's it!
 
Looks great! Thanks for sharing this with us!

Just one question; do you need that 'sit on back of vehicles' ? Like; do the dogs actually go in those seats?

I'm going to install it tomorrow, I'll post if it works.
 
Looks great! Thanks for sharing this with us!

Just one question; do you need that 'sit on back of vehicles' ? Like; do the dogs actually go in those seats?

I'm going to install it tomorrow, I'll post if it works.


Oh no you don't need it it's a separate plugin from Pixel's addin package so that a player can sit on the exterior of the car. The dog will just sit on the back seat.
 
I've just installed this and we got the dog houses but there are no dogs around it. Any advice on how to fix this?
 
I've just installed this and we got the dog houses but there are no dogs around it. Any advice on how to fix this?


Do you hear the barking coming from the dog houses? In your mission.sqm do you have this line for each dog house?

Code:
[FONT=Consolas]init="_nul = [this]execVM ""addin\dogInit.sqf""; _dogSound = createSoundSource [""Sound_LittleDog"", getPosATL this, [], 0];";
[/FONT]
And your paths are correct? What Day Z version? Make sure to check the rpt file as well for errors and it's excluded if you run antihack or anything.
 
I don't hear any barking .. I do have the line in mission.sqm, I'm running Taviana .com 1.7.4.4. and I just checked my RPT log and found this 'error':

19:27:45 dog_1 is not soldier nor transport.
19:27:45 No transport
19:27:45 dog_2 is not soldier nor transport.
19:27:45 No transport
19:27:45 dog_3 is not soldier nor transport.
19:27:45 No transport
19:27:45 dog_4 is not soldier nor transport.
19:27:45 No transport
19:27:45 dog_5 is not soldier nor transport.
19:27:45 No transport
19:27:45 dog_6 is not soldier nor transport.
19:27:45 No transport

I followed exactly what you said in the guide.
 
Ah I think you didn't put the dogs in the mission.sqm under class vehicles but another one? They should be under class vehicles.

Sent from my C6603 using Tapatalk 4 Beta
 
Well I have multiple Class Vehicles; one with items=100 (Added it under this one so now it's 106) one with items=1 and one with items=31. But I think I should have added them under items=31 :p Will try that now. Will let you know if that's it ^^ Thank you for the fast replies :)
 
Sorry all I forgot the part

dogOwner = [];

In the tutorial which you must add to your init.sqf as well. I updated the tutorial, should work 100% now I'm sure.
 
I'd like to have the dog interact with any non-human vehicle and ignore players all together. Anyone willing to give feedback on this code?

Code:
//foo
  if ((count _humans > 0) && (alive _foo)) then
  {
  _distance = _leader distance _foo;
  // warning
  If ((_distance > 10) && (_distance < 200)) then
   {
   _nul = [objNull, _dog, rSAY, "bark"] call RE; 
   _dog domove (position _foo);
   _dog setspeedmode "FULL";
   _nul = [objNull, _dog, rSAY, "bark"] call RE; 
   };
  //initiate attack 
  If ((_distance < 11) && (_foo isPlayer _x)) then
   {
   _nul = [objNull, _dog, rSAY, "growl"] call RE; 
   _dog domove (position _foo);
   _dog setspeedmode "FULL";
   };
  //attack
  If ((_distance < 10) && (_foo isPlayer _x)) then
   {
   _dog domove (position _foo);
   _dog setspeedmode "FULL";
   _stopWait = (time + 4);
   waitUntil {sleep 0.5; (_dog distance _foo) < 5 || time > _stopWait};
   _dog domove (position _foo);
   _dog setspeedmode "FULL";
   if ((alive _dog) && (_foo isPlayer _x)) then 
    {
    _dog attachTo [_foo,[0,0.8,0],"hrudnik"];
    _dog setDir 180;
    _foo setdamage 0.3;
    sleep 1;
    };
   if ((alive _dog) && (_foo isPlayer _x)) then 
    {
    _dog setDir 160;
    _foo setdamage 0.6;
    sleep 1;
    };
   if ((alive _dog) && (_foo isPlayer _x)) then  
    {  
    _dog setDir 180;
    _foo setdamage 0.8;
    sleep 1;
    };
   if ((alive _dog) && (_foo isPlayer _x)) then 
    {
    _dog setDir 200;
    _foo setdamage 1;
    };
   detach _dog;
   _dog domove (position _leader);
   _dog setspeedmode "FULL";
   };
  };
 
You probably forgot the dogowner = []; in your init.sqf please see the tutorial. If you use antihack you'll have to make exclusions

Sent from my C6603 using Tapatalk 4 Beta
 
I have it in like this....
Code:
if (isServer) then {
dogOwner = [];
    _serverMonitor =    [] execVM "\z\addons\dayz_code\system\server_monitor.sqf";
    "atp"    addPublicVariableEventHandler { diag_log format["%1", _this select 1];};
};

And where would i make changes for anti hack ?
 
Back
Top