hexef Posted December 7, 2016 Share Posted December 7, 2016 (edited) I have found out that when you pick up an itemRef which was placed in the GECK editor, its reference is actually NOT removed from the game and it persists forever, even after cell resets. The problem I have is that I need to enable that taken ref again, but it doesn't work with the Enable or Reset3DState function. Weirdly enough, If I call GetDisabled on it, it returns 0. I can change its position or move it in another cell and it is actually there, but the game somehow refuses to render it again. The phenomenons explained above don't apply to items dropped by the player, npcs or spawned via PlaceAtMe function, which makes me think that there is some hardcoding involved here. I know that I can overcome this problem by simulating an activation made by the player by checking if the Activate button was pressed and using GetCrosshairRef, but I still want someone experienced in GECK explain why you cannot "reenable" a taken ref. EDIT: Seems like you cannot simulate an item pick-up, because as soon as you press the activate key, the object will get picked up before your quest script can react. Not even the OnActivate event handlers can do that, they run before the actual activation of the object, but even if you disable said object before its activation, it still activates and gets added to your inventory and also marked as "taken". Edited December 8, 2016 by xqdcss Link to comment Share on other sites More sharing options...
Mktavish Posted December 8, 2016 Share Posted December 8, 2016 (edited) Not really sure about the deeper understanding of what is going on with the reference after it's taken.But there should be a way around in the geck to achieve a desired end result. If you could explain what you are after a little better. However with the seems to me method and talking out of my butt ... The record of the items original placement and state will always be there in the ESM /ESP ... Then the save game is just an overlay which keeps a record of it being changed. So in essence what you are asking is for the save game record to be erased. Edited December 9, 2016 by Mktavish Link to comment Share on other sites More sharing options...
hexef Posted December 9, 2016 Author Share Posted December 9, 2016 (edited) Not really sure about the deeper understanding of what is going on with the reference after it's taken.But there should be a way around in the geck to achieve a desired end result. If you could explain what you are after a little better. However with the seems to me method and talking out of my butt ... The record of the items original placement and state will always be there in the ESM /ESP ... Then the save game is just an overlay which keeps a record of it being changed. So in essence what you are asking is for the save game record to be erased.I was trying to simulate some kind of item respawn on cell reset(only the items placed in geck). I don't really need to reenable a "taken" ref, just a way to find out whether the item was taken by the player or any npc or not. Something like GetPickableItemTaken would come in handy. With a function like that, I could check with a OnReset handler, if the item is marked as taken, and use a PlaceAtMe and SetPos to place a dynamic reference with the same type, healthpercent, coordinates as the original taken ref. NVSE has a filter for the GetRefs function that filters out the "taken" refs, it would be so much better if it also had a function whih checks only for an individual ref. Edited December 9, 2016 by xqdcss Link to comment Share on other sites More sharing options...
Mktavish Posted December 9, 2016 Share Posted December 9, 2016 (edited) So the items taken is dynamic and can end up being more item possibilities than your willing to individually micro manage? At the very least , couldn't you check the items taken against a list? And then just respawn all the items if you can do that. Edited December 9, 2016 by Mktavish Link to comment Share on other sites More sharing options...
miguick Posted December 9, 2016 Share Posted December 9, 2016 Yes, items placed by .esp and .esm files persist after taking them because you cannot 'destroy' their refID, which would be like stripping it from the file they come from. Items generated by the savegame have a 'ff' prefix, and get destroyed and recycled as the game needs when possible.In the script extender for Oblivion there were commands for exactly what you need, IsTaken and SetIsTaken, but I can't see those for NVSE anywhere. Maybe you can request them for JIP or Lutana. Link to comment Share on other sites More sharing options...
hexef Posted December 9, 2016 Author Share Posted December 9, 2016 I requested the functions to luthienanarion. Fingers crossed he will make one. Link to comment Share on other sites More sharing options...
luthienanarion Posted December 11, 2016 Share Posted December 11, 2016 When items are picked up by the player, the "deleted" (removed from ESP) flag is set on them and their 3D data is set to NULL. (Your saved game is actually an ESP that loads last, and it "saves" changes to forms/refs by overriding them the same way an ESP would.) You can make a "taken" reference re-appear by removing that flag and then updating the object's 3D data: someRef.SetRefFlag 32 0 ; flag 32 (0x20) is the "deleted" flag someRef.Update3D Link to comment Share on other sites More sharing options...
hexef Posted December 11, 2016 Author Share Posted December 11, 2016 When items are picked up by the player, the "deleted" (removed from ESP) flag is set on them and their 3D data is set to NULL. (Your saved game is actually an ESP that loads last, and it "saves" changes to forms/refs by overriding them the same way an ESP would.) You can make a "taken" reference re-appear by removing that flag and then updating the object's 3D data: someRef.SetRefFlag 32 0 ; flag 32 (0x20) is the "deleted" flag someRef.Update3D Thank you very much, luthienanarion, you gave me critical information for a mod I've been working on for the past few days. For those who are interested, here are the links with all the ref flags:http://geck.bethsoft.com/index.php?title=GetFlagsLowhttp://geck.bethsoft.com/index.php?title=GetFlagsHigh Link to comment Share on other sites More sharing options...
luthienanarion Posted December 11, 2016 Share Posted December 11, 2016 I must have missed Get/SetFlagsLow/High when 4.6.3 was released; probably too excited about strings, arrays, and events! If you're going to use it as a reference for the flags with Get/SetFormFlag or Get/SetRefFlag, ignore the page for GetFlagsHigh. Link to comment Share on other sites More sharing options...
hexef Posted December 11, 2016 Author Share Posted December 11, 2016 I must have missed Get/SetFlagsLow/High when 4.6.3 was released; probably too excited about strings, arrays, and events! If you're going to use it as a reference for the flags with Get/SetFormFlag or Get/SetRefFlag, ignore the page for GetFlagsHigh. I succesfully manipulated the 'Deleted' flag using NVSE functions GetFlagsLow, SetFlagsLow, GetBit and SetBit. With an OnReset event handle, I check the 'Deleted' flag and set it to 0 if it is already to 1. It seems like I don't need to use the Update3D function, the items look and behave as before. Now they have to bear with my PCs kleptomania forever, hehe. I didn't want to use your functions because I want my mods to have as few plugin requiremets as possible. I had to use one JIP function though, specifically SetPersistent, as it would have been impossible to complete my mod without it. I will credit you for helping me so much, when I release my mod... hopefully in the next few days. Link to comment Share on other sites More sharing options...
Recommended Posts