FiftyTifty Posted September 16, 2017 Share Posted September 16, 2017 One of the main problems with dropping loot in order to decorate, is that the engine will occasionally drop items through the objects and other items they're placed upon. The solution, is to call SetMotionType(2, true) on the items. Trouble is, there are times where GetCrossHairRef() is unreliable, such as placing items in shelves, where it will return an object or item then it's collision box is in front. That, and it's a bloody pain to call it on every item one by one. What I'd like to do, is somehow get all the player owned (all items dropped from the inventory are owned by the player) items within a set radius, and then call SetMotionType() on all of them. What would be the best way to go about this? I figured an explosion would be the way forward, but there's no way to add a script to Explosion records. Link to comment Share on other sites More sharing options...
kitcat81 Posted September 16, 2017 Share Posted September 16, 2017 Why not use "getplayergrabbedref" ? Link to comment Share on other sites More sharing options...
shavkacagarikia Posted September 16, 2017 Share Posted September 16, 2017 Hmm, have you tried findallreferencesoftype() ? If we are lucky passing none or empty formlist as first parameter may force it to find all references in given radius. Then you cycle through it and call getactorrefowner and if its player, setmotiontype. Also what you mean by explosion method? You cannot attach a script on explosion but you can force it to load invisible misc object, attach script on that object and listen for its onload() event Link to comment Share on other sites More sharing options...
FiftyTifty Posted September 16, 2017 Author Share Posted September 16, 2017 Why not use "getplayergrabbedref" ? That means I have to pick up every single object, one by one. Hmm, have you tried findallreferencesoftype() ? If we are lucky passing none or empty formlist as first parameter may force it to find all references in given radius. Then you cycle through it and call getactorrefowner and if its player, setmotiontype. Also what you mean by explosion method? You cannot attach a script on explosion but you can force it to load invisible misc object, attach script on that object and listen for its onload() event Ooh, I didn't notice that function. It's not ideal, as I'd have to make formlists for every item added by the game and mods, but I'll live. The idea with the explosion was to somehow call OnHit() on it, with a large radius and zero force. That way, I'd just call the SetMotionType() function on every item that fired the event. But I don't know if that's even possible. Link to comment Share on other sites More sharing options...
kitcat81 Posted September 16, 2017 Share Posted September 16, 2017 (edited) Why not use "getplayergrabbedref" ? That means I have to pick up every single object, one by one. I thought you need to pick them up anyway in order to rotate and place them on shelves etc .If you wanted to use a magic effect for the explosion, it won`t work for anything but actors. I think you can try to use OnItemRemoved event (In some constant effect or alias that is applied to the player) to obtain the reference of any dropped item and do something with it. Not sue if it can work, but the Skyrim wiki says it returns reference of an item is the item was dropped. Instead of exlposion you can use a quest with refCollectionAlias. But again you will have to use formlists or other conditions to filter Edited September 16, 2017 by kitcat81 Link to comment Share on other sites More sharing options...
FiftyTifty Posted September 16, 2017 Author Share Posted September 16, 2017 I thought you need to pick them up anyway in order to rotate and place them on shelves etc . If you wanted to use a magic effect for the explosion, it won`t work for anything but actors. I think you can try to use OnItemRemoved event (In some constant effect or alias that is applied to the player) to obtain the reference of any dropped item and do something with it. Not sue if it can work, but the Skyrim wiki says it returns reference of an item is the item was dropped. Instead of exlposion you can use a quest with refCollectionAlias. But again you will have to use formlists or other conditions to filter It's a pain to keep mashing a hotkey after adjusting an item. That, and I've already got a whole bunch of items placed already. Being able to just press a hotkey and all the items get changed, is much better. I think the FindAllReferencesOfType() function is where it's at. Currently filling form lists with all the game's droppables. Link to comment Share on other sites More sharing options...
kitcat81 Posted September 16, 2017 Share Posted September 16, 2017 I thought you need to pick them up anyway in order to rotate and place them on shelves etc . If you wanted to use a magic effect for the explosion, it won`t work for anything but actors. I think you can try to use OnItemRemoved event (In some constant effect or alias that is applied to the player) to obtain the reference of any dropped item and do something with it. Not sue if it can work, but the Skyrim wiki says it returns reference of an item is the item was dropped. Instead of exlposion you can use a quest with refCollectionAlias. But again you will have to use formlists or other conditions to filter It's a pain to keep mashing a hotkey after adjusting an item. That, and I've already got a whole bunch of items placed already. Being able to just press a hotkey and all the items get changed, is much better. I think the FindAllReferencesOfType() function is where it's at. Currently filling form lists with all the game's droppables. Yes, it`s a good function. But this way it won`t work items added by mods. Though maybe you don`t nees it to be universal. Link to comment Share on other sites More sharing options...
FiftyTifty Posted September 16, 2017 Author Share Posted September 16, 2017 It would be very easy to extend the script for mods. Just another if check, really. But since I don't use any mods that add items, I should be A-OK. Link to comment Share on other sites More sharing options...
kitcat81 Posted September 16, 2017 Share Posted September 16, 2017 It would be very easy to extend the script for mods. Just another if check, really. But since I don't use any mods that add items, I should be A-OK.I see. I thought you are making a mod so everybody can use it :D In that case using a formlist would not allow to add items from unknown mods.Good luck with your work! Link to comment Share on other sites More sharing options...
shavkacagarikia Posted September 16, 2017 Share Posted September 16, 2017 Have you tried pasing empty formlist? For some other functions passing empty formlists make the function to work for every type of object. Link to comment Share on other sites More sharing options...
Recommended Posts