I've been trying to code this for a few days now, and I'm getting a little confused as to why it's not working.
Here's the pertinent information from my dayz_equip.pbo (config.bin)
and
and
In essence what is happening is that I can loot both objects from the table just fine (both tents create just fine and are lootable objects). I can create the tent, as each calls a different script. The normal tent works as it should and drops... the larger 6 man tent does not do anything. The character goes through the motions of building a tent, and then after the 5 second delay, there's nothing there. The tent item in my inventory is gone, but the tent itself is not placed in the world.
Here is the code from my dometent_pitch.sqf
And yes - I did create a database object in the deployables table called "TentDomeStorage" with a type id set to 1000 (to make it easy to spot in the instance_deployable table).
Any ideas why it's not working?
Here's the pertinent information from my dayz_equip.pbo (config.bin)
Code:
class ItemTent: CA_Magazine
{
scope = 2;
count = 1;
type = "(256 * 3)";
displayName = "$STR_EQUIP_NAME_20";
model = "\dayz_equip\models\tentbag_gear.p3d";
picture = "\dayz_equip\textures\equip_tentbag_ca.paa";
descriptionShort = "$STR_EQUIP_DESC_20";
class ItemActions
{
class Pitch
{
text = "$STR_PITCH_TENT";
script = "spawn player_tentPitch;";
};
};
};
class ItemDomeTent: CA_Magazine
{
scope = 2;
count = 1;
type = "(256 * 3)";
displayName = "6 Man Dome Family Tent";
model = "\dayz_equip\models\tentbag_gearcamo.p3d";
picture = "\dayz_equip\textures\equip_tentbag_ca.paa";
descriptionShort = "6 Man Dome Family Tent";
class ItemActions
{
class Pitch
{
text = "$STR_PITCH_TENT";
script = "spawn player_dometentPitch;";
};
};
};
and
Code:
class WeaponHolder_ItemTent: WeaponHolderBase
{
scope = 2;
displayName = "$STR_EQUIP_NAME_20";
model = "\dayz_equip\proxy\tentbag.p3d";
class eventHandlers
{
init = "[(_this select 0),'cfgMagazines','ItemTent'] execVM '\z\addons\dayz_code\init\object_pickupAction.sqf';";
};
};
class WeaponHolder_ItemDomeTent: WeaponHolderBase
{
scope = 2;
displayName = "6 Man Dome Tent";
model = "\dayz_equip\proxy\tentbag.p3d";
class eventHandlers
{
init = "[(_this select 0),'cfgMagazines','ItemDomeTent'] execVM '\z\addons\dayz_code\init\object_pickupAction.sqf';";
};
};
and
Code:
class ACamp;
class Land_A_tent;
class TentStorage: Land_A_tent
{
vehicleClass = "Survival";
transportMaxMagazines = 100;
transportMaxWeapons = 10;
transportMaxBackpacks = 3;
};
class DomeTentStorage: ACamp
{
vehicleClass = "Survival";
transportMaxMagazines = 200;
transportMaxWeapons = 30;
transportMaxBackpacks = 10;
};
In essence what is happening is that I can loot both objects from the table just fine (both tents create just fine and are lootable objects). I can create the tent, as each calls a different script. The normal tent works as it should and drops... the larger 6 man tent does not do anything. The character goes through the motions of building a tent, and then after the 5 second delay, there's nothing there. The tent item in my inventory is gone, but the tent itself is not placed in the world.
Here is the code from my dometent_pitch.sqf
Code:
private["_position","_tent","_location","_isOk","_backpack","_tentType","_trg","_key"];
//check if can pitch here
call gear_ui_init;
_playerPos = getPosATL player;
_item = _this;
_hastentitem = _this in magazines player;
_location = player modeltoworld [0,2.5,0];
_location set [2,0];
_building = nearestObject [(vehicle player), "HouseBase"];
_isOk = [(vehicle player),_building] call fnc_isInsideBuilding;
//_isOk = true;
//diag_log ("Pitch Tent: " + str(_isok) );
_config = configFile >> "CfgMagazines" >> _item;
_text = getText (_config >> "displayName");
if (!_hastentitem) exitWith {cutText [format[(localize "str_player_31"),_text,"pitch"] , "PLAIN DOWN"]};
//blocked
if (["concrete",dayz_surfaceType] call fnc_inString) then { _isOk = true; diag_log ("surface concrete"); };
//Block Tents in pounds
_objectsPond = nearestObjects [_playerPos, [], 10];
{
_isPond = ["pond",str(_x),false] call fnc_inString;
if (_isPond) then {
_pondPos = (_x worldToModel _playerPos) select 2;
if (_pondPos < 0) then {
_isOk = true;
};
};
} forEach _objectsPond;
//diag_log ("Pitch Tent: " + str(_isok) );
if (!_isOk) then {
//remove tentbag
player removeMagazine _item;
_dir = round(direction player);
//wait a bit
player playActionNow "Medic";
sleep 1;
[player,"tentunpack",0,false] call dayz_zombieSpeak;
_id = [player,50,true,(getPosATL player)] spawn player_alertZombies;
sleep 5;
//place tent (local)
_tent = createVehicle ["TentDomeStorage", _location, [], 0, "CAN_COLLIDE"];
_tent setdir _dir;
_tent setpos _location;
player reveal _tent;
_location = getPosATL _tent;
_tent setVariable ["characterID",dayz_characterID,true];
//player setVariable ["tentUpdate",["Land_A_tent",_dir,_location,[dayz_tentWeapons,dayz_tentMagazines,dayz_tentBackpacks]],true];
dayzPublishObj = [dayz_characterID,_tent,[_dir,_location],"TentDomeStorage"];
publicVariable "dayzPublishObj";
if (isServer) then {
dayzPublishObj call server_publishObj;
};
cutText [localize "str_success_tent_pitch", "PLAIN DOWN"];
} else {
cutText [localize "str_fail_tent_pitch", "PLAIN DOWN"];
};
And yes - I did create a database object in the deployables table called "TentDomeStorage" with a type id set to 1000 (to make it easy to spot in the instance_deployable table).
Any ideas why it's not working?