Hi there peeps!
Not quite sure how to go about this one, so I thought to ask here!
I’m making a game with a range of factions. I planned that each character (including the player) has a relationship variable (likely just an integer) with each faction. If low, gangs are hostile, if high, allies, etc etc.
What I’d like to know is how to make each faction member make checks on all the characters they see (via pawnsensing)? How do you make the relation variable able to be read the same for each person as a universally recognized value rather than having to cast to each individual character for their own unique version of that variable? Would it involve getting actors from class? I’m kinda uncertain about how to go about this XD
Thanks in advance!
I know its not the exact question you asked but there is a free plugin Factions Extension in Code Plugins - UE Marketplace which does alot of what you would be looking for.
Thanks for the suggestion, that actually looks very useful XD I’ve been trying to informally learn unreal for a few months now (never did any game design prior to this) and I guess in this time I didn’t even really consider checking out plugins. I’ll give this plug in a try, thank you!
No problems, Ive used this myself and found it to be useful thats why I recommended it If you want to make factions as a learning exercise though it might be a good idea to do it anyway and if you get stuck theres always the plugin to fall back on.
Ok, I’ve found the answer myself. I did download the faction plugin, but have not bothered using it, at least not yet, as I’m using more specific relations than just Freindly, Neutral and Hostile.
What I did was create a new blueprint class, which I called ‘Respec’. This component contains variables for relations with all factions. Every character will have this component and whichever character with pawn sensing sees that character will check that component to see what they are supposed to think of them.
Example below shows how to check this component using pawn sensing. The character using this is part of a thing called the Iron Sigil and is checking how much it’s faction respects that person.