Jump to content

candlepin

Members
  • Posts

    175
  • Joined

  • Last visited

Nexus Mods Profile

About candlepin

candlepin's Achievements

Collaborator

Collaborator (7/14)

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

Recent Badges

0

Reputation

  1. Not sure what I'm doing wrong, but I still can't get the perk script to compile without errors. It seems to be stemming from the CK not recognizing the property for the other script: unknown type cp_ingredientswap (I get this error from the "CP_IngredientSwap Property PlayerAlias Auto" line) cp_ingredientswap is not a known user-defined type (I get this error twice, once for each time the SwapInventory() function is called)
  2. If you want to use this value during a battle, for example, why not do this: 1) Use FrankFamily's nice function and store the Max Health value as a global variable. Do this intermittently; perhaps on equipping items, leveling up, or just every so often (or some combination thereof). 2) Instead of calling this function every time you want to get the max health, use the stored global variable. It may not be 100% accurate but it will be faster and, depending upon how often you update the global (#1 above), should be accurate enough for most situations. Just spitballing here..
  3. Unfortunately, I was not able to test this out yet. Due to an unexpected family obligation this weekend, I was unable to work on my mod as much as I was planning to. I did start to implement this though, and ran into a snag. While compiling the player alias script was relatively easy, I ran into issues with the perk fragment script. In particular, I kept getting compilation errors. One of the things the CK didn't seem to like was: CP_IngredientSwap Property PlayerAlias Auto It also didn't like the function. I haven't done much with script fragments, so I have the feeling I might be doing something wrong. Could you perhaps explain in simple terms how this should be implemented (e.g. where exactly do I add the script and when)? A Skyrim scripting/CK use for dummies version? And thanks again for all your help! It really is appreciated!
  4. I don't know about others, but the CK is pretty unstable for me. Always has been. Depending on what I'm doing it might crash every 10-15 minutes or every hour. Rarely can I get more out of it than that. I have found that it does depend on what I'm doing. My only advice would be this: save very often. Like stupid, crazy often. Not only will you lose less work when the CK eventually does crash, but for some unknown reason the CK seems to like this and crashes less often with frequent saves.
  5. Wow. That is incredibly kind of you, foamyesque. :thumbsup: I will look into implementing your script into my mod this weekend (have a big work presentation on Friday). SKSE functionality isn't a problem; other components of my mod require it.
  6. Hmm... random thought. Instead of having the alternative version in a chest somewhere, why not just add it directly to the player's inventory (or remove it) using the same OnItemAdded/OnItemRemoved approach? That way, both versions of the item are always accessible with no delay. The only issue I see with this approach would be the inventory weight. Maybe make one of them weightless? Or update the player's carry weight? I might need to think about this possibility some more.
  7. Interesting. My testing with my first method slowly updated the player's inventory while in the crafting menu without the need to craft anything. I've been looking at this a bit too and here is what I came up with for a function to reset the container inventory: I figured it would be quicker and probably cleaner to clear the container contents and then restock it than to compare the container contents to the player's inventory and then adjust. But maybe I'm wrong about that? So this would go in a script attached to the player via ReferenceAlias. I'm thinking that this function would be called upon OnInit(). Maybe also OnPlayerLoadGame()? Not sure when else. Perhaps after exiting the crafting station menu? And here is what I've come up with so far for adjusting the container contents on the fly: I'd put this in the same script attached to the player via ReferenceAlias. To speed things up, I figure I'll also need to add InventoryEventFilters: This can also be called OnInit() and whenever the global variable is swapped. And finally, here is the actual swap function. That's what I've put together so far. I have to do some more thinking about when to add and remove the InventoryEventFilters, but I think this is a pretty good start.
  8. This belongs in Skyrim - Mod Detectives Threadhttps://forums.nexusmods.com/index.php?/topic/485981-skyrim-mod-detectives-thread/page-789
  9. Yeah, I got this aspect of my mod working a while ago. Unfortunately I was initially only testing with a few items and everything seemed fine so I set it aside while I got other aspects of my mod to work. But recently I went back to update the formlists with all my items and tested the swap effect with pretty poor results; it worked but took way too long. Any thoughts on whether it is worth trying to split my formlists and script into ~20 pieces and run those ~20 scripts off the same magic effect/separate magic effects? I think I read somewhere that someone was recommending limiting scripts to 10 threads. Either way I will also definitely try the method you recommended; making a container that adds and removes the swap version of items as the player adds and removes items from their inventory and then swapping the items when called upon.
  10. For my mod, I want to do the following: 1) Swap upon entering crafting menus, swap back upon leaving crafting menus to allow full utilization of the items. This may or may not be necessary based on the version the items are in upon entering the crafting menu (i.e. ingredient or not). This should be done automatically. 2) Swap whenever the player desires. Again, this is about utilizing the items. Maybe the player would like to eat the food version of a particular item. Or maybe they would like to eat the ingredient version to learn its alchemy effects. This should be triggered by casting a spell. All the swapping events will be governed by a global variable. For the crafting menu swaps, the global will be changed and the items swapped upon entering the menu. When the menu is closed the global will be changed and the swap function will be called again. Since the global has been toggled, the swap will be back to the original version. Do you get what I'm going for now?
  11. It does, but it'll have to do the same thing even if you split it, and because the internal execution of the function isn't frame-linked (but the original calls are), splitting it into multiple form lists would tend to slow things down. I'm honestly surprised you say you saw a speed increase by dividing it in two -- my best guess for the cause there is that two separate RemoveItem calls allows the OnItemAdded events that're firing on the chest more time to complete and reduces the total number of suspended stacks. I'll see about working up some full scripts for you to try out, but the total time required for the RemoveItem(formlist) / RemoveAllItems() shouldn't be more than a second or two. Just to check, though: Do you want to restore the originals or not? Because if you don't this is a much simpler problem. I should have been more explicit in saying that not only did I split the formlist, but I also put them in separate scripts that I attached to a separate magic effects (although I guess I could have attached them to the same magic effect with similar results). I attached both magic effects to the same spell and cast the spell. I assume that it cut the swap time in half since the two scripts were run simultaneously. Thus my comment about poor man's threading; by splitting the scripts and running them simultaneously it's effectively doing the same thing as threading.
  12. "PlayerRef.RemoveItem(ListA, 999, true, SwapContainer)" --> I assume for this to execute the engine goes through each item in ListA, one by one, and transfers up to 999 of that item the SwapContainer. That's what I meant by scrolling through the formlist. And that is where I thought the bottleneck was. I've been waffling back and forth about whether I want to split the formlists into tiny chunks and do the swaps that way. But it seems really tedious and I'm a little worried that if I try to run 40+ scripts from a single spell/magic effect that I may create a singularity in Skyrim and implode my laptop :tongue: But maybe I'm overreacting and the simplicity of these scripts would negate any chances of script-burst catastrophes? I would love to hear if this is a valid concern. Normally I would just try both approaches and see what is better but splitting the lists would be a crap ton of work and I really, really don't want to do all that work, have it fail miserably, and have someone turn around and say it was crazy/stupid to try it in the first place.
  13. Thanks for adding this information. My post wasn't that helpful in hindsight.
  14. Interesting results. Splitting the list in half reduced the swap time by 50%. That was what I was hoping for. That still puts me in a pickle though: Assuming this reduction scales, I'd have to split my list into 45 different lists to get my swap down to 1 second (I'd consider a 1 second swap acceptable). That seems like a lot of tedious work, but I could grab another coffee (or forty) and brute force it if necessary. Or I should I try foamyesque's approach but potentially at the cost of a little (perhaps not noticeable on it's own?) lag here and there. Other than it being a stupid amount of tedious work for myself, is there any downside to the first of those approaches (splitting my list into a ton of smaller lists)? Is there a saturation point where too many scripts running at once, even simple ones, doesn't increase the speed? Or potentially even makes things worse?
  15. Well I tested this approach using a persistent container and it really didn't make any huge improvement on the speed. Maybe it's a second faster? Next on the testing block: 1) Split the script in two scripts and split the swap formlist into 2 formlist sets, each with half the items to swap. See if this improves performance noticeably. 2) Try foamyesque's suggestion of pre-loading the swap chest. This should definitely make the swap faster (it seems scrolling through the formlist is the slow part of what I'm trying to do), but if splitting the script into pieces makes it acceptably fast I might go that way so that there isn't a continuously running script on the player checking every time an item is added or removed from their inventory. But if splitting the formlists doesn't work, this approach seems promising.
×
×
  • Create New...