Thanks JOG, now my XFO iron sight wobble works 100%. I'm using a quest script, firing every 1/5 a second and I think I coded it so that this won't continue to go off when it doesn't need to. The perk it applies checks for the sneaking condition, and all this code does is check for first person and iron sights (via RMB).
int bIsRMBPressedint bRemoveOncebegine gamemode if bIsRMBPressed != IsKeyPressed 257 set bIsRMBPressed to IsKeyPressed 257 if bIsRMBPressed if (IsPC1stPerson * player.IsWeaponOut) player.addperk aaIronSightsFix set bRemoveOnce to 1 printc "perk added" elseif bRemoveOnce * (IsPC1stPerson != player.IsWeaponOut) player.removeperk aaIronSightsFix set bRemoveOnce to 0 printc "perk removed" endif elseif bRemoveOnce > bIsRMBPressed player.removeperk aaIronSightsFix set bRemoveOnce to 0 printc "perk removed 2" endif endifend
Now, two things I've noticed.
First, if I switch from 1st to 3rd person while aiming, the function IsPC1stPerson doesn't pick it up (meaning the subroutine that prints "perk removed" never fires) and only releasing the RMB removes the perk.
Second, this perk will be applied to melee weapons.
How do I check for
ranged vs. melee weapons? Also, is there a way to check for
energy weapons vs. guns? The XFO aaIronSightsFix is only for guns but since I use WMX, I should create a energy weapons version and apply it when the PC is using them.
Edit: Damn, answered my own question.
player.IsWeaponSkillType is apparently what I'm looking for.