GuruSR, I believe you're looking for http://cs.elderscrolls.com/constwiki/index.php/GetTargets.
Please read the OBSE documentation on GetTargets, as GetTargets returns a list of "possible" targets to fight, not ones currently fighting you or any actor.
if(IsModLoaded "za_bankmod.esp") Let r := GetFormFromMod "za_bankmod.esp" "00C1B7" if(r) PrintD "Found it: " +$r if(r.GetOwner == playerref) PrintD ">>>>>>>>> Player has it" else PrintD ">>>>>>>>> Chest is not player owned" endif endif endif
Why don't I see any output after the Found it line, that correctly displays the name? (0019b)
I do, r.GetOwner will script crash if R isn't loaded. Just because it's referenced in memory as an object, doesn't mean it's loaded. Referencing a base object or reference to anything that has yet to be loaded will halt a script. Also, for player testing just use Player in this instance. If you know the object type, using GetObjectType will save you a headache, so after the if®, do a second if level testing if(r.GetObjectType == type). I use GetObjectType a lot when dealing with ref's of actors between save game loads, as after a load, those ref's are usually wrong if they're in another cell (as in not loaded, dead) and trying to access them script halts, but GetObjectType won't halt the script on bad refs (thankfully).
Because r is a base object, not actually a reference. Use "GetOwner r", not "r.GetOwner". The script is crashing at runtime because of this.
I'm not sure a base object can even have an owner, but that's a separate issue.
Actually, base actors can have owners. Most likely one of two things, the object isn't loaded and/or the playerref he's using didn't load (was in another cell after a game load). He should printD all over the place showing all the variables he's using so he can track where it stops.
GuruSR.