antstubell Posted September 30, 2020 Share Posted September 30, 2020 Quest has:Alias_Doctor - Unique actorAlias_WateringCan - forced.Alias_Key - created in watering can. At a certain stage I need the key to be removed from the watering can and placed in the doctor's inventory and I don't know the fragment I have to write. Tried a few attempts but got varied errors. Similar topic - I tried disabling the watering can in the render window and when a specific stage is set I added a fragment Alias_WaterCan.Enable() This didn't compile saying Enable is not a function or something like that. Thanks for any help. Link to comment Share on other sites More sharing options...
IsharaMeradin Posted September 30, 2020 Share Posted September 30, 2020 Move alias key from alias container to alias actor without relying on properties. Assumes stage fragment is on the same quest that is holding the aliases. ObjectReference myCan = kmyQuest.GetAliasByName("Alias_WateringCan").GetReference() ObjectReference myKey = kmyQuest.GetAliasByName("Alias_Key").GetReference() ObjectReference myDoctor = kmyQuest.GetAliasByName("Alias_Doctor").GetReference() If myCan && myKey && myDoctor myCan.RemoveItem(myKey,1,true,myDoctor) EndIf Enable a disabled quest alias without relying on properties. Assumes stage fragment is on the same quest that is holding the alias ObjectReference myCan = kmyQuest.GetAliasByName("Alias_WateringCan").GetReference() If myCan myCan.Enable() EndIf NOTE: none of these suggestions have been tested for compilation or function. Nor do they utilize SKSE. Further infoGetAliasByNameGetReference Link to comment Share on other sites More sharing options...
antstubell Posted October 1, 2020 Author Share Posted October 1, 2020 Those scripts are not meant to go in the papyrus fragments of the quest stage are they? I tried 1 line.ObjectReference myCan = kmyQuest.GetAliasByName("WaterCan").GetReference() And this error appears.variable kmyQuest is undefinednone is not a known user-defined typenone is not a known user-defined type Link to comment Share on other sites More sharing options...
cumbrianlad Posted October 1, 2020 Share Posted October 1, 2020 Here's 2 examples where I do this in a quest stage fragment. Alias_MercyChest.GetReference().RemoveItem(Gold001,1200,False) That takes 1200 gold from the 'MercyChest' alias and displays a notification on screen Alias_Player.GetReference().RemoveItem(Gold001,8000,False,Alias_TempleChest.GetReference())Alias_Maramal.GetReference().Removeitem(Alias_Key.GetReference(),1,False,Alias_Player.GetReference())Alias_Maramal.GetReference().Removeitem(Alias_Deeds.GetReference(),1,False,Alias_Player.GetReference()) That little removes items from one quest alias and adds them into another quest alias. For the enabling question I just use this to enable an initially disabled quest alias: Alias_Gerta.TryToEnable() They all work. Edit: sometimes the onscreen notifications don't work. I just add debug notifications into the stage fragment if that's the case. if I want them, that is! If I don't want the player notified replace 'False' with 'True' in the above lines. For the 'Mercy Chest' example, the full fragment is... ;Gerta killedAlias_MercyChest.GetReference().RemoveItem(Gold001,1200,False)MBRVmsgMercyGerta.Show() 'MBRVmsgMercyGerta is a property defined in the main quest script below all the 'Do not edit anything between this and the end comment' stuff! Link to comment Share on other sites More sharing options...
antstubell Posted October 1, 2020 Author Share Posted October 1, 2020 TryToEnable() ?That's a new one for me. Not SKSE is it? Link to comment Share on other sites More sharing options...
cumbrianlad Posted October 1, 2020 Share Posted October 1, 2020 I've used both. It's in vanilla quest fragments. Beth seem to use it on aliases that are actors. Enable() should work fine on an object reference alias. Sorry. Example: ; Stage set by reading Drevisa's noteAlias_RkundDoorMarker.GetReference().Disable(); disables static door + enables real door and triggerSetObjectiveCompleted(10)setObjectiveDisplayed(30) Link to comment Share on other sites More sharing options...
IsharaMeradin Posted October 1, 2020 Share Posted October 1, 2020 Those scripts are not meant to go in the papyrus fragments of the quest stage are they? I tried 1 line.ObjectReference myCan = kmyQuest.GetAliasByName("WaterCan").GetReference() And this error appears.variable kmyQuest is undefinednone is not a known user-defined typenone is not a known user-defined type Yes they were and kmyQuest should work as it is described as a "special variable" for quest stage fragments. See here: https://www.creationkit.com/index.php?title=Quest_Stage_Fragments Link to comment Share on other sites More sharing options...
cumbrianlad Posted October 1, 2020 Share Posted October 1, 2020 Hi. I don't want to muddy the waters but if the question is as I understand, then my lines work. The only difference, between my line and that posted by Antstubell for enabling the watering can container alias is that I included GetReference(), which was why the original line failed to compile, to my mind. So Alias_MyCan.Enable() won't work here, whereas Alias_MyCan.GetReference().Enable() will work. I know it does because I've done it, that's all. Odd that my other line using 'TryToEnable()' for the initially disabled actor 'Gerta' also works without using 'GetReference()'. Maybe you can explain this IsharaMeradin. Me, I'm just a simple, I do what Beth did, where they did it and it works, sort of person! Perhaps Alias_MyCan.TryToEnable() will also work? Is there a reason behind Beth seeming to use this all the time on initially disabled actors? Link to comment Share on other sites More sharing options...
antstubell Posted October 1, 2020 Author Share Posted October 1, 2020 Thank you both, things are becoming clear now. Link to comment Share on other sites More sharing options...
IsharaMeradin Posted October 1, 2020 Share Posted October 1, 2020 GetReference() is the important thing here to allow using the alias in the RemoveItem function in order to transfer it from one location to another. I opted for a route that wouldn't require properties but forgot that it needed an extra step to setup prior. TryToEnable() runs on the reference alias which would be why it can work without the use of GetReference(). Enable() alone runs on the object reference and thus needs GetReference() to function properly. If you look at TryToEnable() it runs GetReference() and then checks that the result is valid before running Enable(). Link to comment Share on other sites More sharing options...
Recommended Posts