Fix tame_dog errors

Tame_dog_old and player_tameDog are not used.
This commit is contained in:
ebaydayz
2016-04-18 21:49:27 -04:00
parent 464c26861c
commit 4d5dc060d2
8 changed files with 29 additions and 104 deletions

View File

@@ -559,13 +559,11 @@ class CfgSurvival {
{
sex = "male";
playerModel = "Graves_Light_DZ";
};
};
class Skin_Drake_Light_DZ: Default {
sex = "male";
playerModel = "Drake_Light_DZ";
};
};
class Skin_CZ_Special_Forces_GL_DES_EP1_DZ: Default {
sex = "male";
playerModel = "CZ_Special_Forces_GL_DES_EP1_DZ";
@@ -574,8 +572,7 @@ class CfgSurvival {
class Skin_TK_INS_Soldier_EP1_DZ: Default {
sex = "male";
playerModel = "TK_INS_Soldier_EP1_DZ";
};
};
class Skin_TK_INS_Warlord_EP1_DZ: Default {
sex = "male";
playerModel = "TK_INS_Warlord_EP1_DZ";

View File

@@ -1,31 +0,0 @@
private ["_target","_id","_pos","_dog","_fsmid","_hasMeat","_hasdog","_meat"];
_target = _this select 0;
//_caller = _this select 1;
_id = _this select 2;
//_params = _this select 3;
_pos = [_target] call FNC_GetPos;
_hasMeat = false;
{
if (_x in Dayz_meatraw) exitWith {
_hasMeat = true;
_meat = _x;
};
} count (magazines player);
_hasdog = player getVariable ["dogid", "false"];
if (_hasMeat && (_hasdog == "false")) then {
player removeMagazine _meat;
deleteVehicle (_this select 0);
_dog = (group player) createUnit [typeOf _target, _pos, [], 0, "FORM"];
_dog disableAI "FSM";
_fsmid = [_dog, typeOf _target] execFSM "\z\addons\dayz_code\system\dog_agent.fsm";
_fsmid setFSMVariable ["_handle", _fsmid];
_target removeAction _id;
player setVariable ["dogid", _fsmid];
} else {
localize "str_epoch_player_18" call dayz_rollingMessages;
};
//handle publicVariables here later.

View File

@@ -12,39 +12,28 @@
_dog = Intended target of the script.
*/
private ["_target","_caller","_id","_dog","_fsmid","_removed","_selected","_animalID","_textRemoved","_chanceToFail","_itemIn","_countIn"];
_target = _this select 0;
_caller = _this select 1;
_id = _this select 2;
private ["_target","_caller","_id","_dog","_fsmid","_textRemoved","_chanceToFail","_meat","_hasMeat"];
//_target = _this select 0;
//_caller = _this select 1;
//_id = _this select 2;
_dog = _this select 3;
_removed = 0;
_itemIn = "FoodRaw";
_countIn = 1;
_selected = "";
{
if( (_removed < _countIn) && ((_x == _itemIn) || configName(inheritsFrom(configFile >> "cfgMagazines" >> _x)) == _itemIn)) then {
_removed = _removed + ([player,_x] call BIS_fnc_invRemove);
_hasMeat = false;
{
if (_x in Dayz_meatraw) exitWith {
_hasMeat = true;
_meat = _x;
};
if(_removed == 1) exitWith { _selected = _x; };
} count magazines player;
} count (magazines player);
// Only proceed if removed count matches
if(_removed == _countIn) then {
if (_hasMeat) then {
player removeMagazine _meat;
_textRemoved = getText(configFile >> "CfgMagazines" >> _meat >> "displayName");
// get name of item removed
_textRemoved = getText(configFile >> "CfgMagazines" >> _selected >> "displayName");
// add failure rate based on skill level variable (days alive)
_chanceToFail = (((random 1) + (dayz_Survived/100)) > 0.5);
if(!_chanceToFail) then {
_animalID = _dog getVariable "fsm_handle";
_animalID setFSMVariable ["_isTamed", true];
uiSleep 1;
//diag_log format["DEBUG: %1, id: %2 [%3]",_dog,_animalID,completedFSM _animalID];
_chanceToFail = (((random 1) + (dayz_Survived/100)) > 0.5);
if (!_chanceToFail) then {
if (!moveToCompleted _dog) then {
_dog moveTo ([_dog] call FNC_GetPos);
};
@@ -52,8 +41,8 @@ if(_removed == _countIn) then {
(group _dog) setBehaviour "AWARE";
_fsmid = [_dog, typeOf _dog] execFSM "\z\addons\dayz_code\system\dog_agent.fsm";
_fsmid setFSMVariable ["_handle", _fsmid];
_fsmid setFSMVariable ["_isTamed", true];
player setVariable ["dogID", _fsmid];
_dog setVariable ["fsm_handle", _fsmid];
_dog setVariable ["CharacterID", dayz_characterID, true];
format[localize "str_epoch_player_173",_textRemoved] call dayz_rollingMessages;

View File

@@ -1,36 +0,0 @@
/*
File: tame_dog.sqf
Author: Kane "Alby" Stone
Description:
Allows a player to tame/domesticate a dog.
Script is applied to object via addAction.
Variables:
_target = Object that action is attached too.
_caller = Object that activates the action.
_id = ID of the action handler.
_dog = Intended target of the script.
*/
private ["_target","_caller","_id","_dog","_fsmid","_animalID"];
_target = _this select 0;
_caller = _this select 1;
_id = _this select 2;
_dog = _this select 3;
player removeMagazine "FoodBeefRaw";
_animalID = _dog getVariable "fsm_handle";
_animalID setFSMVariable ["_isTamed", true];
uiSleep 1;
// diag_log format["DEBUG: %1, id: %2 [%3]",_dog,_animalID,completedFSM _animalID];
if (!moveToCompleted _dog) then {
_dog moveTo ([_dog] call FNC_GetPos);
};
_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];

View File

@@ -11,7 +11,9 @@ _handle setFSMVariable ["_watchDog",_watchDog];
_warn = {
private ["_watchDog","_dog","_nearby","_senseSkill","_handle"];
_handle = _this select 0;
_handle = _this select 0;
_watchDog = _this select 1;
_dog = _this select 2;
while {_watchDog && alive _dog} do {
_watchDog = _handle getFSMVariable "_watchDog";
_senseSkill = _handle getFSMVariable "_senseSkill";
@@ -28,7 +30,7 @@ _warn = {
if (_watchDog) then {
_handle setFSMVariable ["_idleTime",5];
[_handle] spawn _warn;
[_handle,_watchDog,_dog] spawn _warn;
} else {
_handle setFSMVariable ["_idleTime",1];
};

View File

@@ -936,6 +936,7 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur
if (dayz_tameDogs) then {
//Dog
_hasRawMeat = {_x in Dayz_meatraw} count _magazinesPlayer > 0;
if (_isDog && {_hasRawMeat} && {_isAlive} && {_ownerID == "0"} && {player getVariable ["dogID",0] == 0}) then {
if (s_player_tamedog < 0) then {
s_player_tamedog = player addAction [localize "str_actions_tamedog", "\z\addons\dayz_code\actions\dog\tame_dog.sqf", _cursorTarget, 1, false, true];
@@ -1109,6 +1110,8 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur
//Dog actions on player self
if (_dogHandle > 0) then {
_dog = _dogHandle getFSMVariable "_dog";
if (isNil "_dog") exitWith {};
_ownerID = if (!isNull _cursorTarget) then {_cursorTarget getVariable ["CharacterID","0"]} else {"0"};
if (_canDo && !_inVehicle && alive _dog && _ownerID != dayz_characterID) then {
if (s_player_movedog < 0) then {
s_player_movedog = player addAction [localize "str_actions_movedog", "\z\addons\dayz_code\actions\dog\move.sqf", player getVariable ["dogID",0], 1, false, true];

View File

@@ -10,7 +10,7 @@ dayz_waterBottleBreaking = false; // Water bottles have a chance to break when b
dayz_sellDistance_vehicle = 10; // Max distance players can sell land vehicles from at traders
dayz_sellDistance_boat = 30; // Max distance players can sell boats from at traders
dayz_sellDistance_air = 40; // Max distance players can sell air vehicles from at traders
dayz_tameDogs = true; // Allow taming dogs with raw meat
dayz_tameDogs = false; // Allow taming dogs with raw meat
dayz_townGenerator = false; // Spawn vanilla map junk in addition to Epoch DynamicDebris. Only works on Chernarus.
dayz_townGeneratorBlackList = [[4053,11668,0],[11463,11349,0],[6344,7806,0],[1606,7803,0],[12944,12766,0],[5075,9733,0],[12060,12638,0]]; // Town generator will not spawn junk within 150m of these positions.
DayZ_UseSteamID = true; // Use getPlayerUID instead of getPlayerUIDOld

View File

@@ -813,6 +813,7 @@ class FSM
" _handle setFSMVariable [""_hunger"",_hunger];" \n
" uiSleep 0.5;" \n
" };" \n
" player setVariable [""dogID"",0];" \n
"};" \n
"" \n
"_script = [_dog,1,2,[_handle,true]] execVM (_actionDir + ""warn.sqf"");"/*%FSM</STATEINIT""">*/;