edited February 2017 in ORK Support
I was looking at an enemy that was previously working and targeting players correctly with one of his abilities which uses 'Force Found Targets'. I noticed that after I updated to ORK 2.10 (from 2.8) the enemy was no longer restricted to the 'Found Targets' to use an ability with the 'Force Found Targets' setting (it was working correctly with 2.8).

To test this further, I added a 'Clear Found Targets' block to his AI right before the ability - this means he should never be able to target anyone with this ability and so he should never use it. Nevertheless, he still uses the ability all the time and manages to target people somehow.
Post edited by Juryiel on
  • Did a quick test and worked fine here - I'd need more details on your setup (or a test project).
    Clearing targets before the action isn't really a valid test, when there are no found targets, the action will fall back to selecting the targets based on auto target and AI settings, even when found targets is forced.
    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!
  • For the particular ability in question, there are no auto targets set up. This is an enemy using the ability. What other settings can potentially allow the ability to be used on targets even if it's immediately preceded by a Clear Found Targets block? Might be easier to troubleshoot this way since sending an example project would be difficult.

    Also I'm a bit puzzled because the settings I have were not behaving this way prior to me updating - not sure if that is a hint that might point toward something.
  • In that case it will fall back to the AI settings of the combatant (e.g. using nearest or last target) - and if there are no settings there, the action will use a random target in range. And that's how this should have been all the time, it probably now behaves differently for you, because there where some fixes in the big AI update :)

    If you want the combatant to NOT use an action, use a None action. E.g. check the found target count, if it's 0, use a none action.
    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 February 2017
    What I'm trying to accomplish, and what was working before, is that I want a combatant to chose an action and to always target a specific target, even fi that target is out of range of the ability.

    So what was happening before (correctly) is that the enemy would go through a target selection routine, and find a target. It would then select an ability to use on that target, and that target ONLY. If that target was out of range of the ability, the option to use the Move AI to move into ability range was selected, and so the enemy would chase the particular ally combatant he selected, until he could use the ability on him.

    I think it makes sense to have an option that allows us to specifically control waht is and isn't targeted, with no autoselection happening anywhere - because my boss real-time fight designs are generally well-controlled, and I don't want the AI doing random things. I thought the Force Found Targets was the option to allow us to control waht combatants are targeted without any randomness, but I guess that is no longer the case.

    Is it possible to implement something else with that function?

    In fact, I don't really understand what 'Force Found Targets' does now, since it does not in fact 'Force Found Targets'. It specifically says 'The action will only have the found targets available. It can't fall back to other targets based on teh combatant's AI settings if none of the targets is in range' in the description. So in other words if I use 'Clear Found Targets' prior to an ability that has 'Force Found Targets' the description suggests that this ability should not be used.
    Post edited by Juryiel on
  • edited February 2017
    What you describe is how it's currently working (or how it should work and did in my test). The fallback only happens if there are no found targets.

    Check your ability's use range (template) if Move Into Range is enabled. It's a new setting in ORK 2.10 to handle if the ability will use the move AI to move into range and should be enabled by default.
    Post edited by gamingislove on
    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 February 2017
    Move Into Range is enabled. It does work like you say, with the notable exception that the enemy will use the ability on a target in range if the selected target is out of range. But if no targets are in range the enemy will try to move into range of targets.

    The issue is I'm not sure where the random target selection is coming from. The way it's set up, the enemy AI runs through some logic and sets an object variable on itself called 'Target' with a number correpsonding to a player it should target, through an object variable 'PlayerID' on each player. Prior to using an ability the AI uses Check Object Variable blocks to select the correct Player target based on the 'Target' . So for example, the AI checks its own `Target` object variable - if it equals 0, it then it checks for a player with an object variable `PlayerID` that equals to 0. If `Target` isn't equal to 0, then it checks if `Target` equals 1, followed by a block that checks for a player with an object variable `PlayerID` that equals to 1, and so on and so on until it checks for all 4 possible players (0, 1, 2, and 3). All of these blocks checking object variables Clear the Found Targets. If the AI shouldn't target anything, then 'Target' is set to -1 and since no matching targets are found (no player has PlayerID = -1) this leads to a 'None' block. I have manually checked to see that the `Target` variable is being set correctly and never changes to the randomly selected target that I'm seeing the ability used on.

    That means that there is either somehow a random target coming from somewhere or alternatively, the `Check Object Variables` block that searches for specific 'PlayerID' may not be selecting a targets correctly. It may be finding matches incorrectly such that all players are matched with the `PlayerID` check regardless what their value for `PlayerID` actually is.

    For my game it will never make sense for the AI to select a random target or to fall back on anything - target selection system needs to be predictable at all times. This is why the original behavior of 'Force Found Targets' was useful. It would be nice to have a setting that ensures that an ability will never be used on anything other than targets that are found via the Battle AI - and if no such targets are found the AI will go to the next block. Right now, I'm not sure what all the settings are that can lead to random target selection in this context, and they can potentially be buried all over the many, MANY settings in ORK. So I think having a better way to control what is targeted makes a lot of sense.

    But in any case, so far none of the mentioned places that can generate random or fallback targets were enabled, so short of a way to REALLY 'Force Found Targets' a documentation on all places where fallbacks can occur would be useful.

    Post edited by Juryiel on
  • Is it guaranteed that all (player) combatants have a PlayerID? Otherwise 0 isn't a good ID to check for, as this is also the value for variables that aren't set. In that case, there could be multiple found targets and the enemy using the one in range ...

    I'll do some more tests - the Force Found Targets behaviour wasn't changed and should be the same, and the fallbacks are only used if there are no found targets, i.e. if you check the found targets count and it's 0, your battle AI should use the None action as well.
    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 March 2017
    Yeah, all player combatants have a player ID - but I don't think this is what's going on anyway because it auto targets every one of the combatants. I'll keep looking myself but it's hard to know what to look for since targeting seems to come from all sorts of places (battle AI, move AI, abilities).

    I suspect it's probably coming in somewhere entirely unexpectedly and not in the Found Targets - is there a way to get a list of the found targets at runtime so I can debug it better? And in addition is it possible for you to tell me all of the paths where the targets can come in? That way I can Debug.Log each of these possible target lists and see where it's coming in. I think that will really help me narrow down what is happening without you having to invest time in it.

    If this fails, I will try to replicate in a simple project and send it over - but I didn't mean to imply that I want you to keep testing and hunting in the dark without me being able to send you a project! :) Just looking for info from you (and from ORK via Debug.Log) to identify where these targets could potentially be coming in, so that I myself can use that information to debug.
    Post edited by Juryiel on
  • Targeting for actions is never coming from the move AI - only from the battle AI and possibly from the auto target settings of the ability/item (when not forcing found targets). If the battle AI used an action without targets, the targets will be determined by the auto target settings (if used) or the combatants AI settings (e.g. using the nearest target).
    Unless you're using AI rulesets - they can also influence targeting :)

    If one of the used targets is in range, the action will be used on it, otherwise the move AI will move to the nearest target until in use range (if allowed by the use range settings).
    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 March 2017
    Right that makes sense - but is it easy to grab each of those separately and programmatically? So like Debug.Log(FoundTargets), Debug.Log(AutoTargets), Debug.Log(OtherTargetSource) etc so I can monitor exactly what is happening when the AI switches targets?

    The reason is I'm sort of stuck with the GUI part, I checked that:
    1. Neither the abilities nor the combatant have auto targets enabled
    2. Force Found Targets is enabled in the AI
    3. No AI rulesets or any part of that system has been used.
    4. `Clear Found Targets` block was used in this context (e.g. with no auto targets enabled as stated above) to remove all found targets immediately prior to the ability's block, and ability was still used.

    Given the above 4 I don't know where the problem may lie - so seeing the target lists programmatically may help
    Post edited by Juryiel on
  • Like I said - if you use Clear Found Targets, the ability will still be used and find targets itself. Event if you don't use auto targets or enable one of the target definitions in the combatant's AI settings (e.g. using nearest target), it'll just use a random target.

    If the issue is just with Clear Found Targets not preventing using an action - you'll have to check for the found target count (and use a None action in case you want the AI to end and the combatant to not do anything).
    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 March 2017
    Well the issue is with determining where the targets are coming from when I DON'T use `Clear Found Targets`. I think the behavior you describe is very odd. Essentially, if 'Force Found Targets' is enabled, and no targets are found via the AI, even though auto target settings are not enabled, the AI will nevertheless still randomly auto-target. Ok, that's counterintuitive but it isn't really that important - given that that's how it is, that's fine.

    BUT if 'Clear Found Targets' is not the appropriate way to test whether targets are coming from the Found Targets list or from Auto Targets settings, then once again, that suggests that I should try to output the various target sources in Debug.Log() so i can figure out what is causing the targets to show up.

    So how can I do that?
    Post edited by Juryiel on
  • Best way would be to output them in the SetActionTargets function of the CombatantAI class (found in Gameplay/Combatants/Combatant/ in the source code). The preferredTargets list contains the found targets.

    Anyway - I'll need a small test project where this is happening to be able to fix this (in case it's a bug).
    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, I'll test this to see what the Found Targets look like - what about the other target sources? How can I output those?

    It's hard to make a test project without knowing what is causing the issue - I imagine by the time I can build a test project I will basically have figured out whether I have an incorrect setting somehwere or whether it's indeed a bug. So hopefully when I look at these target lists I can figure this out. :)
  • The allies and enemies available for targeting in general are also passed on to this function.

    You don't have to build a test project from scratch - you can pretty much just make a copy of your project and remove all the unneeded stuff (e.g. prefabs/models that aren't in the test case, unused scenes, textures, etc.)
    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!
Sign In or Register to comment.