edited May 2023 in ORK Support
A few questions about targeting.

I am working on a real time battle system.

1) Is there an easy way to see a combatants current targets if its not the move AI target? Like display targets or target changes in the console?

2) I currently have my control maps set to auto target so my abilities/items can be set to single target instead of target none. This allows me to reuse abilities between player and AI combatants. The control map auto target settings tooltip says it uses the "Auto Target" settings in the ability. Is that referring to the auto targeting conditions or the control map overrides?

3) In the case of an ability set to use single target selection, auto target would use an individual target correct?

4) I have a script set up to select targets and add/remove them to a camera targeting group. I have been trying to use
Combatant thisCombatant = ORK.Game.ActiveGroup.Leader;
Combatant target = ORKComponentHelper.GetCombatant(CurrentTarget.CombatantRig.gameObject);
thisCombatant.SelectedTargets[0] = target;


Would using auto target cause issues with this or does it only auto target if there is not a current target?

5) In Target Settings, there are ways to set up different Individual or Group target settings, where can you change which setting you want to use?

Thanks
Post edited by shortyyard on
  • 1) No easy way, but you can display the target in a HUD.
    E.g. using a Combatant HUD to display a combatant's status information, you can add a HUD Combatant Target content provider component to the HUD's prefab. This component can get the current target of the combatant and use it in other HUD components to display information about it. It can be used to get different targets, e.g. currently selected target (target selection), last target, group/individual targets, etc.

    2) Generally, yes. It'll use the auto target settings of the ability (or item).
    If you also enable Auto Target Only, it'll only be used for abilities/items that have auto target conditions defined.
    Otherwise, when no auto target condition is defined or no matching targets are found, it'll fall back to the combatant's AI settings, e.g. using nearest target, last target, etc.

    3) If you refer to the group/individual targets you can set up - no.
    Those are selected (or 'marked') targets for the individual combatant and the whole group. Control map keys have settings for using the group/individual targets for their targeting and will automatically use them if enabled (and available).
    Otherwise, yeah, auto target will use either a single or group of targets based on it's target selection setup.

    4) No, auto target doesn't use the individual targets (that you use here).
    Alternatively, you can also use combatant links via:
    combatant.Battle.CombatantLinks
    Those let you set a combatant for a defined key - or you can just use selected data :)

    5) You don't - you use all of them.
    Each setting has it's own target, so you can use e.g. 3 individual targets, each are separate. When an action uses the individual target, it'll check them for which it's able to target and use the action on.
    E.g. you can have the first group/individual target only target enemies, the 2nd only target allies, etc. - or limit to defined actions.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • edited May 2023
    If I go with using selected data to set target location etc in ability schematics, how does object selected data work? Currently, I have Combatant thisCombatant = ORK.Game.ActiveGroup.Leader;
    Combatant target = ORKComponentHelper.GetCombatant(CurrentTarget.CombatantRig.gameObject);
    thisCombatant.SelectedData.Change("playerTarget", target, GamingIsLove.Makinom.ListChangeType.Set);


    But I am not sure how to verify it actually is saving anything. I haven't found where it shows in the object variable component yet. I tried using a Store selected data content node and a unity console printing the string variable but its not displaying anything.

    Update: My object variables component is on a child object so I just needed to use GetComponent to get the correct object.
    Post edited by shortyyard on
  • edited May 2023
    And to clarify on the individual/group Target Settings, each setting works as a slot or increasing the allowable size of the target list? So if I have two setting profiles then I can have two targets stored? And if I used thisCombatant.SelectedTargets[0] = target; to remove target [0], would target [1] move to [0] like in a list or remain target [1]?
    Post edited by shortyyard on
  • The combatant's SelectedData property gives you access to the selected data, independent of where the component is actually placed on the combatant.
    The object variables component doesn't show selected data content, but the code you used is correct and will set the playerTarget data to the target combatant.

    You can get the combatant out of the selected data like this:
    Combatant target = ORKSelectedDataHelper.GetCombatant(thisCombatant.SelectedData.Get("playerTarget"));
    shortyyard said: And to clarify on the individual/group Target Settings, each setting works as a slot or increasing the allowable size of the target list?
    It works as a slot, you can set target index 0 and target index 1 independent from each other. Removing index 0 doesn't move index 1 up to 0 - 0 is just empty, i.e. has no selected target.

    Each group/individual target setting works on it's own, with it's own ways to select targets, limit what actions can be used on it etc.
    I guess most use cases will only need one setup, i.e. one available target. It's just a feature that's there in case you need to select multiple different targets, e.g. have one enemy and one ally marked as target to use actions on (each naturally can only be used as target for actions that can target them, so attacking an ally is usually not possible unless the action is set up that way).
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Great! Thanks for answering all my questions.
Sign In or Register to comment.