I had need of a custom function that gets the Faction of oTarget. Figured others may have a use for it as well.
Uploaded file is in ERF format. It includes the script function itself, as well as custom Faction Pig creature blueprints to use with the script (they can be found under the Debug section). These Faction Pigs need to exist (be painted down) somewhere in the module for the script to work correctly.
Function has room to edit so you may add up to 10 custom Factions to it. With some more editing you can add an unlimited number of custom Factions to check against. See comments in function for what to edit in this case.
If you don't know how to use custom functions or include script, see the related section in my Scripting For Noobs tutorial.
10 - A Masterpiece, Genuinely Groundbreaking 9 - Outstanding, a Must Have 8 - Excellent, Recommended to Anyone 7 - Very Good, Deserves a Look 6 - Good, Qualified Recommendation 5 - Fair, Solid yet Unremarkable 4 - Some Merit, Requires Improvements 3 - Poor Execution, Potential Unrealized 2 - Very Little Appeal 1 - Not Recommended to Anyone