JustChill Posted January 30, 2020 Author Share Posted January 30, 2020 In addition: [01/30/2020 - 08:37:31PM] I dropped 1x [soulGem < (050179E5)>] into the world[01/30/2020 - 08:37:31PM] The f*#@ just happened?[01/30/2020 - 08:37:36PM] VM is freezing...[01/30/2020 - 08:37:36PM] VM is frozen[01/30/2020 - 08:37:36PM] Log closed Ok, good thing is that this script even fires if you use a soul gem on a weapon :DSo using a Soul Gem is also covered by OnItemRemoved. Now I just have to distinguish between dropping into the world and actually using it. Testing continues... Yet thanks again SurfsideNaturals, this really gets my enthusiasm growing on this ugly Papyrus scripting. XD Link to comment Share on other sites More sharing options...
SurfsideNaturals Posted January 30, 2020 Share Posted January 30, 2020 JustChill, There could be some major problems with your quest idea. For one, I do not think an enchanting station or even a weapon will use a soul gem if it is a quest object. I know the alchemy stations will not. It would be helpful if you did some testing to determine if you can fill your reusable soulgem with the Vanilla Function or testing functions that could help you determine if your gem has been dropped or put in a container. Event OnItemRemoved(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akDestContainer) if akDestContainer Debug.Notification("Have Container") endIf endEvent This is the vanilla soul trapping function. Does it work in Enderal. If Caster.TrapSoul(victim) Debug.Notification("Got the soul") EndIf ReDragon has given you everything you need to create a soul trapping script that will only fill your Black Star with the Vanilla Function ( If it works ). Link to comment Share on other sites More sharing options...
JustChill Posted January 30, 2020 Author Share Posted January 30, 2020 Hey, I try to avoid the vanilla function as of 2 reasons: 1.) You need to choose between NPC or creature souls. I want my soul gem to be able to be filled with both.2.) The current vanilla function and vanilla effect archetype seems to be broken. If you use it, you can fill your soul gem but if you drop it into the world space or a container, it will lose its soul (being empty again). Therefore I like to use the scripted effect with AddItem and RemoveItem. But thanks for the heads up about quest objects. I probably have to find a different solution then. However, OnItemRemoved also comes with akReference.Even if this reference might not return NONE, when used as even the akBaseItem returns the correct ID, I might ask if the reference is in a world space by using GetWorldSpace.I am not sure if that also works on interiors, but I will try it out. :smile:I don't think GetWorldSpace might return something properly when the item is actually removed. ^^ IN ADDITION!I cannot thank you enough for pointing me into the right direction again. :D :D :D :D [01/30/2020 - 09:09:41PM] I dropped 1x [soulGem < (050179E4)>] into the world[01/30/2020 - 09:09:41PM] The f*** just happened?[01/30/2020 - 09:09:41PM] I dropped 1x [soulGem < (050179E5)>] into the world[01/30/2020 - 09:09:41PM] The f*** just happened?[01/30/2020 - 09:09:42PM] I dropped 1x [soulGem < (050179E6)>] into the world[01/30/2020 - 09:09:42PM] The f*** just happened?[01/30/2020 - 09:09:43PM] I dropped 1x [soulGem < (050179E3)>] into the world[01/30/2020 - 09:09:43PM] The f*** just happened?[01/30/2020 - 09:09:55PM] I RECHARGED A WEAPON, I RECHARGED A WEAPON![01/30/2020 - 09:09:55PM] The f*** just happened?[01/30/2020 - 09:10:00PM] VM is freezing...[01/30/2020 - 09:10:00PM] VM is frozen[01/30/2020 - 09:10:00PM] Log closed So, I dropped the 4 higher types of the reusable soul gem and only left the one with a petty soul in my inventory to recharge one of my enchanted weapons.And it realized it! :DThe only downside migth be that it also fires when "RemoveItem" is used. So I have to make a protection when I use RemoveItem as soon as the counter of souls is reached which breaks that gem. Scriptname _00E_YerosCave_PlayerSoulGemCheck extends ObjectReference Event OnItemRemoved(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akDestContainer) if akBaseItem == _00E_YerosCave_SiraSoulbender_FillPetty || akBaseItem == _00E_YerosCave_SiraSoulbender_FillLess || akBaseItem == _00E_YerosCave_SiraSoulbender_FillCom || akBaseItem == _00E_YerosCave_SiraSoulbender_FillGreat || akBaseItem == _00E_YerosCave_SiraSoulbender_FillGrand if !akDestContainer if !akItemReference Debug.Trace("I RECHARGED A WEAPON, I RECHARGED A WEAPON!") else Debug.Trace("I dropped " + aiItemCount + "x " + akBaseItem + " into the world") endif elseif akDestContainer == Game.GetPlayer() Debug.Trace("I gave the player " + aiItemCount + "x " + akBaseItem) else Debug.Trace("I gave " + aiItemCount + "x " + akBaseItem + " to another container") endIf Debug.Trace("The f*** just happened?") endif endEvent SoulGem Property _00E_YerosCave_SiraSoulbender Auto SoulGem Property _00E_YerosCave_SiraSoulbender_FillPetty Auto SoulGem Property _00E_YerosCave_SiraSoulbender_FillLess Auto SoulGem Property _00E_YerosCave_SiraSoulbender_FillCom Auto SoulGem Property _00E_YerosCave_SiraSoulbender_FillGreat Auto SoulGem Property _00E_YerosCave_SiraSoulbender_FillGrand AutoAll that's left now is trying to get this script applied to the player dynamically on runtime.https://www.creationkit.com/index.php?title=Dynamically_Attaching_Scripts This looks actually way more complicated. XDBut I like compatibility and don't want to touch the player base form as that would result in incompatibilites with other mods. :sad: Link to comment Share on other sites More sharing options...
SurfsideNaturals Posted January 30, 2020 Share Posted January 30, 2020 (edited) # 1 The Black Star will fill with any type of souls. # 2 You will need to create a quest, make the player an alias of that quest, and add the script there. # 3 If you put the gem in a container that is not persistent you will not return a akItemReference. This may be used to help you figure out if the gem has been used. # 4 If your script is on the player and this is an on item removed event. How could the player be the akDestContainer? # 5 You will need to install a filter for this function so it only fires for the filled gems. Edited January 30, 2020 by SurfsideNaturals Link to comment Share on other sites More sharing options...
JustChill Posted January 30, 2020 Author Share Posted January 30, 2020 Hm, it seems #1 doesn't work with Enderal.I tried that out by removing the script effect and just adding the "Soul Trap" archetype.But it said that no soul is big enough when I tried to kill any creature, but I perfectly was able to fill it with NPC souls. Thanks for #2, that's something I yet had to figure out. :( Hm, I think I already solved #3 in my script. As if I put the gem into a container if !akDestContainer if !akItemReference Debug.Trace("I RECHARGED A WEAPON, I RECHARGED A WEAPON!") else Debug.Trace("I dropped " + aiItemCount + "x " + akBaseItem + " into the world") endifakDestContainer will be true. Regarding #4, the player doesn't have to be that container.The script should only fire if the player gets the gem removed.I dropped these and picked them up, but I didn't got any response for picking them up which is fine. :) #5 should be covered by this: if akBaseItem == _00E_YerosCave_SiraSoulbender_FillPetty || akBaseItem == _00E_YerosCave_SiraSoulbender_FillLess || akBaseItem == _00E_YerosCave_SiraSoulbender_FillCom || akBaseItem == _00E_YerosCave_SiraSoulbender_FillGreat || akBaseItem == _00E_YerosCave_SiraSoulbender_FillGrand Thanks for the addition. :) Link to comment Share on other sites More sharing options...
JustChill Posted January 30, 2020 Author Share Posted January 30, 2020 In addition:The Black Star should not hold creature souls. That's a bug that got fixed by the Unofficial Skyrim Patch.Even though that's a video of the Skyrim SE, I don't think the fixes of the Unofficial Skyrim SE Patch are that much different. But you can also see the issue where I fill the Black Star, then drop it from the inventory, pick it up again and suddenly it is not filled anymore. :O That's an issue you can resolve by using a scripted effect on the soul gem by "AddItem" and "RemoveItem". IsharaMeradin just confirmed that this issue still persists in the game, so Enderal is surely also affected of.https://forums.nexusmods.com/index.php?/topic/8365073-is-the-current-soul-trap-archetype-still-broken/ Link to comment Share on other sites More sharing options...
NexusComa Posted January 31, 2020 Share Posted January 31, 2020 "Adding filled soul gems and remove the empty ones" ... you can credit me for that part. Or not ... I'll somehow get over it. Link to comment Share on other sites More sharing options...
SurfsideNaturals Posted January 31, 2020 Share Posted January 31, 2020 (edited) JustChill, You are a plethora of information. So Cute!!! :D :D Here is an example script for you. This is set up to work on an object reference. However it can be easily updated when you place it on the PlayerAlias of your quest. It will be very fast. Scriptname _00E_YerosCave_PlayerSoulGemCheck extends ObjectReference ; EVENTS Event OnItemRemoved(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akDestContainer) If akDestContainer ; Gem was placed in container Return EndIf If akItemReference ; According to JustChill Gem was dropped. In some circumstances this could still fill if the gem was removed by the game. Sould be fully tested. Return EndIf If CheckGems(akBaseItem) P.AddItem(_00E_YerosCave_SiraSoulbender, 1, True) ; P will be replaced with GetReference() when script is added to the Quest Alias. EndIf ; You could run a function here to make sure there is only 1 gem in the players inventory and remove any extra as a safety precaution. endEvent Event OnPlayerLoadGame() ; Fill Properties, Set up Array and Event Filter SoulGems = new Form[5] SoulGems[0] = _00E_YerosCave_SiraSoulbender_FillPetty As Form SoulGems[1] = _00E_YerosCave_SiraSoulbender_FillLess As Form SoulGems[2] = _00E_YerosCave_SiraSoulbender_FillCom As Form SoulGems[3] = _00E_YerosCave_SiraSoulbender_FillGreat As Form SoulGems[4] = _00E_YerosCave_SiraSoulbender_FillGrand As Form P = Game.GetPlayer() As ObjectReference ; Once this is on the Player Ref Alias you will use a differnt function. SetFilter() GoToState("Set") ; Make sure this event only runs once. endEvent ; EVENTS END ; FUNCTIONS Function SetFilter() ; Add SoulGem Forms to the Filter so only these Forms will Trigget this Event. Int i While i < 5 AddInventoryEventFilter(SoulGems[i]) i = i + 1 EndWhile EndFunction Bool Function CheckGems(Form G) ; Make sure the item removed is one of the Gems. Int i While i < 5 If G == SoulGems[i] Return True EndIf i = i + 1 EndWhile EndFunction ; FUNCTIONS END ; STATES State Set ; the need for this can be removed when testing is done and the script is moved to the Quest Alias. Event OnPlayerLoadGame() endEvent Function SetFilter() EndFunction EndState ; STATES END ; PROPERTIES SoulGem Property _00E_YerosCave_SiraSoulbender Auto SoulGem Property _00E_YerosCave_SiraSoulbender_FillPetty Auto SoulGem Property _00E_YerosCave_SiraSoulbender_FillLess Auto SoulGem Property _00E_YerosCave_SiraSoulbender_FillCom Auto SoulGem Property _00E_YerosCave_SiraSoulbender_FillGreat Auto SoulGem Property _00E_YerosCave_SiraSoulbender_FillGrand Auto Form[] SoulGems ObjectReference P ; PROPERTIES END Edited January 31, 2020 by SurfsideNaturals Link to comment Share on other sites More sharing options...
JustChill Posted January 31, 2020 Author Share Posted January 31, 2020 "Adding filled soul gems and remove the empty ones" ... you can credit me for that part. Or not ... I'll somehow get over it.Wait, so you have wrote the script for Enderal and all the other mods that use the AddItem and RemoveItem workaround for the Soul Trap magic effect?Like this one:https://www.nexusmods.com/skyrim/mods/77170Or this one:https://www.nexusmods.com/skyrim/mods/14559/?Or that one:https://www.nexusmods.com/skyrim/mods/65975/? Hm, you would be the first user that gets through with 4 different accounts here. XD No really, I don't see how you had anything to do with any solution on this topic. I will credit you in the way as I said on the previous page. :smile: @SurfsideNaturalsAh, thanks. I always like to share my stuff. :smile:But...Holy cow!I actually thought I will have to continue enhancing my script today, but now you present me the perfect solution? :OThank you, very very very much. :D :D :D :DAt first look, that's nothing I would have come up with, but that's just Papyrus for me. XDCompared to Gamebryo script it really feels like a different world. After work, I will have a closer look onto it, for getting an idea about. Thank you very much for all the comments in the code. That definitely will help me to understand your kung fu. :smile: By the way, I am interested in gifting you something, but I rather write you a personal message about. :wink: Kindest regards,Just Chill Link to comment Share on other sites More sharing options...
SurfsideNaturals Posted January 31, 2020 Share Posted January 31, 2020 I am happy to help. I know how frustrating it can be to try and learn a new scripting language. Please test this when you are able. Drop some of the filled gems on the ground, pick them up and then use them for something. If akItemReference does not fill when the Gem is used you should be ok. If one of the Filled Gems should become persistent in the script it will fill, but considering how the player acquires them it does not seem likely. When you have fully tested this and your quest is set up I will redo the script to work on a Ref Alias. It will only take a couple of minutes. Link to comment Share on other sites More sharing options...
Recommended Posts