The KRISS Vector mod is published under the Backblast Studios licenseExample code on this site is free to useBug reports: Backblast Studios DiscordLicense
KRISS Vector
Independent selector levers New
The vanilla weapon has one selector with the safety as one of its positions. The Vector has two parts that move separately.
In plain wordsA safety and a fire selector that are two real parts: two bones, two clips, and a small state that remembers the fire mode while the weapon is safe.
Two bones
Each lever is a bone of the weapon skeleton, with the pivot at its screw. The fire mode lever follows the weapon fire mode, the safety lever follows safe and fire. Each has its own clip: the fire mode clip has positions for single, burst and auto, the safety clip has two.
The state that links them
In the vanilla graph the safe position replaces the fire mode: while safe, the current mode reads as “safe” and the front lever would jump. The weapon should keep showing the mode it was in.
Script remembers the last real fire mode→Spare float variable on the character graph→Weapon graph: safety lever uses the safe state→Fire mode lever uses the remembered value
Example code – free to useMyGun_Mode.c
protected void UpdateMode(BaseWeaponComponent weapon)
{
EWeaponFiremodeType type = weapon.GetCurrentFireModeType();
if (type != EWeaponFiremodeType.Safety) // keep the last real mode while safe
{
m_fMode = 0; // single
if (type == EWeaponFiremodeType.Burst)
m_fMode = 0.5;
else if (type == EWeaponFiremodeType.Auto)
m_fMode = 1;
}
m_Anim.SetSharedVariableFloat(m_ModeVar, m_fMode, true);
}
Checks
- Mark the pivot on a render of the model: the pivot must be the screw, not the middle of the lever.
- In the clip, mark which direction is safe and which is fire. A red line for safe and a green one for fire on a screenshot of the model is a good way to agree on it.