• edited April 2021
    That was so much easier than I expected it to be. =)

    Another question, how do I set up a location so that if the player can get to it they win the battle (presumably get their entire party to it)?

    Also, for the same battle, how do I make it so that if even one member of the player group goes down the player is defeated?
    Post edited by Whatexists on
  • For the area, probably best use regular game events via trigger event interactions - the End Battle node can end the battle and lets you select which outcome (e.g. Victory) it has.
    For getting the entire party there, either do a count for each player combatant entering (i.e. Start By Other enabled in the interaction) until all are in there (also needs a Trigger Exit event removing the count when they leave), or use a Search Combatants node to get all player combatants within range of the event and check if that's all of them.

    The defeated thing has to be handled in the death event of your combatants.
    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!
  • Well I'm working on that and may have questions at some point. But in the mean time what's the right node for checking line of sight in a battle AI? the AI I'm using to get an enemies preferred target is currently:
    Clear Found Targets
    Check Status (check enemy, status requirement: status type status, status needed death, is dead disabled, combatant scope current)
    Get Nearest

    I'd like it to also ignore any enemies that aren't within line of sight, but aren't sure what the right nodes to do this are.
  • I think the best option is to go via the move AI's detection settings. Battle AI's can use the combatant's move AI detection via Check Move AI Detection nodes (and other nodes to check for hunting targets, etc.).

    Even if you don't use the move AI for movement, you can still use it in battle AI for detection.
    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!
  • Alright. I must be doing something wrong with the victory location thing. I can't get the event to trigger in the first place. I'm using a box collider object with is trigger enabled and an event interaction componant for an event that currently just has an End Battle node. The event interaction has start type Trigger Enter, with Start by Collider enabled, Start by Trigger enabled, Start by other enabled, check name/tag enabled, is tag enabled, and name/tag "Ally", interaction type Any. the item is currently a child of the battle grid parent object because it's one of three battle grid prefabs that I've set up to be loaded into the scene based on a different event.
  • Try enabling In Blocked Control - also, if you're checking name or tag, make sure the combatant's game object is also named/tagged like that.
    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!
  • Thanks! That worked!
  • edited May 2021
    Alright. I don't use move AI's currently and must have them set up wrong for this (or I put in the check move AI node wrong).

    For the battle AI that finds a target I currently have it set up with:
    Clear Found Targets >
    Check Status (found targets check, target enemy, don't add targets disabled, exclude found targets disabled, force knowledge disabled, status requirement Death with is dead disabled)
    if failed > nothing
    if successful >
    Check Move AI (found targets check, target enemy, don't add targets disabled, exclude found targets disabled)
    If failed > nothing
    if successful >
    Get Nearest (found targets check, target none, use grid distance enabled.)

    But I'm not sure how to set up my move AI's.
    The current move AI I'm using is basically the "default" settings except:
    Stop distance 1.5
    Add Component enabled
    Use Detection (enemy detection) enabled
    - detect only leader, detect on damage, use attack allies all disabled
    - timeout 0.5
    - detect group targets, detect individual targets both disabled
    - range 100
    - threshold 0.5
    - ignore height distance, no combatant radius both enabled
    - move detections needed one
    Move detection 0
    - detect combatants, detect points of interest both enabled
    - type sight
    - use reycast disabled
    - range 20
    - threshold 0
    - ignore height distance check
    - no combatant radius disabled
    - angle 360
    - angle offset 0
    - horizontal plane xz.
    then Target position checks at 0/0, 0.2/2, 0.5/5, 1/10, 2/20,

    Use Hunt, Use Flee, Use Caution, and Use Protection all disabled.

    On the combatant Use Move AI is enabled with the above move AI selected, and Use Battle Move AI is disabled.

    Enemies appear to pass their turn if a Player is not within 20. If an Player is within 20 and they have line of sight they will attack that player (or the closest one). If a player is within 20 and not within line of sight they... start shooting eachother targeting the closest enemy unit. They don't always do damage when targeting eachother, which is a whole other issue, but one I can deal with separately later since they're not really supposed to be shooting eachother at all, however scared of the presence of a hidden hero they might be!

    If there are Players within 20 and they have line of sight on one, but the closest enemy is behind a wall, they will prefer the hidden one over either the player they can see or another enemy, and will attempt to attack the hidden player.

    Any idea why that might be happening?
    Post edited by Whatexists on
  • Well, since your original goal was about line of sight and your move AI's detection has raycasting disabled, there's no line of sight check going on and you just use anyone that's within 20 world units and in 360 degree around the combatant.

    If line of sight is determined by blocked cells, you could also include that via the ability/item use ranges and the used range template, which has grid line of sight options.
    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!
  • Ah, yep. That fixed literally everything and now it's working perfectly. =)
  • I'm working on enemies AI for some specific scenarios and I'd like to be able to make enemies move along fixed "patrol" paths, or "rails". E.G. for automated turret enemies that are on rails and move a fixed distance along the rail each turn like a toy train set, or for patrolling guards on a stealth mission who have a patrol path that they'll follow until they see a player. This is for during a grid based battle.

    I'm assuming that this sort of thing is best done either with waypoints, or with grid formations. I remember that there was a basic tutorial for getting enemies to patrol along a path designated by waypoints outside of combat. Would that work in grid combat? And could it be done with battle AI's instead of with move AI's?
    And is there a tutorial for grid formations and generally how they work I could work through somewhere?

    Thank you!
  • edited July 2021
    Hm, I don't think that grid formations are working for this.

    Using an ability is probably a better way - the path could either be handled by finding game objects by tag (i.e. setting a tag on the cell's game object) or via the Grid Cell From Coordinate node, where you can define the grid coordinate via Vector3 value.
    E.g. the combatant could store it's start node and path target node as object variables (coordinates) or as selected data and reuse it.

    Move AIs don't work with grid paths.
    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!
  • Alright, so I'll need to build them specific "move" abilities (which is fine, I've already done a lot of that, as this thread testifies =) ), and those abilities will need to target specific grid coordinates for them to move to. Maybe move to a node based on checking a game variable that will get incremented each time the ability is called. Then the ability can be called by a battle AI normally?

    I'd need the game variable to be unique to the combatant rather then a global one. How do I do that?
  • Using the combatant's object variables, obviously :D
    You can pretty much have a single ability for this and control where to move via a Vector3 object variable on the combatant (storing the coordinates of the cell).
    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!
  • sounds perfect! How do I set up object variables? Under the Combatant component > Variable Settings > Set After Adding Combatant > Set Object Variables > Add Game Variable (using variable type Vector 3)?

    If so does this require all of the combatants to already be set up in the scene? The scenario I'm currently working on is one where the player can activate different "test" battles in an arena. So there is a dialogue to determine which one you want to do and that spawns (& deletes if necessary) the appropriate battle grid and terrain objects and stuff in the Arena, and then I'm using different conditional battle groups for the enemies. If I have the enemy combatant prefabs already loaded into the scene how do I add them to the battle groups? Wait, isn't this covered in some of the tutorials?
Sign In or Register to comment.