Jump to content
  • 0

Starting with a Dog?


captgentry

Question

Hello all! I was looking for some help. What I would love to have is all my players spawn in with a dog, all ready to go. I've been looking around to see if anyone had a mod like that and found Pixel at opendayz.net http://opendayz.net/threads/dayz-mission-addin-serverside-scripts.7840/ has one but since Epoch has them added already I think I'd rather just have the players spawn in with a dog. As it stands now it seems, at least on my server, that no one ever uses a dog. This might be because the dogs run around so fast it's nearly impossible to get close enough to tame them. I really like the dogs and having a part of the game go completely unused like that drive me nuts.

 

Anyway, If anyone has an idea on how to simply add a dog to a player when they log in I'd love to use it.

 

Thanks in advance,

Gentry

Link to comment
Share on other sites

20 answers to this question

Recommended Posts

  • 0

BUMP... Any word on this from the admins? Axel? There is already a class system script out there.  It would be a simple matter to incorporate this into one, several, or all of the classes.  Can you guys at least point us in the right direction?

 

Please and thank you.

Link to comment
Share on other sites

  • 0

It's possible to do; I'm planning to include it in my release along with animal farming. If you're trying to spawn a dog, it doesn't come from the same classes as the rest of the animals (CAAnimalsBase) which are Arma 2 classes, it comes from DZ classes. (https://github.com/vbawol/DayZ-Epoch/blob/47edbfa8350a638a08786a97b7e4a0076d8913fd/SQF/dayz_code/Configs/cfgVehicles.hpp) There are two types of dog:

_typesOfDog = ["DZ_Fin","DZ_Pastor"]

Looking at DayZ code, animals are spawned thus: 

// This is spawned as an agent as dogs don't have sides. As per BIS function reference: Creates an (independent) agent (person) of the given type (type is a name of a subclass of CfgVehicles)
// For the DZ_Pastor dog type, create the agent with no special variables when spawning (i.e. behaviour), else for the Fin, use the "FORM".
if (_type == "DZ_Pastor") then { _agent = createAgent [_type, _Pos, [], 0, "NONE"]; } else { _agent = createAgent [_type, _Pos, [], 0, "FORM"]; };

// Sets the position of the dog to a given position
_agent setpos _Pos;

// The point of disabling the simulation is that once tame_dog is called, then the movement and other behaviour is re-activated. Stops the dog from running away. 
PVDZE_zed_Spawn = [_agent];

// You do not need to include this code below, I am just showing you the code trail so you can understand where each bit comes from.
// The code above is also to provide you an explanation of how to create dogs. 

// PVDZE_zed_Spawn in SQF/dayz_code/init/publicEH.sqf - second parameter (_this select 1) isthe dog from above. 
"PVDZE_zed_Spawn"		addPublicVariableEventHandler {(_this select 1) spawn server_handleZedSpawn};

//server_handleZedSpawn in SQF/dayz_server/init/server_functions.sqf
server_handleZedSpawn = {
private["_zed"];
_zed = _this select 0;
_zed enableSimulation false; // This disables the zombie from moving..
};

Then just use whatever method you want to find when the player has spawned, and use getpos/getposATL/getposASL to find the pos of the player, and set that location as where the dog is. If you want the dog to be tamed, then you have to call the taming functions (https://github.com/vbawol/DayZ-Epoch/blob/c911a7cdab7c540bb701f4f7ba906bc5453f4950/SQF/dayz_code/compile/tame_dog.sqf) so the dog is tamed and will do the limited actions it does:

_tameTehDoggy = compile preprocessFile "\z\addons\dayz_code\compile\tame_dog.sqf";
_theDoggyIsTamed = [_dog,_thePlayer,_anyNumberYouWantAsItIsntUsed,_dog] call _tameTehDoggy;

These are just a rough outline of where the code is within dayz/epoch. I've not tested them, but they should help you with inspiration. Always go to the code first! ^_^

Link to comment
Share on other sites

  • 0

Bump, Would love this, maybe a humanity based feature, I.E. Heroes spawn with a dog

 

I am planning to include this feature in Zambino FairServer. At the moment I'm working on ZFM (see the parent forum) but I will include this, and animal farming in a future release.

Link to comment
Share on other sites

  • 0

The dogs have had a little tweaking in the ne t release, one of the results is that taming is a little more time consuming. OP, Look at how we spawn them in and copy that, there is a setvariable on the player to decide the dogs owner..

Link to comment
Share on other sites

  • 0

when i spawn me a dog, i get client RPT error: 

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

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...