urumizawa Posted May 28, 2021 Share Posted May 28, 2021 (edited) Trying to get into papyrus, I want to make a spell that specifically targets clutter items, but before getting into the script it has to target the right object in the first place. the items I currently have in mind are conveniently grouped under Items/MiscItem/Clutter in the CK so I imagine there should be a way to find out if they are "clutter" I hope that made sense and thank you in advance. Edited May 28, 2021 by urumizawa Link to comment Share on other sites More sharing options...
dylbill Posted May 28, 2021 Share Posted May 28, 2021 Do you mean target loose items in the world? If so you can use the game function FindRandomReferenceOfAnyTypeInListFromRef. Put your misc items to search for in a formlist. In your script, have it cast the actual spell if an object is found: Formlist Property MyMiscItems Auto Spell Property MySpell Auto Event OnEffectStart(Actor akTarget, Actor akCaster) ObjectReference MiscRef = Game.FindRandomReferenceOfAnyTypeInListFromRef(MyMiscItems, akCaster, 1000.0) ;find a random ObjectReference that's in the MyMiscItems list within a 1000 unit radius from the caster. If MiscRef != None MySpell.Cast(akCaster, MiscRef) ;Caster of this spell casts MySpell on the miscRef Else ;misc ref not found Endif EndEvent Link to comment Share on other sites More sharing options...
urumizawa Posted May 28, 2021 Author Share Posted May 28, 2021 Will try that thanks a lot. Link to comment Share on other sites More sharing options...
dylbill Posted May 29, 2021 Share Posted May 29, 2021 No problem Link to comment Share on other sites More sharing options...
Recommended Posts