[Simple Tutorial] Dogs on Taviana

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

  1. marvel

    marvel Member

    Joined:
    Jan 13, 2013
    Messages:
    69
    Likes Received:
    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:
    • 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!
     
  2. Will695

    Will695 Member

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

    marvel Member

    Joined:
    Jan 13, 2013
    Messages:
    69
    Likes Received:
    11
    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!
     
    Will695 likes this.
  4. Will695

    Will695 Member

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

    Infinity New Member

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

    marvel Member

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

    Infinity New Member

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

    marvel Member

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

    Infinity New Member

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

    marvel Member

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

    Infinity New Member

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

    marvel Member

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

    Infinity New Member

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

    marvel Member

    Joined:
    Jan 13, 2013
    Messages:
    69
    Likes Received:
    11
    Good to hear, your welcome :)
     
  15. Jay Hughes

    Jay Hughes Member

    Joined:
    May 21, 2013
    Messages:
    51
    Likes Received:
    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
      {
      _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";
       };
      };
    
     
  16. bajaboy1972

    bajaboy1972 Well-Known Member

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

    marvel Member

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

    bajaboy1972 Well-Known Member

    Joined:
    Jun 9, 2013
    Messages:
    202
    Likes Received:
    19
    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 ?
     
  19. marvel

    marvel Member

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

    Sent from my C6603 using Tapatalk 4 Beta
     
  20. bajaboy1972

    bajaboy1972 Well-Known Member

    Joined:
    Jun 9, 2013
    Messages:
    202
    Likes Received:
    19
    Cherno
    1.7.7.1
     

Share This Page