Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

[Released] Advanced AI Pro - AAA AI Solution -

Discussion in 'Assets and Asset Store' started by Zozo2099, Feb 3, 2013.

  1. Zozo2099

    Zozo2099

    Joined:
    Jul 15, 2012
    Posts:
    478
    Hello

    Very little update is now available.

    Changelog 5.3a

    - Renamed some variables for better visibility in the inspector.

    Cheers
     
  2. primus88

    primus88

    Joined:
    May 14, 2013
    Posts:
    611
    Frankly I have no idea what could determine this sudden stop in AIs reactions. Ironically, the more I move and try to put the AI into difficulties, the better he behaves, but as soon as I stop moving / shooting, he sometimes decides to just stop and look at me. If I move a bit, he will starts chasing / attacking me again.

    I tried re-calculating the navemesh, playing around with animation times...
    Could it be something with his view sphere trigger? Because I believe that sometimes I jump very quickly behind him and even though he turns toward me, he is not attacking (sometimes.)

    Also, how does hearing work? Based on the speed I move? (for example if I crouch I have less chances for the AI to hear me?)
     
  3. TheDevGuy

    TheDevGuy

    Joined:
    Mar 3, 2014
    Posts:
    78
    Hearing is from the sound source coming from the player i believe.
     
  4. Zozo2099

    Zozo2099

    Joined:
    Jul 15, 2012
    Posts:
    478
    I will try to investigate more this issue, but I need more resources from you like a video recording, and some images of how your AI, and player collider are setup.

    Hearing feature is based on two factors: First the the "Hearing Distance" of the AI which you find in the "Navigation Ranges", and second the "Audio Source" component(s) attached to your player character or any of its child gameobjects. So the player must be within the hearing range of the AI (blue sphere in the editor), and the audio source(s) components are playing too.

    Also don't forget to check "Can Hear" in the "General Parameters" of the AI if you want it to hear.

    Cheers
     
  5. primus88

    primus88

    Joined:
    May 14, 2013
    Posts:
    611
    Ok, I did more work last evening and now I can replicate the problem 100%.

    Setup: smart AI, melee, hearing set to 8, visibility to 15 with the sphere position modified a bit (meaning that a small part of the sphere goes behind of the AI), the AI is spawned in the game, has all the animations set with three animations set for attack, force melee conclusion.

    how I trigger it: the AI sees me and comes toward me, when the attack animation triggers I just quickly jump behind him and NOT move at all. Sometimes he turns, but most of the time he just stays there.

    Hope this helps.
     
  6. Mementos

    Mementos

    Joined:
    Sep 25, 2012
    Posts:
    79
    Is Cover finding still planned?
     
  7. kurotatsu

    kurotatsu

    Joined:
    May 10, 2012
    Posts:
    588
    Zozo2099, thought ya might to see your AI in my game Voidkeeper coming to Ouya.(I added weapon switching for melee and ranged mode by distance.) Enjoy.

    All the best.

    Kuro.

    https://www.youtube.com/watch?v=Wi4-N7aq9o8

     
  8. Zozo2099

    Zozo2099

    Joined:
    Jul 15, 2012
    Posts:
    478
    Good work Kuro, Am very happy to watch "Advanced AI Pro" implemented in Ouya game, and hope to see more footage of Voidkeeper in the future :)

    Good Luck and wish you the best
     
  9. fredr92

    fredr92

    Joined:
    Jul 8, 2013
    Posts:
    292
    Hi after checking out all the AI packaged and trying out the free ones im looking for a good one for a fair price, and your asset looks like a good choice.
    But im using the FPS constructer from the assetstore, and i have setup all my weapons and meeles. and all my guns uses raycast. And fps constructer uses unity Java, and you AI package uses C. The only reason that i havent bought your package yet is because can i make them work togheter take damage (enemy and player)? My player already have a playerhealth script defining players health.

    Hope to hear back from you, and i hope i can use your asset for my game, thanks !
     
  10. Zozo2099

    Zozo2099

    Joined:
    Jul 15, 2012
    Posts:
    478
    Hi

    Taking damage for both player and AI should not be a problem at all, for the AI, only one line of code to insert in the proper place to hit the AI, and everything will be fine :) if your guns use raycast, then you need to insert a damage method in the code where the weapon raycast method is, something like this:


    Code (csharp):
    1.  
    2. var hit : RaycastHit;
    3. // Here is the code of weapon raycast...
    4. //check if the raycast hit is the AI enemy, and if so then do damage:
    5. if (hit.transform.gameObject.GetComponent(AdvancedAiEnemy))
    6. {
    7.    hit.transform.gameObject.GetComponent(AdvancedAiEnemy).SendMessage("GotHit", damageAmount); //the damage amount is a float value
    8. }
    9.  
    For player's damage it is easier, there is a property in the AI inspector in which you can enter the damage method name used to hurt the player, so if you are familiar with FPS Constructor then you should find it easily :)

    Contact me if you have any more questions :)

    Cheers
     
    Last edited: Mar 18, 2014
  11. RyuMaster

    RyuMaster

    Joined:
    Sep 13, 2010
    Posts:
    468
    Enyone had this problem? Character floats on top of the terrain. And if I check "heigh" in navigation generator, sometimes character randomly falls through the terrain mesh (I am usign static meshes). Is this related to AI-Pro, or to Unity NavMesh specifically?
     
  12. fredr92

    fredr92

    Joined:
    Jul 8, 2013
    Posts:
    292
    Hi again thanks for the fast answere ! i Bought Your package and everything is working very well, the enemy can hurt the player, but i still have some problems when it comes to make my raycast guns do damage too the enemys, I have been Reading true the FPS constructor scripts too try too find the correct Place and tried different Things but havent been able too make it work :( Can you help me locate the correct script to change? do you want me too send some scripts? the fps constructor is a free asset, and if u can download it and see, i would really appreciate it
     
  13. Zozo2099

    Zozo2099

    Joined:
    Jul 15, 2012
    Posts:
    478
    No problem I will download FPS Constructor and inspect its scripts carefully :)
     
  14. Zozo2099

    Zozo2099

    Joined:
    Jul 15, 2012
    Posts:
    478
    Hi fredr92

    Just found it, in GunScript.js go to line 946 and here you will find the line of code responsible of sending damage weapon raycast hit:

    Code (csharp):
    1.  
    2. hit.collider.SendMessageUpwards("ApplyDamagePlayer", finalDamage, SendMessageOptions.DontRequireReceiver);
    3.  
    Just replace "ApplyDamagePlayer" with "GotHit" and AI will take damage from weapons projectiles :)

    Good Luck
     
    Last edited: Mar 23, 2014
  15. fredr92

    fredr92

    Joined:
    Jul 8, 2013
    Posts:
    292
    Thank You so mutch ! You and your Asset is 10 stars :) im very happy with this package and for the great support !
     
  16. Zozo2099

    Zozo2099

    Joined:
    Jul 15, 2012
    Posts:
    478
    This makes me happy :) please check your PM
     
  17. Zozo2099

    Zozo2099

    Joined:
    Jul 15, 2012
    Posts:
    478
    Hello everyone;

    Guide to make Advanced AI Pro compatible with UFPS

    1- Layers setup:

    UFPS takes over certain layers to work properly so we can not use those layers with Advanced AI Pro, after some tests I noted the unused layers so we can use them in Advanced AI Pro setup, for a rapid and easy setup that works fine use the following assignments:
    • Layer 30: Name it "Player" and assign it to your UFPS player, and assign it also to "Main Target" layer in "Layers" section of AI inspector. (In new versions of UFPS Layer 30 is already named LocalPlayer and assigned to UFPS Player).

    • Layer 21: Name it "View Obstruction" and assign it to "View Obstruction Layer" in "Layers" section of AI inspector.

    • Layer 20: Name it "Enemy", assign your enemy AI to this layer (If you have a defender ally AI then you assign this layer too to "Enemy Layer" in its layers section so it will attack it).

    2- Depending on your AI attack mode (melee or ranged), open its suitable section in the inspector and change the "Damage Method Name" to "Damage". This will assure that AI can do damage to UFPS player.

    PS. UFPS uses value of "10" for player's health, so if your UFPS player dies directly after the first attack of the AI then you need to set the "Damage Amount" for AI (melee or projectile damage) to small values (less than 10).

    PS. If you decided to use a second target(s) in your project (like AI Companion or AI Defender....ect) then you need to assign a unique layer for it, make it layer 19 and name it "Second Target", then assign it to "Second Target" layer of your AI Enemy "Layers" section. Also you need to add this layer to "No Decals On These Layers" slot of UFPS projectile prefabs.

    You can find the projectiles prefabs of UFPS in UFPS>Base>Content>Prefabs>Projectils
    In the "Damage" slot of the projectile prefab (in Vp_Hitscan_Bullet component), set the damage value to an appropriate value as AI default health value is 100 and the values used in UFPS projectiles are 1 or smaller so it will take you ages to kill one AI :D

    Note 1:
    If you get an error while shooting at AI, then you need to do a little modification to the UFPS script file called "vp_HitscanBullet.cs", open it, then go to line 166 and replace it with this one:

    Code (CSharp):
    1. hit.collider.SendMessageUpwards(DamageMethodName, Damage, SendMessageOptions.DontRequireReceiver);
    Note 2:
    If you are using a ranged AI with a projectile (like the Soldier AI Prefab) then you may notice that UFPS player dies instantly after being hit by the projectile even if the damage amount is low, this is due to projectile's physics effect on the player, to resolve this issue you need to find the script file called (vp_DamageHandler.cs) then go to the method OnCollisionEnter (line 369) and put the whole method's code in the following IF statement's brackets:

    Code (CSharp):
    1.   if (!collision.gameObject.GetComponent<Projectile>())
    2.         {
    3.                   // Code here..........
    4.         }
    Note 3:

    In the new version of UFPS (1.4.9) there is the new grenade thrower, but you might have noticed that it does not do harm the AI, to fix that issue you need to search for the grenade explosion prefab in: UFPS>Base>Content>Prefabs>Explosions>GrenadeExplosion and in the vp_Explosion component uncheck the option: "Require Damage Handler". Now grenades should damage AI.

    Cheers



    I thinks everything is fine like this, if you have other questions or issues please don't hesitate to post them here :)

    Cheers
     
    Last edited: May 28, 2015
  18. unicat

    unicat

    Joined:
    Apr 8, 2012
    Posts:
    425
    Hi, just updated an older Project from AAI 5.0 to 5.3. Now i always get Errors(NullReferenceExeptions) with ...Anim.Speed (IdleAnim.Speed, DeathAnim.Speed etc.). Worked fine in 5.0. Has something changed? Using it with Realistic FPS Prefab. Thank You.
     
    Last edited: Apr 7, 2014
  19. Zozo2099

    Zozo2099

    Joined:
    Jul 15, 2012
    Posts:
    478
    Hello everyone

    New update 5.4 is now available.

    Changelog 5.4

    - Added "Hear Volume Min" parameter to "Navigation Ranges" section of the AI, which is the minimum audio volume emitted by the target which can be heard by the AI. Useful for stealth games.

    Cheers
     
  20. Zozo2099

    Zozo2099

    Joined:
    Jul 15, 2012
    Posts:
    478
    Hi

    First delete your current "Advanced AI" folder from the project window and then re-import the new version again! There are no changes in animations speed between v5 and v5.3!

    If that did not work then copy/past all the errors you get in the console window here please!

    Bye
     
  21. primus88

    primus88

    Joined:
    May 14, 2013
    Posts:
    611
    Hello Zozo, I still have a problem with the raycasting from weapon and the AI.
    If you can help.

    I have a more problematic issue here. I have an AI. This AI has:
    Code (csharp):
    1.  
    2.  - collider (radius 1)
    3.  - trigger collider (radius 15)
    4.  - layer 25
    I use raycast to shoot my weapon.

    The problem is that there are cases (outside the trigger collider) when I shoot the weapon and the raycast hits the trigger collider even though I should've hit the normal collider.

    I tried lots of methods but none helped:
    Code (csharp):
    1.  - ignoring specific layers is pointless because the two colliders share the same layer.
    2.  - checking if I hit trigger or not is pointless as the raycast hits the trigger collider anyway
    3.  - RaycastAll does not work? Seems there is no way to determine if the specific collider on the AI was hit among the multitude of colliders in the list. Plus creates other problems, like being able to shoot through walls etc.
    Any ideas?
     
    Last edited: Apr 7, 2014
  22. unicat

    unicat

    Joined:
    Apr 8, 2012
    Posts:
    425
    This is from Editor log:

    NullReferenceException
    at (wrapper managed-to-native) UnityEngine.AnimationState:set_speed (single)

    at AdvancedAiEnemy.Start () [0x0018a] in C:\Users\siegf_000\Documents\Attack\Assets\Advanced AI\Scripts\AdvancedAiEnemy.cs:328

    I have only added the idle animation, then this message appears. I have tested another model but with no luck.
     
  23. unicat

    unicat

    Joined:
    Apr 8, 2012
    Posts:
    425
    Solved. After importing my enemy model two times more it is working now. :smile:
     
  24. kurotatsu

    kurotatsu

    Joined:
    May 10, 2012
    Posts:
    588
    I still am loving your system.:D

    I've been wanting to ask for a while now:twisted:. Could I get you to add a vision cone/trapezoid shape we can toggle in the inspector to use instead of the vision sphere.

    It would be nicer for those of us who have players standing on rooftops to not get busted by the enemy when they are facing your direction.

    Then just add variables for: height, length, beginning width( at enemy), and end width at end of range. (And of course a position setting on the x,y,z axises like the viewsphere has, hell ya might be able to use the same one:D)

    I put these examples together just for you.lol enjoy.(If you like them feel free to use in your pdf documentation.)

    $visionconeTopDownView.jpg

    The side view is in perspective, so it would actually be the same height at the enemy and at the end of his view range.

    $visionconeSideView.jpg

    This will greatly enhance stealth gameplay, and offer another option for developers, or allow them to use the sphere field of view if they wish.

    Thanks ZOZO, and keep up the awesome work, man.
     
    Last edited: Apr 11, 2014
  25. Zozo2099

    Zozo2099

    Joined:
    Jul 15, 2012
    Posts:
    478
    Thanks kurotatsu, yes it will be a nice idea to add a vision cone instead, I will plan to do that next :)
     
  26. Fowi

    Fowi

    Joined:
    Dec 2, 2013
    Posts:
    30
    After trying several methods, I have not managed to animate other player than dummy prefab.
    I try to have the dummy prefab as a companion for my Player in my own scene, and works in functionality and the animations.
    I try to have others 3d models characters as a companion, and works in functionality but not work the animations (idle, etc)!
    I followed the instructions! And yeah, my 3d models characters that I am triying to animate is in Legacy mode in the rig tab and using the same animations (in legacy mode too).
    Any ideas anyone?
     
    Last edited: Apr 13, 2014
  27. kurotatsu

    kurotatsu

    Joined:
    May 10, 2012
    Posts:
    588
    Have you tried to go to your characters model that holds the animations in the project hierarchy and set all the animations wrap mode to loop?
     
  28. Fowi

    Fowi

    Joined:
    Dec 2, 2013
    Posts:
    30
    My models tested has no animations, but I borrowed the animations from /Advanced AI\Showcase\Models\Dummy\Dummy_idle, Dummy_Run, etc (idle, Run, Punch, shoot, hit, Death2, Walk, reload), the same animations that works perfectly for the dummy. Now I changed in this animations the Wrap Mode, from default to Loop, I hit Play the scene, and the Dummy continues to work well, but my testing model continues to fail in the animations, no idle, noting, it is moving with the T pose always.
    The Dummy and my testing model has te same components (Transform, Advanced Ai Companion script, Capsule collider - Transform, Animation) with the same values, using the same animations...
    My first impresion was this is was the most advanced AI on the Asset Store, and very easy, but now I am having this problem from yesteday and I am blocked :(.
     
    Last edited: Apr 13, 2014
  29. kurotatsu

    kurotatsu

    Joined:
    May 10, 2012
    Posts:
    588
    The only thing I can think of is that you haven't typed the names in the boxes provided in the inspector to what the animations are named on your new model.

    Example:

    dummy models Idle > is named Idle.

    Your models Idle > is named IdleStanding or something.

    then you have to go to the inspector and rename it appropriately in the idle box.

    The only other thing that I can think of is make sure his animations are actually drug into the animation scripts list.

    Edit:

    Zozo is very helpful, if you still can't get it shoot him a example scene and he'll figure out what's up.
     
    Last edited: Apr 13, 2014
  30. Fowi

    Fowi

    Joined:
    Dec 2, 2013
    Posts:
    30
    Excelent idea! I will send him the project!
     
    Last edited: Apr 13, 2014
  31. Zozo2099

    Zozo2099

    Joined:
    Jul 15, 2012
    Posts:
    478
    Hello Fowi, I have received your project, I will answer you in PM :)

    @primus88 I will check your issue today too.

    Cheers
     
  32. Fowi

    Fowi

    Joined:
    Dec 2, 2013
    Posts:
    30

    Excellent, issue resolved!
     
  33. unicat

    unicat

    Joined:
    Apr 8, 2012
    Posts:
    425
    This are nice instructions, can you do something like this for Realistic FPS Prefab too ?
     
  34. beowulfkaine

    beowulfkaine

    Joined:
    Apr 3, 2014
    Posts:
    185
    Hello!

    I just bought this package and I have to say thank you for making this, it's really amazing and so helpful in my game title. We are working on a space sim and the enemies really are the crux of the game; this implementation has been so easy and worthwhile I'm very excited and saw so much future potential I had to come to the forum as ask if the developer was open to ideas. Here are some that I had that are generic enough to implement for everyone:

    Enemies:
    When enemies get hurt to the point that they are down for the count, can they either:
    a) be revived by other enemy players
    or
    b) (and this would be great) if their own health = less then % then perform retreat (in my game example, lets say there is a firefight between two A.I from opposing teams, one is down for the count but not dead (incapacitated) another is lets say %25 health, he runs over and beams off the ship or location with the wounded A.I. enemy. Again in my example it would be them "beaming" off a ship or location playing a particle effect over their retreat.

    The ability to have enemies do one of these things:
    a) plant a bomb or object at a specific waypoint (if killed, then re-spawn another to finish the same task)
    b) attempt to retrieve an object, kind of like capture the flag
    c) play a specific animation at a specific waypoint (that one would be great and very useful in so many ways especially for NPC behaviors)
    d) stay in "groups" so they don't wander away from an attack party
    e) respond to a trigger and move to that exact point of the trigger (alarm or something)

    Allies:
    a) the ability to heal downed players (npc or player controller)


    Universal:
    After an "attack" or "event alarm = null then idle duration = "x" then return to stationary patrol point (not moving but origination start

    This would be cool, you know how you have attacks on allies/enemies with blood splatter? how about something with like a personal shield value before actual damage is taken, for example, you could have a value set for shield value = 100, health =100, when shield is 0 then health gets reduced, and even have multiple colors for the "effect" of the shield using different mats, like <75%= blue, <50% green, <25% red, ect..


    There are actually a bunch of things that would be awesome really, the animation setup you have is great, I wish it could be expanded even more! I hope to see great things, excellent $125 I ever spent!

    Grumpy Otis Games
     
    Last edited: Apr 15, 2014
  35. InteractivaStudios

    InteractivaStudios

    Joined:
    Apr 28, 2013
    Posts:
    19
    Just bought this asset and I want to say its amazing, perfect for what I need right now.
    One thing though, each time I kill an Enemy AI I get missing reference exception "The object NavMeshAgent has been destroyed but you are is still trying to access it" At AdvancedAIEnemy.cs 935. Any help?
     
  36. kurotatsu

    kurotatsu

    Joined:
    May 10, 2012
    Posts:
    588
    I get this as well, can't wait to hear of a solution.
     
  37. beowulfkaine

    beowulfkaine

    Joined:
    Apr 3, 2014
    Posts:
    185
    Open the test scene that came with it and watch the enemies die in the epic battle, if you still get that error then something may be misplaced, if no error, then the navmesh you created in your own scene may be missing elements such as things placed after its been baked.

    I have yet to come across this error, my big problems are the layers in which the enemies and players are on.
     
  38. Zozo2099

    Zozo2099

    Joined:
    Jul 15, 2012
    Posts:
    478
    @HERMES123 and @kurotatsu

    Hi

    I am unable to reproduce your error! Any other details you can provide me please! Are you using the latest version 5.4a?

    @beowulfkaine

    Hi, Can I know please your issues with the layers? :)
     
    Last edited: Apr 19, 2014
  39. InteractivaStudios

    InteractivaStudios

    Joined:
    Apr 28, 2013
    Posts:
    19
    I have made a screenie of the error and the part of my script it mentions where I apply damage to the AI:
    $AdvancedAIPro Error.png

    1 - Is the console error I get
    2 - the line 178 where I apply damage to the AI
    3 - Line 104 where I call function Fire() from my script, everything in number 2 is inside Fire().

    @Beowulfkaine
    Yeah I played the epic battle, and no problems. Something with my scripts maybe.
     
    Last edited: Apr 19, 2014
  40. InteractivaStudios

    InteractivaStudios

    Joined:
    Apr 28, 2013
    Posts:
    19
    I think I fixed it, I don't know how, I unchecked disappear on death witch I had checked and it seemed to work. Also, sometimes when an AI dies it doesn't leave the decal. Sometimes, I want it to always leave the blood decal thing.
     
  41. Zozo2099

    Zozo2099

    Joined:
    Jul 15, 2012
    Posts:
    478
    Hi HERMES123

    I have fixed that issue, plus other fixes and improvements! I will submit the update tonight, so I hope it will be online after the ween-end :)

    Cheers
     
  42. primus88

    primus88

    Joined:
    May 14, 2013
    Posts:
    611
    Zozo was awesome. His support is really unbeatable as far as I experienced until now.
    Until now, I needed his help at least 5 times and he always helped me within 24 hours.
    This last time he stayed with me and helped me out through mail for an entire day in order to iron out some bugs and was always fast and willing to go the extra mile.

    Well done man! Well done!
     
  43. Zozo2099

    Zozo2099

    Joined:
    Jul 15, 2012
    Posts:
    478
    Hello

    Update 5.5 is now available on the asset store.

    Changelog 5.5:

    • Fixed a major issue with "Go Idle" sphere being hit with raycast causing AI not receiving damage from weapons using raycast when outside of the "Go Idle" sphere. This should resolve issues with UFPS and other FPS packages which use raycast logic.
    • Fixed little issue causing error "The object NavMeshAgent has been destroyed but you are is still trying to access it".
    • Fixed issue when hitting smart AI from outside of the "Go Idle" range causing AI to go search for the target playing the idle animation instead of the chase mode.
    Cheers
     
    Last edited: Apr 22, 2014
  44. unicat

    unicat

    Joined:
    Apr 8, 2012
    Posts:
    425
    Can`t get ranged attack to work with Realistic FPS Prefab using raycast (no bullets). I`m using ApplyDamage which works fine with melee attack, but not with shooting. Any hints ?
     
  45. Zozo2099

    Zozo2099

    Joined:
    Jul 15, 2012
    Posts:
    478
    Hi

    I did not understand well your question, Do you mean that Realistic FPS weapons can not hurt the AI?
    I already helped a customer here via PM in the setup process of Realistic FPS + Advanced AI and it works very well.
     
    Last edited: Apr 25, 2014
  46. unicat

    unicat

    Joined:
    Apr 8, 2012
    Posts:
    425
    Yes, RFPS weapons don`t hurt the AI. And AI weapons don`t hurt the Player. Only melee attacking from AI to Player works.
     
  47. Zozo2099

    Zozo2099

    Joined:
    Jul 15, 2012
    Posts:
    478
    I will look into that, if I remember well there is a line of code to add to one of Realistic FPS Prefab scripts to make it hurt the AI ! When I have the final solution I will post here :)

    BTW use "ApplyDamage" for AI ranged attack too! You can find it "Damage Method Name" in the "Ranged Attack" section of the AI, did you try it?

    Cheers
     
    Last edited: Apr 25, 2014
  48. unicat

    unicat

    Joined:
    Apr 8, 2012
    Posts:
    425
    Yes, i use ApplyDamage for both, melee and ranged attack but only melee is working. Thanks.
     
  49. Zozo2099

    Zozo2099

    Joined:
    Jul 15, 2012
    Posts:
    478
    Hello everyone;

    Guide to make Advanced AI Pro compatible with Realistic FPS Prefab
    When you import Realistic FPS Prefab into your project you will get new pre-configured layers like "Player", "NPC", and "World Collision" layers, so we will make use of them in our little setup.

    • In the "Layers" section of the AI assign the layer named "Player" to "Main Target" layer.
    • Assign the "World Collision" layer to"View Obstruction Layer" in "Layers" section of the AI.
    • In "!!!FPS Player Main" gameobject, open "!!!FPS Camera", and then "Main Camera", you will find a gameobject child called "LeanCollider", you should set its tag from "Player" to "Untagged". (Important step or AI won't recognize the player).
    • Assign the AI gameobject to "NPCs" layer.
    • In !Realistic FPS Prefab Files/Scripts/Weapons open "WeaponBehavior" script then delete the entire "if" statement in lines 1049 1050 1051 and put instead this line of code:
    • Code (csharp):
      1. hit.collider.gameObject.SendMessage("GotHit", damage);
    • Finally you need to change the "Damage Method Name" in the melee and ranged attack sections of your AI to "ApplyDamage".

    Tested and working :)

    Cheers
     
    Last edited: Mar 16, 2015
  50. unicat

    unicat

    Joined:
    Apr 8, 2012
    Posts:
    425
    Hi, i had already done the points you described, except changing the code. With your code my player can now damage the ai. Thank You for this.
    But i can`t get ranged attack (shooting) to work. My Player doesn`t get hurt from the ai. Only melee works here. I had already set both damage methods to "ApplyDamage".

    $ai_damage.JPG
    $ai_layers.JPG
    $ai_npc.JPG
     
    Last edited: Apr 26, 2014