I have been trying to address the issue of having folks on the same side as u in combat, so u can fight along side goodies (or baddies), rescue people in the midst of a fight etc. There are a wide variety of issues to address for this but first up, how do we read the faction? Trying: y = attachee.obj_get_int( obj_f_npc_faction ) returned a value for y of 288 for an NPC with a proto faction of 6: getting him to have a look at a nearby NPC: for npc in game.obj_list_vicinity(attachee.location,OLC_NPC): _________x = npc.obj_get_int( obj_f_npc_faction ) likewise returned a value for x of 289 for an NPC with a proto faction of 7 (who was spawned by script, so no mob interfering). Anyone got any ideas?
Well, I've also tested this. Went to the Welcome Wench, and likewise looked at everyone's obj_f_npc_faction. Couldn't find a pattern, so I figured let's spawn some via script to see, like you said, if there are any MOB artifacts. So I spawned a bunch of Gloras. They all had different values, each incrementing by one. If that's not confusing enough, the original Glora and Spugnoir had the same value, despite the fact that Spug's factions (according to protos) is 9 and Glora's is 9, 12. So I went outside, and spawned more Gloras. This time it started from 368, and incremented by 1, sometimes 2. Then in Renton's home, I once again checked the residents. 317 and 318. Spawned a Glora - 319. Spawned a three Trolls - 321, all of them. They have no faction listed in Protos. I'm pretty sure I've seen someone in the Inn with 321 as well. If it weren't for Spugnoir and Glora having the same number back at the Inn, I'd say it's a pointer. Maybe it actually is, I dunno. Either way, it doesn't seem to be reliable in determining faction based on the value alone.
Thanks for the feedback. The capacity to interpret the faction seems to be very limited: obj_f_npc_faction seems to be the only relevant flag, there don't seem to b any other handles that deal with it (other than those for faction.mes). Its such a fundamental of combat though, there must b some way we can look at it. Maybe through 'hostile' and 'friendly'.