-
Posts
82 -
Joined
-
Last visited
Nexus Mods Profile
About lesi123
Profile Fields
-
Country
United States
Recent Profile Visitors
lesi123's Achievements
-
[LE] MCM List Option Buttons
lesi123 replied to lesi123's topic in Skyrim's Creation Kit and Modders
I messed around with the menus a bit more and found that while the menu list doesn't have a built in Accept/Cancel button, ShowMessage does. Using that, I made some prompts so if you opened the menu and didn't mean to or had second thoughts, you could select any option and just say "No" on the prompt and it would kick you back out to your previous selection with no values changed. Here's a bare bones version of what I did in case anyone wants to know: int PresetsOID_M ; Menu to choose presets string[] PresetsList ; Options on menu to choose a preset int OldPresetIndex ; Integer for current selected preset int PresetsIndex = 0 ; Default option on menu is None event OnConfigInit() ... PresetsList = new string[...] PresetsList[0] = "None " ; space needed after None or menu is blank PresetsList[1] = "Preset 1" PresetsList[2] = "Preset 2" PresetsList[3] = "Preset 3" ... endEvent event OnOptionMenuAccept(int option, int index) if (option == PresetsOID_M) PresetsIndex = index SetMenuOptionValue(PresetsOID_M, PresetsList[PresetsIndex]) ; ---------- DEFAULT BLANK PRESET ---------- if (index == 0) ; None ShowMessage("No preset selected.", false) SetMenuOptionValue(PresetsOID_M, PresetsList[OldPresetIndex]) ; Go back to previous preset selection ; ---------- PRESET 1 ---------- elseif (index == 1) ; Preset 1 if ShowMessage("Are you sure you want to enable Preset 1?", true, "Yes", "No") OldPresetIndex = 1 ; Do stuff ShowMessage("All options adjusted to Preset 1.", false) ForcePageReset() else SetMenuOptionValue(PresetsOID_M, PresetsList[OldPresetIndex]) endif ; ---------- PRESET 2 ---------- elseif (index == 2) ; Preset 2 if ShowMessage("Are you sure you want to enable Preset 2?", true, "Yes", "No") OldPresetIndex = 2 ; Do stuff ShowMessage("All options adjusted to Preset 2.", false) ForcePageReset() else SetMenuOptionValue(PresetsOID_M, PresetsList[OldPresetIndex]) endif ; ---------- PRESET 3 ---------- elseif (index == 3) ; Preset 3 if ShowMessage("Are you sure you want to enable Preset 3?", true, "Yes", "No") OldPresetIndex = 3 ; Do stuff ShowMessage("All options adjusted to Preset 3.", false) ForcePageReset() else SetMenuOptionValue(PresetsOID_M, PresetsList[OldPresetIndex]) endif endif endif EndEvent -
[LE] MCM List Option Buttons
lesi123 replied to lesi123's topic in Skyrim's Creation Kit and Modders
I see, good idea! Thanks! -
Is there a way to add a Cancel button to a menu list that just closes the list and ignores any selection changes? I only see Default and Exit buttons. Selecting Default does the expected and loads the default option but selecting Exit (or pressing Escape) forces whichever option is currently selected to load. It causes some values to reset if they were altered after initally selecting an option from the list.
-
[LE] Throttling OnHit scripts
lesi123 replied to lesi123's topic in Skyrim's Creation Kit and Modders
Masterofnet, When you PM’ed me on Dec 22 about the script rewrites you and ReDragon had done, I replied with the following PM: I did not abandoned this thread; I stated in my last post I would update this thread if I had anything else to report after using the wait function in addition to using states. Since then, I’ve run into no issues and thus had no reason to check back in except for when you PM’d me and asked me to, which I did. However, my script was working fine and there was so much back and forth between script rewrites that I didn’t feel it prudent to partake in that conversation. I was actually surprised that this thread was still going. Also, I clearly stated that I would not be working on the mod during the holidays. I am spending time with friends and family and occasionally checking my mod pages for questions. As for respect, if you read the PM I sent you and my previous posts on this thread, I have thanked everyone for their time and help because it has truly been helpful. I do not mod for a living. I do not script for a living. I don’t even work with computers for a living, so to find time to mod is somewhat challenging for me but I do this to relax, offer help when I can, ask for help when I need it, and offer my thanks to anyone involved, but the original problem of throttling OnHit has been solved. If you’ve lost faith in me, that’s your problem. All that said, I will not be revisiting this thread again. -
[LE] Throttling OnHit scripts
lesi123 replied to lesi123's topic in Skyrim's Creation Kit and Modders
I had added in the OnHit event inside the Busy state so I could fire a debug notification to see how many times the event was firing while in that state. Without the utility.wait, I never saw my message fire from the Busy state during a fight. I've tried different methods of accomplishing what I wanted over the past few years (abilities, perks, spells), but many would conflict with other mods and I wanted to avoid that as much as possible. Also, since this script is attached to a quest on the player, it can be turned on or off which I find very nice. Most sources of damage that hit the player returns as a weapon so I had to get more specific with keywords. That's why I had to take out dragons and hagravens from the script because dragon breaths and hagraven firebolt spells were returning as weapons and applying bleeds to the player. I used these in my OnHit events for testing: debug.notification("Attacker is" + akAggressor) debug.notification("Source is" + akSource) I don't get it, but I'll roll with the punches. -
[LE] Throttling OnHit scripts
lesi123 replied to lesi123's topic in Skyrim's Creation Kit and Modders
Since I was fighting a single sun dragon and the only real mods I have are my mod and Deadly Dragons, I wouldn't have thought the system would overload as much as it did. That, and the dragon was part of the DragonRace, I had expected the script to stop at the (Aggressor.GetRace() != DragonRace) on the first line. I'm seriously stumped on that one. -
[LE] Throttling OnHit scripts
lesi123 replied to lesi123's topic in Skyrim's Creation Kit and Modders
Sorry I haven't kept a very close tabs on this thread since my last post but I think I found a workaround with the script after lots (and lots...) of debug notifications. My thought was by adding a Utility.Wait(X) before the script is to head back into the Ready state, the script would be forced to chill out in the busy state until he "cooldown" was up. I just got finished a fight that dang sun dragon for 20 minutes and then a 5 minute fight with a pack of 5 wolves; bleeds were being applied appropriately and no errors or stack dumps showed up in the log from the session. ReDragon, thank you very much for the rewrite! I'll have to read through it, I'm still not the best at scripting and it takes awhile to grasp things. I'll have to do more testing later though, work comes early in the morning. I'll update this topic if I have anything else to report. Again, thank you everyone for your help! -
[LE] Throttling OnHit scripts
lesi123 replied to lesi123's topic in Skyrim's Creation Kit and Modders
I spawned the Sun Dragon with only USLEEP, SkyUI, MfgConsole, and Deadly Dragons and got no errors in my log after 5 minutes of being attacked. As soon as I load in my mod and do the same timed test, it's stack dumping with 1-2 thousand counts of this: Frame count: 0 (Page count: 0) State: Waiting on other stack for call (Freeze state: Freezing) Type: Normal Return register: None Has stack callback: No Stack trace: [alias PlayerAlias on quest BTDQuestCREATUREtoPLAYERBleedDmg (0C01F387)].BTDCREATUREtoPLAYERDmg.OnHit() - (requested call) [param 0]: None [param 1]: [SPELL < (0D051BFF)>] [param 2]: [PROJECTILE < (0200C610)>] [param 3]: False [param 4]: False [param 5]: False [param 6]: False I've not seen any drop in FPS during battles either. Adding an empty OnHit event in the busy state is giving the same result. The other instance of my script showing up in the log is 1 count of this: Frame count: 1 (Page count: 1) State: Running (Freeze state: Freezing) Type: Normal Return register: None Has stack callback: No Stack trace: [alias PlayerAlias on quest BTDQuestCREATUREtoPLAYERBleedDmg (0C01F387)].BTDCREATUREtoPLAYERDmg.OnHit() - "BTDCREATUREtoPLAYERDmg.psc" Line 74 IP: 1374 Instruction: 41 Line: 74 [akAggressor]: None [akSource]: [WEAPON < (000001F4)>] [akProjectile]: None [abPowerAttack]: False [abSneakAttack]: False [abBashAttack]: False [abHitBlocked]: False [::NoneVar]: None [::temp0]: None [::temp1]: None [::temp2]: False [::temp3]: None [::temp4]: False [::temp5]: None [::temp6]: None [::temp7]: False and 1 count of this: Frame count: 1 (Page count: 1) State: Running (Freeze state: Freezing) Type: Normal Return register: None Has stack callback: No Stack trace: [alias PlayerAlias on quest BTDQuestCREATUREtoPLAYERBleedDmg (0C01F387)].BTDCREATUREtoPLAYERDmg.OnHit() - "BTDCREATUREtoPLAYERDmg.psc" Line 74 IP: 1374 Instruction: 41 Line: 74 [akAggressor]: None [akSource]: [SPELL < (0D051BFF)>] [akProjectile]: [PROJECTILE < (0200C610)>] [abPowerAttack]: False [abSneakAttack]: False [abBashAttack]: False [abHitBlocked]: False [::NoneVar]: None [::temp0]: None [::temp1]: None [::temp2]: False [::temp3]: None [::temp4]: False [::temp5]: None [::temp6]: None [::temp7]: False -
[LE] Throttling OnHit scripts
lesi123 replied to lesi123's topic in Skyrim's Creation Kit and Modders
Well, I spoke too soon. I fought the dragon for longer this time (a little over 5 minutes) and ended up with stack dumps again, log at 3,285kb. The script below is what I'm using. It takes longer to start dumping stacks but it seems to still have trouble keeping up. -
[LE] Throttling OnHit scripts
lesi123 replied to lesi123's topic in Skyrim's Creation Kit and Modders
ScriptName LongFunctionScript extends ObjectReference Function LongFunction() GoToState("Busy") ; Don't run this function again until it's finished ; Do something that takes a long time GoToState("Waiting") ; The function has finished, so it can be called again EndFunction State Busy Function LongFunction() ; Do nothing EndFunction EndState On the Cipscis site's example above, I simply replaced LongFunction with OnHit. I thought maybe it was serving an important purpose being there. :| -
[LE] Throttling OnHit scripts
lesi123 replied to lesi123's topic in Skyrim's Creation Kit and Modders
Whoops, I didn't see the other changes in the script. My bad! Just did the same test as the others with all of your changes and had no errors in the log (24kb file). I also spawned in some wolves to double check the hits were registering from races that could give the player bleeds; so far so good! I will continue testing and hope that this was the last scripting hurdle. Thank you very much for all of your help guys! -
[LE] Throttling OnHit scripts
lesi123 replied to lesi123's topic in Skyrim's Creation Kit and Modders
Here's my script that I have been testing: Scriptname BTDCREATUREtoPLAYERDmg extends ReferenceAlias {Script that handles Creature to Player bleed damage} ;--------------------------------------------------------------------------------------------------------------------------------------- ; The HitChance conditions in the function blocks control the hit chances to apply the bleed damage spells to targets. To increase the chances of applying a bleed, use a lower number. To reduce the chances of applying a bleed, use a higher number. ;--------------------------------------------------------------------------------------------------------------------------------------- Actor Property PlayerRef Auto Race Property WolfRace Auto Race Property SlaughterfishRace Auto Race Property SabreCatRace Auto Race Property SabreCatSnowyRace Auto Race Property BearBlackRace Auto Race Property BearBrownRace Auto Race Property BearSnowRace Auto Race Property IceWraithRace Auto Race Property WerewolfBeastRace Auto Race Property SprigganRace Auto Race Property SprigganMatronRace Auto Race Property TrollRace Auto Race Property TrollFrostRace Auto Race Property DwarvenSphereRace Auto Race Property DwarvenCenturionRace Auto Race Property DLC1DeathHoundRace Auto Race Property DLC1SabreCatGlowRace Auto Race Property SprigganEarthMotherRace Auto Race Property DLC1GargoyleRace Auto Race Property DLC1GargoyleVariantBossRace Auto Race Property DLC1GargoyleVariantGreenRace Auto Race Property DLC2SprigganBurntRace Auto Race Property DLC2WerebearBeastRace Auto Race Property DLC1LD_ForgemasterRace Auto Race Property DLC2DwarvenBallistaRace Auto Race Property DLC2dunKarstaagIceWraithRace Auto Race Property DragonRace Auto Spell Property BTDSpellCREATURESmalltoPLAYERBleedDmg Auto Spell Property BTDSpellCREATUREMediumtoPLAYERBleedDmg Auto Spell Property BTDSpellCREATURELargetoPLAYERBleedDmg Auto Spell Property BTDSpellCREATUREXLargetoPLAYERBleedDmg Auto Keyword Property ActorTypeAnimal Auto Keyword Property ActorTypeCreature Auto Keyword Property ActorTypeDwarven Auto Actor Aggressor Race AggressorRace Int HitChance ; Dragons and hagravens had to be excluded since their breaths and spells would apply bleeds to the player. ;------------------------------------------------------------------------------------------------------------------------ ; HIT REGISTERED ON PLAYER ;------------------------------------------------------------------------------------------------------------------------ Auto State Ready Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked) GoToState("Busy") ; Don't run this function again until it's finished Aggressor = akAggressor as Actor if (akAggressor != None) && (akSource as Weapon) && (abHitBlocked != true) && (Aggressor.GetRace() != DragonRace) && !(akSource as Spell) if (Aggressor.HasKeyword(ActorTypeAnimal)) PlayerHitByAnimal(Aggressor) elseif (Aggressor.HasKeyword(ActorTypeCreature)) PlayerHitByCreature(Aggressor) elseif (Aggressor.HasKeyword(ActorTypeDwarven)) PlayerHitByDwarven(Aggressor) endif endif GoToState("Ready") ; The function has finished, so it can be called again EndEvent EndState State Busy Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked) ; Nothing EndEvent EndState ;------------------------------------------------------------------------------------------------------------------------ ; FUNCTION BLOCKS ;------------------------------------------------------------------------------------------------------------------------ ; ---------- Player hit by an animal ---------- Function PlayerHitByAnimal(Actor Param1) AggressorRace = Aggressor.GetRace() HitChance = Utility.RandomInt() if ((AggressorRace == WolfRace) && (HitChance >= 70)) || ((AggressorRace == SlaughterfishRace) && (HitChance >= 30)) BTDSpellCREATURESmalltoPLAYERBleedDmg.cast(PlayerRef,PlayerRef) elseif ((AggressorRace == SabreCatRace) && (HitChance >= 60)) || ((AggressorRace == SabreCatSnowyRace) && (HitChance >= 50)) || ((AggressorRace == BearBlackRace) && (HitChance >= 50)) || ((AggressorRace == BearBrownRace) && (HitChance >= 60)) || ((AggressorRace == BearSnowRace) && (HitChance >= 50)) || ((AggressorRace == DLC1SabreCatGlowRace) && (HitChance >= 50)) BTDSpellCREATUREMediumtoPLAYERBleedDmg.cast(PlayerRef,PlayerRef) elseif ((AggressorRace == TrollRace) && (HitChance >= 60)) || ((AggressorRace == TrollFrostRace) && (HitChance >= 50)) BTDSpellCREATURELargetoPLAYERBleedDmg.cast(PlayerRef,PlayerRef) endif EndFunction ; ---------- Player hit by a creature ---------- Function PlayerHitByCreature(Actor Param1) AggressorRace = Aggressor.GetRace() HitChance = Utility.RandomInt() if ((AggressorRace == DLC1DeathHoundRace) && (HitChance >= 70)) BTDSpellCREATURESmalltoPLAYERBleedDmg.cast(PlayerRef,PlayerRef) elseif ((AggressorRace == IceWraithRace) && (HitChance >= 50)) || ((AggressorRace == DLC2dunKarstaagIceWraithRace) && (HitChance >= 50)) BTDSpellCREATUREMediumtoPLAYERBleedDmg.cast(PlayerRef,PlayerRef) elseif ((AggressorRace == WerewolfBeastRace) && (HitChance >= 50)) || ((AggressorRace == SprigganRace) && (HitChance >= 60)) || ((AggressorRace == SprigganMatronRace) && (HitChance >= 50)) || ((AggressorRace == SprigganEarthMotherRace) && (HitChance >= 40)) || ((AggressorRace == DLC1GargoyleRace) && (HitChance >= 50)) || ((AggressorRace == DLC1GargoyleVariantBossRace) && (HitChance >= 40)) || ((AggressorRace == DLC1GargoyleVariantGreenRace) && (HitChance >= 50)) || ((AggressorRace == DLC2SprigganBurntRace) && (HitChance >= 60)) || ((AggressorRace == DLC2WerebearBeastRace) && (HitChance >= 50)) BTDSpellCREATURELargetoPLAYERBleedDmg.cast(PlayerRef,PlayerRef) endif EndFunction ; ---------- Player hit by a dwarven automaton ---------- Function PlayerHitByDwarven(Actor Param1) AggressorRace = Aggressor.GetRace() HitChance = Utility.RandomInt() if ((AggressorRace == DwarvenSphereRace) && (HitChance >= 50)) BTDSpellCREATURELargetoPLAYERBleedDmg.cast(PlayerRef,PlayerRef) elseif ((AggressorRace == DwarvenCenturionRace) && (HitChance >= 20)) || ((AggressorRace == DLC1LD_ForgemasterRace) || (AggressorRace == DLC2DwarvenBallistaRace) && (HitChance >= 10)) BTDSpellCREATUREXLargetoPLAYERBleedDmg.cast(PlayerRef,PlayerRef) endif EndFunction I did two tests just now with a Sun Dragon from DD. Both tests were timed for 1min 30sec as soon as I spawned the dragon. My character was at the entrance to the cave leading from Helgen (save with no mods) and the only other NPC nearby was Rolof. The first test was with the script above as is. The log was 242kb. Image of the Papyrus Log Viewer: http://i.imgur.com/CsM7NdI.png The second test was with the OnHit Event in the Busy state marked out with ;. The log was 598kb. Image of the papyrus Log Viewer: http://i.imgur.com/XEzLEmy.png -
[LE] Throttling OnHit scripts
lesi123 replied to lesi123's topic in Skyrim's Creation Kit and Modders
Sure thing. As soon as I get home from work I'll post what I have written and maybe someone can spot something I missed. -
Did you remember to add the PlayerRef to the property? I'm a constant offender of this. :P
-
[LE] Throttling OnHit scripts
lesi123 replied to lesi123's topic in Skyrim's Creation Kit and Modders
After doing some more stress testing, I’ve run into another issue with throttling. As of now, dragons are my favorite NPC to test OnHit scripts with since they spit out so many and I’m able to get a rough idea of how much it takes to make Papyrus overload. Deadly Dragons is one of my favorite mods and so I’ve been using that to help test. However, after spawning a single Sun Dragon from DD, I get stack dumps less than a minute after combat begins. I disabled every other mod in my load order except for official DLC, USLEEP, SkyUI, MfgConsole, Deadly Dragons, and Bleed Them Dry(my mod) and it’s the same situation of stack dumps shortly after combat starts. I’m assuming that even though my script may be in the Busy state, the script is still requesting to run even though it would return nearly instantly since the Busy state has no code in it. My character is just getting pummeled too fast with OnHit events from stuff during the fight with the Sun Dragon for Papyrus to keep up, regardless of states. As of now, I’m using a quest to add or remove the OnHit script from the player depending on an option selected in the MCM. Would it be wise to make an stronger throttle option that starts and stops the quest in some sort of interval to allow Papyrus to catch up? Such as starting the quest, waiting X seconds, stopping the quest for X seconds, starting the quest again, waiting X seconds, etc. I have no idea how resource intensive it is on the system to start and stop quests though or if there is a better method. This seems to be a very situational issue but I’m hoping to find a way to work with it since I really like Deadly Dragons.