The placeholder model path (dz\structures\wood\wooden_crate.p3d) does not exist, so boxes spawned invisible with no selection geometry - hence not visible and no action (nothing to look at/target). Server logic was fine (8 boxes, proximity msgs fired). YALootBoxes_Base now uses the vanilla SeaChest model (\DZ\gear\camping\sea_chest.p3d) plus a 10x10 Cargo grid so the crate renders, is targetable, and can hold loot. Verified model + texture paths exist locally. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
122 lines
No EOL
4 KiB
C++
122 lines
No EOL
4 KiB
C++
// ============================================================
|
|
// FILE: config.cpp
|
|
// Place at mod root: YALootBoxes/config.cpp
|
|
// ============================================================
|
|
|
|
class CfgPatches
|
|
{
|
|
class YALootBoxes
|
|
{
|
|
units[] = {};
|
|
weapons[] = {};
|
|
requiredVersion = 0.1;
|
|
requiredAddons[] = { "DZ_Data", "DZ_Scripts" };
|
|
};
|
|
};
|
|
|
|
class CfgMods
|
|
{
|
|
class YALootBoxes
|
|
{
|
|
dir = "YALootBoxes";
|
|
picture = "";
|
|
action = "";
|
|
hideName = 1;
|
|
hidePicture = 1;
|
|
name = "YALootBoxes";
|
|
credits = "";
|
|
author = "";
|
|
authorID = "0";
|
|
version = "1.0.0";
|
|
extra = 0;
|
|
type = "mod";
|
|
dependencies[] = { "Game", "World", "Mission" };
|
|
|
|
class defs
|
|
{
|
|
// 4_World code (PlayerBase, Container_Base, ActionContinuousBase,
|
|
// ActionData, etc.) must load ONLY into the World script module.
|
|
// Binding it to gameScriptModule too forces it to compile inside
|
|
// 3_Game - where those World types don't exist yet - which is what
|
|
// produced all the "Unknown type" errors and aborted the server.
|
|
class worldScriptModule
|
|
{
|
|
value = "";
|
|
files[] = { "YALootBoxes/scripts/4_World" };
|
|
};
|
|
// 5_Mission bootstrap: a modded MissionServer that self-starts the
|
|
// lootbox manager. Lives in the Mission module because that's the
|
|
// only module with a mission-lifecycle entry point (OnInit).
|
|
class missionScriptModule
|
|
{
|
|
value = "";
|
|
files[] = { "YALootBoxes/scripts/5_Mission" };
|
|
};
|
|
};
|
|
};
|
|
};
|
|
|
|
// ------------------------------------------------------------
|
|
// Lootbox entity classes.
|
|
//
|
|
// BINDING: DayZ binds a CfgVehicles class to a script class by
|
|
// NAME. The three crate classes below do NOT each need their own
|
|
// script class - instead they all inherit from a shared config
|
|
// class "YALootBoxes_Base" whose name matches the script class in
|
|
// YALootBoxes_Lootbox.c. The engine walks the config inheritance
|
|
// chain upward until it finds a matching script class, so every
|
|
// crate resolves to the YALootBoxes_Base script type. The old
|
|
// "simulationModule" line did NOT do this and has been removed.
|
|
//
|
|
// BASE CLASS / MODEL / CARGO: inherits vanilla "Container_Base" and
|
|
// reuses the vanilla SeaChest model + a matching 10x10 cargo grid, so
|
|
// the crate is visible, has selection geometry (needed for the player
|
|
// to look at it and get the action), and can actually hold loot via
|
|
// CreateInInventory. Swap 'model' and the cargo size for your own p3d
|
|
// if you have one. (The earlier "wooden_crate.p3d" path did not exist,
|
|
// so boxes spawned invisible with no geometry -> no action.)
|
|
// ------------------------------------------------------------
|
|
class CfgVehicles
|
|
{
|
|
class Container_Base;
|
|
|
|
// Shared, non-spawnable base. Name MUST match the script class
|
|
// "YALootBoxes_Base" in YALootBoxes_Lootbox.c for binding.
|
|
class YALootBoxes_Base : Container_Base
|
|
{
|
|
scope = 0;
|
|
vehicleClass = "Containers";
|
|
model = "\DZ\gear\camping\sea_chest.p3d";
|
|
weight = 10000;
|
|
itemSize[] = {10, 10};
|
|
itemBehaviour = 0;
|
|
carveNavmesh = 1;
|
|
hiddenSelections[] = { "camoGround" };
|
|
hiddenSelectionsTextures[] = { "\dz\gear\camping\data\sea_chest_co.paa" };
|
|
|
|
class Cargo
|
|
{
|
|
itemsCargoSize[] = {10, 10};
|
|
openable = 0;
|
|
allowOwnedCargoManipulation = 1;
|
|
};
|
|
};
|
|
|
|
class YALootBoxes_Crate_Military : YALootBoxes_Base
|
|
{
|
|
scope = 2;
|
|
displayName = "Military Crate (Locked)";
|
|
};
|
|
|
|
class YALootBoxes_Crate_Medical : YALootBoxes_Base
|
|
{
|
|
scope = 2;
|
|
displayName = "Medical Crate (Locked)";
|
|
};
|
|
|
|
class YALootBoxes_Crate_Industrial : YALootBoxes_Base
|
|
{
|
|
scope = 2;
|
|
displayName = "Industrial Crate (Locked)";
|
|
};
|
|
}; |