# [Simple Tutorial] Dogs on Taviana

Discussion in 'Tutorials' started by marvel, Jun 16, 2013.

1. ### marvelMember

Joined:
Jan 13, 2013
Messages:
69
11
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:
• 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 {


Code:
dogOwner = [];

Then find this:

Code:
_id = player addEventHandler ["Respawn", {_id = [] spawn player_death;}];


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;}];

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";
titles[] = {};
};
class growl
{
name="growl";
titles[] = {};
};
class whistleFollow
{
name="whistleFollow";
titles[] = {};
};
class whistleStay
{
name="whistleStay";
titles[] = {};
};
class WhistleFind
{
name="WhistleFind";
titles[] = {};
};
class whistleNon
{
name="whistleNon";
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:
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!

2. ### Will695Member

Joined:
Mar 31, 2013
Messages:
88
2
awesome dude gonna try this, do you know how to get the "sit on back of vehicles" bit from pixels tut?

3. ### marvelMember

Joined:
Jan 13, 2013
Messages:
69
11
That's not very hard to do.

Extract it to your mission file.

Code:
//vehicle climb

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!

Will695 likes this.
4. ### Will695Member

Joined:
Mar 31, 2013
Messages:
88
2
awesome thanks for the quick reply. I'll give it a go tonight.

5. ### InfinityNew Member

Joined:
May 25, 2013
Messages:
23
0
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.

6. ### marvelMember

Joined:
Jan 13, 2013
Messages:
69
11

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.

7. ### InfinityNew Member

Joined:
May 25, 2013
Messages:
23
0
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?

8. ### marvelMember

Joined:
Jan 13, 2013
Messages:
69
11

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.

9. ### InfinityNew Member

Joined:
May 25, 2013
Messages:
23
0
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.

10. ### marvelMember

Joined:
Jan 13, 2013
Messages:
69
11
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

11. ### InfinityNew Member

Joined:
May 25, 2013
Messages:
23
0
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 Will try that now. Will let you know if that's it ^^ Thank you for the fast replies

12. ### marvelMember

Joined:
Jan 13, 2013
Messages:
69
11
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.

13. ### InfinityNew Member

Joined:
May 25, 2013
Messages:
23
0
Confirmed working on Taviana (.com) 1.7.4.4. Works perfectly! Thank you so much

Joined:
Jan 13, 2013
Messages:
69
11

15. ### Jay HughesMember

Joined:
May 21, 2013
Messages:
51
5
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
{
// 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 setspeedmode "FULL";
};
};


16. ### bajaboy1972Well-Known Member

Joined:
Jun 9, 2013
Messages:
202
19
I got the dog house in and have a dog but no scroll option to command him?

17. ### marvelMember

Joined:
Jan 13, 2013
Messages:
69
11
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

18. ### bajaboy1972Well-Known Member

Joined:
Jun 9, 2013
Messages:
202
19
I have it in like this....
Code:
if (isServer) then {
dogOwner = [];
"atp"    addPublicVariableEventHandler { diag_log format["%1", _this select 1];};
};
And where would i make changes for anti hack ?

19. ### marvelMember

Joined:
Jan 13, 2013
Messages:
69
11
What dayz version and what map?

Sent from my C6603 using Tapatalk 4 Beta

Joined:
Jun 9, 2013
Messages:
202