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

Advanced Fantasy AI Tutorials

Discussion in 'Community Learning & Teaching' started by brilliantgames, Mar 27, 2012.

  1. nancy30

    nancy30

    Joined:
    Mar 7, 2013
    Posts:
    17
    I am completely new to unity but this tutorial has motivated me to work hard and learn this as fast as I can. Thanks for the tutorials brilliant games.
     
  2. jbufo

    jbufo

    Joined:
    Aug 16, 2010
    Posts:
    52


    Does your water plane end about where the mesh stops segmenting itself out?
     
  3. DragonHunter

    DragonHunter

    Joined:
    Mar 4, 2013
    Posts:
    2
    $Water.jpg

    It is this size.
     
  4. jbufo

    jbufo

    Joined:
    Aug 16, 2010
    Posts:
    52
    If I remember right there was some quirky stuff when water planes were present. I don't remember if my solution was to raise the navmesh above it when I calculated or just remove the water and add it back later.
     
  5. Eyehawk

    Eyehawk

    Joined:
    Dec 24, 2012
    Posts:
    288
    Hi there, how do you increase rate of fire for ranged characters? There are 2 parameters: timebforeappears and timebeforefires, which I changed but this has no effect. I guess there is also a dependency on the attack animation itself? I can't seem to find this by the way.

    EDIT 4/1/13 - just figured it out. I had to lower TBA and TBF figures, and then also lower the AttackSpeed Variable in AI, which would allow the character to fire faster.
     
    Last edited: Mar 31, 2013
  6. rated15268

    rated15268

    Joined:
    Oct 2, 2012
    Posts:
    1
    Hello there,

    I've been having trouble setting up my player. I'm using my own player controller script. My player has the team, health script on it. It seems like the custom melee AI enemies are attacking something in the distant, and when I get closer to them, they just patrol normally. And the custom ranged AI enemy shoots at my player fine, but when I get closer to it, it stops doing it. So then I added the Skeleton Hard enemy to test a working AI, and it tries to attack my player, but it moves away from my player to some unknown target instead.

    What am I missing? Also, I don't know what to do with collision layer, should I set something up in the physics layer so the enemies attack my player properly?

    Thanks
     
  7. MolowaKeiki

    MolowaKeiki

    Joined:
    Dec 21, 2012
    Posts:
    6
    Hello!

    I'm having a problem with my setting up of the characters. I have followed your tutorials (which are great by the way), putting in the guard and easy skeleton into my scene so that they would attack each other like in your video, but when I push start, the guard runs off towards the origin of my game world and the skeleton follows after him. His state is in Charge and Run until he hits a corner collider that he gets stuck in, then it switches to Hunt, but never really attacks the skeleton. I also get this error in my console for both of them.

    NullReferenceException: Object reference not set to an instance of an object
    Navigation.Update () (at Assets/Fantasy AI 2.0/Scripts/Navigation/Navigation.cs:103)

    I'm still very new with coding so I don't exactly follow what the code is doing at that point. Any help would be greatly appreciated! :)

    Thanks!
     
  8. brilliantgames

    brilliantgames

    Joined:
    Jan 7, 2012
    Posts:
    1,937
    Hey. It sounds like you have not attached a 'navmeshtarget' script to your characters? Hope this helps. This is required in order for the AI to properly navigate a target.

    In the AI script, check to make sure your player is set to the 'character collision layer'. I believe the default is 9. Though you should check to see what layer your AI are set to to make sure. As well another reason AI can loose sight of their target is because their default axis is at their targets feet or at ground level. This can cause problems because the raycast will cast to the default axis on the object its targeting, so something as small as a rock or bump on the ground can cause them to loose sight. Changing your axis is easy. Have your player as the child of an empty game object that has its axis at head level. :)
     
  9. MolowaKeiki

    MolowaKeiki

    Joined:
    Dec 21, 2012
    Posts:
    6
    Well I drag and dropped your fully rigged characters into my scene and they did that. It wasn't my models. I should just be able to drop in your fully rigged characters and they should work right away? That's the way it sounded in your tutorial video. I'm just asking, no disrespect intended.
     
  10. brilliantgames

    brilliantgames

    Joined:
    Jan 7, 2012
    Posts:
    1,937
    Do you have any triggered colliders hanging out in your scene? Try placing them in an empty scene. You could have colliders blocking their vision.
     
  11. unior

    unior

    Joined:
    Jul 17, 2013
    Posts:
    3
    I have a quastion At me to you a request you couldn't create a video tutorial about that as it is correct to adjust to new model of the Player. And that I have difficulties at camera movement is my player is walking. Thanks in advance! Forgive for bad English
     
  12. brilliantgames

    brilliantgames

    Joined:
    Jan 7, 2012
    Posts:
    1,937
    The player prefab is just a simple example included to get you started. You can use any player prefab you want with Fantasy AI. Just add the team and health scripts, as well as setting the character tag and character collision layers to whatever player prefab you use.
     
  13. Midi

    Midi

    Joined:
    Aug 2, 2013
    Posts:
    10
    Fantastic package :)

    I'm fairly new to all this and i too have been trying to change the player controller character and really struggling to get it correct. Would it be possible to do a youtube tutorial on this?
     
  14. targetblock

    targetblock

    Joined:
    Aug 11, 2013
    Posts:
    1
    Hello,

    I was wondering, I want to buy this tool, but in the tutorials I do not see any enemy/player damage (blood, blood splatter, cuts, and such), is this possible with using this tool?

    Thank you.

    Well, I guess this is a dead project, 3 weeks from the last post to answer questions, that makes up my mind.
    Thanks anyway....
     
    Last edited: Aug 12, 2013
  15. Warlyte

    Warlyte

    Joined:
    Jan 15, 2014
    Posts:
    1
    Hey, I know you guys haven't really responded in this thread in a while but I wondered. Is there a way I can get my AI to prioritize certain teams to attack? E.g. two enemy factions that attack the player team when possible but will go back to killing each other if left alone.
     
  16. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,633
    When you use patrolling does he still navigate to the points on his own? I added 2 patrol points and now he wont actually navigate around things, is that meant to happen ? Was working with 1 in targetLocatateTo. I was hoping I could have him act like that but with multiple targets that he visits in a row? Thanks, amazing package so far!!!.

    ps, what is check patrol?

    pps, Fixed it! Its amazing that you can use so few way points to make such complex movements, im impressed! It seems I sometimes i have to move my nav mesh up and down to get my guy walking again, might have been human error :).. also is there a way to hide all the nav stuff once youre happy with it? I dont want to see it while im editing but I cannot see a way to turn it off.

    And now my next main question :) Is there a way to trigger a delay in a patrol route when the player hits a target node? for example if i want him to stop and idle for 5 seconds, then continue ? Leading me onto my next question, is it possible to change an animation in this way? Or have a series of actions - For example - Can I have him walk to a chair, play a chair sitting anim for 5 secs, then play a standing up anim and have him continue patrolling ? Or is animation swapping not included? Basically if it could do this it would replace all the other waypoint solutions out there (which don't work well for me) and have the awesome pathfinding :-D

    Im assuming I could add this myself, it should be mostly just defining new states of my own (sit,standup etc) and then triggering it from a targetnode somehow?

    Thanks,
    Gaz.

    been a long night, been editing this post every few hours lol, anyway finishing off now with a youtube video of Fantasy Ai in my game (in a very basic fashion) and also hopefully some form of explanation of what Id like to do with this AI pack :) https://www.youtube.com/watch?v=awYwOusuuf8&feature=youtu.be
     
    Last edited: May 28, 2014
  17. BryanO

    BryanO

    Joined:
    Jan 8, 2014
    Posts:
    186
    I'm reposting this here because it is relevant to both dynamic navigation at Fantasy AI 2.0. I've set up the fantasy ai as indicated for the dynamic navigation set up a grid removed the outdated scripts and dropped in the new ones and set both the grid fields for the new scripts and my charectors insist on running off the screen through un walkable marked grid areas rather than following the patrol points set up with prefab target nodes in their patrol points list and placed near them on a walkable grid area... So I set up a blank project with only the two packages in it and started messing only with the prefabs and no other scripts or objects present in a brand new scene. I set up a 100 x 100 grid on a brand new terrain and I got a prefab blue guard ai running between two patrol points - so far so good the grid marked the target nodes and the charectors un passable but I moved them away from that area and they started working. I set up an identical ai by duplication following the 2 target nodes in reverse order... So far so good... I drop a player in the scene set up as indicated for dynamic navigation ... Ok so far... Now it gets wierd - I change the team of one of the ais to "2" from 1. team one ai attacks and team 2 ignores team one and continues to walk the target nodes. I switch the team of the player to team 2 and without changing anything else and now the team 2 guard attacks and team 1 ignores!!!! I remove all traces of the dynamic grid and set up with only fantasy ai prefabs and the ais without any grid only using the stock settings of the prefabs and the target nodes. They continue to walk the target nodes regardless of not having a grid and behave exactly the same way. I switch team 2 to a 3. And add two more target nodes. And make the guards walk them in reverse order by setting up an identical duplicated prefab blue guard with a different team number with a reversed order target node list. And the ais ignore each other and walk the nodes bumping into each other as they pass. I move the player close to them and they both attack the player I attack them and kill them and move away. Both respawn and instead of ignoring each other they attack each other. I restart and they go back to ignoring each other. I restart but this time I switch my player team to team one and now team one attacks and team 3 ignores. What is up???? Anyone got a fix for the team weirdness ? At this point I would be super happy to set up nodes that ai walk and will attack each other if not on the same team and then return to walking the nodes after battle as advertised. I don't even need advanced path finding or a dynamic grid (but it looked so cool in the demo so I bought it). If there's no fix for this can somebody suggest another asset from the store that does work?
     
  18. BryanO

    BryanO

    Joined:
    Jan 8, 2014
    Posts:
    186
    Where is the reply to this issue?
     
  19. Mad Grendel

    Mad Grendel

    Joined:
    Jun 12, 2014
    Posts:
    13
    I'm trying like many others to get a player model in place of the fully rigged spartan prefab that comes with this package. I was able to get a lot of things working but using the freefly script messes up a lot of things. I can move until I touch another collider whether it's an object or an enemy...then I'm just stuck and can't move anywhere. I tried using the character controller and character motor components along with it and that seemed to work better but no matter what I cannot damage any of the enemies. I have compared everything I can see from the Player prefab to My Own Model in place of the Spartan rig. I did this by placing an empty AI prefab with sounds into the scene, like in the tutorial, but in my case it was my main player not just a mob or enemy.

    Basically what is the proper procedure for making this AI work with your own rigged Player model, not enemies or other AI models, the main Player? I see many people asking but the only answer is to add those four scripts, Team, Health, NavMesh, and AI but there is obviously more to it than that. I have spent days trying to figure it out to no avail. I have to make my own animation controller in Mechanim, and although the Enemies are attacking me according to the teams set in the AI script, I cannot damage anything. I have all the targeting and faceposition etc gameobjects on my player just like the Player prefab and plugged them into the AI script, still can't damage any of them.

    They can kill me all day long but basically I can't get animations to work from my own models using this AI script, and i can't damage them when everything seems to be setup just like your Spartan Player prefab. Sorry for the long message, I was trying to be a little specific.

    I think this package would really be helpful if I could just get it to work with my own stuff. All the tutorials just show a non player controlled mob working. How did you create your Player prefab, that's what we all want to know?

    Thank you so much and please make a tutorial on this for us, pretty pleeease!!!
     
  20. Raptorsbane

    Raptorsbane

    Joined:
    Aug 30, 2014
    Posts:
    11
    Took me about a day but I figured out how to get my player controlled character working with the AI. It's a bit more quirky then the NPC setups since there is no prefab. If you still need help let me know!
     
  21. alittlespent

    alittlespent

    Joined:
    Aug 29, 2014
    Posts:
    2
    I do require help getting my own PLAYER to function properly with this kit, ive tried alot of things to get it working... but I cannot get attacking working. Freefly works okay, I added gravity, but now my player runs through objects like rocks and walls and such, jumping just flys off into nowhere, I would like to add the ability to rotate the character as I use a wow like camera controller. But if I could just get it working id be happy :) Yes MAD GRENDAL!!! we want to know how to get your own player to work with this package!!
     
    Korenbloem likes this.
  22. Ayato-Naoi

    Ayato-Naoi

    Joined:
    Mar 17, 2013
    Posts:
    2
    Hi! Um, I just tried to download the AI Destroy Script and it seems that the dropbox link for it isn't working, could you please fix that? It would help me so, so, so much, thank you!