RemoveScopeModelPath

From GECK
Jump to: navigation, search


A function added by the JohnnyGuitar NVSE Plugin version 4.65.

Description

Removes model path of a Weapon scope.

Syntax

[help]
(isSuccess:0/1) RemoveScopeModelPath weapon:baseform

Example

RemoveScopeModelPath WeapSniperRifle

Notes

To successfully remove a scope from a scoped weapon via script, a number of other operations must be carried out. First of all, the 'Has Scope' flag must be removed from the weapon in question, as well as the 'Scope From Mod' and 'Scope Has Night Vision' flags (if applicable). You must also increase the weapon's FOV if you don't want it to zoom in as far as it did with the scope equipped, and remove the mod-added scope FOV reduction (if applicable).

However, to successfully fully remove a scope from a weapon in game these operations must take place AFTER you call RemoveScopeModelPath on the weapon. If the scoped weapon is currently equipped to the player character Player.ReloadEquippedModels must be called to apply the changes to the weapon.

Example 2, Removing Scope From Current Equipped Weapon

let refWeap := Player.GetEquippedObject 5

RemoveScopeModelPath refWeap

let iWeapFlags := GetWeaponFlags1 refWeap
let iWeapFlags := ClearBit iWeapFlags, 2
SetWeaponFlags1 iWeapFlags, refWeap

let iWeapFlags := GetWeaponFlags1 refWeap
let iWeapFlags := ClearBit iWeapFlags, 12
let iWeapFlags := ClearBit iWeapFlags, 13
SetWeaponFlags2 iWeapFlags, refWeap

SetWeaponSightFOV 65 refWeap
Player.ReloadEquippedModels 5

See Also