List of systems that addon makers can implement in their own creations [WIP]
This system handles both animation (gesture to be exact) & sound for bolt action, both for AI & players. Utilizing weapon event handler ensures reliability & high compatibility with user made content.
Since this solution utilizes those recently introduced EHs, core of the system
class Rifle_Base_F : Rifle {
class Eventhandlers;
};
class YourWeaponClass: Rifle_Base_F {
// inheriting Eventhandlers class for better modcross compatibility
class Eventhandlers: Eventhandlers {
// Bolt action EH is in it's own class for better mod cross compatibility
class RHS_BoltAction {
fired = "[_this select 0,_this select 1,_this select 2] call rhs_fnc_boltAction;";
};
};
// your bolt action reload sound - {sound path, volume, pitch, distance}
// it important to include file extension!
// while engine assumes .wss extension for all sounds which doesn't specify, this one is other
rhs_boltActionSound[] ={"rhsafrf\addons\rhs_c_weapons\sounds\bolt.wss", 1.42, 1, 20};
// your bolt action animation [gesture]
rhs_boltActionAnim = "RHS_GestureRechamberOrsis";
};
List of rechamber animations available in RHS:
Example bolt action rifle (T5000 model by Shaftynsky) http://reyhard.armacenter.pl/arma3/dev/ExampleBoltAction.rar
Disposable weapons script can be used with all kind of weapons (launchers, sidearms, primary rifles) and, like bolt action system, is based on newly introduced weapon event handlers.
To use it, you just need include following EH into your weapon config
class Rifle_Base_F : Rifle {
class Eventhandlers;
};
class YourWeaponClass: Rifle_Base_F {
// inheriting Eventhandlers class for better modcross compatibility
class Eventhandlers: Eventhandlers {
// Disposable action EH is in it's own class for better mod cross compatibility
class RHS_DisposableWeapon {
fired = "_this call rhs_fnc_disposable;";
};
};
};
Disposable weapon will be replaced with "weaponnamme" + "_used". i.e. "rhs_weap_rpg26" will be replaced by "rhs_weap_rpg26_used"
Example config
class rhs_weap_rpg26 : Launcher_Base_F [...]
class rhs_weap_rpg26_used : rhs_weap_rpg26 {
// it's important to use dummy mag on used weapon!
magazines[]={rhs_launcher_dummy_mag};
}
Handles safemode functionality & animations on weapons. By default it's binded to Shift+F key but it can be changed to any other key through RHS Action Menu.
Following code need to be added. If you have grenade launcher on your weapon then make safemode as a last muzzle. Example below
muzzles[] = {"this","GP25Muzzle","SAFE"};
// cfgWeapons
class RHS_SAFE_BASE; // add "rhs_c_weapons" to properly inherit this value
class YourWeapon: Rifle_Base_F {
// load script once player hold this weapon
weaponInfoType = "rhs_rscOptics_yourWeaponHandler";
// add safemode muzzle
class SAFE: RHS_SAFE_BASE {};
muzzles[]={"this","SAFE"}; // last muzzle in the config
};
In order to have it triggered properly, you need new weapon info type for your weapon, which will call rhs_fnc_safeMode script.
class RscPicture;
class RscInGameUI
{
class RscWeaponZeroing;
class rhs_rscOptics_yourWeaponHandler: RscWeaponZeroing
{
onLoad="['onLoad',_this,'RscUnitInfo','IGUI'] call (uinamespace getvariable 'BIS_fnc_initDisplay');_this call rhs_fnc_safemode";
controls[] = {"CA_Zeroing","RHS_safemode_handler"};
class RHS_safemode_handler: RscPicture {idc=9999;}; // IDC is important here!
};
If you have safety animation already made then you only need to add safemode anim defined in model.cfg
// model.cfg
// selector fire anims
class safety_mode_rot
{
type = rotation;
source = weaponMode;
selection = "fireselector";
axis = "fireselector_axis";
memory = 1;
minValue = 0;
maxValue = 0.25;
angle0 = (rad -8);
angle1 = 0;
};
// safe mode rotation
class safety_mode_safe_rot: safety_mode_rot
{
source=weaponMuzzle;
minValue=0.99;
maxValue=1;
angle0=0;
angle1=(rad 21);
};
[WIP]
[WIP]
Gripod system allows to equip different grips to under barrel weapon slot with proper animations. Implementation requires some model additions (adding blank gripod item), adding some cfg entries & creation of some new classes in cfgWeapons.
class UnderBarrelSlot;
class rhs_rifle_gripod_slot: UnderBarrelSlot
{
displayName = "Gripod slot";
class compatibleItems
{
rhsusf_acc_grip1=1;
rhsusf_acc_grip2=1;
rhsusf_acc_grip2_tan=1;
rhsusf_acc_grip3=1;
rhsusf_acc_grip3_tan=1;
};
};
class rhs_western_rifle_gripod_slot: rhs_rifle_gripod_slot
{
linkProxy = "rhsusf\addons\rhsusf_weapons\rhs_grip_proxy"; // link to your proxy used in weapon
};
weaponInfoType = "RHS_Gripod1";
- initialize display with onLoad handler
rhs_grip_type="rhs_grip1_change";
- defines for which entry should script look at in weapon config
class rhsusf_acc_grip1 : rhsusf_acc_harris_bipod
{
Author_Macro
scope=2;
model = "\rhsusf\addons\rhsusf_weapons\acc\grips\grip1";
picture = "\rhsusf\addons\rhsusf_weapons\icons\a_grip1.paa";
displayName = "Grip Pod";
descriptionShort = "A Grip Pod is a weapon stabilization system that serves as a weapon grip and as a retractable bipod.";
weaponInfoType = "RHS_Gripod1";
class ItemInfo
{
deployedPivot = "bipod";
hasBipod = 1;
mass = 10;
type = 302;
};
inertia = -0.2;
type = 131072;
rhs_grip_type="rhs_grip1_change";
};
rhs_grip1_change, 2 & 3 are standard entries which RHS use for grippod system. Those entries defines class names for weapon changing. You also need to add additional slot to your weapon which handle those underbarrel accesories
ATTENTION: Arma 3 supports only 5 slots for accesories!
Each grip number represents different type of grips & have specific animation like:
class rhs_weap_m4 : rhs_weap_m4_Base
{
//used to determine animation switch
rhs_grip1_change = "rhs_weap_m4_grip";
rhs_grip2_change = "rhs_weap_m4_grip2";
rhs_grip3_change = "rhs_weap_m4_grip3";
//MAX 5 slots
class WeaponSlotsInfo
{
mass = 73.04;
allowedSlots[] = {901};
class UnderBarrelSlot: rhs_western_rifle_underbarrel_slot {};
class CowsSlot: rhs_western_rifle_scopes_slot_short {};
class PointerSlot: rhs_western_rifle_laser_slot_top {};
class MuzzleSlot: rhs_western_rifle_muzzle_slot {};
class GripodSlot: rhs_western_rifle_gripod_slot {}; //link to our gripod slot
};
};
Each variant inherits from main class & changes only handAnim. You can also change inertia if you want to simulate better stability with grip attached. You can use macro to save some space in your config. Those subvariants won't be visible in Virtual Arsenal due to inherited "baseWeapon" parametr
Note, that preattaching accessory with LinkedItems is not required and it's here for creating custom unit loadouts in troops config.
#define Grip_Macro(numb,name) \
handAnim[] = {"OFP2_ManSkeleton",\rhsusf\addons\rhsusf_c_weapons\anims\rhs_hand_##name##.rtm};\
class LinkedItems\
{\
class LinkedItemsUnder\
{\
item = rhsusf_acc_grip##numb##;\
slot = "UnderBarrelSlot";\
};\
};
// first grippo
class rhs_weap_m4_grip : rhs_weap_m4
{
Author_Macro
displayName = $STR_RHS_CFGWEAPONS_RIFLE_M4_foreg;
picture = "\rhsusf\addons\rhsusf_weapons\icons\w_m4carryhandlegrip_ca.paa";
class WeaponSlotsInfo: WeaponSlotsInfo
{
mass = 61;
class UnderBarrelSlot {};
};
Grip_Macro(1,m16a4)
};
class rhs_weap_m4_grip2 : rhs_weap_m4_grip
{
Author_Macro
displayName = $STR_RHS_CFGWEAPONS_RIFLE_M4_afg;
picture = "\rhsusf\addons\rhsusf_weapons\icons\w_m4carryhandlegrip_ca.paa";
Grip_Macro(2,m4a1_afg)
};
class rhs_weap_m4_grip3 : rhs_weap_m4_grip
{
Author_Macro
displayName = $STR_RHS_CFGWEAPONS_RIFLE_M4_grip;
picture = "\rhsusf\addons\rhsusf_weapons\icons\w_m4carryhandlegrip_ca.paa";
Grip_Macro(3,m16a4)
};
Weapon need additional proxy (in our case _rhsusf\addons\rhsusf_weapons\rhs_gripproxy, you can create new one you don't want to create dependency). Position of that proxy can be changed as you wish but you need to take into account that animations need change then too, which is as simple as moving -LeftHand selection in Object Builder.
It's worth to mention that that process of creating custom hand animations could be simplifed by coping this animation [load .rtm and then click on "copy" in that context menu which you get after pressing right mouse button on animation window] & pasting over selection [load your current hand anim, select -LeftHand selection & choose "Copy over selection" from previously mentioned menu]
Example animation & p3d included http://reyhard.armacenter.pl/arma3/dev/ExampleGrip.rar
You can either reuse those entries from RHS or create your own uniqe, to be sure, it's loaded after changing accessory. It's caused by weaponInfoType entries not being loaded again if idd is same currently running dialog.
Avaialable RHS weaponInfoType entries for grippod system:
Example code
class RscInGameUI
{
class RHS_Gripod1
{
idd=3006;
onLoad="['onLoad',_this,'RscUnitInfo','IGUI'] call (uinamespace getvariable 'BIS_fnc_initDisplay'); _this call rhs_fnc_accGripod";
};
};