Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Tactical Shooter AI - Asset Store Pack

Discussion in 'Works In Progress - Archive' started by squared55, Mar 2, 2015.

  1. hellobard

    hellobard

    Joined:
    Sep 26, 2012
    Posts:
    140
    is it possible to use non-humanoid models in this system? I have two enemy types in my game, one that's mecanim humanoid and one with custom animations and rig that's not humanoid at all.
     
  2. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    For almost the entirety of development my rig was set to be generic, so I'd say yes, barring some extreme circumstances with your model (like it being a snake, or something).
     
  3. bluesubstance2

    bluesubstance2

    Joined:
    Jun 1, 2014
    Posts:
    11
    Hi there, I have encountered a slight problem.
    When an agent sees my player, he seems to be able to see him all the time, no matter if the Line of Sight is broken. (He does not shoot through walls) Is there any way to make him "target" the last seen position of the target? I want the player to be able to sneak up on an alerted AI without it noticing him.

    Thanks for any reply!
     
  4. Tinjaw

    Tinjaw

    Joined:
    Jan 9, 2014
    Posts:
    518
    From what I know of TSAI, is that what you are asking for is what Search behavior presently does.
     
  5. bluesubstance2

    bluesubstance2

    Joined:
    Jun 1, 2014
    Posts:
    11
    True, but in "Search" mode the AI moves directly towards the actual position of the player, not the one he has last seen him.
     
  6. Tinjaw

    Tinjaw

    Joined:
    Jan 9, 2014
    Posts:
    518
    But does so by going from one "known position" the the next. Only updating when it reaches its current target destination. The AI is not continuously tracking the player's position in realtime.

    UPDATE: From the docs...
    Search: The agent actively looks for their target. When the behavior starts, they are given the targets current position. They will then move to this position. When they reach the position designated at the behaviors initialization, their destination will once agent match their targets current position. If the target stays still, they will quickly be found, but a mobile target will be able to avoid detection a while longer.
     
    Last edited: Jul 15, 2016
  7. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    The agent will revert back to their idle behavior when the player gets far enough from the last spot they were seen by the agent. The parameters to adjust this are in the targetscript. I can look into making them shoot at the last known spot with a toggle in a future update,
     
  8. bluesubstance2

    bluesubstance2

    Joined:
    Jun 1, 2014
    Posts:
    11
    Oops, my bad. Should've read the docs a little more carefully, will now tweak the script values. Shooting at the last know position sounds good, thanks again. ^^
     
  9. rbm123

    rbm123

    Joined:
    May 24, 2015
    Posts:
    130
    I have this errors:
    I've set Tag for AI controller !

     
  10. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    Make sure the spelling and capitalization is exact. The only way that first error could appear is the result of an incorrect or missing tag. And make sure you don't have any duplicates. The second is almost certainly a result of the first.
     
  11. rbm123

    rbm123

    Joined:
    May 24, 2015
    Posts:
    130
    I change the values in "target script : Line of sight parameters " on AGENT

    but when "my max distance to notice" on default value "9999" the agent can detect me from all over the map ! when I make a change in value the agent only walks to me!

    Also when Agent detects me , first he walks to my position and when I move around he start engaging!

    edit: there is nothing (wall , stone , car) in scene between AI and character! but Ai can see ne from far distance instead of changing values in line of sight !

    Sorry for my bad English
     
    Last edited: Jul 17, 2016
  12. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    I'm sorry, but I'm not sure what the problem is. Is the agent seeing you when he shouldn't, or not seeing you when he should?
     
  13. rbm123

    rbm123

    Joined:
    May 24, 2015
    Posts:
    130
    he can see and detect and attack me from high(far) distance !
    i changed max distance to notice but didnt worked!

    watch this one minute video:
     
  14. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    If you set the AI Controller's layermask variable to nothing, does the agent see the player from afar? If so, it's a problem with your layermasks, make sure that the player themselves is NOT on the AI Controller's layer.

    ---

    Got some new animations that should let me add some new features! I almost have dodging animations working:

     
  15. rbm123

    rbm123

    Joined:
    May 24, 2015
    Posts:
    130
    yes ! I changed layers but AI Agent Detects me from afar!
    ** you mean AI controller layer or layer mask in script option?



    I changed layer but still have same problem!
     
  16. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    The layermask.

    And you set the layermask to default. It needs to be nothing. And make sure the target script is attached to your camera.
     
    Last edited: Jul 21, 2016
  17. baroquedub

    baroquedub

    Joined:
    Aug 27, 2015
    Posts:
    11
    I've got Tactical Shooter AI 1.3.3 and UFPS 1.6.1 working together. Player and Agents both give and take damage.

    How would I go about getting the agents to take a physical impact from the UFPS Player bullets? Although the agents' health goes down when hit, it doesn't look very realistic as they don't move or flinch.

    Any help much appreciated
     
  18. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    The easiest way would probably be to add a "flinch" animation to the animation controller, and then call it when the agent takes a large enough damage. I got some relevant animations recently and am working on adding this functionality built-in. It should arrive soon-ish (I hope!).

    Dodging animations are basically ready to go at this point. I'll probably be submitting this to the asset store tomorrow.
     
    Last edited: Jul 23, 2016
    baroquedub likes this.
  19. ParadoxSolutions

    ParadoxSolutions

    Joined:
    Jul 27, 2015
    Posts:
    325
    Hello again,

    I have decided it would be easier just to write our own AI rather than continuously jump through hoops to get these AI working awhile ago. Although I thought I would come back tonight and try again to get the A* Pathfinding Project to work with this asset and I have not had much luck. To override the NavmeshInterface class it has to be in the ParagonAI namespace, but at the same time to have the A* seeker get things like the desired velocity it needs to be in the Pathfinding namespace, I have tried this 3 different ways but keep coming up with similar problems, I cant use the A* components in place of Unity's built in NavmeshAgent the way Tactical Shooter AI is written unless I am interpreting the A* examples wrong. Our games rarely bake navmeshes and all pathfinding needs to be done at runtime on graphs that were generated on the fly. I wish this worked out of the box with such a popular pathfinding solution especially since Unity's built-in agents/navmesh are so limited. I studied AI at DIT but I just don't have time to write AI from the ground up, maybe someone more experienced with the A* Pathfinding Project can figure it out.
     
  20. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    Hey, sorry that didn't work out. I could try and get it to work with A* specifically before you try and move on to another attempt.

    Even if you don't end up using it, it was be good to know what other specific problems there are with A* so that I can get it working for others.

    EDIT: See below for A# attempt #1. :)
     
    Last edited: Jul 23, 2016
    hopeful likes this.
  21. ParadoxSolutions

    ParadoxSolutions

    Joined:
    Jul 27, 2015
    Posts:
    325
    There is a free version http://arongranberg.com/astar/ and from what I understood was the AI uses the "Seeker" component similar to the agent using Unity's NavmeshAgent and I tried switching those out but I think it needs a middle script to hold a separate AI just for movement/velocity and animation but that should be handled by Tactical Shooter AI already and I just couldn't figure out how to link all that. I know a few others after me have asked how to use their "pathfinding assets", could ask them what they used and if it worked.
     
  22. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    OK, so here's what should be an A* Navmesh Interface, I just straight-up replaced the old one with this for simplicity's sake, but you'll still need to drag it onto the Agent game object and apply the variables.. Its kinda hard to test because the included map is so small and I'm too lazy to manually make my own navmesh with Blender or something.

    I used the free version of A* 3.8.2, but it looks like the pro version has a "RichAI" which has some slight changes, however the key methods seem to be the same. I'm hoping that you could get it working there with some simple swapping out of the class names, as well as adding the simple variable references mentioned in the comments of the attached. If you can't I might pick up Pro, but I'd rather not spend twice the price of my asset if I can help it. :)

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class NavmeshInterface : MonoBehaviour
    5. {
    6.     //NavMeshAgent agent;
    7.     public Transform markerTransform;
    8.     public AIPath pathAI;
    9.     Vector3 lastPos;
    10.     Vector3 currSpeed;
    11.  
    12.     public void Initialize(GameObject gameObject)
    13.     {
    14.  
    15.     }
    16.  
    17.     public void Awake()
    18.     {
    19.         pathAI = gameObject.GetComponent<AIPath>();
    20.         markerTransform.parent = null;
    21.     }
    22.  
    23.  
    24.     void LateUpdate()
    25.     {
    26.         currSpeed = (transform.position - lastPos)/Time.deltaTime;
    27.         lastPos = transform.position;
    28.     }
    29.  
    30.     public virtual void SetDestination(Vector3 v){
    31.             markerTransform.position = v;
    32.     }
    33.  
    34.     public virtual bool ReachedDestination(){
    35.         return pathAI.atDestination;
    36.     }
    37.  
    38.     public virtual bool PathPartial(){
    39.         return false;
    40.     }
    41.  
    42.     public virtual Vector3 GetDesiredVelocity()
    43.     {
    44.         //return agent.desiredVelocity;
    45.         //Really just the speed we're moving at.
    46.         return currSpeed;
    47.     }
    48.  
    49.     public virtual bool PathPending(){
    50.         return false;
    51.     }
    52.  
    53.     public virtual bool HasPath(){
    54.         return false;
    55.     }
    56.  
    57.     public virtual Vector3[] GetNavmeshVertices(){
    58.         //Just use Raycast dynamic cover!
    59.         Vector3[] v3 = null;
    60.         return v3;
    61.     }
    62.     public virtual void SetSpeed(float f){
    63.         pathAI.speed = f;
    64.     }
    65.  
    66.     public virtual float GetSpeed(){
    67.         return pathAI.speed;
    68.     }
    69.  
    70.     public virtual void SetAcceleration(float f){
    71.         //Use RichAI acceleration variable here
    72.     }
    73.     public virtual float GetAcceleration(){
    74.         //Use RichAI acceleration variable here
    75.         return 1;
    76.     }
    77.     public virtual void SetStoppingDistance(float f){
    78.         //Use RichAI endReachedDistance variable here
    79.     }
    80.  
    81.     public virtual float GetStoppingDistance(){
    82.         //Use RichAI endReachedDistance variable here
    83.         return 0;
    84.     }
    85.  
    86.     public virtual float GetRemainingDistance(){
    87.         //return agent.remainingDistance;
    88.         //Not ideal, but should be good enough seeing as I only use this to check if we've got somewhere.
    89.         if(pathAI.atDestination)
    90.         {
    91.             return 0;
    92.         }
    93.         return 100000;
    94.     }
    95. }
    96.  
    97.  
    Some extra things you'll need:
    1. Add a character controller to your agent. Make sure it's on a physics layer which can't interact with the ragdoll, or else it'll comically fly straight up into the air at half the speed of light.

    2. I made the Nav-interface namespace-less, so you'll need to go into the basescript and eliminate all references to the old namespace (just do a ctrl-F find for NavmeshInferfacein the BaseScript and delete the preceding namespace, there's only a few. Alternatively, you could just follow the error log.). However, I don't think that'll be nessecary given some of the next few changes, so you might want to hold off on that (you'll also need to add the namespace back to the class).

    3. Create a "targetMarker" empty gameobject, make it a child of the agent (for convenience purposes with prefabs) and assign it to the NavI as the MarkerTransform.

    4. Attach a "Seeker" and a "AI Path" component to the agent.

    5. In the AI Path script, create a public bool called "atDestination"; Make it assigned to true in OnTargetReached(). Make it false in SearchPath(). I'm assuming there's an equivalent for the RichAI class.

    My solution for that was to just create a transform that the Seeker is set to follow and then just move the transform to the target destination. That takes care of the movement, and then what isn't provided by the script I would just math out. There's lag of one frame on things like speed, but it's completely unnoticeable.

    Let me know how things go!
     
    Last edited: Jul 23, 2016
    pcg likes this.
  23. ParadoxSolutions

    ParadoxSolutions

    Joined:
    Jul 27, 2015
    Posts:
    325
    Just to clarify, when removing the references from the base script am I removing the NavmeshInterface references as well as all the NavI references or am I setting something new as equal to NavI. I've done the other steps except step 2 and 3.
     
  24. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    Just the "ParagonAI." bit preceding every reference to the NavmeshInterface class in the basescript, nothing else needs to be added. Basically, if you copy-paste the code exactly in place of the included one and it throws you errors, that's how you fix it. If you just include the body of the class, you might not even have to do that.
     
    Last edited: Jul 23, 2016
  25. baroquedub

    baroquedub

    Joined:
    Aug 27, 2015
    Posts:
    11
    great stuff. You're a real pro, as always.
     
  26. ParadoxSolutions

    ParadoxSolutions

    Joined:
    Jul 27, 2015
    Posts:
    325
    I'm not sure I understand, I'm reimporting the baseScript because it can't refrence the navmeshInterface, I am not sure what I did but I broke it haha. Looks like UFPS just updated too.
     
  27. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    I think I'm making this sound way more complicated than it is.

    The script I posted above is not in the namespace the BaseScript was expecting because I started work off the assumption that it would have to be in a different namespace. That turned out to be unnecessary, but by that I'd already adjusted my base script in my test project and the lack of namespace in my pasted code reflects that.

    Just try pasting everything from the commented out "//NavMeshAgent agent;" down into the body of your default, out of the box NavmeshInterface class and it should work fine (assuming you set up everything else like I said.)

    That keeps all the namespace info of the original class (really just the one line above the class name) but has all the A* methods. Make sure to add/remove brackets at the end of the file as needed.

    If you can't get it working I'll post a modified version that should require no changes besides pasting it in next time I'm at my computer (I'm writing this on mobile.)

    Unless UFPS changed the damage system again, things should work fine. :) There's a video I posted a page or two back on getting UFPS 1.6 working, I'm pretty sure it still holds.
     
    Last edited: Jul 24, 2016
  28. GenOli

    GenOli

    Joined:
    Apr 21, 2013
    Posts:
    139
    @squared55

    How do I make the AI only do Melee attacks?

    eg: Run up to enemy and attack even if being shot at, like a zombie?
     
  29. rbm123

    rbm123

    Joined:
    May 24, 2015
    Posts:
    130
    I did changes as you said but still AI detects me from afar and then comes to my position!

    * when I choose "nothing" in layer mask , AI agent only take cover in places which have cover nod and when I choose "default" the Agent take dynamic covers too !
    ** I put an object between character and AI agent but still he detects me afar and come to my position! but when engaging he dont shoot character behind the object !

    sorry for my english!
     
  30. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    Disabling the gun script, setting the AI Type to Berserker and enabling melee in the base script should to the trick. Also make sure that the minimum distance distance to target is not in cover is set to a value lower than the melee range.

    Choose an idle behavior that isn't Search.
     
  31. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    Working on getting some basic parkour implemented. I'm starting small, just by leaping over some gaps but I hope to get some more advanced stuff in the future.

     
    hopeful likes this.
  32. rbm123

    rbm123

    Joined:
    May 24, 2015
    Posts:
    130
    I choosed another option - patrol- and AI didnt engaged me!

    ** I have added an Agent with different team number and both of agents first move next to each other and then start shooting!
     
  33. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    Choose the wander behavior for testing. For patrol you will need to set up waypoints in the base script.

    Choosing nothing for the layer mask will cause the AI to see through everything. If that lets the agent fire from afar then we know it's an issue with the layermask. Before you add any layers back to the layer mask, make sure your player is on a different layer than the map and then only choose the layers your level parts are on (I would make them their own layer and call it level parts or something similar).


    Also, make sure you test on the demo maps to make sure it is not some issue with your scene.

    Finally, make sure you are using 1.3.3 so you have all the bug fixes. Plus, if nothing up to this point has worked, a clean import probably will help rather than hunting down the one variable that needs to be changed.
     
    Last edited: Jul 26, 2016
  34. Mr-Logan

    Mr-Logan

    Joined:
    Apr 13, 2006
    Posts:
    455
    I'm working on a game where spaceships can link up and allow boardingparties to cross, the ships may or may not be procedurally generated, but for now I'm just making prefab parts and throwing them together manually.
    Would this solution work for me?
    What I'm worrying about is for example with navmeshes I can't (to my knowledge) bake navmeshes to prefabs, rather I'd need to do it to levels which can then be loaded additive, and as far as I'm aware there's no way to set neither positions nor rotation when adding a level ^_^
    I suspect there may be a way to get levels working like I want, but it's a hassle, and I don't know if you can place offlink's or whatever they are called dynamically either ...

    Anyway, if this solution can do the magic required, I'll be buying it in a few days :)

    Also, I saw on page 1 that you had trouble adding your own animations because you couldn't open the mesh file.
    You don't need the mesh file, you just need a bipedal skeleton and unity can map the animation from one to the other. :)
     
  35. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    Unless you do something really impressive with the navmeshes, I don't think it would work out of the box. However, all the navmesh functions are in their own Navmesh Interface class which you could alter to work with another solution that supports on-the fly baking. Above is an example that should work with A*'s free version. I really hope Unity gets this feature implemented sooner rather than later.

    With regards to the animations, I've actually got some new ones to play around with. :) Vaulting, for one:

     
    NeoUnity, Mr-Logan and hopeful like this.
  36. rbm123

    rbm123

    Joined:
    May 24, 2015
    Posts:
    130
    This option Worked !
    but one thing ! the agent is not engaging when I shoot near him! to engage , he should see me when I am in front of him or when I shoot himself !

    I'm from Iran and I cant buy assets my self ! I should wait for doing some jobs for some one and then ask him to buy this asset for me Instead of paying !

    sorry for my English
     
  37. Mr-Logan

    Mr-Logan

    Joined:
    Apr 13, 2006
    Posts:
    455
    Ok, I'll have to think it over. I had a look at the roadmap and it seems to be way off .. currently there's the 5.4 beta which doesn't have it, then the next alpha they are working on, and then a hypothetical alpha out in the future where they are planning to finally add it..

    I seem to have found a different solution though, RAIN AI, it can do everything runtime, including generating new navmeshes, however it for some reason they are giving everything away for free, and have no way of really earning on their hard labour, which I suspect is why there haven't been updates in a while, which is a shame as it's incredibly powerful.
     
  38. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    Working on adding stagger/hit animations:



    This agent is being knocked a few steps backwards after being hit with a high-powered rifle. Right now that's all I've got, but I'm hoping to expand it to include flinching from small hits or being ragdolled by a very powerful one.
     
  39. musolo

    musolo

    Joined:
    Sep 12, 2014
    Posts:
    238
    Have you thought about making player being able to give orders to friendly agents?
     
  40. ParadoxSolutions

    ParadoxSolutions

    Joined:
    Jul 27, 2015
    Posts:
    325
    This wouldn't be to hard to do yourself by adding the agents to a squad GameObject and having a function that changes the behaviors for all the agents in the squad.
     
  41. ParadoxSolutions

    ParadoxSolutions

    Joined:
    Jul 27, 2015
    Posts:
    325
    Ok, I see what you did now, when I tried to take it out of the namespace it was a different approach than the targetMarker thing you did. I was on vacation for a week without internet so sorry for the delay. I tested this out and I have no errors I have put a character controller as a child of the agent same as the targetMarker and put it on a layer that can't interact with any other layers and the characters still fly in the air.


    Edit: After a few hours of experimenting I took out AIPath and am using RichAI, put the whole agent on it's own layer that only uses physics with LevelParts and put the controller on the agent. Added the atDestination variable to the richAI script. I also added:
    richAI.target = markerTransform;
    after setting the position of the marker transform so the richAI component would be set to the markerDestination, the markerTransform doesn't seem to be set though, with the player as the enemy, the AI makes no attempt to move the markerTransform to try and path to the target.

    SetDestination doesn't seem to work correctly in the navmeshInterface. I also set the target as the player for testing and noticed that the agent would run up to the players transform and clip through the player even when the player had a navmeshCut component that is pretty much like an A* navmeshObsticle. So far the agent starts, sees the enemy, maybe move a little, shoots then stands there forever.
     
    Last edited: Jul 31, 2016
  42. musolo

    musolo

    Joined:
    Sep 12, 2014
    Posts:
    238
    I`m not coder. So "isn`t to hard" does not ring the bells here man) All a hope for is to be heard here and given some kind of a solution to risen necessity.
     
  43. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    Because I can't predict how people want to input commands, it's not possible for to make this sort of thing code-free. The easiest way to give destinations would probably be to assign an empty object to the agent'ts KeyTransform, set the Behaviours to Berskerer and MoveToPoint and then move the object where you want the agent to go.

    Would you mind posting your updated Navmesh Interface? :)

    I imagine the markerTransform not being set and it not moving are connected. Instead of trying to assign them in via script, I'd recommend just manually assigning it in the inspector. If you need to do it via script for whatever reason, I'd guess that the "richAI" variable isn't being assigned to anything so I'd start there. However, unless you've done some sort of changes to the other script's code, the actually calling of SetDestination should be fine.

    Use the Wander and Skirmish behaviors for testing purposes. And, of course, make sure your agent is actually using the new interface.

    As for the agent clipping through the player off-mesh, that sounds like an A* issue, not a TSAI issue. :)
     
    Last edited: Jul 31, 2016
  44. ParadoxSolutions

    ParadoxSolutions

    Joined:
    Jul 27, 2015
    Posts:
    325
     
  45. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818

    Thanks. I can't see anything that appears wrong at first glance, other than that you should probably only assign richAI.target to markerTransform once in awake, rather than each time you call SetDestination.

    Besides that, I can't see anything wrong at first glance. I'd start by making sure there isn't something simple you've missed. Things like:

    - Making sure good testing AI behaviors are set (again, I recommend Wander as the Idle and Skirmish as the AI Type/Combat Behaviour).
    - Making sure an AI Controller is in your scene.
    - Making sure you've made an "AI Controller" tag.
    - Making sure you have a targetScript on a target object.
    - Making sure you've assigned "markerTransform" to an empty game object.
    - Making sure you don't have the agent's "Key Transform" set to itself.


    If that doesn't fix it, then I'd add a

    Code (CSharp):
    1. Debug.Log(v.ToString());
    call to the SetDestination(), to ensure it's being called at all. If that doesn't print something out to the console or it's calling it's own position, it's probably just another configuration issue with TSAI, if it is printing out sensible results, it's likely a problem with the navmesh interface.

    Oh, and just a heads up, the next update will have a few new methods added to the Navmesh interface class, so you might want to hold out on it until we get this working.

    ---

    I'll hopefully be adding stagger animations, basic parkour, and support for diagonal movement animations in the next update. I'm currently trying to hammer out the last bugs that show up every once in a while. :)
     
    Last edited: Aug 1, 2016
  46. rbm123

    rbm123

    Joined:
    May 24, 2015
    Posts:
    130
    what does UNCOMMENT mean? what should I do?
    ****************************************************
    Hi- I've upgraded to 1.3.1 (someone bought for me!)
    when I choose "wonder" for Idle behavior , the AI agent walk around in a huge direction! he goes any where!
    (sorry for my English) !! how can I make limits or waypoint for Wonder behavior?
    Also I want the AI agent Engages me when I shoot near him.
    thanks for your great support!
     
    Last edited: Aug 1, 2016
  47. musolo

    musolo

    Joined:
    Sep 12, 2014
    Posts:
    238
    I imagine a set of functions in separate script that will handle commands from new gui buttons. A set of commands for starters could be as follows:
    1Hold fire until i make first shot.
    2 Shot at target i make fist shot after giving this order.
    3 hold your current position.
    4 Advance to point a or b (some predefined points on the map)

    Idealy it would be perfect to to implement orders rollout like in GRAW and GRAW2 games.
    Anyway this ordering tab idea should be next thing in the TSAI evolvment curve.
    Btw there is clearly a neglected feel to mechanized units not being developed (revamped) even after nomerous requests and questions about them.
    Hope you take it seriously after all.
    Thanks.
     
    SuperNewbee likes this.
  48. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    1. Disable the gun script until you want them to shoot.

    2. Add a target script to an empty gameobject. Set its priority to -1. When you want the agents to shoot at it, set its priority super high and make it a child of the target enemy. Use OnAIDeath() to disable, lower priority, and deparent this target when the agent dies.

    3 and 4. Move To Point / Berserker behavior + set Key Transform in inspector. Move the key transform where you want the agents to go.
     
    Last edited: Aug 1, 2016
  49. ParadoxSolutions

    ParadoxSolutions

    Joined:
    Jul 27, 2015
    Posts:
    325
    It looks like SetDestination() is calling the agents own position.
     
  50. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    What behaviours are you using? Is the Key Transform set to itself?