dayz mission addin (serverside scripts)

DayZCC_V5.9.4.1 Dayz 1.8.0.3 beta patch 103718
Scripts: selfbloodbag,carradio,bridge,spawn uid, newspawn, safe zone uid
now i have add this addin script with dogs and anomalies and my server
works but have some problems
After restart and relog-
>Inevtart items x2 vehicles x2 cars spawns in cars
>heli, buildings-2 door insisde door
 
Last edited:
DayZCC_V5.9.4.1 Dayz 1.8.0.3 beta patch 103718
Scripts: selfbloodbag,carradio,bridge,spawn uid, newspawn, safe zone uid
now i have add this addin script with dogs and anomalies and my server
works but have some problems
After restart and relog-
>Inevtart items x2 vehicles x2 cars spawns in cars
>heli, buildings-2 door insisde door
that sounds very odd. Start form your default PBO and add each one in. Do this one mod at a time until you replicate the double objects issue. Then that will at least reveal what is causing the issue. When you find this out then we can fix the issue.
 
Ya it never is :/ btw here are those dog files you wanted.


//filter useless publicBroadcast
if (_action == player getVariable "dogAction") exitWith {_nul = [objNull, player, rSAY, "whistleNon"] call RE;};

if (_action == "follow") then
{
player setVariable ["dogAction",_action,true];
_nul = [objNull, player, rSAY, "whistleFollow"] call RE;
};
if (_action == "stay") then
{
player setVariable ["dogAction",_action,true];
_nul = [objNull, player, rSAY, "whistleStay"] call RE;
};
if (_action == "find") then
{
player setVariable ["dogAction",_action,true];
_nul = [objNull, player, rSAY, "whistleFind"] call RE;
};[/CODE]

in your init.sqf add this:
Code:
[] execVM "addin\dog.sqf";

right after if (!isDedicated) then {

and this:
Code:
_null = [] execVM "addin\plrInit.sqf";

after _playerMonitor = blah blah blah


then enjoy your permanent dogs :)
we only used the German Shepard model btw.
Just a quick question
Do I do this on top of the usual installation?
And do the dogs still spawn at doghouses after this?
 
Last edited:
Actually it has been so long since i used this version i couldnt tell you lol. I now run them a bit differently:

I run this script on a headless client now too, seems to still be very sluggish and "stupid" behavior, scripts just need some tweaking:

In the init.sqf add this and make sure it is executed GLOBALLY, i.e. not isServer or !isDedicated,
Code:
[] execVM "addin\dogInit.sqf";

Now this is the dogInit.sqf:
Code:
//private ["_dogHouse","_mapCenter"];

if (!hasInterface) then {
    _mapCenter = getArray (configFile >> "CfgWorlds" >> worldName >> "centerPosition");
    _dogHouses = nearestObjects [_mapCenter, ["Land_psi_bouda"], 10000];

    _dogHouseNumber = 0;
    _num = count _dogHouses;
    for "_i" from 0 to _num - 1 do {
        _dogHouse = _dogHouses select _dogHouseNumber;
        _dogHousePos = getPos _dogHouse;
     
        _rndMarker = format ["_rndMarker_%1", _i];
        _dummyMarker = createMarker [_rndMarker, _dogHousePos];
        _dummyMarker setMarkerAlpha 0;
        _dummyMarker setMarkerColor "ColorRed";
        _dummyMarker setMarkerShape "ELLIPSE";
        _dummyMarker setMarkerBrush "Grid";
        _dummyMarker setMarkerSize [3,3];
     
        _rndTrigger = format ["_randTrigger_%1", _i];
        _rndTrigger = createTrigger["EmptyDetector", getMarkerPos _rndMarker];
        _rndTrigger setTriggerArea[2,2,0,false];
        _rndTrigger setTriggerActivation["West","Present",true];
        _rndTrigger setTriggerStatements["isPlayer (thisList select 0)","nul = [(thisList select 0)] execVM 'addin\dog.sqf'",""];

        _dogHouseNumber = _dogHouseNumber + 1;
        sleep 0.1;     
    };
};
This searches for all existing dog houses on the map and creates the trigger.

This is my custom version that uses humanity to determine which player gets which type of dog. Bandits get a mastiff and all other players get a Shepard,
replace if (!hasInterface) exitWith {
with if (isServer) exitWith {
same with any !hasInterface. There is one in the doginit.sqf also

Code:
//===================piXel 12-02-2013============
if (!hasInterface) exitWith {
//waitUntil {initialized};

private ["_dogHumnty","_leader","_dog","_breed","_grp","_dogname","_clientID","_humans","_distance","_foo","_commd","_animals","_targetAnimal","_stopWait","_veh"];
_leader = _this select 0;
_clientID = owner _leader;

if (count dogOwner >= 10) exitWith {[nil, _leader, "loc", rTITLETEXT, "Sorry, all available dogs found a companion", "PLAIN DOWN"] call RE;};
if ({_X == _leader} count dogOwner == 1) exitWith {[nil, _leader, "loc", rTITLETEXT, "This dog is not interested", "PLAIN DOWN"] call RE;};

_dogHumnty = _leader getVariable ["humanity",0];
if (_dogHumnty >= 0) then {
_breed = "Pastor";
} else {
_breed = "Fin";
};

_grp = creategroup (side _leader);
_dogname = "K9";
call compile format ['"%2" createUnit [getposATL _leader, _grp,"%1=this; this setSpeedMode ""full""; this disableAI ""autotarget""; this setbehaviour ""aware"";",1]',_dogname,_breed];
_dog = call compile format ["%1",_dogname];
_dog setIdentity "dogs";
_nul = [objNull, _dog, rSAY, "bark"] call RE;
dogOwner = dogOwner + [_leader];

sleep 1;
_clientID publicVariableClient "dogOwner";

while {(alive _dog) && (alive _leader)} do
{
waitUntil {(alive _dog) && (alive _leader)};
_humans = [];
_distance = 1000;
_humans = nearestObjects [_leader , ["CAManBase"], 40] - [_leader,_dog];
_foo = _humans select 0;
_commd = _leader getVariable "dogAction";

//debug menu
//_txt = parseText format["debugDog: %1 %2",_leader,_commd];
//[nil, _leader, "loc", rHINT, _txt, "PLAIN DOWN"] call RE;

if (_commd == "stay") then
{
_dog switchmove "Dog_Sit1";
_dog disableAI "move";
sleep 4;
};
if (_commd == "find") then
{
_dog enableAI "move";
_dog switchmove "";
_animals = nearestObjects [_dog, ["Hen","Cock","Cow04","Cow03","Cow02","Cow01","Goat","Sheep","WildBoar"],3000];
if (count _animals != 0) then
{
_targetAnimal = _animals select 0;
_stopWait = (time + 60);
_dog domove (position _targetAnimal);
_dog setspeedmode "FULL";
waituntil {_dog domove (position _targetAnimal); sleep 2;  (_dog distance _targetAnimal < 20) || (time > _stopWait) || (_leader getVariable "dogAction" != "find")};
_dog switchmove "Dog_Walk";
_nul = [objNull, _dog, rSAY, "bark"] call RE;
};
_dog switchmove "Dog_Walk";
sleep 4;
};
if (_commd == "follow") then
{
_dog enableAI "move";
_dog switchmove "";
//foo
if ((count _humans > 0) && (alive _foo)) then
{
_distance = _leader distance _foo;
// warning
/*
If ((_distance > 10) && (_distance < 30)) 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) && (side _foo != side _leader)) then
{
_nul = [objNull, _dog, rSAY, "growl"] call RE;
_dog domove (position _foo);
_dog setspeedmode "FULL";
};
//attack
If ((_distance < 10) && (side _foo != side _leader)) 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 isKindOf "zZombie_Base")) then
{
_dog attachTo [_foo,[0,0.8,0],"hrudnik"];
_dog setDir 180;
_foo setdamage 0.3;
sleep 1;
};
if ((alive _dog) && (_foo isKindOf "zZombie_Base")) then
{
_foo setdamage 0.3;
sleep 1;
};
if ((alive _dog) && (_foo isKindOf "zZombie_Base")) then
{
_dog setDir 160;
_foo setdamage 0.6;
sleep 1;
};
if ((alive _dog) && (_foo isKindOf "zZombie_Base")) then
{
_dog setDir 180;
_foo setdamage 0.8;
sleep 1;
};
if ((alive _dog) && (_foo isKindOf "zZombie_Base")) then
{
_dog setDir 200;
_foo setdamage 1;
};
detach _dog;
_dog domove (position _leader);
_dog setspeedmode "FULL";
};
};
//getin
if ((vehicle _leader != _leader) && ((vehicle _leader isKindOf "car") || (vehicle _leader isKindOf "air"))) then
{
_veh = vehicle _leader;
_dog domove position _veh;
_dog setspeedmode "FULL";
_stopWait = (time + 10);
waituntil {_dog domove position _veh; sleep 1; (_dog distance _veh < 5) || time > _stopWait};
_dog attachto [_veh,[0,-0.5,-1],"podlaha"];
//getout
waitUntil{sleep 2;((vehicle _leader == _leader) || (!alive _dog) || (!alive _leader))};
sleep 1;
detach _dog;
_dog setPos (getposATL _leader);
_veh = objNull;
};
//tofar
if ((_leader distance _dog) > 1200) then
{
_dog  setDamage 1;
};
//toClose
if ((_leader distance _dog) < 5) then
{
_dog switchmove "Dog_Siting";
}
else
{
_dog switchmove ""; //Dog_Sprint
_dog domove position _leader;
_dog setspeedmode "full";
};
_foo = objNull;
sleep 3;
};
};
_dog  setDamage 1;
sleep 15;
hideBody _dog;
sleep 5;
deleteVehicle _dog;
_grp = grpNull;
_stopWait = (time + 120);
waitUntil {time >= _stopWait};
dogOwner = dogOwner - [_leader];
sleep 1;
_clientID publicVariableClient "dogOwner";
};
 
Actually it has been so long since i used this version i couldnt tell you lol. I now run them a bit differently:

I run this script on a headless client now too, seems to still be very sluggish and "stupid" behavior, scripts just need some tweaking:

In the init.sqf add this and make sure it is executed GLOBALLY, i.e. not isServer or !isDedicated,
Code:
[] execVM "addin\dogInit.sqf";

Now this is the dogInit.sqf:
Code:
//private ["_dogHouse","_mapCenter"];

if (!hasInterface) then {
    _mapCenter = getArray (configFile >> "CfgWorlds" >> worldName >> "centerPosition");
    _dogHouses = nearestObjects [_mapCenter, ["Land_psi_bouda"], 10000];

    _dogHouseNumber = 0;
    _num = count _dogHouses;
    for "_i" from 0 to _num - 1 do {
        _dogHouse = _dogHouses select _dogHouseNumber;
        _dogHousePos = getPos _dogHouse;
    
        _rndMarker = format ["_rndMarker_%1", _i];
        _dummyMarker = createMarker [_rndMarker, _dogHousePos];
        _dummyMarker setMarkerAlpha 0;
        _dummyMarker setMarkerColor "ColorRed";
        _dummyMarker setMarkerShape "ELLIPSE";
        _dummyMarker setMarkerBrush "Grid";
        _dummyMarker setMarkerSize [3,3];
    
        _rndTrigger = format ["_randTrigger_%1", _i];
        _rndTrigger = createTrigger["EmptyDetector", getMarkerPos _rndMarker];
        _rndTrigger setTriggerArea[2,2,0,false];
        _rndTrigger setTriggerActivation["West","Present",true];
        _rndTrigger setTriggerStatements["isPlayer (thisList select 0)","nul = [(thisList select 0)] execVM 'addin\dog.sqf'",""];

        _dogHouseNumber = _dogHouseNumber + 1;
        sleep 0.1;    
    };
};
This searches for all existing dog houses on the map and creates the trigger.

This is my custom version that uses humanity to determine which player gets which type of dog. Bandits get a mastiff and all other players get a Shepard,
replace if (!hasInterface) exitWith {
with if (isServer) exitWith {
same with any !hasInterface. There is one in the doginit.sqf also

Code:
//===================piXel 12-02-2013============
if (!hasInterface) exitWith {
//waitUntil {initialized};

private ["_dogHumnty","_leader","_dog","_breed","_grp","_dogname","_clientID","_humans","_distance","_foo","_commd","_animals","_targetAnimal","_stopWait","_veh"];
_leader = _this select 0;
_clientID = owner _leader;

if (count dogOwner >= 10) exitWith {[nil, _leader, "loc", rTITLETEXT, "Sorry, all available dogs found a companion", "PLAIN DOWN"] call RE;};
if ({_X == _leader} count dogOwner == 1) exitWith {[nil, _leader, "loc", rTITLETEXT, "This dog is not interested", "PLAIN DOWN"] call RE;};

_dogHumnty = _leader getVariable ["humanity",0];
if (_dogHumnty >= 0) then {
_breed = "Pastor";
} else {
_breed = "Fin";
};

_grp = creategroup (side _leader);
_dogname = "K9";
call compile format ['"%2" createUnit [getposATL _leader, _grp,"%1=this; this setSpeedMode ""full""; this disableAI ""autotarget""; this setbehaviour ""aware"";",1]',_dogname,_breed];
_dog = call compile format ["%1",_dogname];
_dog setIdentity "dogs";
_nul = [objNull, _dog, rSAY, "bark"] call RE;
dogOwner = dogOwner + [_leader];

sleep 1;
_clientID publicVariableClient "dogOwner";

while {(alive _dog) && (alive _leader)} do
{
waitUntil {(alive _dog) && (alive _leader)};
_humans = [];
_distance = 1000;
_humans = nearestObjects [_leader , ["CAManBase"], 40] - [_leader,_dog];
_foo = _humans select 0;
_commd = _leader getVariable "dogAction";

//debug menu
//_txt = parseText format["debugDog: %1 %2",_leader,_commd];
//[nil, _leader, "loc", rHINT, _txt, "PLAIN DOWN"] call RE;

if (_commd == "stay") then
{
_dog switchmove "Dog_Sit1";
_dog disableAI "move";
sleep 4;
};
if (_commd == "find") then
{
_dog enableAI "move";
_dog switchmove "";
_animals = nearestObjects [_dog, ["Hen","Cock","Cow04","Cow03","Cow02","Cow01","Goat","Sheep","WildBoar"],3000];
if (count _animals != 0) then
{
_targetAnimal = _animals select 0;
_stopWait = (time + 60);
_dog domove (position _targetAnimal);
_dog setspeedmode "FULL";
waituntil {_dog domove (position _targetAnimal); sleep 2;  (_dog distance _targetAnimal < 20) || (time > _stopWait) || (_leader getVariable "dogAction" != "find")};
_dog switchmove "Dog_Walk";
_nul = [objNull, _dog, rSAY, "bark"] call RE;
};
_dog switchmove "Dog_Walk";
sleep 4;
};
if (_commd == "follow") then
{
_dog enableAI "move";
_dog switchmove "";
//foo
if ((count _humans > 0) && (alive _foo)) then
{
_distance = _leader distance _foo;
// warning
/*
If ((_distance > 10) && (_distance < 30)) 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) && (side _foo != side _leader)) then
{
_nul = [objNull, _dog, rSAY, "growl"] call RE;
_dog domove (position _foo);
_dog setspeedmode "FULL";
};
//attack
If ((_distance < 10) && (side _foo != side _leader)) 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 isKindOf "zZombie_Base")) then
{
_dog attachTo [_foo,[0,0.8,0],"hrudnik"];
_dog setDir 180;
_foo setdamage 0.3;
sleep 1;
};
if ((alive _dog) && (_foo isKindOf "zZombie_Base")) then
{
_foo setdamage 0.3;
sleep 1;
};
if ((alive _dog) && (_foo isKindOf "zZombie_Base")) then
{
_dog setDir 160;
_foo setdamage 0.6;
sleep 1;
};
if ((alive _dog) && (_foo isKindOf "zZombie_Base")) then
{
_dog setDir 180;
_foo setdamage 0.8;
sleep 1;
};
if ((alive _dog) && (_foo isKindOf "zZombie_Base")) then
{
_dog setDir 200;
_foo setdamage 1;
};
detach _dog;
_dog domove (position _leader);
_dog setspeedmode "FULL";
};
};
//getin
if ((vehicle _leader != _leader) && ((vehicle _leader isKindOf "car") || (vehicle _leader isKindOf "air"))) then
{
_veh = vehicle _leader;
_dog domove position _veh;
_dog setspeedmode "FULL";
_stopWait = (time + 10);
waituntil {_dog domove position _veh; sleep 1; (_dog distance _veh < 5) || time > _stopWait};
_dog attachto [_veh,[0,-0.5,-1],"podlaha"];
//getout
waitUntil{sleep 2;((vehicle _leader == _leader) || (!alive _dog) || (!alive _leader))};
sleep 1;
detach _dog;
_dog setPos (getposATL _leader);
_veh = objNull;
};
//tofar
if ((_leader distance _dog) > 1200) then
{
_dog  setDamage 1;
};
//toClose
if ((_leader distance _dog) < 5) then
{
_dog switchmove "Dog_Siting";
}
else
{
_dog switchmove ""; //Dog_Sprint
_dog domove position _leader;
_dog setspeedmode "full";
};
_foo = objNull;
sleep 3;
};
};
_dog  setDamage 1;
sleep 15;
hideBody _dog;
sleep 5;
deleteVehicle _dog;
_grp = grpNull;
_stopWait = (time + 120);
waitUntil {time >= _stopWait};
dogOwner = dogOwner - [_leader];
sleep 1;
_clientID publicVariableClient "dogOwner";
};
So just to recap, with your edits to this script dogs will spawn at any doghouse on the map. And then stay with you after loging???
And all players that arnt bandits get Shepards while bandits get mastiff?
Cause thats soo cool! you should post your own thread on how to just add these dogs without the portals etc that this thread has.
 
hmmm when i go up to any dog house about 5 dogs spawn on me.. haha they work for about 5 min then the randomly disappear. Any idea what might be causing this?
 
these dogs do not persist through logging out and restarts. I have been implementing a secondary database to save variables to allow for this to happen though. They are disappearing due to your server cleanup script. Open your sched_corpses.sqf in the server pbo in the scheduler folder and look for this:

Code:
_delQtyAnimal = 0;
    {
        if (local _x ) then {
            _x call sched_co_deleteVehicle;
            _delQtyAnimal = _delQtyAnimal + 1;
        };
    } forEach entities "CAAnimalBase";
Then replace it with this:

Code:
_delQtyAnimal = 0;
    {
        if (local _x && !((typeOf _x) in ["Pastor","Fin"])) then {
            _x call sched_co_deleteVehicle;
            _delQtyAnimal = _delQtyAnimal + 1;
        };
    } forEach entities "CAAnimalBase";
 
these dogs do not persist through logging out and restarts. I have been implementing a secondary database to save variables to allow for this to happen though. They are disappearing due to your server cleanup script. Open your sched_corpses.sqf in the server pbo in the scheduler folder and look for this:

Code:
_delQtyAnimal = 0;
    {
        if (local _x ) then {
            _x call sched_co_deleteVehicle;
            _delQtyAnimal = _delQtyAnimal + 1;
        };
    } forEach entities "CAAnimalBase";
Then replace it with this:

Code:
_delQtyAnimal = 0;
    {
        if (local _x && !((typeOf _x) in ["Pastor","Fin"])) then {
            _x call sched_co_deleteVehicle;
            _delQtyAnimal = _delQtyAnimal + 1;
        };
    } forEach entities "CAAnimalBase";


Thanks fore helping us out with this...I always thought this was a "never gonna happen" thing. But alas, I'm currently in-game standing with my dog after it hunted down a cow. Thanks dude!.

couple things...

This is with DayzMod 1.8.6.1 Vanilla.

the dogs kept disappearing even after the above modification. I had to comment out the entire section in order to keep the dog from disappearing. I've had mine for about an hour now after commenting out that section entirely.

I'll try again just to make sure though...
 
Last edited:
Got a version of PiXels cool dogs working client side. But, have not yet been able to get rid of the serious error where when the player model changes due to humanity morph or changing clothes.

I have removed object references between player and dog even, and making sure I deleteVehicle the dog first before the player object gets deleted and the player gets a new player object. I believe I have even just hide the body and not delete the dog and it still happens. Its something I think with a reference from the dog to player, or maybe vice versa that I am not seeing, and since I have a work-around for now (my code catches when model changes and has player logout and login again and whistle for dog), as well as spending hours on other aspects of my mod, I dont feel motivated to dig deeper atm.
Has anyone fixed this?
 
Last edited:
Got a version of PiXels cool dogs working client side. But, have not yet been able to get rid of the serious error where when the player model changes due to humanity morph or changing clothes.

I have removed object references between player and dog even, and making sure I deleteVehicle the dog first before the player object gets deleted and the player gets a new player object. I believe I have even just hide the body and not delete the dog and it still happens. Its something I think with a reference from the dog to player, or maybe vice versa that I am not seeing, and since I have a work-around for now (my code catches when model changes and has player logout and login again and whistle for dog), as well as spending hours on other aspects of my mod, I dont feel motivated to dig deeper atm.
Has anyone fixed this?

What exactly happens when you change clothes and have a dog? I haven't used PiXels dogs in years.
 
Vehicle not found error, player cant get back into the server. all scripts client side stop working. some people have reported that the server may need to be restarted as well., since the original dog code ran server side.
 
Vehicle not found error, player cant get back into the server. all scripts client side stop working. some people have reported that the server may need to be restarted as well., since the original dog code ran server side.

Think i noticed that you said you delete the dog and relog the player to make the dog work again?
 
yeah, Im using DayZ 1.7.6.1 codebase. I basically catch when there is a switch of model, like with humanity morph or with changing clothes, and get rid of the dog and let the player know that they will need to log out and back in to get the dog back. When changing clothes, I tell them to changes the clothes first. :)
Its long winded but good enough. Its based on requiring an inventory item by the player, that is given to them when the dog is tamed, then taken away when the dog actually dies. I implemented this workaround when I didnt have as much experience working with arma modding. Was reading about deleteVehicle on the BIS community wiki, and that said that scripts referencing a handle to an object that has deleted can cause serious problems, which somehow is happening here I believe with the player object being deleted. Ah, when/if I get the time and motivation in the future will take another look at it.

Ideally I think dogs should be implemented as deployables, in the DB, but do deployables get removed when they have damage =1? havent tested

when I get some time, I can post my workaround, if there is any interest. I think it would worth waiting to find out if any fixed it properly first.
 
yeah, Im using DayZ 1.7.6.1 codebase. I basically catch when there is a switch of model, like with humanity morph or with changing clothes, and get rid of the dog and let the player know that they will need to log out and back in to get the dog back. When changing clothes, I tell them to changes the clothes first. :)
Its long winded but good enough. Its based on requiring an inventory item by the player, that is given to them when the dog is tamed, then taken away when the dog actually dies. I implemented this workaround when I didnt have as much experience working with arma modding. Was reading about deleteVehicle on the BIS community wiki, and that said that scripts referencing a handle to an object that has deleted can cause serious problems, which somehow is happening here I believe with the player object being deleted. Ah, when/if I get the time and motivation in the future will take another look at it.

Ideally I think dogs should be implemented as deployables, in the DB, but do deployables get removed when they have damage =1? havent tested

when I get some time, I can post my workaround, if there is any interest. I think it would worth waiting to find out if any fixed it properly first.

profileNamespace and setVariable might be a good idea to make it work as well as a client sided humanitymorph. Use profileNamespace to house something like dog alive or not. setVariable could be used to tag a dog with like a player id. In humanitymorph you could use the combination of profileNamespace and setvariable to determine if nearestobject is needed and if so to determine if there is a dog with player id attached to it nearby the player to delete the vehicle then just whistle back the dog at the end of the humanity morph?

No idea if it'd all work but seems like a probable way of getting around the issue. Also the profileNamespace could be a way to keep dogs persistent through restarts as well other then having to have an item.
 
Thanks for the information, not heard of profilenamespace before. That may help. will let you know when I get time to try it out.
 
Here is an example of something that I use profileNamespace for...

init.sqf
Code:
_anonstat = profileNamespace getVariable "Anon";
    if (isnil "_anonstat") then {
        player setVariable ["Anon",false,true];
        profileNamespace setVariable ["Anon",false];
        saveProfileNamespace;
    } else {
        if (_anonstat) then {
            player setVariable ["Anon",true,true];
        } else {
            player setVariable ["Anon",false,true];
        };
    };

command menu
Code:
["Toggle Anonymous", [8],  "", -5, [["expression","_anonstat = profileNamespace getVariable 'Anon';if (isnil '_anonstat') then {player setVariable ['Anon',false,true];};if (player getvariable 'Anon') then { profileNamespace setVariable ['Anon',false];player setVariable ['Anon',false,true]; systemchat 'Your name will show up in kill messages now...';} else { profileNamespace setVariable ['Anon',true]; player setVariable ['Anon',true,true]; systemchat 'You will now be anonymous in kill messages.';};saveProfileNamespace;"]], "1", "1"],

Then server side where I have my kill messages I check if the player has getVariable 'Anon' true or false to either display their name or not. The profileNamespace variable persists through logging and restarts so the players settings persists so that they do not have to keep choosing the same thing.

With profileNamespace it can only be checked on the client, but I think it could be a good idea along with setVariable to get the dogs working.
 
thanks. going over the dog code again. I am only setting some simple variables on the player and on the dog like characterid. odd.
Do profilenamespace variables get obsfucated so that players cannot tinker with the values in their profile?
 
thanks. going over the dog code again. I am only setting some simple variables on the player and on the dog like characterid. odd.
Do profilenamespace variables get obsfucated so that players cannot tinker with the values in their profile?

I think the file gets saved in a way that you cannot edit it, but you could go into the editor and write a script to change it yourself. Also changing your ingame name will wipe the value and you're also able to delete the file to start with a clean one. But most likely no one will know.
 
Back
Top