Been playing around a bit with this function trying to figure out how to get what I want to happen actually happening. The problem is this: xGetPCTarget only seems to work on an NPC while you are NOT in combat with the NPC. Soon as you are in combat it stops reporting. I note this is also the same time the name box over an NPC's head goes away, so its behavior is following along with its description I guess (although why combat causes an NPC to no longer have a name mystifies me) I tried to do a work around using xRefID (which in theory returns the object ID, but gives me a number instead) to no avail. Wrote myself a small script to test all this out. Here is the script:
Begin Target_TestFloat TargetFatigueLong PCTarget1Long PCTarget2setx PCTarget1 to xGetPCTargetIfx ( PCTarget1 ) setx PCTarget2 to PCTarget1->xRefID xSetRef, PCTarget1 Set TargetFatigue to GetFatigueEndIfMessageBox "Your Target is: %d, and the xRefID is: %d. Target Fatigue is: %f" PCTarget1 PCTarget2 TargetFatigueEnd Target_Test
Here are a couple pics I took: http://www.tesvskyrim.com/screenshot-2142-1, http://www.tesvskyrim.com/screenshot-2143-1, http://www.tesvskyrim.com/screenshot-2144-1 (not dead).
Suggestions? (Other than look at Adul's Opponent Fatigue Indicator, which is currently broken and is what got me started on this whole thing. Took me quite awhile fiddling with his code to track the problem down to this function.)
Edit: silly code box >.<, Also that target ID changes when you reload the game and try again, forgot to mention that.