Jump to content

Spawn a Tame Dog


Logi

Recommended Posts

I have been playing Epoch for about 3 months and I have never had a tame dog or seen anyone with one. So I thought rather than chasing after one with some raw meat, I would do it the easy way.

I had no idea how the dogs worked so I just looked at the Epoch files and throw this basic script together. I am sure that it is not perfect and it has only been used for a very short time on my test server.

I was intending to create some custom scripts for the dog to give it some actual purpose. But I don't really have the time at the moment.

I did create a little script which made the dog bark every 5 seconds if there was another player or zombie within 100m. But I am sure that there are better uses for the dog.

You could have a dog spawn when the player spawns or let players buy a dog. There is a dog kennel in the editor.

On my test server I was just spawning the dog with a bar of gold.

The script will probably need a bit of tweaking if you are going to put it on a live server.

 

http://youtu.be/ZPFQltAZTw8

 

Script.

 

private ["_hasdog","_type","_pos","_dog","_animalID","_fsmid"];
 
closedialog 0;
 
// Check if player currently has a dog
_hasdog = player getVariable ["dogID", 0];
 
if (_hasdog == 0) then {
   _type = "DZ_Pastor";
   _Pos = getPosATL player;
 
   // Create dog
   _dog = createAgent [_type, _Pos, [], 0, "NONE"];
   PVDZE_zed_Spawn = [_dog];
   publicVariableServer "PVDZE_zed_Spawn";
   _animalID = [_pos,_dog] execFSM "\z\addons\dayz_code\system\animal_agent.fsm";
 
   // Tame dog
   _animalID = _dog getVariable "fsm_handle";
   _animalID setFSMVariable ["_isTamed", true]; 
   _dog disableAI "FSM";
   (group _dog) setBehaviour "AWARE";
   _fsmid = [_dog, typeOf _dog] execFSM "\z\addons\dayz_code\system\dog_agent.fsm";
   _fsmid setFSMVariable ["_handle", _fsmid];
   player setVariable ["dogID", _fsmid];
   _dog setVariable ["fsm_handle", _fsmid];
   _dog setVariable ["CharacterID", dayz_characterID, true];
 
   systemChat "Your dog has been spawned!";
} else {
   systemChat "You already have a dog!";
};

Link to comment
Share on other sites

just tested it out and it works great! For people wondering how to install it, I just added it to the right click on the radio.

 

 

    class ItemRadio {
        class Use {
            text = "Summon Dog";
            script = "execVM 'scripts\tame_dog.sqf'";
        };
    };

 

Just change the 'scripts\tame_dog.sqf'"; to whatever you named the file and where you placed it

Link to comment
Share on other sites

Sounds cool! Would you be willing to share the script for the dog barking, when someone near?

 

I am not sure where I put it, but the script is very basic.

You can just run a loop while the dog is alive, counting the number of players and the number of zombies within a specified distance. 

Then while the count is above zero, have the dog bark then add a sleep for 5 seconds or whatever you want. Here are the commands for making the dog perform the bark animation and the bark sound.

_dog playActionNow "GestureBark";
[_dog,"dog_bark",0,false] call dayz_zombieSpeak;

 

 

how to update add price(cashmoney) to tame dog 

 

It depends how you are planning on spawning the dog. A very easy but unrealistic way would be to spawn the dog by right clicking a gold bar. Then you can add [player, "ItemGoldBar", 1] call BIS_fnc_invRemove;

That way after the player has clicked the gold bar and spawned a dog, the goldbar will be removed from the players inventory.

Or you could do what fireplace has done and spawn it using a radio. If you are using the radio, you would first need to check if the player actually has the gold before removing it from their inventory.

 

You could try to add the dog to a trader but that would be more difficult.

I was thinking about using the dog kennel in a trader zone and having a scroll menu option appear if the player is within x meters from the dog kennel and the player has above x amount of money ect.

Or maybe have the dog spawn when a player lays a plot pole, then have it patrol within range of the plot pole.

I only released this small script so that people could have a bit of fun with the dogs, how you implement the script is entirely up to you, there are many different ways that you could do it.

Link to comment
Share on other sites

I added right click rawmeat and cost is rawmeat.

for deploy anything... overwrites\config.sqf

["FoodSteakRaw","call a dog","execVM 'custom\tame_dog.sqf';","true"],

 

at bottom of tame_dog.sqf

   systemChat "Your dog has been spawned!";
   player removeMagazine 'FoodSteakRaw';
} else {
   systemChat "You already have a dog!";
};

battleye kicks

publicvariable.txt

 

I added 

5 "remExFP" !="switchmove" !="say" !="z_dog_bark_1", !="Dog_SitDown" !="dog_callBack"

 

publicvariableval.txt

// 5 "dog_"

 

thankz for the share....

Link to comment
Share on other sites

I'm using the emerald designer mod to spawn a dog when near a kennel with raw meat.

private["_isKennel"];

_isKennel = cursorTarget isKindOf "MAP_psi_bouda";
 
if (_isKennel) then {
        if (s_player_doggy < 0) then {
            s_player_doggy = player addaction["Heel hound", "fixes\tame_dog.sqf", cursorTarget, 1, false, true, "",""];
        };
    } else {
        player removeAction s_player_doggy;
        s_player_doggy = -1;
    };

I added an extra parameter in the script for the meat.

private ["_hasdog","_type","_pos","_dog","_animalID","_fsmid","_hasRmeat"];
 
closedialog 0;
 
// Check if player currently has a dog
_hasdog = player getVariable ["dogID", 0];
_hasRmeat = "FoodSteakRaw" in Magazines player;

if (!_hasRmeat) then exitWith {cutText [format["You have no Raw Meat"], "PLAIN DOWN"];};
 
if (_hasdog == 0) then {
   _type = "DZ_Pastor";
   _Pos = getPosATL player;
 
   // Create dog
   _dog = createAgent [_type, _Pos, [], 0, "NONE"];
   PVDZE_zed_Spawn = [_dog];
   publicVariableServer "PVDZE_zed_Spawn";
   _animalID = [_pos,_dog] execFSM "\z\addons\dayz_code\system\animal_agent.fsm";
 
   // Tame dog
   _animalID = _dog getVariable "fsm_handle";
   _animalID setFSMVariable ["_isTamed", true]; 
   _dog disableAI "FSM";
   (group _dog) setBehaviour "AWARE";
   _fsmid = [_dog, typeOf _dog] execFSM "\z\addons\dayz_code\system\dog_agent.fsm";
   _fsmid setFSMVariable ["_handle", _fsmid];
   player setVariable ["dogID", _fsmid];
   _dog setVariable ["fsm_handle", _fsmid];
   _dog setVariable ["CharacterID", dayz_characterID, true];
 
   systemChat "Your dog has been spawned!";
   player removeMagazine 'FoodSteakRaw';
} else {
   systemChat "You already have a dog!";
};

Great mod - better than the one I was using, more natural. Beans!

Link to comment
Share on other sites

  • 2 weeks later...

possible that the dog attack the zombie ?

 

It is certainly possible to create a script that would make the dog attack zombies within a certain distance. But that is not a standard feature for the dog.

If I have some spare time I might add some extra features to the dog. But at the moment I am a bit busy with uni coursework.

Link to comment
Share on other sites

Is the spawned dog also buggy as when you tame a dog the normal way?

Gone after restart, run around like a chicken without a head etc etc.

 

Also is the dog gone again when i logout?

Can i make the dog permanent (until it's killed or dismissed)

 

I've seen movies on youtube where the guy had a tame dog and the dog even drove around with him in the car etc.

Would absolutely love somthing like that!

Link to comment
Share on other sites

Is the spawned dog also buggy as when you tame a dog the normal way?

Gone after restart, run around like a chicken without a head etc etc.

 

Also is the dog gone again when i logout?

Can i make the dog permanent (until it's killed or dismissed)

 

I've seen movies on youtube where the guy had a tame dog and the dog even drove around with him in the car etc.

Would absolutely love somthing like that!

 

Yeah the dog is a bit buggy. This script is just like taming a standard dog in the game. Except you spawn the dog rather than having to find one and tame it manually.

The dog will be gone if you log out or get in a car ect just like normal.

It would be possible to create a script to allow the dog to travel with the player in the back of a pickup truck or something like that.

Link to comment
Share on other sites

  • 3 months later...
  • 2 weeks later...

i got an client RPT error when spwaning a dog:

Error in expression <dle"];
_handle = _this select 0;
while {_watchDog && alive _dog} do {
_watchDog >
  Error position: <_watchDog && alive _dog} do {
_watchDog >
  Error Undefined variable in expression: _watchdog
File z\addons\dayz_code\actions\dog\warn.sqf, line 15
Link to comment
Share on other sites

  • 4 months later...

Nice script! If anyone ever does have the free time, the dog would be awesome. Maybe a script to have him "Stay" and "Find animals within say 200 or 300 meters". Also, it would be awesome to have him bark when a player or zombie is within 100 meters like you said before.

 

I have tamed dogs before and by default it seems to be hit and miss whether or not the dog is there when you get out of a vehicle. Would be awesome to have a script to make sure you didn't lose him.

 

i wonder if there is a texture for a dog with a pack? Would be cool if he could carry a little bit of stuff.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...