4
Fork 0

Instant and SKSE-free dismantling list generation, added a script generating recipe conditions

development
Eddoursul 3 months ago
parent b3058adf18
commit 315b7910eb
  1. BIN
      Dismantling update.esp
  2. 3
      Enderal SE v2.1.0 Changelog.txt
  3. BIN
      _build/Enderal - Generate COBJ dismantling conditions.pas
  4. BIN
      scripts/_00e_fs_dismantle_workbench.pex
  5. 111
      source/scripts/_00e_fs_dismantle_workbench.psc

Binary file not shown.

@ -45,8 +45,9 @@ Gameplay changes:
- Fixed visibility of the picnic quest marker in Cuthbert's Legacy.
- Fixed the issue, when Ark citizens stopped reacting to player's crimes after signing contract with the Golden Sickle (reported by BallOfFire).
- Patched a source of infinite money, appearing during Every Day Like the Last, Part VI.
- Fixed inability to dismantle items after buying a house.
- Player no longer can leave the first conversation with Jespar.
- Fixed inability to dismantle items after buying a house.
- Instant dismantling list generation. Surplus copies of equipped items can be dismantled as well.
- Due to changes in time calculation with active Slow Time effect in Skyrim SE 1.6+, echo visions started to end prematurely. Durations of the echoes have been updated for 1.6, but the slowdown effect now stays a few seconds too long on 1.5.97. Completed an unfinished vision in The Shards of Order, Part II.
- Added missing critical damage chance to 13 items, more consistent sound detection parameters.
- Updated dagger crit bonuses: minimum multiplier set to 2, fixed missing crit bonus with the Ambush daggers, increased bonus with mystical and unique items.

Binary file not shown.

@ -1,98 +1,41 @@
Scriptname _00E_FS_Dismantle_Workbench extends ObjectReference
{lets the player melt down items to one of its base components, extends the crafting classes}
; properties
Actor Property PlayerREF Auto
FormList Property _00E_DismantleList Auto
FormList Property _00E_DismantleItemList Auto
FormList Property _00E_DismantleResetList Auto
Message Property _00E_CheckForDismantlingMSG Auto
Keyword Property CraftingSmelterDismantling Auto
Keyword Property InvisibleDismantling Auto
Perk Property _00E_Class_Phasmalist_P04_A_ArcaneBreakdown Auto
ObjectReference Property _00E_RemoveAllItems_TrashContainer Auto
; events
Event OnInit()
BlockActivation()
EndEvent
Event OnActivate(ObjectReference akActionRef)
If Self.IsActivationBlocked()
RegisterForMenu("Crafting Menu")
; GenerateMeltDownList() is relatively slow due to using formlists hence we notify the player that something is calculated in the background
_00E_CheckForDismantlingMSG.Show()
GenerateMeltDownList()
Self.Activate(PlayerREF, true)
EndIf
Weapon rightHand = PlayerREF.GetEquippedWeapon(false)
Weapon leftHand = PlayerREF.GetEquippedWeapon(true)
Endevent
Event OnMenuClose(String MenuName)
If menuName == ("Crafting Menu")
UnregisterForMenu("Crafting Menu")
ResetMeltDownList()
; only enable the player controls after everything is reset properly
Game.EnablePlayerControls()
EndIf
EndEvent
; functions
Function GenerateMeltDownList()
; this function is responsible for filling a list based on the items in the players inventory which can be melted down to crafting material
Int iTotalItemCount = PlayerREF.GetNumItems()
Int iItemCount = 0
Form ItemToCheck
Bool bPlayerHasArcaneBreakdown = PlayerREF.HasPerk(_00E_Class_Phasmalist_P04_A_ArcaneBreakdown)
Form equippedItemLeft = PlayerRef.GetEquippedObject(0)
Form equippedItemRight = PlayerRef.GetEquippedObject(1)
While iItemCount < iTotalItemCount
ItemToCheck = PlayerREF.GetNthForm(iItemCount)
If (ItemToCheck as Armor) != None ; armor
;checks the item if it's equipped and if it's either enchanted or if the player has the perk to dismantle enchantmented items
If ItemToCheck != equippedItemRight && ItemToCheck != equippedItemLeft && PlayerREF.IsEquipped(ItemToCheck) == False
If bPlayerHasArcaneBreakdown || (ItemToCheck as Armor).GetEnchantment() == None
AddItemToDismantleList(ItemToCheck)
EndIf
EndIf
ElseIf (ItemToCheck as Weapon) != None ; weapon
;checks the item if it's equipped and if it's either enchanted or if the player has the perk to dismantle enchantmented items
; Note: IsEquipped does not work for any stuff in the left hand when dual wielding
If ItemToCheck != equippedItemRight && ItemToCheck != equippedItemLeft
If bPlayerHasArcaneBreakdown || (ItemToCheck as Weapon).GetEnchantment() == None
AddItemToDismantleList(ItemToCheck)
EndIf
EndIf
EndIf
if rightHand || leftHand
_00E_RemoveAllItems_TrashContainer.RemoveAllItems()
iItemCount += 1
EndWhile
EndFunction
Function AddItemToDismantleList(Form itemToAdd)
; if the item passes the checks, we need to set the workbenchkeyword of the respective constructible object so it gets displayed properly in the menu
; it also adds it to the reset list so the keyword gets set back to the default one after exiting the menu
Int iFoundAtIndex = _00E_DismantleItemList.Find(itemToAdd)
If iFoundAtIndex >= 0
ConstructibleObject recipe = _00E_DismantleList.GetAt(iFoundAtIndex) as ConstructibleObject
recipe.SetWorkBenchKeyword(CraftingSmelterDismantling)
_00E_DismantleResetList.AddForm(recipe)
EndIf
EndFunction
Function ResetMeltDownList()
; this function resets the workbenchkeyword back to default
Int iTotalRecipesToReset = _00E_DismantleResetList.GetSize()
Int iRecipesToReset = iTotalRecipesToReset
if rightHand == leftHand
_00E_RemoveAllItems_TrashContainer.AddItem(rightHand, 2, true)
else
if rightHand
_00E_RemoveAllItems_TrashContainer.AddItem(rightHand, 1, true)
endif
if leftHand
_00E_RemoveAllItems_TrashContainer.AddItem(leftHand, 1, true)
endif
endif
endif
Game.EnablePlayerControls()
Activate(PlayerREF, true)
if rightHand || leftHand
while ! Game.IsLookingControlsEnabled()
Utility.Wait(0.5)
endwhile
_00E_RemoveAllItems_TrashContainer.RemoveAllItems()
endif
While iRecipesToReset > 0
iRecipesToReset -= 1
(_00E_DismantleResetList.GetAt(iRecipesToReset) as ConstructibleObject).SetWorkBenchKeyword(InvisibleDismantling)
EndWhile
_00E_DismantleResetList.Revert()
EndFunction
Endevent

Loading…
Cancel
Save