Search Unity

Controller Third Person Templates by Invector

Discussion in 'Tools In Progress' started by Invector, Aug 20, 2015.

  1. Invector

    Invector

    Joined:
    Jun 23, 2015
    Posts:
    966
    Hey @skytow2003, we spend today coding a new jump solution because our current basically sucks :confused:
    I personaly don't like jump with rigibody physics on games with a more real approche, I prefer to use root motion animations with a little bit of coding to make right, but I understand that most of you guys want the jump for different types of games, so we will improve!

    We manage to get very nice results replacing the old transform for rigidbody.AddForce, as well for the extraGravity - and it's working way better then before, you can jump super high and put faster extraGravity to make the char fall faster.
    I will just give a polish tomorrow and upload as soon as I can ;)
     
  2. snackzilla

    snackzilla

    Joined:
    Aug 17, 2014
    Posts:
    91
    Now that 1.3d is live, any luck contacting the Inventory Pro guys? That's currently where I'm stalled in my project. I just got back from vacation, so I'm downloading the new update now and will get back to prodding at it soon. Thanks again for all y'alls hard work!:)
     
  3. Invector

    Invector

    Joined:
    Jun 23, 2015
    Posts:
    966
    Hey Guys! :D

    To start the Shooter Template with the right foot, We hired an 3D Artist to develop the V-Bot 2.0 and a 3D Animator to make all the new shooter animations! - Nothing but the best for you guys!

    Here is a preview of the new V-bot rendered on Unity 5.3.5 using Standard Material with Metallic & Normal maps 4k

    V-bot 2.0 will be included on ALL Invector Templates!

    More details with 4k textures


    New details & Rig allowing better movement


    Metallic texture looks beautiful with the Standard Shader


    More materials to make new combinations






    And here is a preview of the development


    I will create a post talking about the process on our Blog and post here soon :D
     
    ScaraBe, Vibhanshu, PIGame and 3 others like this.
  4. Invector

    Invector

    Joined:
    Jun 23, 2015
    Posts:
    966
    Glad you're back dude! - We're really focus on the Shooter right now, after that we will take a look on the most requested assets for integration ;)
     
  5. AshyB

    AshyB

    Joined:
    Aug 9, 2012
    Posts:
    191
    @Invector The work looks fantastic! More pics and teasers please :D
     
  6. googlebac

    googlebac

    Joined:
    Feb 1, 2015
    Posts:
    56
    Hi I've finally had some time to sit down and play with the enemy AI. just wondering if there was a way to stop the character sometimes freezing in mid air after death like this:

    It would be preferable to have remove physics after death still turned on.
     
  7. skytow2003

    skytow2003

    Joined:
    Feb 9, 2014
    Posts:
    30
    thanks for the better jumping but expecially for your very professional way of running your work.
    pietro
     
    Invector and Malbers like this.
  8. Shadex

    Shadex

    Joined:
    Dec 18, 2013
    Posts:
    89
    A while back on page 23 someone was talking about Heavy attacks and Light attacks. I think the idea was tap "attack" for a quick attack and hold "attack" for a strong attack. Did anything ever come of that? If so i would love that script!

    Also, Is there a way to add knock-down aka ragdoll for a specific attack instead of setting it to the weapon? Is there force applied?
     
  9. Invector

    Invector

    Joined:
    Jun 23, 2015
    Posts:
    966
    Just test here, you need to change the Culling Mode from the Animator from Cull Update Transforms to Always Animate, not sure how this will impact performance though... It happens when the character is not being renderer by the camera, and the animator make some kind of culling, you also can manually change the Culling mode only when the character dies, I think it's the best performance solution.

    It's really simple to trigger a heavy attack, you just need to make the Input method, and create a new Trigger like HeavyAttack, then use the same ATK_ID on the animator. I will make a example of this for the next update ;)

    To activate the ragdoll is quit easy, but require a little bit of coding.
    I also can create this option for you guys :)
     
  10. PIGame

    PIGame

    Joined:
    May 2, 2016
    Posts:
    32
    I bought this pack from Invector site I can't review on Unity Asset Store so I will post here, what I like most about this pack:

    - Not about it's the AAA-game-quality character controller, best on the Asset Store IMO, they use so many advanced techniques and I have a feeling that every single line of code is all carefully, thoughtfully written.
    - Not about it has so many advanced features like melee combat (with enemy AI) system, box dragging, climbing ect. so that you can really make a REAL GAME with it believe me there are so many "Complete Project"s on the asset store that are far from complete, there's only a few like TPC-Melee which you can actually make a game out of it.

    It's about the support, it's when I'm running around asking dumb questions (I believe I'm not the only one asking questions) but they patiently answer all of them. You guys are so admirable, Invector!
     
    Last edited: Jun 22, 2016
    jcarrick and Invector like this.
  11. Invector

    Invector

    Joined:
    Jun 23, 2015
    Posts:
    966
    @PIGame No words, just feels >



    You guys are awesome :p
     
    Last edited: Jun 22, 2016
    jcarrick, PIGame and Malbers like this.
  12. Invector

    Invector

    Joined:
    Jun 23, 2015
    Posts:
    966
    Sure :D
    Here is a few comparison shots of the new vs old V-bot







    You can check the post on our Blog with more info [Here]
     
    snackzilla, PIGame and Malbers like this.
  13. jbooker410

    jbooker410

    Joined:
    Mar 9, 2014
    Posts:
    41
    Hey guys. Is there no way to add blood effects for hitting enemy? I find it odd that there is recoil hits but no blood lol.
     
  14. Invector

    Invector

    Joined:
    Jun 23, 2015
    Posts:
    966
    Just add the vHitDamageParticle Component on your enemy :)
     
  15. Shadex

    Shadex

    Joined:
    Dec 18, 2013
    Posts:
    89
    That's what i figured. I got the heavy/light attacks working on one mouse button. I tried to code the ragdoll to MeleeAttackBehavior.cs but i do not think i have the code skills to get it working atm. But i would love that option. I know you guys are working hard on the shooter template as well.


    If anyone wants the code to be able to tap for quick attacks and hold for strong attacks, let me know.
     
    jcarrick likes this.
  16. jbooker410

    jbooker410

    Joined:
    Mar 9, 2014
    Posts:
    41
    awesome thanks. Now how do I change the sound when you swing you weapon? Can change hit sounds but cant find how to change attack sounds. Trying to make a zombie grunt while attacking. Also any scripts for random sounds?
     
    ScaraBe likes this.
  17. snackzilla

    snackzilla

    Joined:
    Aug 17, 2014
    Posts:
    91
    I THINK the sounds are for melee weapons only at the moment, but I could be mistaken. You do have a couple options, though You could create a 'vMeleeWeapon', equip it to the zombie, and turn off the mesh, then set up the sounds on your invisible weapon.. I haven't tried that, but in theory it should work.

    The proper way to do it would be to use animation events to play a sound at the start of the attack, and this isn't Invector specific. You can search around on the Unity Forums or in the official documentation for more information on this. If you want, I could PM you a couple scripts that I use for initiating random sounds on attack.
     
  18. ScaraBe

    ScaraBe

    Joined:
    Oct 7, 2015
    Posts:
    43
    Just have an idea that could be nice to implement:
    The ability to add a hitbox collider to the head, to allow hit with head (don't know how to say it in english), or to allow Zombie's bites :rolleyes:
     
  19. drewradley

    drewradley

    Joined:
    Sep 22, 2010
    Posts:
    3,063
    Here's a simple script to do that for you:
    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. [RequireComponent(typeof(AudioSource))]
    4. public class RandomAudio : MonoBehaviour {
    5.     public AudioClip[] _clip;
    6.     AudioSource _source;
    7.     void Start()
    8.     {
    9.         _source = GetComponent<AudioSource>();
    10.     }
    11.     public void PlaySound () {
    12.  
    13.         int rA = Random.Range(0, _clip.Length);
    14.         _source.PlayOneShot(_clip[rA],1);
    15.  
    16.     }
    17. }
    18.  
    Attach this to your zombie animator object (or whatever) and fill in the sounds. Then use animation events to call "PlaySound" exactly when you want it to play.

    p.s. I have not tested the script but I'm confident it will work fine.
     
    snackzilla likes this.
  20. REEFY

    REEFY

    Joined:
    May 9, 2013
    Posts:
    13
    Hello, im messing around with something simple but it doesnt work as intended. I duplicated the stepup collider when your character and the ai can climb up on objects. For some reason when I duplicate it and parent it to my own object other then your green box, the ai doesnt follow my character on top of the newly created box with the step collider I created for it. The character can climb on it but the ai doesnt follow behind. Is there a fix to this-

    Im only using the same process as the green box's but ai doesnt follow on your own created objects for the stepup collider
     
  21. Invector

    Invector

    Joined:
    Jun 23, 2015
    Posts:
    966
    You can add the script vTriggerSoundByState on any animation state, it will also play random sounds :)

    Hmmmmmmm I you think something out :p

    Did you bake the navmesh after the modification?
     
  22. sebsmax

    sebsmax

    Joined:
    Sep 8, 2015
    Posts:
    118
    hello,

    I've been playing with invector since few days, I have issue with melee weapons, with the default bot, it can pickup the weapons on the floor, but with my character... I can't make it work!

    I've tried to copy all the settings of the default bot, but nothing happens!

    Also moving the boxes is a bit strange (even with the default bot)

    And one last thing, is it possible to create an auto jumping between two platform like the auto climb?

    Thank!
     
  23. Invector

    Invector

    Joined:
    Jun 23, 2015
    Posts:
    966
    Make sure to follow this tutorial step by step, creating handlers and checking if you're using the correct layers ;)



    I guess you can create a trigger that make the bool jump of the player be true, in this case I recomend you to use a animation with root motion combine with match target to make the character land on the right spot (take a look at how our actions climb, stepup, jumpover works)
     
    jayimagination likes this.
  24. bluray467

    bluray467

    Joined:
    May 28, 2015
    Posts:
    15
    so i had this idea
    maybe when the shooter template is done have an action game template which includes both the melee template and shooter template?

    also, being able to double wield both a melee weapon and a gun,
    left mouse click would be for the sword , and when right mouse is held down it would go into aiming mode for the gun.
    also, being able to do a short dash by pressing a button would be cool.

    maybe if i pay you more money you could add this?
     
  25. Henzu88

    Henzu88

    Joined:
    Feb 6, 2016
    Posts:
    19
    Hi all!

    I would like to have swimming included to this great asset. :)
    Well I wrote this code for swimming and I would be like if developer would include swimming to this asset in future.

    For this script to work:
    - You need to include "Water" tag to your Water :)
    - You need to add Box Collider to your water where center Y is -[something] e.g. -0.00004, so that your character goes underwater
    - You need to include swim animation to your '3rdPersonController' animator and make transition from 'Any State' to 'Swimming' but not from 'Swimming' to e.g. 'Base Layer'. Otherwise animation will stop. You need to have swimming animation from somewhere.
    - Then you need to add this script in your '3rdPersonController' and add Animator '3rdPersonController(Animator)', Rb, '3rdPersonController(Rigidbody)' and 'Hero' '3rdPersonController(Transform)'
    - Change swimming speed to what you want.
    - I added some photos to clarify.

    I am still working on this and would be glad if someone could advice or help too.
    Some problems:
    - If too steep cliff character can (will) jump in air.

    Code (CSharp):
    1. namespace NameSpaceSwim {
    2.  
    3. using UnityEngine;
    4. using System.Collections;
    5.  
    6. public class Swimming : MonoBehaviour {
    7.         public Animator animator;
    8.         public Rigidbody rigidBody;
    9.         public Transform hero;
    10.         private vThirdPersonInput v_thirdPersonInput;
    11.         public float swimmingSpeed;
    12.         private bool is_swimming;
    13.  
    14.         void Start ()
    15.         {
    16.             animator = GetComponent<Animator>();
    17.             rigidBody = GetComponent<Rigidbody>();
    18.             hero = GetComponent<Transform>();
    19.             v_thirdPersonInput = GetComponent<vThirdPersonInput>();
    20.             is_swimming = false;
    21.         }
    22.         void OnTriggerEnter(Collider other) {
    23.            
    24.             // IF Character is collided to the tag "Water"
    25.             if(other.CompareTag("Water")) {
    26.                
    27.                 // IF character is in Y position 0 or lower start swimming
    28.                 if (transform.position.y <= 0) {  
    29.  
    30.                     // Debug text.
    31.                     Debug.Log ("Enter Water");
    32.  
    33.                     // Set swimming to true
    34.                     is_swimming = true;
    35.  
    36.                     //Disable rigidbody gravity
    37.                     rigidBody.useGravity = false;  
    38.  
    39.                     // Disable controller actions
    40.                     v_thirdPersonInput.actionsController.Attack.use = false;
    41.                     v_thirdPersonInput.actionsController.Crouch.use = false;
    42.                     v_thirdPersonInput.actionsController.Defense.use = false;
    43.                     v_thirdPersonInput.actionsController.DragBox.use = false;
    44.                     v_thirdPersonInput.actionsController.Interact.use = false;
    45.                     v_thirdPersonInput.actionsController.Jump.use = false;
    46.                     v_thirdPersonInput.actionsController.LockOn.use = false;
    47.                     v_thirdPersonInput.actionsController.Roll.use = false;
    48.                     v_thirdPersonInput.actionsController.Sprint.use = false;
    49.                     v_thirdPersonInput.actionsController.Strafe.use = false;
    50.  
    51.                     //Enable swimming animation
    52.                     animator.Play ("Base Layer.Action.Swimming");
    53.                 }
    54.             }
    55.         }
    56.  
    57.         void FixedUpdate() {
    58.            
    59.             // Character is swimming
    60.             if (is_swimming == true) {  
    61.                
    62.                 // Up Key (w)
    63.                 if (Input.GetAxis ("Vertical") > 0) {
    64.                     rigidBody.MovePosition (transform.position + transform.forward * Time.fixedDeltaTime * swimmingSpeed);
    65.                 }
    66.  
    67.                 // Down Key (s)
    68.                 if (Input.GetAxis ("Vertical") < 0) {
    69.                     // Change direction?
    70.                 }
    71.  
    72.                 // Left Key (a)
    73.                 if (Input.GetAxis ("Horizontal") < 0) {
    74.                     hero.Rotate (0, -90 * Time.fixedDeltaTime, 0, Space.Self);
    75.                 }
    76.  
    77.                 // Right Key (d)
    78.                 if (Input.GetAxis ("Horizontal") > 0) {
    79.                     hero.Rotate (0, 90 * Time.fixedDeltaTime, 0, Space.Self);
    80.                 }
    81.  
    82.                 // Release Button
    83.                 if ((Input.GetButtonUp ("Horizontal")) || (Input.GetButtonUp ("Vertical"))) {
    84.                     // What happens when the button is released?
    85.                 }
    86.  
    87.                 // Stop Swimming when character is Y position 0 or more.
    88.                 if (transform.position.y >= 0) {  
    89.                
    90.                     // Debug text
    91.                     Debug.Log ("Exit Water");
    92.  
    93.                     // Set swimming to false
    94.                     is_swimming = false;
    95.  
    96.                     // Play Free Movement animation
    97.                     animator.Play("Base Layer.Grounded.Free Movement");
    98.  
    99.                     // Enable controller actions
    100.                     v_thirdPersonInput.actionsController.Attack.use = true;
    101.                     v_thirdPersonInput.actionsController.Crouch.use = true;
    102.                     v_thirdPersonInput.actionsController.Defense.use = true;
    103.                     v_thirdPersonInput.actionsController.DragBox.use = true;
    104.                     v_thirdPersonInput.actionsController.Interact.use = true;
    105.                     v_thirdPersonInput.actionsController.Jump.use = true;
    106.                     v_thirdPersonInput.actionsController.LockOn.use = true;
    107.                     v_thirdPersonInput.actionsController.Roll.use = true;
    108.                     v_thirdPersonInput.actionsController.Sprint.use = true;
    109.                     v_thirdPersonInput.actionsController.Strafe.use = true;
    110.  
    111.                     // Enable rigidbody gravity back
    112.                     rigidBody.useGravity = true;
    113.                 }
    114.             }
    115.         }
    116. }
    117. }
     

    Attached Files:

    Last edited: Jun 23, 2016
  26. Invector

    Invector

    Joined:
    Jun 23, 2015
    Posts:
    966
    The Shooter Template will have all the Melee Combat features ;)

    I love to see you guys modify the template for your needs and sharing new stuff here, we do have plans to add swimming after the shooter, with new animations include :)
     
  27. Henzu88

    Henzu88

    Joined:
    Feb 6, 2016
    Posts:
    19
    Great! I am looking forward to this :)
     
  28. bluray467

    bluray467

    Joined:
    May 28, 2015
    Posts:
    15
    and the gun/melee double wielding thing?
    is it possible?
     
  29. Invector

    Invector

    Joined:
    Jun 23, 2015
    Posts:
    966
    We design so that the Left button is for defense and the Right attack, I guess you can combine a shield with pistol for example, like the old days of CS 1.5 :rolleyes:, no promisses for the sword/gun at the same time, but let's see how it goes ;)
     
  30. Invector

    Invector

    Joined:
    Jun 23, 2015
    Posts:
    966
    Last edited: Jun 23, 2016
    jcarrick, Malbers, Henzu88 and 8 others like this.
  31. bluray467

    bluray467

    Joined:
    May 28, 2015
    Posts:
    15
    this looks amazing
     
  32. tr1stan

    tr1stan

    Joined:
    Jan 23, 2009
    Posts:
    150
    Hello Invector,

    This 3rd personal template is great! I've tried some control in Asset Store until I found your. I have to say it's the best overall. I would like to see more customization feature. With this template can I add some custom hit effect? e.g When the player's attack hit target, it blows the target to the air or knock it backward.

    And do you have a release schedule or upcoming new feature?
     
  33. sebsmax

    sebsmax

    Joined:
    Sep 8, 2015
    Posts:
    118
    Thanks, I was only following the tutorial in the PDF, didn't help much :)
    Now I need to find out how to draw/undraw a weapon instead of picking-it up on the ground




    I've also implemented Conditions on "triggers", so it's possible to use "Auto Action" on ladder in/out


     
    Last edited: Jun 23, 2016
    Invector likes this.
  34. AlanGameDev

    AlanGameDev

    Joined:
    Jun 30, 2012
    Posts:
    437
    Hello.

    I noticed something very strange when I was using the template. For some reason when Transform is collapsed in the inspector, the combat collisions won't work. Is it supposed to work like that?

    Also, I wanted to make a character 'flee' from combat, but I couldn't find a flee state on the character controller, just idle/patrol/chase, what would be the best way to make the characters flee from combat? Ideally something that doesn't require modification to the invector code.

    Overall the template is very good. A minor thing that could be improved is animations for when the characters are hit.

    Thanks in advance.
     
    jcarrick likes this.
  35. REEFY

    REEFY

    Joined:
    May 9, 2013
    Posts:
    13
    Say if you scale the default size of the enemy, what will make the enemy be able to hit the player character. I'm trying different approaches but nothing works. The enemy is maybe a few feet larger then the default size but the attack range isn't working. Is there a workaround to be exact?
     
  36. duniatorga

    duniatorga

    Joined:
    Mar 11, 2016
    Posts:
    21
    Hello,
    There is to Know, How to Turn off Stamina For All Characters?
     
  37. Invector

    Invector

    Joined:
    Jun 23, 2015
    Posts:
    966
    Thanks :D
    You mean hit effect (particle) or hit animation? anyways you can add both!
    you can trigger specific hit particles according to the attack animation, just type a string on the AttackName field on the Attack Animation State (mecanim) and type the same string at the HitDamage Particle component on the character.
    And to trigger a hit animation, you just need to put a Recoil_ID on the Attack Animation State, and put your hit animation on the HitReaction sub-state machine.

    Cool! - what conditions you add?

    Strange, I just test here and it's working fine... what version of Unity you're using?
    We don't have a flee behaviour, the AI was originally created to be very simple 'chase/attack', I guess we get too excited when developing this :p - but the focus of this template is the Character Controller.

    We ship the package with simple but decent animations, enought to show how things work.
    I will leave the animations for you guys to add your own custom and make some awesome games :D

    Resize character can leave to unexpect bugs, sometimes it works, sometimes cause some issues...
    I recommend you to scale directly on the FBX and not using the Transform, your Prefab will problably be mess up and you will need to setup again the materials and stuff, but it's the correct way to do.

    Open your Actions Input Options, and leave the Stamina field with 0 ;)
     
  38. duniatorga

    duniatorga

    Joined:
    Mar 11, 2016
    Posts:
    21
    Already Trying But Not Functioning Especially Sprint, Jump, Roll, and Attack
    In the mean feature that was not In Total
     
  39. tr1stan

    tr1stan

    Joined:
    Jan 23, 2009
    Posts:
    150
    Hey I mean some custom hit reaction like physics and scripted movement. e.g. When the target is hit I force it move backward an additional distance.
     
  40. AlanGameDev

    AlanGameDev

    Joined:
    Jun 30, 2012
    Posts:
    437
    I'm on 5.3.5f1... however, I just tried to reproduce the problem again and it won't happen. I guess there's something wrong with my setup, or maybe that version of Unity has some intermittent issues... sometimes when I quit it it also shows the bug report window, so let's just leave that for the moment. At very least that's something you can try when people report the melee collision aren't working on the editor (expand the Transform in the inspector).
    OK, fair enough. How would you recommend to implement such 'fleeing' feature?

    Thank you for your reply.
     
  41. sebsmax

    sebsmax

    Joined:
    Sep 8, 2015
    Posts:
    118
    I've adapted my own 'trigger' plugin to your system, the conditions are:
    Trigger based on speed of the player.
    Trigger based on player's direction matching the direction of the trigger (that's why there is an arrow+angle range in the screenshot)
    Timeout after a trigger (can't be triggered for few seconds)
    Detection of certain animations to delay trigger.
     
    Invector likes this.
  42. Invector

    Invector

    Joined:
    Jun 23, 2015
    Posts:
    966
    It's like this:


    And the attacks you have to change on the Hitbox of your weapon, it has the same Stamina Cost variable.

    Hmmm I would probably make the AI go to a random point, with a distance set.
    Or make 'hidespots' using the waypoint system, then make the AI go there if the health is to low, something like that.
     
  43. sebsmax

    sebsmax

    Joined:
    Sep 8, 2015
    Posts:
    118
    Is it possible to have the weapons always equipped, instead of having to pick up the weapons on the floor every time?
     
  44. Invector

    Invector

    Joined:
    Jun 23, 2015
    Posts:
    966
    Hmm you mean like GTA euphoria physics? nahh this is way more advanced behaviour for us humans lol
    But you can add different animations to react for each attack you have as I say earlier, which is also pretty cool :p

    Sure, just drag and drop your weapon prefab on the corresponding handler and hit play
     
  45. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    I was looking at the latest released store assets and I found your new footstep system. You also say that it's already included in your third person controller asset. I knew you already had a footstep system, but last time I looked at it it was tightly coupled with the third person controller. This new asset makes it look like it could be used with other systems as well. However, is that also true of the version included in your third person controller? Could I now take the scripts within your TPC and use them elsewhere?
     
  46. bluray467

    bluray467

    Joined:
    May 28, 2015
    Posts:
    15
    I want to go to the next scene after an enemy (a boss) is defeated.
    how can i do this?
     
  47. Invector

    Invector

    Joined:
    Jun 23, 2015
    Posts:
    966
    Yep :) it's the same system, the only difference is that the Footstep Standalone has the folder Resources (which contains the skins for the editor) and the script vScriptableObjectUtility included, while the 3rd Person Template is located on a separated folder.

    You can create a script that access the currentHealth of a vCharacter, and when reaches 0, load another scene :)
     
    magique likes this.
  48. bluray467

    bluray467

    Joined:
    May 28, 2015
    Posts:
    15
    how much would i have to pay you to make that script for me?
    i dont have any programming knowledge.
     
  49. drewradley

    drewradley

    Joined:
    Sep 22, 2010
    Posts:
    3,063
    Haven't tested it but this should do what you want:
    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using Invector.CharacterController;
    4. using UnityEngine.SceneManagement;
    5.  
    6.  
    7. public class BossFight : MonoBehaviour {
    8.     public vThirdPersonController controller;
    9.     public string SceneName;
    10.     public float waittime = 1;
    11.     // Use this for initialization
    12.     void Start () {
    13.         controller = GetComponent<vThirdPersonController>();
    14.        
    15.     }
    16.    
    17.     // Update is called once per frame
    18.     void Update () {
    19.         if (controller.currentHealth <= 0)
    20.         {
    21.  
    22.         }
    23.     }
    24.     IEnumerator ChangeScene(float waitTime)
    25.     {
    26.         yield return new WaitForSeconds(waittime);
    27.         SceneManager.LoadScene(SceneName);
    28.        // Application.LoadLevel(SceneName);
    29.     }
    30. }
    31.  
    Just attached it to anything with vThirdPersonController and fill in the wait time and scene name.
    If it doesn't work, let me know exactly what happens and I'll try to fix it.

    Now you can send me one million dollars!

    Or not. :)
     
  50. Invector

    Invector

    Joined:
    Jun 23, 2015
    Posts:
    966
    Hey!! You're trying to stole my million bucks!! :p

    To make more generic you can use the vCharacter instead of the Controller, this way you can put the script on the player, enemy or companion

    * also not tested

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using Invector;
    4. using UnityEngine.SceneManagement;
    5.  
    6.  
    7. public class BossFight : MonoBehaviour
    8. {
    9.     public vCharacter iChar;
    10.     public string SceneName;
    11.     public float waittime = 1;
    12.  
    13.     // Use this for initialization
    14.     void Start ()
    15.    {
    16.         iChar = GetComponent<vCharacter>();
    17.     }
    18.  
    19.     // Update is called once per frame
    20.     void Update () {
    21.         if(iChar.currentHealth)
    22.         {
    23.            StartCoroutine(ChangeScene(waittime ))
    24.         }
    25.     }
    26.     IEnumerator ChangeScene(float waitTime)
    27.     {
    28.         yield return new WaitForSeconds(waittime);
    29.         SceneManager.LoadScene(SceneName);
    30.        // Application.LoadLevel(SceneName);
    31.     }
    32. }
     
    jcarrick and drewradley like this.