With that issue resolved I'm doing a re-write to have both the menu and HUD icons be set using the ui XML. It will eliminate all the remaining issues and provide seamless icon replacement.
Nice. Can't wait :thumbsup:
scn LPCSBActiCheckCurrentSpellScriptref rSpellarray_var aIteratorBegin OnActivate let rSpell := GetPlayerSpell if ( Player.HasSpell rSpell == 0 ) && ( GetObjectType rSpell == 16 ) DebugPrint "%aLPCSB:%a Player has equipped a hidden Spell -> Search other Spell", 2, 3 ForEach aIterator <- ( Player.GetSpells ) let rSpell := aIterator["Value"] if ( GetSpellType rSpell == 1 ) || ( GetSpellType rSpell == 4 ) ;Disease || Ability Continue else SelectPlayerSpell rSpell Break endif Loop if ( Player.HasSpell rSpell == 0 ) DebugPrint "%aLPCSB:%a No Spell found -> Search for Scrolls", 2, 3 ForEach aIterator <- ( Player.GetItems 21 ) let rSpell := aIterator["Value"] if ( GetBookIsScroll rSpell ) SelectPlayerSpell rSpell Break endif Loop endif let aIterator := ar_Null endifEnd
if ((currentSpell != GetPlayerSpell) || (refresh)) set currentSpell to GetPlayerSpell if (refresh) SelectPlayerSpell CSIDummySpell SelectPlayerSpell currentSpell set refresh to 0 endif...
RunScriptLine "set LPUSfEQuInitialization.rCustomSpellIcons to CustomSpellIcons" set lIndex to ( GetSourceModIndex rCustomSpellIcons ) set sTemp to ( GetNthModName lIndex ) set rCustomSpellIconsReset to ( GetFormFromMod $sTemp "001C82" ) set rCustomSpellIconsSet to ( GetFormFromMod $sTemp "0015AD" ) sv_Destruct sTemp if Eval ( IsFormValid rCustomSpellIconsSet ) && ( !bCustomSpellIcons ) if ( IsReference rCustomSpellIconsSet ) ;I put this one in because I used the wrong FormID first ^^ if ( rCustomSpellIconsSet.HasVariable "SpellRef" ) && ( rCustomSpellIconsSet.HasVariable "IconPath" ) PrintD ( ASCIIToChar 2 ) + "LPUSfE (" + ( GetFormIDString rScript ) + "):" + ( ASCIIToChar 3 ) + " Custom Spell Icons found." set bCustomSpellIcons to 1 let aMagicItems := ( Call LPUSfEFuncGetAllMagicItems ) PrintD ( ASCIIToChar 2 ) + "LPUSfE (" + ( GetFormIDString rScript ) + "):" + ( ASCIIToChar 3 ) + " Start, MagicEffectCount: " + ( ToString ( ar_Size aMagicItems ) ) ForEach aIterator <- aMagicItems let rMagicItem := ( aIterator["Value"] ) PrintD ( ASCIIToChar 2 ) + "LPUSfE (" + ( GetFormIDString rScript ) + "):" + ( ASCIIToChar 3 ) + " MagicItem: " + ( GetName rMagicItem ) + " (" + ( GetFormIDString rMagicItem ) + ")" set lIndex to -1 While ( ( lIndex += 1 ) < ( GetMagicItemEffectCount rMagicItem ) ) if ( ( GetNthEffectItemScript rMagicItem, lIndex ) == LPUSfEMEAbsorbScript ) || ( ( GetNthEffectItemScript rMagicItem, lIndex ) == LPUSfEMEDrainScript ) || ( ( GetNthEffectItemScript rMagicItem, lIndex ) == LPUSfEMEFortifyScript ) Break endif Loop if ( lIndex == ( GetMagicItemEffectCount rMagicItem ) ) PrintD ( ASCIIToChar 2 ) + "LPUSfE (" + ( GetFormIDString rScript ) + "):" + ( ASCIIToChar 3 ) + " MagicItem " + ( GetName rMagicItem ) + " (" + ( GetFormIDString rMagicItem ) + ") doesn't have an Unarmored ME-Script." Continue endif if ( ( GetNthEffectItemScript rMagicItem, lIndex ) == LPUSfEMEAbsorbScript ) set rMagicEffect to ( MagicEffectFromChars ABSK ) elseif ( ( GetNthEffectItemScript rMagicItem, lIndex ) == LPUSfEMEDrainScript ) set rMagicEffect to ( MagicEffectFromChars DRSK ) elseif ( ( GetNthEffectItemScript rMagicItem, lIndex ) == LPUSfEMEFortifyScript ) set rMagicEffect to ( MagicEffectFromChars FOSK ) endif set sIconPath to ( GetIconPath rMagicEffect ) PrintD ( ASCIIToChar 2 ) + "LPUSfE (" + ( GetFormIDString rScript ) + "):" + ( ASCIIToChar 3 ) + " IconPath: " + sIconPath rCustomSpellIconsSet.RunScriptLine "set SpellRef to %i", rMagicItem, 1 ;These are the lines where I'm not sure if they're working rCustomSpellIconsSet.RunScriptLine "set IconPath to %.0f", sIconPath, 1 ;These are the lines where I'm not sure if they're working rCustomSpellIconsSet.Activate2 Player, 1 Loop sv_Destruct sIconPath PrintD ( ASCIIToChar 2 ) + "LPUSfE (" + ( GetFormIDString rScript ) + "):" + ( ASCIIToChar 3 ) + " Finished, MagicEffectCount: " + ( ToString ( ar_Size aMagicItems ) ) else PrintD ( ASCIIToChar 2 ) + "LPUSfE (" + ( GetFormIDString rScript ) + "):" + ( ASCIIToChar 3 ) + " Variables not found. Reference: " + ( rCustomSpellIconsSet.GetName ) + " (" + ( rCustomSpellIconsSet.GetFormIDString ) + ")" set bCustomSpellIcons to 0 endif else PrintD ( ASCIIToChar 2 ) + "LPUSfE (" + ( GetFormIDString rScript ) + "):" + ( ASCIIToChar 3 ) + " Is not a Reference: " + ( GetName rCustomSpellIconsSet ) + " (" + ( GetFormIDString rCustomSpellIconsSet ) + ")" set bCustomSpellIcons to 0 endif endif
scn LPUSfEFuncSetSpellIconslong lIndexref rCustomSpellIconsSetref rMagicEffectref rMagicItemref rScriptarray_var aIteratorarray_var aMagicItemsBegin Function { rCustomSpellIconsSet } set rScript to LPUSfEFuncSetSpellIcons if ( IsFormValid rCustomSpellIconsSet ) PrintD ( ASCIIToChar 2 ) + "LPUSfE (" + ( GetFormIDString rScript ) + "):" + ( ASCIIToChar 3 ) + " Custom Spell Icons found." SetFunctionValue 1 let aMagicItems := ( Call LPUSfEFuncGetAllMagicItems ) PrintD ( ASCIIToChar 2 ) + "LPUSfE (" + ( GetFormIDString rScript ) + "):" + ( ASCIIToChar 3 ) + " Start, MagicEffectCount: " + ( ToString ( ar_Size aMagicItems ) ) ForEach aIterator <- aMagicItems let LPUSfEQuInitialization.rSpell := rMagicItem := ( aIterator["Value"] ) PrintD ( ASCIIToChar 2 ) + "LPUSfE (" + ( GetFormIDString rScript ) + "):" + ( ASCIIToChar 3 ) + " MagicItem: " + ( GetName rMagicItem ) + " (" + ( GetFormIDString rMagicItem ) + ")" set lIndex to -1 While ( ( lIndex += 1 ) < ( GetMagicItemEffectCount rMagicItem ) ) if ( ( GetNthEffectItemScript rMagicItem, lIndex ) == LPUSfEMEAbsorbScript ) || ( ( GetNthEffectItemScript rMagicItem, lIndex ) == LPUSfEMEDrainScript ) || ( ( GetNthEffectItemScript rMagicItem, lIndex ) == LPUSfEMEFortifyScript ) Break endif Loop if ( lIndex == ( GetMagicItemEffectCount rMagicItem ) ) PrintD ( ASCIIToChar 2 ) + "LPUSfE (" + ( GetFormIDString rScript ) + "):" + ( ASCIIToChar 3 ) + " MagicItem " + ( GetName rMagicItem ) + " (" + ( GetFormIDString rMagicItem ) + ") doesn't have an Unarmored ME-Script." Continue endif if ( ( GetNthEffectItemScript rMagicItem, lIndex ) == LPUSfEMEAbsorbScript ) set rMagicEffect to ( MagicEffectFromChars ABSK ) elseif ( ( GetNthEffectItemScript rMagicItem, lIndex ) == LPUSfEMEDrainScript ) set rMagicEffect to ( MagicEffectFromChars DRSK ) elseif ( ( GetNthEffectItemScript rMagicItem, lIndex ) == LPUSfEMEFortifyScript ) set rMagicEffect to ( MagicEffectFromChars FOSK ) endif set LPUSfEQuInitialization.sTemp to ( GetIconPath rMagicEffect ) PrintD ( ASCIIToChar 2 ) + "LPUSfE (" + ( GetFormIDString rScript ) + "):" + ( ASCIIToChar 3 ) + " IconPath: " + LPUSfEQuInitialization.sTemp rCustomSpellIconsSet.RunScriptLine "set SpellRef to LPUSfEQuInitialization.rSpell", 1 rCustomSpellIconsSet.RunScriptLine "set IconPath to LPUSfEQuInitialization.sTemp", 1 rCustomSpellIconsSet.Activate2 Player, 1 Loop sv_Destruct LPUSfEQuInitialization.sTemp PrintD ( ASCIIToChar 2 ) + "LPUSfE (" + ( GetFormIDString rScript ) + "):" + ( ASCIIToChar 3 ) + " Finished, MagicEffectCount: " + ( ToString ( ar_Size aMagicItems ) ) else PrintD ( ASCIIToChar 2 ) + "LPUSfE (" + ( GetFormIDString rScript ) + "):" + ( ASCIIToChar 3 ) + " Custom Spell Icons not found." SetFunctionValue 0 endifEnd
;Scriptname & Variables hereBegin Gamemode;Some other stuff here RunScriptLine "set LPUSfEQuInitialization.rCustomSpellIcons to CustomSpellIcons" set lIndex to ( GetSourceModIndex rCustomSpellIcons ) set sTemp to ( GetNthModName lIndex ) set rCustomSpellIconsReset to ( GetFormFromMod $sTemp "001C82" ) set rCustomSpellIconsSet to ( GetFormFromMod $sTemp "0015AD" ) sv_Destruct sTemp if Eval ( IsFormValid rCustomSpellIconsSet ) && ( !bCustomSpellIcons ) let bCustomSpellIcons := ( Call LPUSfEFuncSetSpellIcons rCustomSpellIconsSet ) if ( bCustomSpellIcons ) PrintD ( ASCIIToChar 2 ) + "LPUSfE (" + ( GetFormIDString rScript ) + "):" + ( ASCIIToChar 3 ) + " Custom Spell Icons Initialized." else PrintD ( ASCIIToChar 2 ) + "LPUSfE (" + ( GetFormIDString rScript ) + "):" + ( ASCIIToChar 3 ) + " Custom Spell Icons couldn't be Initialized." endif endif if ( bAllMIDummyEffectsHidden ) && ( bCustomSpellIcons ) let bAllMIDummyEffectsHidden := ( Call LPUSfEFuncAllMIAddDummyEffects ) PrintD ( ASCIIToChar 2 ) + "LPUSfE (" + ( GetFormIDString rScript ) + "):" + ( ASCIIToChar 3 ) + " Added Dummy Effects." Call LPUSfEFuncSetSpellIcons rCustomSpellIconsSet endifEndBegin Menumode if Eval ( !( Menumode 1022 ) ) && ( !( Menumode 1037 ) ) || ( !bCustomSpellIcons ) || ( bAllMIDummyEffectsHidden ) ;Magic / Spell Purchase Return endif let bAllMIDummyEffectsHidden := ( Call LPUSfEFuncAllMIRemoveDummyEffects ) PrintD ( ASCIIToChar 2 ) + "LPUSfE (" + ( GetFormIDString rScript ) + "):" + ( ASCIIToChar 3 ) + " Removed Dummy Effects." Call LPUSfEFuncSetSpellIcons rCustomSpellIconsSetEnd