How to get an Agent's(character object currently in a game) Position?

Users who are viewing this thread

So I am trying to do some specific things but I need to know where the agents in the game are and their current position in the game world. Is there a way to get this information or query on it? Is there a way to get a full list of character agents in the current game? Thanks!
 
Are you referring to their position on the world map, or in a settlement/battle?

Haven't looked into the campaign map yet. I can't imagine that it'd be too much harder.

In a settlement/battle you can get the mission and use mission.agents to grab a list of all the agents in the scene. From there, just loop through them and use the Position field or GetWorldPosition method.
 
Upvote 0
I was thinking specifically the campaign map. Although the that is some great info on the missions thank you. Also so you have a code example to get the current mission?
 
Last edited:
Upvote 0
That one got me a null reference, I think that might be if your in a mission. I did have some luck doing this Campaign.Current.Characters.Count() I am going to investigate it some more.

Updated: Okay so that gave the ability to currently query on all campaign characters which what I wanted. How do you utilize the getWorldPosition method?
 
Last edited:
Upvote 0
If you think heroes in general you can just use the encyclopedia, reachable by hitting N on the campaign map, or right clicking any characters picture in town etc.
There are loads of npc that aren't part of the encyclopedia though, the way to find them like a random gangleader in a random town would be through quest description. Else I don't know ¯\_(ツ)_/¯
 
Upvote 0
Looks like the best way to handle finding characters is to start with mobile parties, then grab all the members for them. Check to see if the leader is a hero, then from the hero object you can tell where the unit has been recently.
 
Upvote 0
Back
Top Bottom