Search Unity

  1. Unity 2019.3 is now released.
    Dismiss Notice

Third person cover controller

Discussion in 'Assets and Asset Store' started by EduardasFunka, May 23, 2017.

  1. Toby31

    Toby31

    Joined:
    Jul 7, 2014
    Posts:
    38
    @EduardasFunka Have updated project to latest build of TPCST, using 2019.1.0f2 and on runtime of demo scene in new project cannot play due to Library/PackageCache/com.unity.package-manager-ui@2.0.3. have deleted package cache folder and can play demo scene but upon reload of unity and project the package cache folder returns and have same issue. Is there another folder I need to delete in the project or should I be downloading the TPCST asset from the old store?
    Everything else seems to be working but A.I is still not using tall cover.
     
  2. Lay84

    Lay84

    Joined:
    Mar 8, 2014
    Posts:
    32
    @Toby31 I had this same issue, but I believe it was Unity package cache issue not TPCS. I tried many things but I think ultimately what fixed it was to go back to original editor version (hopefully you have a back up), go to Help>reset Packages, then upgrade project.

    Edit*
    Other options:
    try opening project from external harddrive to test issue.
    It could be also be conflicting unity temp cache stored in appdata so delete all unity 2018 appdata in C>user>appdata>unity folder.

    Hope this helps.
     
    JBR-games likes this.
  3. Lay84

    Lay84

    Joined:
    Mar 8, 2014
    Posts:
    32
  4. Toby31

    Toby31

    Joined:
    Jul 7, 2014
    Posts:
    38
    Thanks for the response this has fixed the issue. I had only imported tpcst asset luckily, just to test before updating full project. Have updated full project with asset now and seems to be working without any errors. :)

    Edit* Sorry have issue with textmeshpro in cached assets but have removed through the package manager and resolved issue
     
    Last edited: May 14, 2019
  5. Dawar

    Dawar

    Joined:
    Dec 7, 2014
    Posts:
    122
    reference to the mini map Icon at start of your enemy. assign at start method your icon when enemy alive. after dead just change the icon.
     
  6. Dawar

    Dawar

    Joined:
    Dec 7, 2014
    Posts:
    122
    ***** Toggle your Crouching********
    Step 1:- make it public

    Code (CSharp):
    1.     public class ThirdPersonController : MonoBehaviour
    2.     {  
    3. [HideInInspector]
    4.         public bool _wantsToCrouch;
    5. }
    6.  
    7.  
    8.        
    Step2:-
    Code (CSharp):
    1.     public class ThirdPersonController : MonoBehaviour
    2.     {
    3. // Replace this
    4. protected virtual void UpdateCrouching()
    5.         {
    6.             if (Input.GetButtonDown("Crouch"))
    7.             {
    8.                 if (!_controller._wantsToCrouch)
    9.                 {
    10.                     _controller._wantsToCrouch = true;
    11.                 }
    12.                 else
    13.                 {
    14.                     _controller._wantsToCrouch = false;
    15.                 }
    16.  
    17.             }
    18.              
    19.         }
    20. }[/code
    21. That's it.
     
  7. gsmax

    gsmax

    Joined:
    Jun 12, 2018
    Posts:
    10
    How will I get when the player is dead, I do have to call it from the health script right ? But how ?
     
  8. Dawar

    Dawar

    Joined:
    Dec 7, 2014
    Posts:
    122
    Code (CSharp):
    1.  public class CharacterHealth : MonoBehaviour, ICharacterHealthListener
    2.     {
    3.         /// <summary>
    4.         /// Executed on death.
    5.        /// Attach here your Method when your character dead
    6.       /// event will be invoke
    7.         /// </summary>
    8.         public Action Died;
    9. }
    lets says you have script name MiniMapIcon. you can attach it like this
    Code (CSharp):
    1. public class MiniMapIcon : MonoBehaviour
    2. {
    3.  
    4. public void Start()
    5.     {
    6.         //register
    7.         this.GetComponent<CharacterHealth>().OnDead += OnDead;
    8.     }
    9.  
    10.     void OnDead()
    11.     {
    12.         //here change you Icon;
    13.         //unregister
    14.         this.GetComponent<CharacterHealth>().OnDead -=   OnDead;
    15.     }
    16. }
     
    redoxoder likes this.
  9. redoxoder

    redoxoder

    Joined:
    May 11, 2013
    Posts:
    67
    :(
    any news about next update and new ai ?
    thanks
     
  10. Rahd

    Rahd

    Joined:
    May 30, 2014
    Posts:
    270
    yes using the Characters class (this one will have AllAlive Characters enemy and player in it )
    example using .Characters .AllAlive will give you a list of Character then you can get the actor.Side and the Ai script to check if the same side Characters in that list are fighting the same fight , then you can play around with the ai by giving it orders to take cover or play with the timer of assault , or you can establish a link using a script that will make the enemy find all the other enemies close to him , and then you can make them attack in turns , like take cover while others are attacking ... this is really important to make the game playable but , with the AI brain graph you can do this without any coding , i'm just gonna wait for that to be done to , continue working .
     
  11. umair21

    umair21

    Joined:
    Mar 4, 2016
    Posts:
    86
    Hi, Anybody integrated TPCS enemy AI with Realistic FPS Prefab player character?
    @Rahd any idea about this thing? How to integrate it?
     
  12. Toby31

    Toby31

    Joined:
    Jul 7, 2014
    Posts:
    38
    @Paul-Swanson Thanks for posting up your scripts for AmmoDrop. was going to do this in playmaker but found your posts which is a great help as I'm not a coder and only just starting to use playmaker. Have been following along as you have described in your post and having some issues with not being able to pick up the item. For some reason I cannot apply the character motor script in the motor slot, not sure if this supposed to be automatically assigned, have tried dragging charactermotor script and cowboy into Motor slot to no avail.
    1. Does this AmmoDrop script deal with the pickup? lines 63-79
    2. or should I be adding another Box Trigger under the ammo pickup object to deal with triggering the pickup script upon entering with the cowboy with Player Tag?
    (I have also looked at the script you posted beforehand for A.I dropping ammo, and you mentioned that this could be used for pickups if adapted)

    At the moment I just kick my cube/ammo along the floor upon runtime :(

    Any help would be greatly appreciated. :)
     
    Last edited: May 20, 2019
  13. Paul-Swanson

    Paul-Swanson

    Joined:
    Jan 22, 2014
    Posts:
    287
    1. 67 is the line where the pickup for ammo takes place.
    2. Once i get off work I'll review how Iv got it setup. Its been a while since I made all my prefabs. Give me a few hours

    2. ** I have 2 colliders on my Pickups. A trigger Volume and a Collision one. The larger trigger Volume has IsTriggerChecked.

    I found the issue. I worked on the script a little after the fact iu now have 3 added functions. They will automatically assign the player So use this new one.

    Code (CSharp):
    1. using System;
    2. using System.Collections;
    3. using System.Collections.Generic;
    4. using UnityEngine;
    5. using UnityEngine.UI;
    6. using CoverShooter;
    7.  
    8. [RequireComponent(typeof(AudioSource))]
    9. [RequireComponent(typeof(Rigidbody))]
    10.  
    11. public class AmmoDrop : MonoBehaviour
    12. {
    13.     public enum AmmoType { Pistol, Rifle, Shotgun, Sniper }
    14.  
    15.     [Tooltip("Select the Type of Ammo you want to restock")]
    16.     public AmmoType refNumber;
    17.     private int AmmoSelector;
    18.  
    19.     [Tooltip("Player Gets assigned Here Automatically")]
    20.     public GameObject Player = null;
    21.     [Tooltip("Player Motor Gets assigned Here Automatically")]
    22.     public CharacterMotor Motor = null;
    23.     [Tooltip("Set the tag or it gets set to Player Automatically")]
    24.     public string PlayerTag = null;
    25.  
    26.     [Tooltip("Ammo you want sent")]
    27.     public int AmmoDropAmount = 5;
    28.  
    29.     [Tooltip("Object for HUD display")]
    30.     public GameObject FloatingTextPrefab;
    31.    
    32.     [Tooltip("Popup you want for the HUD")]
    33.     private string GUIpopup;
    34.  
    35.     public AudioClip soundEffect;
    36.     AudioSource audio;
    37.     private int SoundCount = 0;
    38.  
    39.     void Awake()
    40.     {
    41.         AssignTag();
    42.         AssignPlayer();
    43.         AssignMotor();
    44.     }
    45.    
    46.     // Use this for initialization
    47.     void Start()
    48.     {
    49.         AmmoSelector = (int)refNumber;
    50.         audio = GetComponent<AudioSource>();
    51.     }
    52.  
    53.     void OnTriggerEnter(Collider other)
    54.     {
    55.         if (other.tag == PlayerTag && other.gameObject.layer == 10)
    56.         {
    57.             other.GetComponent<CoverShooter.CharacterInventory>().Weapons[AmmoSelector].RightItem.GetComponent<CoverShooter.Gun>().BulletInventory += AmmoDropAmount;
    58.             if (FloatingTextPrefab != null)
    59.             {
    60.                 SendGUItext();
    61.                 PlaySound();
    62.             }
    63.             Destroy(gameObject);
    64.         }
    65.     }
    66.  
    67.     void SendGUItext()
    68.     {
    69.         GUIpopup = "+ " + AmmoDropAmount + " " + refNumber.ToString();
    70.         var go = Instantiate(FloatingTextPrefab, transform.position, Quaternion.identity);
    71.         go.GetComponent<TextMesh>().text = GUIpopup;
    72.     }
    73.  
    74.     void PlaySound()
    75.     {
    76.         if (!audio.isPlaying && SoundCount < 1)
    77.         {
    78.             audio.PlayOneShot(soundEffect, 1.0F);
    79.             SoundCount++;
    80.         }
    81.         else return;
    82.     }
    83.  
    84.     void AssignTag()
    85.     {
    86.         if (PlayerTag == null)
    87.         {
    88.             PlayerTag = "Player";
    89.         }
    90.         else
    91.         {
    92.             return;
    93.         }
    94.     }
    95.  
    96.     void AssignPlayer()
    97.     {
    98.         if (Player == null)
    99.         {
    100.             Player = GameObject.FindGameObjectWithTag(PlayerTag);
    101.         }
    102.         else
    103.         {
    104.             return;
    105.         }
    106.     }
    107.  
    108.     void AssignMotor()
    109.     {
    110.         if (Motor == null)
    111.         {
    112.             Motor = FindObjectOfType<CharacterMotor>();
    113.         }
    114.         else
    115.         {
    116.             return;
    117.         }
    118.     }
    119. }
     

    Attached Files:

    Last edited: May 20, 2019
    Rahd and Toby31 like this.
  14. Acissathar

    Acissathar

    Joined:
    Jun 24, 2011
    Posts:
    491
    I haven't totally dug into it yet, but is anyone aware of what is responsible for bodies falling into the ground and sinking then disappearing upon their death?
     
  15. Toby31

    Toby31

    Joined:
    Jul 7, 2014
    Posts:
    38
    @Paul-Swanson Thank you very much for responding so quickly and taking the time to look at this. :) Unfortunately upon runtime I'm still kicking the ammo along the floor. The cowboy has the player Tag, I've copied and pasted script to replace the last one you created.
    Haven't assigned cowboy under Player/ this does get assigned automatically but the Motor is still left empty and is not assigned upon runtime. (Cannot add Motor script or cowboy manually)
    One thing I did notice is in your previous example you had changed the name of the character motor script??? would this make a difference? not sure what I'm doing wrong and sorry to be a pain, just clutching at straws and trying to figure out what I've done differently from your example.
     

    Attached Files:

  16. Paul-Swanson

    Paul-Swanson

    Joined:
    Jan 22, 2014
    Posts:
    287
    TBH im not sure why its not working for you. Try this:

    Add this under start.
    This should be fine since it'll only change if the value is still null. Maybe the code is running too quickly or something. Iv had to do that in the past and layer functions inside each other...was weird. But give this a shot.

    Code (CSharp):
    1. void Update
    2. {
    3. AssignMotor();
    4. }
     
  17. Toby31

    Toby31

    Joined:
    Jul 7, 2014
    Posts:
    38
    It's the character motor not being called at runtime in your script you posted above for some reason.
    I have managed to get the script to work but quite a hacky way. After testing HasnainKhan script, I managed to get that to work. so I compared both of your scripts and changed lines 60 in your above pasted script. I changed in your script,
    if (other.tag == PlayerTag && other.gameObject.layer == 10)
    to
    (other.tag == PlayerTag &&other.GetComponent<CoverShooter.CharacterMotor>().EquippedWeapon.Gun != null)
    some how this has worked lol U.I pop up works with +ammo but sound doesn't play upon collection of ammo. also shotgun and sniper ammo collection doesn't work with this method. I collect the shotgun and sniper rifle ammo and the ammo ui amount doesn't update. I know this isnt the correct way but might help shed light on why the character motor is not being called upon runtime????

    I've tried starting afresh with the AmmoDrop script as you mentioned and added under line 51
    void Start()
    {
    AmmoSelector = (int)refNumber;
    audio = GetComponent<AudioSource>();
    }
    void Update
    {
    AssignMotor();
    }

    this has caused the player to kick the ammo along the floor on runtime. think its to do with charactermotor not being called at run time in your script. Could you change it so that the charactermotor is called OnTriggerEnter line 55 rather than being automatically assigned as it doesnt seem to assign for me or I cant drag and drop the charactermotor script or player into motor area in inspector.

    Thanks again for your time, really appreciate the help :)

    EDIT: Have managed to fix the issue with collecting the right ammo now by changing the shotgun with sniper in character inventory around.

    Not sure if other people are having the same issue but shotgun ammo doesn't seem to decrease on reload?
     
    Last edited: May 23, 2019
  18. MastermindInteractive

    MastermindInteractive

    Joined:
    Jun 13, 2014
    Posts:
    86
    @EduardasFunka - Any updates? As of May 6th you were almost done with the latest version.
     
    redoxoder likes this.
  19. redoxoder

    redoxoder

    Joined:
    May 11, 2013
    Posts:
    67
    no news about update :(
     
  20. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    461
    It is done. Now I am working on trailer and documentation.
     
  21. redoxoder

    redoxoder

    Joined:
    May 11, 2013
    Posts:
    67
    Thanks for the news
     
  22. io1

    io1

    Joined:
    May 7, 2015
    Posts:
    13
    looks like I found you in time for a new update :D I'll be picking this up next weekend, see you around.
     
  23. io1

    io1

    Joined:
    May 7, 2015
    Posts:
    13
    Hey Eduardas I've just been looking through the older posts and I've noticed that your thinking about splitting off the AI from the Character controller. If I buy this now will I get the reduced upgrade price to the AI component?
     
  24. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    461
    Right now thinking to publish 2 packages AI + Controller and Controller + AI. same asset different marketing. You can buy any of those.
     
    Rahd and io1 like this.
  25. Toby31

    Toby31

    Joined:
    Jul 7, 2014
    Posts:
    38
    Has anybody else had an issue with the latest TPCST update shotgun ammo not going down on reload? Mine currently seems to be stuck at 10000?
    All other ammo decrease for other weapons on reload.
     
  26. Paul-Swanson

    Paul-Swanson

    Joined:
    Jan 22, 2014
    Posts:
    287
    Yes, that's something I brought up back in November. You can also hold R and it will rapidly reload instead of being timed correctly. It wasn't evident until I exposed the ammo counts, so initially I assumed it was something I did wrong. But I'm not so sure anymore.

    In this post here:
    https://forum.unity.com/threads/third-person-cover-controller.472313/page-27#post-3889678
     
    Last edited: May 28, 2019
    Toby31 likes this.
  27. Toby31

    Toby31

    Joined:
    Jul 7, 2014
    Posts:
    38
    @EduardasFunka you mention publishing the asset as two separate packages, do you have a list of updates and improvements since the last update in may please? :) And ETA?
     
  28. io1

    io1

    Joined:
    May 7, 2015
    Posts:
    13
    Hey group. Would anyone object to me starting a discord for this addon as it makes things a lot easier?
     
    Last edited: May 29, 2019
  29. Paul-Swanson

    Paul-Swanson

    Joined:
    Jan 22, 2014
    Posts:
    287
    I personally think it's fine. But it's Ed's asset. As long as no one share his code directly I'm sure he wouldnt really object. I think he might have a patreon discord though but I might be mis remembering
     
  30. io1

    io1

    Joined:
    May 7, 2015
    Posts:
    13
    Hey Paul I wouldn't share the source code, but I was thinking of a general chat and a show a what your working on kind of thing, perhaps an FAQ, roadmap ect ...
     
    Paul-Swanson likes this.
  31. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    461
    HDRI render pipeline should work you just need to update particle shaders. I made video series with TPCS in HDRI. About discord go ahead and make one. I do not promise that I will be online all the time it's very hard for me to multitask.
     
    Paul-Swanson likes this.
  32. io1

    io1

    Joined:
    May 7, 2015
    Posts:
    13
    Just after I posted my post related to working with the HDRP I found your video about working with the HDRP, ironically I'd nearly watched all the other videos in that play list haha. Totally understand about the discord and being available, i'm super busy myself. Thanks for making this btw it's a solid base, my imagination is on fire with all the ideas going through my head right now.
     
    Paul-Swanson likes this.
  33. Wothanar

    Wothanar

    Joined:
    Sep 2, 2016
    Posts:
    97
    i bought the asset need help , character not moving ! game crash on all scenes ! and in editor crash and im using unity Unity 2018.3.0.2, why this!
     
  34. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    461
    I would be helpful if you relax and just send the errors you get.
     
    satchell and io1 like this.
  35. redoxoder

    redoxoder

    Joined:
    May 11, 2013
    Posts:
    67
    Hi, can t wait the update..
    Trailer and documentation near ends ??
    Thanks
     
    io1 likes this.
  36. redoxoder

    redoxoder

    Joined:
    May 11, 2013
    Posts:
    67
    hi ,
    it is possible to have one hand aiming gun ?
    thanks
     
  37. Wothanar

    Wothanar

    Joined:
    Sep 2, 2016
    Posts:
    97
    im calm but its frustrating that you bought an asset that its almost 100 usd and just is not come out of the box in the version of unity i was using now im downloading the unity 2019.1.4f1 as you say in the email, hope this work all what its say on the description since im not very happy with whats going on there since i want to get what i pay for...
     
  38. io1

    io1

    Joined:
    May 7, 2015
    Posts:
    13
    I just got this other day (Thursday) and its working fine for me. I'm only commenting to let you know that it's probably something you can sort out and not a broken asset. There are some massive updates coming too which i'm sure will put a smile on your face they arrive, hang in there.
     
  39. Rahd

    Rahd

    Joined:
    May 30, 2014
    Posts:
    270
    @EduardasFunka you should make a forum and stop using the unity thread ...
    new people will struggle to fix simple problem and end up posting a rant about the asset .
    with a forum we can make a thread for each problem on our own , that way you can spend more time on your work .
    i liked the discord idea too ... to anyone who still can't make this asset work a simple search in the thread will fix your problem . frustration will not help you .
     
  40. Paul-Swanson

    Paul-Swanson

    Joined:
    Jan 22, 2014
    Posts:
    287
    Totally agree here.
     
    Rahd likes this.
  41. MastermindInteractive

    MastermindInteractive

    Joined:
    Jun 13, 2014
    Posts:
    86
    I really like this idea as well. This will allow issues to be tracked properly, almost like on Github. Right now, issues get lost on this forum. I also think that Ed needs help, the asset needs commenting, documentation and it needs to be cleaned up badly (there are orphan files, duplicate, unused animations, etc). The community can help with that.
     
    Paul-Swanson, io1 and Rahd like this.
  42. io1

    io1

    Joined:
    May 7, 2015
    Posts:
    13
    Does anyone have suggestions for good platforms that Eduardas could consider. Wordpress forum is the first thing that comes to mind for me personally but it's not dedicated forum software. As for documentation check this out it's open source, i've used it with a lot with other apps I use. https://readthedocs.org/
     
  43. gsmax

    gsmax

    Joined:
    Jun 12, 2018
    Posts:
    10
    @Paul-Swanson please how did you get the Kripto impacts to align properly with your POV.
    When i hit an object from one side the effects come out well, but from another side of the same object the effect kind of looks rotated.
    Am currently using the 'hit effect' script.
     
  44. Wothanar

    Wothanar

    Joined:
    Sep 2, 2016
    Posts:
    97
    yea made a discord , since my character its not moving i follow all the steps have unity 2019.1 the cowboy works but following the survival tutorial , my survival character does all except move wsad , it shoot etc but why is not moving? it has tag player , layer character .... i cant see the problem of why its moving and i dont have any documentation about this and im seriously being sad with this now.
     
  45. Wothanar

    Wothanar

    Joined:
    Sep 2, 2016
    Posts:
    97
  46. Wothanar

    Wothanar

    Joined:
    Sep 2, 2016
    Posts:
    97
    io1 likes this.
  47. io1

    io1

    Joined:
    May 7, 2015
    Posts:
    13
  48. Wothanar

    Wothanar

    Joined:
    Sep 2, 2016
    Posts:
    97
    yeah , but the ai characters im creating happend same , why this anyone know?
     
  49. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    461
    We had Forum on our website but nobody posted there I even stopped replying to support questions on this forum. At that time people said that they prefer Unity forum. Maybe it's better for you to create a forum or reddit with your own community rules. I sell assets, so if I make one it will be more on a corporate side and boring.
     
    io1 likes this.
  50. Muhamad_Faizol

    Muhamad_Faizol

    Joined:
    Jan 21, 2017
    Posts:
    47
    A community run forum would be nice, but we still need a way for your asset buyers to be able to share the asset's code snippet from time to time in our discussions, thus it can't be a totally public forum. Personally I would prefer something like github (easy to trace posted problems and searchable too), but since the free one is only available as a public forum/thread, that means those who purchased your asset can't discuss your code there.
     
unityunity