Jump to content

VencGanence

Supporter
  • Posts

    28
  • Joined

  • Last visited

Nexus Mods Profile

About VencGanence

Profile Fields

  • Country
    United States

VencGanence's Achievements

Explorer

Explorer (4/14)

  • First Post
  • Collaborator Rare
  • Week One Done
  • One Month Later
  • One Year In

Recent Badges

0

Reputation

  1. Better menu code ;Description ;----------------------------------------------------------------------------- ;Menu for changing meshes. ;Takes an array containing shorts, whose structure is listed below. ;Displays a Table of Contents when SubMenu = 0 and lists page ranges of PgHi ;size. If there's only one range on the ToC or PgHi <= 0, skips ToC entirely. ;Uses Page to determine which names to display on the buttons when past ToC. ;Returns to ToC if Page < PageLowerBound or Page > PageLowerBound + PgHi. This ;obviously doesn't happen if ToC is skipped. ;Displays a maximum of 7 names per Page, due to MessageBox's button limit. ; ;Makes use of MessageBox's inability to handle empty strings to truncate ;unneeded buttons. ; ;Called when Menu[0] = 4 || 5. ; ;Menu: ;0::MenuIndex ;1::Button ;2::Page ;3::SubMenu ;4::PageLowerBound ;----------------------------------------------------------------------------- ;Parameters ;----------------------------------------------------------------------------- string_var Name array_var Data array_var Menu ;Return value string_var But0 string_var But1 string_var But2 string_var But3 string_var But4 string_var But5 string_var But6 string_var But7 string_var But8 short Size short i short j float PgCnt float Count short PgHi short PgLo array_var Opt ;----------------------------------------------------------------------------- ;----------------------------------------------------------------------------- begin Function { PgHi, Name, Data, Menu } ;----------------------------------------------------------------------------- if eval( Menu[1] == -2 ) Let Size := ar_Size Data DebugPrint "Size: %.0f" Size Let But0 := "[<Back]" ;Empty strings so MessageBox short circuits Let Opt := ar_Map 0::"" 1::"" 2::"" 3::"" 4::"" 5::"" 6::"" 7::"" ;----------------------------------------------------------------------------- ;Table of contents ;----------------------------------------------------------------------------- if eval( Menu[3] == 0 ) ;Header Let Name += " Form Table of Contents:" Let PgCnt := Size / 7 Let PgCnt := Ceil PgCnt if ( PgHi > 0 ) Let Count := PgCnt / PgHi Let Count := Ceil Count else Let Count := 1 endif ;If only 1 button, skip this submenu if ( Count == 1 ) ;Page is negative if we are going [<Back] if eval( Menu[2] < 0 ) Let Menu[0] := 1 ;Else we are going forward else Let Menu[3] := 1 Let Menu[4] := Menu[5] := 0 endif ;Button is already -2 SetFunctionValue Menu Return ;Adjust PgHi if going over 8 buttons elseif ( Count > 8 ) Let Count := PgCnt / 8 Let PgHi := Ceil Count ;Recalc Count Let Count := PgCnt / PgHi Let Count := Ceil Count endif ;Store PgHi incase it was modified ;Menu[5] will be wiped once Menu[0] = 0 Let Menu[5] := PgHi ;Populate Opt with page ranges Let i := 0 while ( i < Count ) Let PgLo := 1 + ( i * PgHi ) Let Opt[i] := "Page " + $(PgLo) ;Get the end of the buttons range Let j := PgLo + PgHi - 1 if ( j > PgCnt ) Let j := PgCnt endif ;Only show a range if there is a range if ( j > PgLo ) Let Opt[i] += " - " + $(j) endif Let i += 1 loop ;----------------------------------------------------------------------------- ;Individual pages ;----------------------------------------------------------------------------- elseif eval( Menu[3] == 1 ) ;Header Let Name += " Form (p. " + $(Menu[2]+1) + "):" ;Change Back to Prev if hitting it will return to another individual page if eval( Menu[2] != Menu[4] ) Let But0 := "[<Prev]" endif ;Until all 7 buttons are filled or reach end of Data Let i := Menu[2] * 7 Let j := i + 7 while ( i < j && i < Size ) Let Opt[i%7] := Data[i][6] Let i += 1 loop ;Truncate [Next>] if all 7 buttons are filled but there is no next page if ( i < Size ) if eval( Menu[5] > 0 && Menu[2] >= Menu[4] + Menu[5] - 1 ) Let Opt[7] := "[Back>]" else Let Opt[7] := "[Next>]" endif endif endif Let But1 := Opt[0] Let But2 := Opt[1] Let But3 := Opt[2] Let But4 := Opt[3] Let But5 := Opt[4] Let But6 := Opt[5] Let But7 := Opt[6] Let But8 := Opt[7] ;Display menu MessageBox $Name "[Cancel]" $But0 $But1 $But2 $But3 $But4 $But5 $But6 $But7 $But8 Let Menu[1] := -1 elseif eval( Menu[1] < 0 ) Let Menu[1] := GetButtonPressed elseif eval( Menu[1] == 0 ) ;Cancel DebugPrint "Cancelling MeshMenu." Let Menu[0] := 0 elseif eval( Menu[1] == 1 ) Let Menu[1] := -2 if eval( Menu[3] == 0 ) ;Back DebugPrint "Returning to FormMenu." Let Menu[0] := 1 elseif eval( Menu[3] == 1 ) ;Prev Let Menu[2] -= 1 if eval( Menu[2] < Menu[4] ) ;Back DebugPrint "Returning to MeshMenu ToC." Let Menu[3] -= 1 endif endif elseif eval( Menu[3] == 1 && Menu[1] == 9 ) ;Next Let Menu[2] += 1 Let Menu[1] := -2 if eval( Menu[5] > 0 && Menu[2] >= Menu[4] + Menu[5] ) ;Back DebugPrint "Returning to MeshMenu ToC." Let Menu[3] -= 1 endif else ;if ToC, adjust Page based on button chosen if eval( Menu[3] == 0 ) ;Menu[4] will be wiped once Menu[0] = 0 Let Menu[2] := Menu[4] := Menu[5] * ( Menu[1] - 2 ) Let Menu[1] := -2 endif Let Menu[3] += 1 endif SetFunctionValue Menu Return ;----------------------------------------------------------------------------- end ;Function { PgHi, Name, Data, Menu } ;-----------------------------------------------------------------------------
  2. Speaking of large lists, the mod's up to 16 pages on some body parts, so... yeah. Gonna need a solution to cut down that navigation time. Thinking of implementing a table of contents atm
  3. I've got a start. It's fine for small lists, but I'll need something more to reduce navigation time on large lists. ;Description ;----------------------------------------------------------------------------- ;Menu for changing meshes. ;Takes a name, array of mesh data, last button pressed and current menu page. ;Uses Page to determine which section of Data to list in the menu. ;Makes use of MessageBox inability to handle empty strings to truncate ;unneeded buttons. ;----------------------------------------------------------------------------- ;Parameters ;----------------------------------------------------------------------------- string_var Name array_var Data short Button ;Return value short Page ;Return value string_var But0 string_var But1 string_var But2 string_var But3 string_var But4 string_var But5 string_var But6 string_var But7 string_var But8 short Size short i short j array_var Opt ;----------------------------------------------------------------------------- ;----------------------------------------------------------------------------- begin Function { Name, Data, Button, Page } ;----------------------------------------------------------------------------- if ( Button == -2 ) ;Header Let Name += " Form (p. " + $(Page+1) + "):" if ( Page == 0 ) Let But0 := "Back" else Let But0 := "Prev" endif ;Empty strings so MessageBox short circuits Let Opt := ar_Map 0::"" 1::"" 2::"" 3::"" 4::"" 5::"" 6::"" ;Until all 7 buttons are filled or reach end of Data Let i := Page * 7 Let j := i + 7 Let Size := ar_Size Data while ( i < j && i < Size ) Let Opt[i%7] := Data[i][6] Let i += 1 loop Let But1 := Opt[0] Let But2 := Opt[1] Let But3 := Opt[2] Let But4 := Opt[3] Let But5 := Opt[4] Let But6 := Opt[5] Let But7 := Opt[6] ;Truncate next if all 7 buttons are filled but there is no next page if ( i == Size ) Let But8 := "" else Let But8 := "Next" endif ;Display menu MessageBox $Name "Cancel" $But0 $But1 $But2 $But3 $But4 $But5 $But6 $But7 $But8 Let Button := -1 elseif ( Button < 0 ) Let Button := GetButtonPressed endif SetFunctionValue ar_Map 0::Button 1::Page Return ;----------------------------------------------------------------------------- end ;Function { Name, Data, Button, Page } ;-----------------------------------------------------------------------------
  4. It's not. There's 373 forms (400+ counting vanilla) including claymores, bastard swords, longswords, shortswords, daggers, warhammers, battleaxes, maces, waraxes, bows and staves.
  5. I'll be trying that. Got so OP I could clear gates in 5 minutes, so I do miss running through them...
  6. I'm moving onto the last big part of growth armor's coding: menu code. Like Dusfergon, growth armor will have a form change function and unlike Dusfergon, I stored the data in a proper array this time. So, I want ideas about how to code menus that create themselves dynamically. As in, any change I make to the array - re-ordering, adding or subtracting entries - will be reflected in the menu boxes without having to rewrite the code. I have an idea of how to do the buttons using $Stringify, if not MessageBoxEX, but the dynamic page count... The menu code I wrote for Dusfergon can be found here, here and here. Full V1.6.1 repository here.
  7. Growth Weapon - Dusfergon Grows as you hit things, fully customizable ini file. Made it myself. Most default settings are pretty balanced, but the offering absorption rate wasn't tweaked down when I had it take charge into account as well. I strongly recommend reducing that setting down to 0.05 from 0.13. (You can offer other weapons to Dusfergon and it'll gain XP, durability and charge based on that weapon's own durability and charge. As such, higher tier weapons give more XP)
  8. A bit late to this, but I wrote a giant scripted mod a few months back and am writing another one now, of which I have posted the code for both to GitHub. I commented everything thoroughly with the express intent of others learning from it. https://github.com/Zephyrum-Alsend/Growth-Items The sub-directories Dusfergon and Zefiros specifically. I hope it helps.
  9. Stupid past me moved the function call but didn't change the variable names in that call. I've been getting an inexplicable runtime error on this function: scn aaZefirosReorderEffects ;Main script ;----------------------------------------------------------------------------- ;aaZefirosManager ;----------------------------------------------------------------------------- ;Used scripts ;----------------------------------------------------------------------------- ;----------------------------------------------------------------------------- ;Related scripts ;----------------------------------------------------------------------------- ;aaZefirosSetMergeEnch ;----------------------------------------------------------------------------- ;Used globals ;----------------------------------------------------------------------------- ;----------------------------------------------------------------------------- ;Related globals ;----------------------------------------------------------------------------- ;----------------------------------------------------------------------------- ;Description ;----------------------------------------------------------------------------- ;Given a table containing MagicEffect and ActorValue codes and an array of ;enchantments, moves all listed effect items to the back of each enchantment ;by deleting and undeleting them. ; ;Effects: ;[0]EffectCode ;[1]ActorValueCode ;----------------------------------------------------------------------------- ;Parameters ;----------------------------------------------------------------------------- array_var Effects array_var Enchs short Size short Count short i short j long EffC long Magn long Area long Dura short Rang short AuxC ref Spl array_var Ench array_var Data ;----------------------------------------------------------------------------- ;----------------------------------------------------------------------------- begin Function { Effects, Enchs } ;----------------------------------------------------------------------------- Let Size := ar_Size Enchs DebugPrint "Reorganizing effects on %.0f enchantment(s)..." Size Let Data := ar_Construct Array Let Size := ar_Size Effects ForEach Ench <- Enchs Let Spl := *Ench ;----------------------------------------------------------------------------- ;Find and remove each effect ;----------------------------------------------------------------------------- Let Count := GetMagicItemEffectCount Spl Let i := Count while ( i > 0 ) Let i -= 1 ;Check if this effect is on the list Let j := 0 while ( j < Size ) ;If it is... if eval( Effects[j][0] == GetNthEffectItemCode Spl i && Effects[j][1] == GetNthEffectItemActorValue Spl i ) ;Remove effect and store its values ar_Append Data GetNthEffectItem Spl i RemoveNthEffectItem Spl i endif Let j += 1 loop loop ;----------------------------------------------------------------------------- ;Add each removed effect back ;----------------------------------------------------------------------------- Let Count := ar_Size Data Let j := 0 while ( j < Count ) Let EffC := Data[j]["effectCode"] Let Magn := Data[j]["magnitude"] Let Area := Data[j]["area"] Let Dura := Data[j]["duration"] Let Rang := Data[j]["range"] Let i := AddFullEffectItemC EffC Magn Area Dura Rang Spl if eval( ar_HasKey Data[j] "actorValue" ) Let AuxC := Data[j]["actorValue"] SetNthEffectItemActorValueC AuxC Spl i endif Let j += 1 loop ;Reset Data for next loop ar_Erase Data loop DebugPrint "Reorganized effects." Return ;----------------------------------------------------------------------------- end ;Function { Effects, Enchs } ;----------------------------------------------------------------------------- The line throwing the runtime error is: Let Spl := *Ench However, there is no actual error. Effects are properly re-ordered, everything behaves as desired. Yet this line keeps throwing the "Expression failed to evaluate" error. I've tried Let Spl := Ench["value"] Same error. I've also ar_Dump Ench and it looks right, ["key"] = 0.0000000 ["value"] = Ench2 I have no idea what's causing this error to be thrown here.
  10. I found a method to detect disease contraction, using an OnMagicApply event handler: ;Parameters ;----------------------------------------------------------------------------- ref MagicItem ref Caster ref Self short Type ;----------------------------------------------------------------------------- ;----------------------------------------------------------------------------- begin Function { MagicItem, Caster } ;----------------------------------------------------------------------------- ;GetSelf returns who was hit Let Self := GetSelf Let Type := GetSpellType MagicItem if ( Self == Player && Type == 1 ) DebugPrint "%n contracted %n." Self MagicItem endif ;----------------------------------------------------------------------------- end ;----------------------------------------------------------------------------- Unfortunately, this handler type cannot be filtered by target, so there will be some wasted cycles. Edit: oddly enough, the Caster for diseases is the victim, so I can apply a filter for Caster. The question is if mod added diseases have the same behaviour.
  11. There's functions to get the total magnitude of disease effects, but that information doesn't tell me what I want.
  12. That does seem like the only way to me, but it has the unwanted drawback of being unable to detect multiple diseases unless I go a step further tracking sources of effects in addition to effect types. That just sounds like it'd get a bit too complicated, which worries me that it may impact performance. There are the OnMagicApply and OnMagicCast event handlers, but my testing of OnMagicApply fired inconsistently, plus I don't know if a disease would trigger the handler despite technically being a spell.
  13. Is it possible to detect when the PC contracts a disease? I don't need to know which disease it is, simply the moment they contract it. I don't want to detect that they have a disease, but that they gained a disease.
  14. I ended up making 2 methods to accomplish what I wanted, leaving only scripted effects on a dynamically generated enchantment. One is very simple: Create Ench Create EnchBase RemoveAllEffectItems Ench CopyAllEffectItems EnchBase Ench The other is to make my own RemoveAllEffectItems function that ignores scripted effects.
  15. Is it possible to dynamically add script effects to enchantments like regular effects can? As in after RemoveAllEffectItems Ench I can do some wizardry to re-add the script effect A Ctrl+F through the list of functions showed a lot of stuff for setting and getting script effect items, but none for adding. GetNthEffectItemScript GetNthEffectItemScriptName GetNthEffectItemScriptSchool GetNthEffectItemScriptVisualEffect GetSpellScriptEffectAlwaysApplies IsNthEffectItemScripted IsNthEffectItemScriptHostile MagicItemHasEffectItemScript ModNthEffectItemScriptName ScriptEffectElapsedSeconds SetNthEffectItemScript SetNthEffectItemScriptHostile SetNthEffectItemScriptName SetNthEffectItemScriptNameEX SetNthEffectItemScriptSchool SetNthEffectItemScriptVisualEffect SetNthEffectItemScriptVisualEffectC SetSpellScriptEffectAlwaysApplies is what turned up.
×
×
  • Create New...