A3Epoch:Arma 3 Epoch Reusable Functions

From Epoch Mod Wiki
Jump to: navigation, search

GUI functions[edit | edit source]

Generic[edit | edit source]

Epoch_getIDC - returns and registers an unused IDC. Pass your control to the function to unregister it (keep it tidy) for reuse.

This is a very simple function for those who prefer creating controls in their dialogs or displays fully dynamically. There are pros and cons to both - creating controls statically (.ext, .cpp, .hpp) files or dynamically (.sqf, .fsm). Biggest pro to dynamic controls being you are not limited by static amount of controls, create and destroy as many as you like. Biggest con being - you are expected to somewhat understand aspect ratios and there's no visual editor, obviously. An example used in Epoch survival mod is the new Dynamic menu (space bar), it's created fully dynamically.List of currently used IDCs are stored in rmx_var_uniqueIDCarray An example video shows this function in action.


Epoch_getColorScheme - returns RGBA in form of array with 4 elements.

Allows designing your GUIs to adapt to player's chosen color scheme under Arma's game settings. Notable example - Epoch's new message system that paints it's background the same color scheme rest of the game uses.


Epoch_message, Epoch_message_old1, Epoch_message_old2

Simple messaging systems, pass the variable and it will be displayed on the screen. Example videos: Old1, Old2


Epoch_dragControl - Advanced

Allows drag and dropping controls around the screen just like you would with dialogs with movingenable=1 set. Please refer to Epoch_GUI_rmx.hpp in EpochCore git and look for examples named rmx_drag_RscActivePicture and rmx_drag_RscActivePictureKeepAspect for event handlers. All of this can be done programatically via SQF, just don't forget to enable the control first (ctrlEnable).

2D Control animations[edit | edit source]

Epoch_2DCtrlShake

Gives ability to shake a control by utilising an undocumented BIS function ctrlSetAngle with various parameters like speed, amount of shakes and angle.


Epoch_2DCtrlHeartbeat

Gives ability to add heartbeat effect to your controls with various parameters. This function is currently used in the new debuff dynamic HUD when debuff reaches the critical level.

2D Controls Projected from 3D space[edit | edit source]

Epoch_gui3DCooldown - Demo Video

Adds animated circular cooldown with a timer to an object and tracks its movement in 2D space.

If your project requires removing cooldown before it expires, you will need to use a global bool variable and pass it's name in parameters to a function. This way you can remove cooldown externally by simply setting it to false.


Epoch_gui3DWorldPos, Epoch_gui3DModelPos

Both functions projects and tracks 2D images from 3D space. The difference as names suggest is using world or model space. Worldspace is fastest and safest to use for obvious reasons, but modelspace function offers ability to follow moving objects. First demo video shows worldspace in action and that it can be applied to all objects (if they exist in configs). A second demo video shows a good example on how these functions can be creatively utilized, in this case to show the level of damage on hitpoints of vehicles, can be used on units if you're designing some medical system for example.

3D controls (advanced)[edit | edit source]

Epoch_3DctrlYaw, Epoch_3DctrlPitchYaw

Both functions are designed for a single purpose - rotate object following mouse movement. This is especially cool for projects that showcases 3D objects (ie inventory system). They were originally designed for Crafting V2, but later replaced with more autonomous rotation system function (Epoch_3DCtrlSpin).

Requirements are simple - create 3D dialog (see my examples in core files) and add placeholder model in config files. Next create a 2D plane (RscPicture), preferably invisible to end user and overlay it on top of your 3D object, make sure to enable it. Read function's description on how to create an event handler to run it. While supported, I would not recommend using EH on object itself as it will only work on fire LOD.


Epoch_3DctrlSpin - rotates object, use rmx_var_3dCtrlSpin boolean to stop rotation. Use rmx_var_3dCtrlSpin_Vectorinteger to change vector (tilt) of rotation.

This function is currently used in Crafting V2 for 3D preview. Since the whole function relies on a single boolean to be disabled, please be wary when using it, especially with multiple objects on screen. Please make sure to always set boolean to false before killing your dialog to avoid RPT errors. This function isn't really "reusable" per say because of this, but it could be a cool addition to your project if used wisely. Alternatively just copy it and make your own variant with it much more safer for your environment.

Post processing[edit | edit source]

Epoch_setRadiation - creates radiation effect on player.

There are 10 levels of radiation effect that can be set, use 0 to disable the effect.


Epoch_setDrunk - creates drunk effect on player.

There are 10 levels of drunk effect that can be set, use 0 to disable the effect.

Post processing Advanced[edit | edit source]

You might want to get a PP editor for these. Mine (Video) is currently posted to public, but there's no documentation on how to use the mod, but it shouldn't be a problem to launch for experienced developers. I will be releasing it via announcement at some point and the updated version of tool will be available in Epoch tools section.


Epoch_postProcessCreate

Makes it easier to create new PP effects without diving into documentation. Just give it name of PP like "filmgrain" and priority (used to order PP layer). Returns handle which is later used to adjust this PP using Epoch_postProcessAdjust, so make sure to call this function from a variable define.


Epoch_postProcessAdjust

Please read the comment section carefully for usage and Arma's default values (you're welcome). Adjust your PP effect using the handle, speed of transformation and an array of the new desired effect.


Epoch_postProcessDestroy

Pass the handle (or array full of handles) to destroy your PP effects created using Epoch_postProcessAdjust.