Skip to content

Adding Build Items

Ansible2 edited this page Sep 16, 2021 · 7 revisions

This will be a walkthrough of adding a single wall item to the shop. A tall concrete wall of the class Land_CncWall4_F.

Relevant Files:

https://github.com/Ansible2/Arma-3-Survival/blob/a9d7894c47a7a572986a009e614cb9b12d6a7ce6/Headers/descriptionEXT/Build%20Items/Main%20Build%20Items.hpp

  • Headers\descriptionEXT\Build Items\Main Build Items.hpp

https://github.com/Ansible2/Arma-3-Survival/blob/a9d7894c47a7a572986a009e614cb9b12d6a7ce6/Headers/descriptionEXT/GUI/shopGUICommonDefines.hpp

  • Headers\descriptionEXT\GUI\shopGUICommonDefines.hpp

Configure Your Item(s):

  1. Create a .hpp file in the same directory as the Main Build Items.hpp. You can see examples of this for the mods OPTRE & RHS in the same folder. My file will be called My Wall Header.hpp. (SEE NOTE 1)

  2. Prepare an empty class for the build item by placing the following inside your .hpp file.

class
{
};
  1. Now find the object's classname that you want to add to the shop. The easiest method for this is to go into the Eden Editor and find the item in entities list. Select it, set the item down, then right-click on it -> Log -> Log Classes To Clipboard. Go back to your header file and paste it inside right in front of the class.
class Land_CncWall4_F
{
};
  1. Now we're at the point where we need to give the item some properties. If you go back to the Main Build Items.hpp, you'll notice at the top of the file that there are a few "generic" base classes such as BLWK_genericLampBase or BLWK_genericTurretBase that you can inherit from. It's best to inherit from one of the bases, for the wall, I will use the BLWK_genericBuildItemBase. Tweak your config properties according to this wiki page.
class Land_CncWall4_F : BLWK_genericBuildItemBase
{   
};
  1. After step 4 the item will be capable of being pulled out of the shop. Go back to the Main Build Items.hpp and add a #include for your header file towards the bottom of the main BLWK_buildItems class. You'll see a number of other included files to reference.

Main Build Items.hpp:

...
...
	class Land_GarbageContainer_open_F : BLWK_genericBuildItemBase
	{
		displayName = "Item Reclaimer";
		price = 900;
		category = UNIQUE_CATEGORY;
		attachmentY = 2;
		attachmentZ = 0.8;
		invincible = 1;
		detectCollision = 0;

		tooltip = "Place items inside, reclaim, and get points put into the community pool";

		onPurchasedPostfix = "_this call BLWK_fnc_itemReclaimer_init";
		onSold = "_this call BLWK_fnc_itemReclaimer_onSold";
	};

	#include "OPTRE Build Items.hpp"
	#include "RHS Build Items.hpp"
	#include "SOG PF Build Items.hpp"
	#include "My Wall Header.hpp" // my header file is added here
};
  1. You should now be able to pull your item out of the shop.

NOTES:

  1. While not necessary, the act of placing items in separate .hpp files helps declutter the main file. That being said, if you are adding items from the vanilla game, you can add them to the Main Build Items.hpp.