Hamitho Posted March 17, 2019 Share Posted March 17, 2019 Hi guys, I understood, that quest items are not droppable due to a flag in quest aliases, but I wonder how it works with keys. Are they hardcoded to be not droppable? Is there a way to change that? Link to comment Share on other sites More sharing options...
Hamitho Posted March 22, 2019 Author Share Posted March 22, 2019 (edited) Hi again, same problem, different approach.I am trying to create a container that removes all keys from the player on activation and puts it into the container. Here is the part of the script, which is actually a modified copy of the Bobblehead stand auto STATE AllowActivate Event OnActivate(ObjectReference akActionRef) GoToState("Busy") BlockActivation(TRUE) if akActionRef == Game.GetPlayer() MoveKeysToContainer() Utility.Wait(0.1) endif GoToState("AllowActivate") BlockActivation(FALSE) EndEvent EndSTATE STATE Busy ;Do Nothing EndSTATE Function MoveKeysToContainer() while (Game.GetPlayer().GetItemCount(KeyKeyword) >= 1) Game.GetPlayer().RemoveItem(KeyKeyword, 1, false, self) endwhile EndFunction It is working in general but with some flaws: 1) When a key in the container is grabbed from the "quick loot", the key is removed instantly from the player and put back into the container2) When a key is transferred into the container on activation is is not instantly displayed in the inventory, player has to exit the container and activate it again So resulting questions:When is the OnActivate event triggered exactly and is there a way to distinguish between quick looting and entering the transfer menu?How can I force the container to update its inventory so the items are shown correctly? Sorry, I am still beginner, so anything that might help pointing me in the right direction is very welcome! Edited March 22, 2019 by Hamitho Link to comment Share on other sites More sharing options...
DieFeM Posted March 22, 2019 Share Posted March 22, 2019 I would create a perk to add an activation button for this container that calls MoveKeysToContainer(). Link to comment Share on other sites More sharing options...
Hamitho Posted March 22, 2019 Author Share Posted March 22, 2019 Thank you for your answer DieFeM, I think I understood that you suggest to activate the container via an extra activator which executes the function above instead of calling the function directly in the container to avoid multiple execution. That makes sense to me, but I am puzzled why I need a perk for this and how to create such an activation button. Could you point me to an example in the vanilla scripts or, if such don't exist, give me some more information how to begin with? Link to comment Share on other sites More sharing options...
DieFeM Posted March 22, 2019 Share Posted March 22, 2019 There's an example of adding an activation button in the Perk V81_01Ashes, which adds a button to activate Ashes (the cat from Vault 81) to send him back to the Vault.In the perk entries list is an entry point which is set as "Activate" with the function "Add Activate Choice", there you can add an activation button, use the Target conditions with the condition function GetIsId on your container to add an activation button to it. If you click on Edit Script, in the advanced tab, you'll see the Fragment Entry function, which uses the arguments akTargetRef (this would be the reference of the container) and akActor (the owner of the perk) so you could set the fragment script like this: while (akActor.GetItemCount(KeyKeyword) >= 1) akActor.RemoveItem(KeyKeyword, 1, false, akTargetRef) endwhile with KeyKeyword as a property of the fragment. PS: "Replace Default" replaces the default activation button, makes sure it is unchecked. Link to comment Share on other sites More sharing options...
Hamitho Posted March 24, 2019 Author Share Posted March 24, 2019 Thank you DieFeM for the detailed Information.I tried to follow your instructions, but something seems to be missing still. This is my perk Setup so far:(the perk owner tab is emtpy) The function is the following: ;BEGIN FRAGMENT CODE - Do not edit anything between this and the end comment Scriptname Fragments:Perks:PRKF_KeyRackActivate Extends Perk Hidden Const ;BEGIN FRAGMENT Fragment_Entry_01 Function Fragment_Entry_01(ObjectReference akTargetRef, Actor akActor) ;BEGIN CODE while (akActor.GetItemCount(KeyKeyword) >= 1) akActor.RemoveItem(KeyKeyword, 1, false, akTargetRef) endwhile ;END CODE EndFunction ;END FRAGMENT ;END FRAGMENT CODE - Do not edit anything between this and the begin comment Keyword Property KeyKeyword Auto Const It compiles and is also displayed in the Papyrus Fragments tab, so I guess the CK digested it correctly. I also made sure I have several keys with a KeyKeyword in inventory, but I still don't get a different activation button, just the usual container UI.Anything I missed? Link to comment Share on other sites More sharing options...
DieFeM Posted March 24, 2019 Share Posted March 24, 2019 (edited) You must add the perk to the player, you can do it in multiple ways, the easiest way would be just by adding it by a quest script.As a quest script it would be like: Scriptname AddPerkQuestScript extends quest Perk Property MyButtonPerk Auto Event OnQuestInit() Game.GetPlayer().AddPerk(MyButtonPerk) EndEvent Or if you want you can use an script in an alias of the player instead: Scriptname AddPerkAliasScript extends ReferenceAlias Perk Property MyButtonPerk Auto Event OnAliasInit() GetActorRef().AddPerk(MyButtonPerk) EndEvent Or, since a quest alias can have a spell, you can setup a spell to cast your perk so you don't need more scripts. You can do it on any script you want, like using an activator, a potion or any thing in which you can attach a script and use AddPerk. Edited March 24, 2019 by DieFeM Link to comment Share on other sites More sharing options...
Hamitho Posted March 25, 2019 Author Share Posted March 25, 2019 (edited) Hi again,I start feeling stupid because it doesn't want to work. I tried to add the perk via console command to make sure it is active but the console doesn't even find the ID. Is it normal that the console does not know custom assets or am I doing something completely wrong? The container itself shows up in the workshop menu so it can't be that wrong, can it? Initially I tried to add the perk to the player in the OnLoad event of the container, but I wasn't sure if it is added or not. Perk Property KeyRackActivate Auto Event OnLoad() if !AlreadyLoaded AlreadyLoaded = TRUE KeysInContainer = New Form[0] Game.GetPlayer().AddPerk(KeyRackActivate) endif EndEvent Edited March 25, 2019 by Hamitho Link to comment Share on other sites More sharing options...
DieFeM Posted March 25, 2019 Share Posted March 25, 2019 I've noticed that the Target condition is set to "run on target", but it should "run on subject". I know it seems a bit confusing, but it is how it works. Link to comment Share on other sites More sharing options...
Hamitho Posted March 26, 2019 Author Share Posted March 26, 2019 Brilliant, you made my day! Link to comment Share on other sites More sharing options...
Recommended Posts