SCN PlasmaPistolWeapScript
; Custom reload animations script
; Authors: VeliV - www.project-valhalla.org / chai - www.svartberg.com
; If you use this script in your mod, please keep these lines intact
begin gamemode
ref rContainer
set rContainer to GetContainer
if rContainer.GetAnimAction == 9
if rContainer.GetEquipped WeapPlasmaPistol == 1
rContainer.CastImmediateOnSelf PlasmaPistolReloadActorEffect
endif
endif
end
scn PlasmaPistolReloadEffectScript
; Custom reload animations script
; Authors: VeliV - www.project-valhalla.org / chai - www.svartberg.com
; If you use this script in your mod, please keep these lines intact
short doOnce
float jamPercent
short weapCond
short chance
float timer
begin ScriptEffectUpdate
ref rContainer
if doOnce == 0 ; reload animation
set timer to 40 ; this timer works on gamelogic ticks and it just for creating safety delay
set rContainer to GetSelf
if rContainer == player
if IsPC1stPerson == 1
player.PlayIdle PlasmaPistolReload1stPerson
else
player.PlayIdle PlasmaPistolReload
endif
EnablePlayerControls 1 1 1 1 1 1 1
set doOnce to 1
else
rContainer.PlayIdle PlasmaPistolReload
set doOnce to 2 ; no jamming for NPC's so skip the jam loops
endif
elseif doOnce == 1 ; only run jamming timer if it's the player
if timer > 0
set timer to timer - 1
elseif rContainer.IsIdlePlaying == 0 ; timer ran out
set weapCond to player.GetWeaponHealthPerc
if weapCond < 50 ; only run if equiped weapon is below 50%
if weapCond > 40
set jamPercent to GetGameSetting fWeaponConditionReloadJam5
elseif weapCond > 30
set jamPercent to GetGameSetting fWeaponConditionReloadJam4
elseif weapCond > 20
set jamPercent to GetGameSetting fWeaponConditionReloadJam3
elseif weapCond > 10
set jamPercent to GetGameSetting fWeaponConditionReloadJam2
else
set jamPercent to GetGameSetting fWeaponConditionReloadJam1
endif
set jamPercent to (jamPercent * 100)
set chance to getRandomPercent
if chance < jamPercent
if IsPC1stPerson == 1
player.PlayIdle PlasmaPistolJam1stPerson
else
player.PlayIdle PlasmaPistolJam
endif
endif
endif
set doOnce to 2 ; stop loop
endif
endif
end