Search Unity

[RELEASED] Third Person Shooter Bundle

Discussion in 'Assets and Asset Store' started by Viniterra, Mar 17, 2020.

  1. Viniterra

    Viniterra

    Joined:
    Dec 4, 2014
    Posts:
    193
    Could you send me an email, or use the contact form from the support link? I can provide you a solution for that.
     
  2. satg

    satg

    Joined:
    Dec 23, 2016
    Posts:
    7
    alright sent you message using contact form.
     
  3. VeryBadPenny

    VeryBadPenny

    Joined:
    Jun 3, 2018
    Posts:
    40
    Hi, I have followed the tutorial and set up a character, she shoots her rifle but can't see the cover. I have the block (as in the tutorial video) set to Layer="Cover", and the Cover Behaviour set up on my character. Cover Mask is set to Cover + "Cover Invisible". Is there something else needed for the cover to be accessible? Thanks!

    upload_2020-6-9_21-46-39.png upload_2020-6-9_21-47-28.png
     
  4. Viniterra

    Viniterra

    Joined:
    Dec 4, 2014
    Posts:
    193
    Hi, have you baked the navmesh path?
     
  5. VeryBadPenny

    VeryBadPenny

    Joined:
    Jun 3, 2018
    Posts:
    40
    Yes, I have baked the navmesh. Also, I just tried another experiment:

    I copied the shadow character from your tutorial level (in the asset pack) and placed him in my scene - he works OK and can use the cover. So the problem must be with the configuration of my character, not the environment. I'll keep investigating. Thanks for the reply!

    EDIT, LATER: I seem to have found the problem, which is hinted at in the README for the Cover system, but in a different context. Although my character could move, shoot and animate perfectly, I couldn't use cover until her collider was extended further below her toes.
     
    Last edited: Jun 10, 2020
    mcschuele likes this.
  6. VeryBadPenny

    VeryBadPenny

    Joined:
    Jun 3, 2018
    Posts:
    40
    Hello, I'm making some good progress with the system. I needed to add an "invert Y" option and did it as below; this script sits on my Player prefab for now - is this the best way to do it? I'm not talking about an options screen, just the actual mechanics of implementing inverted Y axis. Thanks in advance.

    Code (CSharp):
    1. public class BPG_Invertor : MonoBehaviour
    2. {
    3.     private Camera _camera;
    4.     private ThirdPersonOrbitCam _cameraController;
    5.  
    6.     private void Awake()
    7.     {
    8.         _camera = Camera.main;
    9.         _cameraController = _camera.GetComponent<ThirdPersonOrbitCam>();
    10.     }
    11.  
    12.     void Update()
    13.     {
    14.         if (Input.GetKeyDown(KeyCode.I))
    15.         {
    16.             _cameraController.verticalAimingSpeed *= -1;
    17.             Debug.Log("Y axis switched");
    18.         }
    19.     }
    20. }
    21.  
     
  7. Viniterra

    Viniterra

    Joined:
    Dec 4, 2014
    Posts:
    193
    The collider origin has influence on the cast origin point, which can make the covers not being detected. The collider must be correctly configured to avoid other cover problems also, like a larger radius that can prevent the character from moving when under cover.

    Thanks for the feedback.
     
    VeryBadPenny likes this.
  8. Viniterra

    Viniterra

    Joined:
    Dec 4, 2014
    Posts:
    193
    You just need to invert the Vertical Aiming Speed value of the Third Person Orbit Cam script.
     
    VeryBadPenny likes this.
  9. VeryBadPenny

    VeryBadPenny

    Joined:
    Jun 3, 2018
    Posts:
    40
    Hi, another question which may be helpful to other users of this asset so I am posting it here (to be searchable, etc)... or maybe someone else can help me out.

    Background: I am spawning enemies from a pool; initially they are set to Inactive in the pool, then the spawner script assigns their waypoints and aimTarget after finding their StateController component.

    Being Inactive doesn't stop Awake() being called, so I had to move the line below from Awake() to Start() because when they're instantiated they have no aimTarget:

    Code (CSharp):
    1.             // Ensure the target has a health manager component to receive shots
    2.             Debug.Assert(aimTarget.root.GetComponent<HealthManager>(), "You must add a health manager to the target");
    3.  
    Then in my SpawnerAndDeployer script I have this code after the enemy is pulled (still inactive) from the pool; note that my Player gets to tell the AI where to aim - in your examples this is Spine_02, but I need to vary it:

    Code (CSharp):
    1.             // there may be a Third Person Pack StateController
    2.             var _TPSStateController = _enemy.GetComponent<StateController>();
    3.             if (_TPSStateController != null)
    4.             {
    5.                 // TPS state requires an aim point - tested: works
    6.                 var _target = FindObjectOfType<Player>();
    7.                 _TPSStateController.aimTarget = _target.GetComponent<BPG_PlayerHealth>().WhereToAim;
    8.  
    9.                 // TPS state also requires waypoints - tested: works
    10.                 if (waypoints.Length > 0) { _TPSStateController.patrolWayPoints = waypoints.ToList(); }
    11.             }
    12.             else
    13.             {
    14.                 Debug.Log("No StateController");
    15.             }
    16.          
    17.             _enemy.gameObject.SetActive(true);
    18.  
    So now I have enemies which spawn from the pool when triggered by my SpawnerAndDeployer; they appear in the scene and have the correct aimTarget, they follow waypoints correctly and when they see the player they go into Attack state.

    However, once in Attack state, the pooled enemies do not raise their weapon and shoot at the player. Can you think why this might be the case, or how to debug the problem?

    I created a scene where there are two identical enemies; one is enabled in the original scene and another (labeled Clone) is from the pool. These two enemies have identical views in the inspector. I added a Handle call to label the enemies in the Editor view here with name and currentState:
    upload_2020-6-14_0-46-5.png
    and here is the inspector view side-by-side (same scene):
    upload_2020-6-13_23-41-28.png

    Any advice would be appreciated. So far, I've found the code very easy to understand and modify but I must be missing something here. Thanks!
     
    Last edited: Jun 14, 2020
  10. Viniterra

    Viniterra

    Joined:
    Dec 4, 2014
    Posts:
    193

    From your scene image, it seems that the animator controller for the pooled enemy is messed. It is not even sustaining the guard position.

    When an enemy is killed, many components are removed from it, including the animator controller. I don't know how you manage to re-add the removed components, but it appears to be a situation similar to when you edit a script on a scene already playing, and then try to resume it. The animator always becomes messy.

    Honestly, I would go for a solution that uses prefabs for the enemies and instantiate it on demand, in the same script you assign the aim targets and waypoints.
     
    Last edited: Jun 16, 2020
    VeryBadPenny likes this.
  11. VeryBadPenny

    VeryBadPenny

    Joined:
    Jun 3, 2018
    Posts:
    40
    Thanks for your thoughtful reply. My AIs at this point (when the screenshot was taken) have not been killed and reused, so it is not a problem of components being removed, but I see your point and I will run into that later with a pooling system.

    I will try your suggestion - it will be OK for a relatively small number of enemies and if I have problems with many enemies I will have to rewrite things to be poolable, but I think I can handle that. Thanks again.
     
  12. Viniterra

    Viniterra

    Joined:
    Dec 4, 2014
    Posts:
    193
    It was just a guess, a suggestion based on your report and the pictures you provided.

    I might be able yo help you more with your current setup, using pooling, even if it is to provide a more accurate feedback. Since this may involve accessing project files, could you please contact me trough the support channel (contact form, e-mail)?
     
    VeryBadPenny likes this.
  13. VeryBadPenny

    VeryBadPenny

    Joined:
    Jun 3, 2018
    Posts:
    40
    I do not want to take up much of your time with more questions until I have experimented a little more myself, but your offer to help is very kind. If I cannot move forward I will make a sample project to share with you illustrating my problem. Thank you.
     
    Viniterra likes this.
  14. admin_unity23

    admin_unity23

    Joined:
    Apr 11, 2018
    Posts:
    1
    Hi, I like the assets so far. Is there any "easy" way or tutorial how to add movements, such as rolling or climbing a ladder? ;)
     
    VeryBadPenny likes this.
  15. Viniterra

    Viniterra

    Joined:
    Dec 4, 2014
    Posts:
    193
    The asset was designed in a way that you can create new, plug and play actions for the player, without any major complications and refactorings.

    Assuming you know how basic Unity developing works, in terms of controlling the actions in the Animator Controller by setting parameters via script, it becomes an easy task.

    The overview of the steps is to:

    1) Configure an animation layer with the animations for action you want, transitions etc.
    2) create a new class that inherits from the GenericBehaviour, and make it subscribe to the behaviour manager
    3) Set when it will activate, probably by player input, by using the register or the override function (depends on the design for your new player action).
    4) Set when it will end (by player input or when the animation ends, for example), by unregistering or revoking the override for the behaviour.

    In fact this is a good ideia for an extension tutorial, like the one I am now creating to show how to extend the current enemy NPC FSM. I will consider creating one demonstration for a simple player action, thanks for the suggestion.
     
    Acissathar likes this.
  16. TechSinsN

    TechSinsN

    Joined:
    Apr 12, 2014
    Posts:
    121
    @Viniterra Any idea when the grenades are coming and or a tutorial on how to add mobile controls?
     
  17. Davood_Kharmanzar

    Davood_Kharmanzar

    Joined:
    Sep 20, 2017
    Posts:
    411
    this package needs Grenade, Crowbar, Shield and Swimming too ;]
     
  18. Viniterra

    Viniterra

    Joined:
    Dec 4, 2014
    Posts:
    193
    I provide a mobile version of the basic package:

    3rd Person Controller + Fly Mode (Mobile)

    This package is the basic 3rd person package, with the addition of a Input system for mobile platforms. This system mimics the default Unity Input System, but using virtual buttons and analogs.

    At the end of the video tutorial for this package, I show how you can configure the mobile inputs in any game you want. It can be used even in 2D games, for example.
     
  19. AnanyaIG

    AnanyaIG

    Joined:
    Sep 12, 2018
    Posts:
    9
    Hey @Viniterra, I was wondering if the cover system/cover behavior script could be used on it's own? I really liked the cover system you have, but I already have my third person shooter system ready and I wanted to use this cover system. And I also don't wanna redo my shooter system. Do you have any idea as to what all could I do? Since I tried using the cover behavior on it's own but it didn't work and I was getting errors telling me to use the basic behavior as well, and when I took a look at the references in basic behavior, it was camera and all the other stuff.

    So what I'm asking is, how could I integrate just the cover system with my existing system?
     
  20. Viniterra

    Viniterra

    Joined:
    Dec 4, 2014
    Posts:
    193
    Hi,

    The entire system is bounded to the camera, although the cover behaviour specifically doesn't need that to work. But all the behaviours need the basic behaviour to work. So there is no full integration with another system. The solution would be by alternating both systems, given by some input (the enter/exit cover key, for example).

    I have tried this kind of integration before, with the cover behaviour itself and another system, by switching the systems, and it seems to be a way that could work, even using the other system camera. But I had some problems with the third party input system, that changes the collider material and completely affects the cover movement. In that case, this input system could not be disabled in that other system or their camera would not work. Since then I have not made any further progress.

    Other future problem I have identified is about aiming when in cover. This integration would need some more work in that part, since it temporally quits the cover to aim and shoot. The peek system in particular, used in cover corners is completely integrated with the aim behaviour, and I honestly don't see a way to make it work with another shooting system. Basically, I would go by including the aim button as another exit point to switch the systems, but this could lead to the player moving freely and exiting the cover, so that would be something that would need treatment too.

    So I believe it is possible, but it is not as easy as using the entire system, which is basically plug and play. There is some work that needs to be done to achieve that integration.
     
  21. Anhella

    Anhella

    Joined:
    Nov 18, 2013
    Posts:
    67
    Good day can you add enter/exit car please?
    have good day
     
  22. Viniterra

    Viniterra

    Joined:
    Dec 4, 2014
    Posts:
    193
    As long as you have the proper animations, you can easily create that by adding a new behaviour.
     
  23. BioBurden

    BioBurden

    Joined:
    May 28, 2018
    Posts:
    115
    Hi, is there an implementation for aiming down sights with this asset? Thanks in advance.
     
  24. Viniterra

    Viniterra

    Joined:
    Dec 4, 2014
    Posts:
    193
    You can change the Aim Pivot and Aim Offset parameters, in the AimBehaviour script, to match the desired ADS position.
     
  25. kenmasu200x

    kenmasu200x

    Joined:
    Aug 15, 2020
    Posts:
    5
    Hi! This is great asset!

    I have a question.
    (I've watched your video all , but it was skipped )

    while set upping TPS bundle,

    after attached Player Health Script on my player,

    I wonder what should I select for items below.
    I can't find healthHUD

    healthHUD: ?
    Hurt Prefab: ?
    Death Clip: ?
    Hurt Prefab: ?

    thank you
     
    Last edited: Sep 19, 2020
  26. Viniterra

    Viniterra

    Joined:
    Dec 4, 2014
    Posts:
    193
    Hi,

    You can jump directly to the section where the player health is setup (this link is already in there):

    Health setup

    If you expand any of the video tutorials, you'll see all sections with their respective time on the video to jump right on.
     
    Last edited: Aug 9, 2022
  27. SnowDaySoftware

    SnowDaySoftware

    Joined:
    Mar 25, 2013
    Posts:
    11
    Hello, I'm having an issue with the EnemyAI package, similar to what the one user described above. Anytime you inactivate an enemy and reactivate them to reuse them for an Enemy pool, some reference somewhere gets messed up. In your example scene called "FPS", if you start the scene, disable an enemy in the hierarchy, then reenable them, their AI is messed up and no longer sees the player.
    Object pooling the enemies is extremely important, especially for developing on consoles. Instantiating an enemy during gameplay will cause large framerate spikes. Hopefully you have a solution for this so i can continue to utilize the product in my game, other than that, it's an amazing AI framework.
     
  28. VeryBadPenny

    VeryBadPenny

    Joined:
    Jun 3, 2018
    Posts:
    40
    Pooling of these enemy AIs is quite difficult and I never went back to it (but should). I was keeping enemies inactive until spawned or activated. They do get messed up when inactive and then reactivated. The author was helpful and suggested a fix to at least that problem:

    Code (CSharp):
    1. # Just move the line that adds the enemy animation component for the enemy
    2. # from the Awake() function to the Start() function, inside the State Controller script:
    3.  
    4. enemyAnimation = this.gameObject.AddComponent<EnemyAnimation>();
    This worked for my use case and might help you. But I agree that a general pooling solution would be necessary for larger scale use.

    P.S. I wish we had a sort of Wiki for this asset pack. It's a great bundle and I have made a variety of changes to it myself which I would be happy to document and share.
     
  29. Viniterra

    Viniterra

    Joined:
    Dec 4, 2014
    Posts:
    193
    Since it is a recurring request, I'll put on the roadmap some time to study a pooling method for the package, thanks for the feedback guys

    PS.: for some reason I wasn't notified of the last two messages in this topic. I must remeber that the support link is always the fastest response.
     
    VeryBadPenny likes this.
  30. kokakee

    kokakee

    Joined:
    Jun 8, 2015
    Posts:
    9
    Does asset integrate well with others? Pixelcrusher Quest and dialogue system for example ... or adventure creator
     
  31. Viniterra

    Viniterra

    Joined:
    Dec 4, 2014
    Posts:
    193
    I don't know exactly how these systems work, I have never used them.

    I believe it is more like a complementary than a conflicting situation, considering a dialog system. So, I think it can be integrated by anyone that has some scripting and engine understanding.
     
  32. fantasydirections

    fantasydirections

    Joined:
    Feb 29, 2020
    Posts:
    1
    have watched your video how to setup the Ai with a custom model. Everything works but when the Ai goes into the attackstate the Ai doesn't shoot. Pls help
    my Email: FantasyDirections@gmail.com
     
  33. Viniterra

    Viniterra

    Joined:
    Dec 4, 2014
    Posts:
    193
    Hello, I've replied your direct message.
     
    b9mtee likes this.
  34. b9mtee

    b9mtee

    Joined:
    Jul 30, 2021
    Posts:
    1

    I made several attempts to solve the problem, but I don't understand
     
  35. Viniterra

    Viniterra

    Joined:
    Dec 4, 2014
    Posts:
    193

    The first error is related to some missing components. This player health scripts was created for the example scene, and contains some extra components. If you intend to use it, you must add all the needed components, exactly like the example. The player setup video tutorial shows how to create or adapt your own health script.

    The second error is related to a wrong setup for the enemy weapon. Please review the setup video tutorial for the enemy and check for unconformities.

    Player setup:

    Enemy setup :
     
  36. JC_LEON

    JC_LEON

    Joined:
    May 20, 2014
    Posts:
    520
    Hi i mported the shooter bundle in an empty project and got this error after import

    Assets\TPS Bundle\EnemyAI\Examples\Characters\TopDownCharacter\Scripts\PlayerMovement.cs(4,14): error CS0101: The namespace '<global namespace>' already contains a definition for 'PlayerMovement'


    edit

    solved

    there was a same name script int oa cinemachine example demo scene... my bad..
     
    Last edited: Aug 10, 2021
  37. Viniterra

    Viniterra

    Joined:
    Dec 4, 2014
    Posts:
    193

    Hello,

    This conflicting file is from one of the example scenes. You are importing the package within a project that already contains other files, and one with the same name is causing the conflict.

    If you want to use the example scenes, please import the package under an empty project. In case you want to use the asset on an existing project, you must follow the video tutorials to import just the needed files into your project.
     
  38. JC_LEON

    JC_LEON

    Joined:
    May 20, 2014
    Posts:
    520
    thanks for your reply but i had already solved simply modify the name and the class of the cinemachine script... after that no errors...

    btw i followed the tutorials forimplementing the system(basically i only need the ai system to e integrated into my game) but in the second one when set the script on robot kyle and play the scene to view the aim alignement towards the player .. robbot kyle doesnt sense the player and doesnt turn to it ..i rewatched the video many times and didnt miss anything...

    but if player shoot the robot the robot takes damage , headshoot works perfectly and when robot health is zero robot die correclty... only doesnt sense the plòayer
     
  39. Viniterra

    Viniterra

    Joined:
    Dec 4, 2014
    Posts:
    193
    You must ensure the player has the same layer and tag Player on the main game object, and also has a collider on it, in order to be detected by the enemies. The health manager is also needed. All of these steps are covered in the video tutorial.

    Take a look at the console for possible error messages, as they must point to missing components.
     
  40. PRfsJay

    PRfsJay

    Joined:
    Apr 22, 2021
    Posts:
    15
    i love your 3rd person template, i have many questions but i guess ill ask the currently important one: in the enemy AI tutorial you aks us to set up an player health script, yet in my game I have a premade player health script, with alot of scripting in it, what is that player health script for?
     
  41. Viniterra

    Viniterra

    Joined:
    Dec 4, 2014
    Posts:
    193

    Hello, thank you for your interest.

    This specific section in the video tutorial covers the interaction between the enemies and the player. In short, it shows how the player receives the damage from the enemy bullets.

    In your case, you just need to inherit your existing health script from the HealthManager, instead of inheriting it from the MonoBehaviour directly, and then implement the TakeDamage() function inside your health script. It is the function that will be called when an enemy hits the player. Do inside that function whatever you need to do when the player receives damage.

    The tutorial gives a brief overview of the TakeDamage() function and the parameters. For more information about these parameters, you can also take a look at the README file that comes with the package.
     
  42. PRfsJay

    PRfsJay

    Joined:
    Apr 22, 2021
    Posts:
    15
    Thank you for your reply. Is their by chance a way to have a HUD for the players health as well? I would like to add script for giving ammo and for giving health but I would like to see a HUD with player health in the corner as well. did I perhaps miss a tutorial for this?
     
  43. Viniterra

    Viniterra

    Joined:
    Dec 4, 2014
    Posts:
    193
    Hi, there is no tutorial for this. There is one one in the demo scenes (the TPS one), created exclusively for it. Assuming you know how Unity canvas works, you can base on that example to create your own.
     
  44. PRfsJay

    PRfsJay

    Joined:
    Apr 22, 2021
    Posts:
    15
    Hello, sorry to be a burden but hopefully you can give me a hint.
    So I got the health HUD to work and wanted to get the fade in and out with the dissolve character feature back in.
    I assigned the spawneffects.script to the player character, imported and set up the fader.object under the scene, and then added this code to the end of the character playerhealth script:

    private void Kill()
    {
    this.GetComponentInChildren<SpawnEffect>().enabled = true;
    AudioSource.PlayClipAtPoint(deathClip, transform.position, 5);
    }

    and I seem to be getting the null problems in the picture. any idea what i can do to fix it?

    thank you.
     

    Attached Files:

  45. PRfsJay

    PRfsJay

    Joined:
    Apr 22, 2021
    Posts:
    15
    actually to be specific I added the fader object as a child to the game controller / screenHUD
     
  46. Viniterra

    Viniterra

    Joined:
    Dec 4, 2014
    Posts:
    193
    Hi,

    By opening the script and checking the error lines, you will see that the SpawnEffect script is trying to find components that are missing in the scene. In this case, the object with the Tag finish (the Fader game object in the original scene).

    If you want to use the components you've mentioned, since they are outside the scope I can provide for the package, you must configure all components exactly like the example scenes, with all the referenced ones(HUD, etc.), layers tags, etc.
     
  47. Ben_Iyan

    Ben_Iyan

    Joined:
    May 13, 2016
    Posts:
    204
    I am working on an XCom style game and the top down view will work well, but the "Player" is really just the camera and the active NPC will change. In other words there won't be just one avatar and, therefore, no avatar with the tag "Player". Based on how you have designed the system, would it require a major update to the code?
     
  48. Viniterra

    Viniterra

    Joined:
    Dec 4, 2014
    Posts:
    193

    You can have multiple entities on the scene with the layer player. About coding, I believe you just need to create a manager that changes the aim target for each enemy, based on incoming entities within their sense radius.
     
  49. VeryBadPenny

    VeryBadPenny

    Joined:
    Jun 3, 2018
    Posts:
    40
    I discussed with PRfdJay a little on some of the work he is doing. In the process, we came up with this simple script called ZombieHands which can be placed on any object (zombie hands is just the example) to do damage to the player when using the framework of the TPS Bundle. We tested it by attaching it to a garbage can - every time the player bumps the can, they take damage. So it could be sued for anything melee-like or an electric fence, toxic waste, etc... It may be helpful to other developers learning this package.

    Code (CSharp):
    1. using UnityEngine;
    2.  
    3. public class ZombieHands : MonoBehaviour
    4. {
    5.     // put this script on the "weapon" (usually the hands) of a zombie
    6.     //
    7.     // this would actually work for any melee-based attack or even a static object
    8.     // like an electric fence if the player walks into it.
    9.  
    10.     [SerializeField] private float _myZombieHandDamage = 1f;
    11.  
    12.     private void OnCollisionEnter(Collision other)
    13.     {
    14.         // what did we hit?
    15.         GameObject damageReceiver = other.gameObject;
    16.      
    17.         // does it even have a Health component?
    18.         HealthManager targetHealth = damageReceiver.GetComponent<HealthManager>();
    19.      
    20.         if(targetHealth != null)
    21.         {
    22.             // this should be a safe way to identify the zombie/attacker
    23.             GameObject damageGiver = this.gameObject;
    24.      
    25.             // where was the hit? we only take the first contact point
    26.             Vector3 hitPoint = other.contacts[0].point;
    27.      
    28.             // what was the hit direction? again only take first point
    29.             Vector3 direction = other.contacts[0].normal;
    30.      
    31.             // how much damage does this melee attack do? Could adjust here
    32.             float damage = _myZombieHandDamage;
    33.      
    34.             // finally we need to know what/where received the damage
    35.             Collider playerCollider = other.contacts[0].otherCollider;
    36.  
    37.             // deal the damage!
    38.             targetHealth.TakeDamage(hitPoint, direction, damage, playerCollider, damageGiver);
    39.         }
    40.     }
    41. }
    42.  
     
  50. Vince33270

    Vince33270

    Joined:
    Jul 10, 2018
    Posts:
    1
    Hi @Viniterra,
    thanks for this great asset.
    i just bought the bundle. Do you plan to make a multiplayer version with Mirror or Photon ?
    if not, is it possible to make it myself ? Easily ?