Grahame Posted March 19, 2018 Report Share Posted March 19, 2018 Another item added to EpochCore client-side in 1.1 is a Large Workbench - using the ARMA model for a steel work table with drawers and a vice. Here is the code for placing them and a suggestion (and code) for actually making use of them to provide greater flexibility in crafting for your players. Installation Instructions (1) Add the large workbench "kit" to your loot tables and trader price lists. The class name is KitWorkbenchLarge (2) Add the following to epoch_config/Configs/CfgItemInteractions.hpp: class KitWorkbenchLarge : Item_Build_base { buildClass = "WorkbenchLarge_SIM_EPOCH"; }; (3) Add the following to epoch_config/Configs/CfgBaseBuilding.hpp: class WorkbenchLarge_EPOCH : Default { removeParts[] = {{"KitWorkbenchLarge",1}}; GhostPreview = "WorkbenchLarge_Ghost_EPOCH"; staticClass = "WorkbenchLarge_EPOCH"; simulClass = "WorkbenchLarge_SIM_EPOCH"; }; class WorkbenchLarge_SIM_EPOCH : WorkbenchLarge_EPOCH { removeParts[] = {}; }; class WorkbenchLarge_Ghost_EPOCH : WorkbenchLarge_SIM_EPOCH {}; So, those minor changes will allow you to build a large workbench from a kit and then utilize it within Epoch's crafting system. All further changes will be made to epoch_config/Configs/CfgCrafting.hpp. Let's start our examination of that with the crafting of the large workbench itself. The crafting system in Epoch is really nice, quite simple (though it can look imposing at first glance) and very flexible. Basically it comprises parts and kits that are built from them and allows the specification of either things (water or fire) or objects to be nearby in order to build the kit. For the building of the large workbench you will need to add the following new entry: class KitWorkbenchLarge : Kit { recipe[] = {{"PartPlankPack",8},{"ItemCorrugatedLg",2},{"ItemPipe",2},{"ItemCorrugated",2},{"VehicleRepair",1}}; nearby[] = {{"Workbench","","workbench",{1,{"WorkBench_EPOCH","WorkbenchLarge_EPOCH"}},3,1,0,1}}; model = "\A3\Structures_F_Heli\Furniture\Workbench_01_F.p3d"; previewPosition[] = {0.8,1,0.27}; previewScale = 0.15; previewVector = 0; }; This entry illustrates nicely the configuration for a craftable item. Let's look at a few lines in it starting with the recipe[]. This specifies which items are needed to build the kit, in this case 8 lumber packs, 2 large salvage metal, two pipes, two small salvage metals and a vehicle repair parts (for the vice). In order to show the Large Workbench as a buildable from these individual items in the crafting menu you need to add the Large Workbench to their entries' usedin[] array, for example: Spoiler class PartPlankPack : Item { usedIn[] = {"KitStudWall","KitWoodFloor","KitWoodFoundation","KitWoodStairs","KitWoodRamp","KitWoodLadder","KitWoodTower","KitTiPi","KitWorkbench","KitSpikeTrap","KitMetalTrap","KitWoodQuarterFloor","KitWoodHalfFloor","KitBarGate","KitBagBunker","KitWatchTower","KitLightPole","KitScaffolding","KitWorkbenchLarge","KitStorageCrate"}; recipe[] = {{"WoodLog_EPOCH",2}}; previewPosition[] = {0.797837,1,0.288258}; previewScale = 0.2; previewVector = 1; craftTime = 2; }; class ItemCorrugatedLg : Item { usedIn[] = {"KitPlotPole","KitTankTrap","KitHesco3","KitSolarGen","ItemRotor","EngineBlock","KitMetalFloor","KitMetalHalfFloor","KitMetalQuarterFloor","KitMetalTower","KitFieldToilet","KitSink","KitPortableLight_Single","KitPortableLight_Double","KitBarbedWire","KitWorkbenchLarge"}; recipe[] = {{"ItemCorrugated",3}}; nearby[] = {{"Large Workbench","","workbench",{1,{"WorkbenchLarge_EPOCH"}},3,1,0,1}}; previewPosition[] = {0.797491,1,0.32899}; previewScale = 0.25; previewVector = 0.5; }; class ItemPipe : Part { usedIn[] = {"KitVehicleUpgradeIII_200_EPOCH","KitTentA","KitTentDome","KitScaffolding","KitSink","KitSunShade","KitWaterPump","KitSmallForestCamoNet","KitWell","KitWorkbenchLarge"}; previewPosition[] = {0.802374,1,0.26}; previewScale = 0.2; previewVector = 0.5; }; class ItemCorrugated : Item { usedIn[] = {"KitShelf","ItemCorrugatedLg","VehicleRepairLg","EngineParts","KitSink","KitFieldToilet","KitWaterPump","KitLightPole","KitWell","KitWorkbenchLarge"}; nearby[] = {{"Fire","","fire",{1,{"ALL"}},3,1,1,0}}; recipe[] = {{"ItemScraps",2}}; previewPosition[] = {0.791088,1,0.300004}; previewScale = 0.2; previewVector = 1; }; class VehicleRepair : Part { usedIn[] = {"VehicleRepairLg","EngineParts","SpareTire","KitVehicleUpgradeI_200_EPOCH","KitWorkbenchLarge"}; previewPosition[] = {0.787659,1,0.30098}; previewScale = 0.45; previewVector = 1.5; }; Okay, at this point you can click on any of these parts and a Large Workbench will be shown as a possible recipe for the part. Now let's look at the nearby[] array in the Large Workbench's crafting definition. This specifies things that are needed nearby in order to complete the crafting, in this case: nearby[] = {{"Workbench","","workbench",{1,{"WorkBench_EPOCH","WorkbenchLarge_EPOCH"}},3,1,0,1}}; Now, reading the very handy comment at the head of CfgCrafting.hpp shows what each part of this line means: USAGE: nearby[] = { { "Fire", //Name of field, anything "", //image folder path (ie "\x\addons\a3_epoch_code\Data\UI\crafting\"), empty for Epoch default "fire", //image prefix, suffix will be added by code. 2 possible suffixes: [_true.paa, _false.paa] {1,{"ALL"}}, //ARRAY of p3D {0,{"filename.p3d","filename.p3d"}} or ARRAY of logic classes {1,{"AIR","LAND","className"}} or 2 WorldInteractions check {2,{"water"}} Integer to switch array mode 3, //distance to check in meters 1, //count 1, //BOOL: object has to be on fire 0 //BOOL: object has to be alive (not destroyed) }; }; So you can see in the nearby[] array for Large Workbenches that it needs either a standard Epoch workbench or a large workbench itself within 3m of the player in order to build one. You can have as many requirements as you want in that list including categories defined in epoch_config/Configs/CfgEpochClient/WorldInteractions.hpp like "Water" or "Tree" or ... "bankTerminal" Now you can craft a Large Workbench and then build it, you can now use the fact you have one to make crafting just a little more immersive by, for example, only allowing small things to be crafted with a standard Epoch workbench and requiring a large workbench for more complicated or larger buildables. For example, let's say we leave buckets of mortar as being able to be crafted on a small one. You probably also want to allow your to craft them on a large one as well so you would have both items in the nearby[] array for them: class MortarBucket : Item { usedIn[] = {"KitFoundation","KitCinderWall","KitHesco3","KitCinderFloor","KitCinderHalfFloor","KitCinderQuarterFloor","KitCinderTower","KitSandbagWall","KitSandbagWallLong","KitBagBunker","KitWaterPump","KitWell"}; nearby[] = {{"Fire","","fire",{1,{"ALL"}},3,1,1,0},{"Workbench","","workbench",{1,{"WorkBench_EPOCH","WorkbenchLarge_EPOCH"}},3,1,0,1}}; recipe[] = {{"ItemRock",12},{"water_epoch",2}}; previewPosition[] = {0.799442,1,0.426761}; previewScale = 0.6; previewVector = 0; }; Now this is an interesting item (the reason I picked it...) because it demonstrates making a craftable dependent on multiple things nearby, in this case a burning fire and either a small or large workbench... cool huh? For the wooden buildables I like to allow a small workbench so each of their definitions would have both the large and small workbench in the nearby[] array like this: class KitStudWall : Kit { recipe[] = {{"PartPlankPack",4}}; model = "\x\addons\a3_epoch_assets\models\Wooden_Wall_SIM.p3d"; nearby[] = {{"Workbench","","workbench",{1,{"WorkBench_EPOCH","WorkbenchLarge_EPOCH"}},3,1,0,1}}; previewPosition[] = {0.797675,1,0.398882}; previewScale = 0.07; previewVector = 0; }; But for cinder buildables I think you need a more flexible work environment, thus the small workbench is removed from their nearby[] arrays, for example: class KitCinderFloor : Kit { usedIn[] = {"KitCinderTower"}; recipe[] = {{"CinderBlocks",4},{"MortarBucket",4}}; nearby[] = {{"Large Workbench","","workbench",{1,{"WorkbenchLarge_EPOCH"}},3,1,0,1}}; model = "\x\addons\a3_epoch_community\models\cinderfloor.p3d"; previewPosition[] = {0.800198,1,0.262418}; previewScale = 0.055; previewVector = 3.6; }; That's pretty much it. Now you can build a large workbench, craft one and make other items dependent on it - or indeed any other object in the game. As a final example here's a modified entry for an energy pack that relies on you having a power source within 30m, and a fire and a large workbench within 3m: class EnergyPack : Item { usedIn[] = {"EnergyPackLg"}; nearby[] = {{"Fire","","fire",{1,{"ALL"}},3,1,1,0},{"Large Workbench","","workbench",{1,{"WorkbenchLarge_EPOCH"}},3,1,0,1},{"Power Source","","electricity",{1,{"Land_spp_Tower_F","Land_wpp_Turbine_V2_F","Land_wpp_Turbine_V1_F","SolarGen_EPOCH","Land_Wreck_Satellite_EPOCH"}},30,1,0,1}}; recipe[] = {{"CircuitParts",1},{"ItemCopperBar",1},{"clean_water_epoch",1}}; previewPosition[] = {0.8,1,0.29}; previewScale = 1.75; previewVector = 2.8; }; Now let your imagination run wild! natoed, Razor1977 and Ghostrider-GRG 3 Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now