Build Item Config Properties - Ansible2/Arma-3-Survival GitHub Wiki

Relevant Files:

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

  • Headers\descriptionEXT\GUI\shopGUICommonDefines.hpp

Properties:

attachmentX

Type(s): NUMBER

Description:

This property handles how far in to the side of the player the item should be when they purchase it from the shop. For example, a value of 1 will place the item 1m to the right of the player. -1 will place it 1m to the left.

Example(s):

attachmentX = 0;

attachmentY

Type(s): NUMBER

Description:

This property handles how far in front of the player the item should be when they purchase it from the shop.

Example(s):

attachmentY = 1;

attachmentZ

Type(s): NUMBER

Description:

This property handles how far above or below the player the item should be when they purchase it from the shop.

Example(s):

attachmentZ = 3;

category

Type(s): STRING

Description:

Categories can be any string so you can make your own very easily. You can find some already made category macros in the shopGUICommonDefines.hpp file listed above.

Example(s):

category = OTHER_CATEGORY;

category = "My Category";

detectCollision

Type(s): NUMER or BOOL

Description:

A true value (either true or 1) will register this item as an object that should register with the AI collision script. AI will try not to walk directly through the object.

Example(s):

detectCollision = false;

detectCollision = 1;

displayName

Type(s): STRING

Description:

The DisplayName property is only required if you would like a custom name for the item. Otherwise, the item's CfgVehicles class displayname will be used. This name will also show up in the object's actions when purchased.

Example(s):

displayName = "My Custom Name";

hasAI

Type(s): NUMER or BOOL

Description:

If the item is intended to have AI, it will be spawned with BIS_fnc_spawnVehicle as opposed to just createVehicle. This is mostly intended for auto-turrets.

Example(s):

hasAI = false;

hasAI = 1;

invincible

Type(s): NUMER or BOOL

Description:

Simply makes the item invincible or not.

Example(s):

invincible = 0;

invincible = true;

keepInventory

Type(s): NUMER or BOOL

Description:

If false, inventory will be cleared from item if it has any.

Example(s):

keepInventory = 0;

onPickedUp

Type(s): STRING

Description:

This is uncompiled code that fires locally each time the player picks up an item of that type (also fires during purchase).

Parameters:

OBJECT: _object - The picked up object

Example(s):

onPickedUp = "hint str _object";

onPlaced

Type(s): STRING

Description:

This is uncompiled code that fires locally each time the player places down an item of that type.

Parameters:

OBJECT: _object - The placed object

BOOL: _wasSnapped - Was the object snapped to the surface

Example(s):

onPlaced = "hint str [_object,_wasSnapped]";

onPurchasedPrefix

Type(s): STRING

Description:

This is uncompiled code that fires locally each time the player purchases an object of this type. Specifically this prefix function fires before before the item is created and is capable of initiating an abort of the purchase.

Parameters:

STRING: _this select 0 - The class of the object to be purchased

ARRAY: _this select 1 - An array of these various config properties related to the item:

0: PRICE <NUMBER>
1: CATEGORY <STRING>
2: ROTATION <NUMBER>
3: ATTACHMENT_COORDS <ARRAY>
4: HAS_AI <BOOL> 
5: INDESTRUCTABLE <BOOL>
6: KEEP_INVENTORY <BOOL>
7: DETECT_COLLISION <BOOL>
8: DISPLAY_NAME <STRING>

BOOL: _doExit - Set to true to exit the purchase function

BOOL: _refund - Set to true to get a refund if exiting the purchase function

Example(s):

onPurchasedPrefix = "hint (_this select 0)";

Shows class name.

onPurchasedPrefix = "_doExit = true; _refund = true; hint 'You can't buy this, but here's your money'";

Exits purchase and refunds. Also shows a message to the player.

onPurchasedPrefix = "params ['','_propertiesArray']; hint (_propertiesArray select 8)";

Hints the displayname of the item.

onPurchasedPostfix

Type(s): STRING

Description:

This is uncompiled code that fires locally each time the player purchases an item. Specifically it fires after the item is created, all the relevant properties have been loaded from the config, and the actions have been added to the local player.

Parameters:

OBJECT: _object - The purchased object

Example(s):

onPurchasedPostfix = "hint str _object";

onPurchasedPostNewtork

Type(s): STRING

Description:

This is uncompiled code that fires locally each time the player purchases an item. Specifically it fires locally after the item's actions are synced across the network. This is ~10 seconds after the item is first placed down by the player who purchased it. (this is because of issues with transferring ownership of items too soomn if someone tries to manipulate the object)

Parameters:

OBJECT: _object - The purchased object

Example(s):

onPurchasedPostNewtork = "hint str _object";

onSold

Type(s): STRING

Description:

This is uncompiled code that fires locally before an item is sold (with the action when it is outside the shop). This code MUST return a BOOL. That bool determines whether or not the item can be sold.

Parameters:

OBJECT: _object - The purchased object

Example(s):

onPurchasedPostNewtork = "hint str _object; true";

Item can be sold

onPurchasedPostNewtork = "hint str _object; false";

Item can't be sold

price

Type(s): NUMBER

Description:

The amount of points the item costs in the shop

Example(s):

price = 100;

rotation

Type(s): NUMBER

Description:

The rotation of the item when it is purchased from the shop.

Example(s):

rotation = 90;

tooltip

Type(s): STRING

Description:

A custom tooltip of the object in the shop.

Example(s):

tooltip = "This object is special";

NOTES:

  1. NUMER or BOOL means the property can accept either 0 or false or 1 or true
  2. Currently as of version 0.9.0 the build events are always compiled each time they are called. So keep the code within the actual string short and if a larger function is needed, place it into either a CfgFunctions entry or global variable for example.
⚠️ **GitHub.com Fallback** ⚠️