Информация о файле
Многие наверное сталкивались с ситуацией когда вражеский НПС или ваш напарник не могли достать оружие? Тогда вы по адресу.
Переписанный скрипт Dual Sheath Redux для исправления циклов скрипта. Скрипт был серьезно видоизменен в логическом отношении. Скрипт больше не будет вылопнять не требуемые действия, тем самым не вызывая зацикливаний у НПС.
Перед установкой нужно на старой версии мода: избавится от всех напарников и зайти в дом где никого нет, сохраниться.
Для установки требуется иметь оригинальный DSR мод с удаленными файлами в папке Data\scripts:
- dualsheathreduxapplyeffect.pex
- dualsheathreduxeffect.pex
- dualsheathreduxplayerscript.pex
- dualsheathreduxquest.pex
Распаковать с заменой, пересоздать патч. Если есть какие-то трудности то пересохраниться с отключением DSR.
;/ Decompiled by Champollion V1.0.1
Source : dualsheathreduxeffect.psc
Modified : 2017-02-21 09:57:30
Compiled : 2017-02-21 09:57:36
User : Mitradis
Computer : PC1
/;
scriptName dualsheathreduxeffect extends activeMagicEffect
;-- Properties --------------------------------------
spell property DualSheathReduxAbility auto
form[] property Lists auto
actor property PlayerRef auto
;-- Variables ---------------------------------------
FormList BaseStaffList
FormList BackShieldList
FormList LeftWeaponList
Bool BlockState = false
FormList LeftSheathList
FormList BackShieldListClk
FormList RightStaffList
Armor LeftSheath
actor ThisActor
Armor RightWeapon
FormList BaseShieldList
Int IndexInList = -1
FormList BaseWeaponList
Bool IsPlayer = false
FormList LeftStaffList
Weapon LeftBase
Armor LeftWeapon
Armor ShieldOnBack
Weapon RightBase
Armor ShieldBase
;-- Functions ---------------------------------------
function EquipItemFunction(Armor Type)
if Type != none
ThisActor.EquipItem(Type as form, false, true)
endIf
endFunction
function RightWeaponFunction()
if ThisActor.IsWeaponDrawn()
self.UnEquipItemFunction(RightWeapon)
elseIf ThisActor.GetWornForm(16384) as Armor != RightWeapon as Armor
self.RemoveItemFunction(ThisActor.GetWornForm(16384) as Armor)
self.EquipItemFunction(RightWeapon)
endIf
endFunction
function ShieldOnBackFunction()
if ThisActor.IsWeaponDrawn()
self.UnEquipItemFunction(ShieldOnBack)
elseIf ThisActor.GetWornForm(1073741824) as Armor != ShieldOnBack as Armor
self.RemoveItemFunction(ThisActor.GetWornForm(1073741824) as Armor)
self.EquipItemFunction(ShieldOnBack)
endIf
endFunction
function DestroyLeftWeapon()
self.RemoveItemFunction(LeftSheath)
LeftSheath = none
self.RemoveItemFunction(LeftWeapon)
LeftWeapon = none
LeftBase = none
endFunction
function RefreshState()
utility.WaitMenuMode(0.250000)
if ThisActor.GetEquippedWeapon(false)
if ThisActor.GetEquippedItemType(1) == 5 || ThisActor.GetEquippedItemType(1) == 6 || ThisActor.GetEquippedItemType(1) == 7 || ThisActor.GetEquippedItemType(1) == 9 || ThisActor.GetEquippedItemType(1) == 12
self.DestroyRightWeapon()
self.DestroyLeftWeapon()
self.DestroyShield()
elseIf ThisActor.GetEquippedItemType(1) == 8
if ThisActor.GetEquippedWeapon(false) == RightBase as Weapon
self.RightWeaponFunction()
else
self.DestroyRightWeapon()
IndexInList = -1
IndexInList = BaseStaffList.Find(ThisActor.GetEquippedWeapon(false) as form)
if IndexInList != -1
RightBase = ThisActor.GetEquippedWeapon(false)
RightWeapon = RightStaffList.GetAt(IndexInList) as Armor
self.RightWeaponFunction()
endIf
endIf
else
self.DestroyRightWeapon()
endIf
else
self.DestroyRightWeapon()
endIf
if ThisActor.GetEquippedWeapon(true)
if ThisActor.GetEquippedItemType(0) == 1 || ThisActor.GetEquippedItemType(0) == 2 || ThisActor.GetEquippedItemType(0) == 3 || ThisActor.GetEquippedItemType(0) == 4
if ThisActor.GetEquippedWeapon(true) == LeftBase as Weapon
self.LeftWeaponFunction(false)
else
self.DestroyLeftWeapon()
self.DestroyShield()
IndexInList = -1
IndexInList = BaseWeaponList.Find(ThisActor.GetEquippedWeapon(true) as form)
if IndexInList != -1
LeftBase = ThisActor.GetEquippedWeapon(true)
LeftWeapon = LeftWeaponList.GetAt(IndexInList) as Armor
LeftSheath = LeftSheathList.GetAt(IndexInList) as Armor
self.LeftWeaponFunction(false)
endIf
endIf
elseIf ThisActor.GetEquippedItemType(0) == 8
if ThisActor.GetEquippedWeapon(true) == LeftBase as Weapon
self.LeftWeaponFunction(true)
else
self.DestroyLeftWeapon()
self.DestroyShield()
IndexInList = -1
IndexInList = BaseStaffList.Find(ThisActor.GetEquippedWeapon(true) as form)
if IndexInList != -1
LeftBase = ThisActor.GetEquippedWeapon(true)
LeftWeapon = LeftStaffList.GetAt(IndexInList) as Armor
LeftSheath = none
self.LeftWeaponFunction(true)
endIf
endIf
else
self.DestroyLeftWeapon()
endIf
else
self.DestroyLeftWeapon()
endIf
if ThisActor.GetEquippedItemType(0) == 10
if ThisActor.GetEquippedObject(0) as Armor == ShieldBase as Armor
self.ShieldOnBackFunction()
else
self.DestroyLeftWeapon()
self.DestroyShield()
IndexInList = -1
IndexInList = BaseShieldList.Find(ThisActor.GetEquippedObject(0))
if IndexInList != -1
ShieldBase = ThisActor.GetEquippedObject(0) as Armor
if ThisActor.GetWornForm(65536) as Armor
ShieldOnBack = BackShieldListClk.GetAt(IndexInList) as Armor
else
ShieldOnBack = BackShieldList.GetAt(IndexInList) as Armor
endIf
self.ShieldOnBackFunction()
endIf
endIf
elseIf IsPlayer
self.DestroyShield()
elseIf ThisActor.GetWornForm(1073741824) as Armor != ShieldOnBack as Armor
self.DestroyShield()
endIf
endFunction
function RemoveItemFunction(Armor Type)
if Type != none
ThisActor.RemoveItem(Type as form, 50, true, none)
endIf
endFunction
function OnEffectStart(actor akTarget, actor akCaster)
if akTarget == none
self.Dispel()
return
else
ThisActor = akTarget
if ThisActor == PlayerRef
IsPlayer = true
if Lists[0].GetFormID() == 0
debug.MessageBox("DSR:\nDual Sheath Redux Patch не найден.")
endIf
endIf
BaseWeaponList = Lists[0] as FormList
LeftWeaponList = Lists[1] as FormList
LeftSheathList = Lists[2] as FormList
BaseStaffList = Lists[3] as FormList
RightStaffList = Lists[4] as FormList
LeftStaffList = Lists[5] as FormList
BaseShieldList = Lists[6] as FormList
if IsPlayer
BackShieldList = Lists[7] as FormList
BackShieldListClk = Lists[9] as FormList
else
BackShieldList = Lists[8] as FormList
BackShieldListClk = Lists[10] as FormList
endIf
utility.WaitMenuMode(0.250000)
self.GotoState("Alive")
endIf
endFunction
function UnEquipItemFunction(Armor Type)
if Type != none
ThisActor.UnEquipItem(Type as form, false, true)
endIf
endFunction
function OnEffectFinish(actor akTarget, actor akCaster)
BlockState = true
self.DestroyRightWeapon()
self.DestroyLeftWeapon()
if !IsPlayer
self.EquipItemFunction(ShieldBase)
endIf
self.DestroyShield()
utility.WaitMenuMode(0.500000)
BlockState = false
endFunction
; Skipped compiler generated GetState
function DestroyRightWeapon()
self.RemoveItemFunction(RightWeapon)
RightWeapon = none
RightBase = none
endFunction
; Skipped compiler generated GotoState
function LeftWeaponFunction(Bool Staff)
if ThisActor.IsWeaponDrawn()
if !Staff
if ThisActor.GetWornForm(1073741824) as Armor != LeftSheath as Armor
self.RemoveItemFunction(ThisActor.GetWornForm(1073741824) as Armor)
self.EquipItemFunction(LeftSheath)
endIf
endIf
self.UnEquipItemFunction(LeftWeapon)
else
if ThisActor.GetWornForm(1073741824) as Armor != LeftWeapon as Armor
self.RemoveItemFunction(ThisActor.GetWornForm(1073741824) as Armor)
self.EquipItemFunction(LeftWeapon)
endIf
if !Staff
self.UnEquipItemFunction(LeftSheath)
endIf
endIf
endFunction
function DestroyShield()
self.RemoveItemFunction(ShieldOnBack)
ShieldOnBack = none
ShieldBase = none
endFunction
;-- State -------------------------------------------
state Dead
endState
;-- State -------------------------------------------
state Alive
function OnDying(actor akKiller)
BlockState = true
self.DestroyRightWeapon()
self.DestroyLeftWeapon()
self.DestroyShield()
utility.WaitMenuMode(0.500000)
BlockState = false
self.GotoState("Dead")
endFunction
function OnObjectUnequipped(form akBaseObject, objectreference akReference)
if !BlockState && akBaseObject != none && akBaseObject != ShieldOnBack as form && akBaseObject != RightWeapon as form && akBaseObject != LeftWeapon as form && akBaseObject != LeftSheath as form
self.RefreshState()
endIf
endFunction
function OnRaceSwitchComplete()
BlockState = true
self.Dispel()
utility.WaitMenuMode(0.500000)
BlockState = false
ThisActor.Addspell(DualSheathReduxAbility, false)
endFunction
function OnItemRemoved(form akBaseItem, Int aiItemCount, objectreference akItemReference, objectreference akDestContainer)
if !BlockState
if akBaseItem == RightBase as form
if ThisActor.GetItemCount(RightBase as form) == 0
self.DestroyRightWeapon()
endIf
endIf
if akBaseItem == LeftBase as form
if ThisActor.GetItemCount(LeftBase as form) == 0
self.DestroyLeftWeapon()
endIf
endIf
if akBaseItem == ShieldBase as form
if ThisActor.GetItemCount(ShieldBase as form) == 0
self.DestroyShield()
endIf
endIf
endIf
endFunction
function onBeginState()
BlockState = true
self.RegisterForAnimationEvent(ThisActor as objectreference, "WeaponDraw")
self.RegisterForAnimationEvent(ThisActor as objectreference, "WeaponSheathe")
self.RefreshState()
utility.WaitMenuMode(0.250000)
BlockState = false
endFunction
function OnAnimationEvent(objectreference akSource, String asEventName)
if !BlockState
if asEventName == "WeaponDraw"
BlockState = true
if ShieldOnBack as form
self.UnEquipItemFunction(ShieldOnBack)
endIf
if RightWeapon as form
self.UnEquipItemFunction(RightWeapon)
endIf
if LeftWeapon as form
self.UnEquipItemFunction(LeftWeapon)
endIf
if LeftSheath as form
self.EquipItemFunction(LeftSheath)
endIf
elseIf asEventName == "WeaponSheathe"
BlockState = true
if ShieldOnBack != none
self.EquipItemFunction(ShieldOnBack)
endIf
if RightWeapon as form
self.EquipItemFunction(RightWeapon)
endIf
if LeftWeapon as form
self.EquipItemFunction(LeftWeapon)
endIf
if LeftSheath as form
self.UnEquipItemFunction(LeftSheath)
endIf
endIf
if BlockState
utility.WaitMenuMode(0.250000)
BlockState = false
endIf
endIf
endFunction
function OnObjectEquipped(form akBaseObject, objectreference akReference)
if !BlockState && akBaseObject != none && akBaseObject != ShieldBase as form && akBaseObject != ShieldOnBack as form && akBaseObject != RightWeapon as form && akBaseObject != LeftWeapon as form && akBaseObject != LeftSheath as form
self.RefreshState()
endIf
endFunction
endState
Что нового в версии 1.0.1 Просмотр изменений
Размещено
Добавлен блок функций, удаление "потерянных" псевдо оружия и щита, общее улучшение. Окончательная версия.

Рекомендуемые комментарии
Для публикации сообщений создайте учётную запись или авторизуйтесь
Вы должны быть пользователем, чтобы оставить комментарий
Создать учетную запись
Зарегистрируйте новую учётную запись в нашем сообществе. Это очень просто!
Регистрация нового пользователяВойти
Уже есть аккаунт? Войти в систему.
Войти