Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Realistic FPS Prefab [RELEASED]

Discussion in 'Assets and Asset Store' started by Deleted User, Apr 5, 2013.

  1. Defcon44

    Defcon44

    Joined:
    Aug 19, 2013
    Posts:
    400
    Good idea thanks !

    i go test this tomorrow :)
     
  2. DownFall

    DownFall

    Joined:
    Oct 12, 2014
    Posts:
    36
    Thanks Il check it out and for the RFPS Hud is there is video tut by and chance because I can't really code :/
     
  3. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,678
    I don't know of any video tutorial, but it's only a few lines of code. Make a backup and give it a try. :)
     
  4. DownFall

    DownFall

    Joined:
    Oct 12, 2014
    Posts:
    36
    I get an error when I paste it :/ can you send the code edited. I Don't know what is happened :p
     
  5. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,678
    Unless someone else can beat me to it, I'll try to PM it to you tomorrow.
     
  6. canaljuegos32

    canaljuegos32

    Joined:
    Jun 29, 2015
    Posts:
    56
    You tried player height mod in FPSRigidBodyWalker?
     
  7. DownFall

    DownFall

    Joined:
    Oct 12, 2014
    Posts:
    36
    thanks
     
  8. J0linar

    J0linar

    Joined:
    Dec 12, 2013
    Posts:
    68
    @Azuline Studios
    i would like to know when the next version will come out?
    And yes i
    just tested the Developement version and i like it actually pretty much and as you mentioned arrows/bows in aprevious post, how are the chances for us to see these things in the upcoming version?
    Havent bought your asset yet, as am a bit undecided, especially since the Melee part has no projectiles yet (arrows/bows)..
     
  9. Takahama

    Takahama

    Joined:
    Feb 18, 2014
    Posts:
    166
    @Azuline Studios
    Please make enemies or friendly soldiers can hear each other's attacks and footsteps :p
    like; if an enemy soldier shoots a zombie, friendly soldiers investigate to source of sound.
    Hmm looks like an instant waypoint at sound's location :p
     
  10. mentolatux

    mentolatux

    Joined:
    Nov 2, 2014
    Posts:
    236
    Patico, Deleted User and TonyLi like this.
  11. NinjaMaster

    NinjaMaster

    Joined:
    May 16, 2015
    Posts:
    7
    I bought this asset a few days ago and when I added the AI to a new scene, they could move and shoot through walls. Anyone know how I can fix this?
     
  12. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,678
    I think your walls need to be on the World Collision layer (User Layer 10).
     
  13. NinjaMaster

    NinjaMaster

    Joined:
    May 16, 2015
    Posts:
    7
    I tried this and the AI still can walk through them.
     
  14. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,678
    Do your walls and NPCs have colliders?
     
  15. Takahama

    Takahama

    Joined:
    Feb 18, 2014
    Posts:
    166
    mentolatux likes this.
  16. DownFall

    DownFall

    Joined:
    Oct 12, 2014
    Posts:
    36
    If anyone has any idea of adding multiplayer please just let me know I want to release my game with MP
     
  17. unicat

    unicat

    Joined:
    Apr 8, 2012
    Posts:
    416
    Why does my Player only get damage from the npc in the 1 camera Setup? In the 2 camera setup there is no damage. Using Unity 5.2.2p2.
     
  18. Baraff

    Baraff

    Joined:
    Aug 16, 2014
    Posts:
    251
    I am having a problem with sound playback. The audio seems to be clipped a lot and sounds quite bad. In my real scene I have much action and consequently a lot of sounds being fired off.

    The problem also happens when you run the sandbox test scene and you set of the mines so that more that one tries to explode and hence play the explosion sounds.

    Anyone have any ideas on this?
    Does anyone else notice the distortions and clipping I am referring to?
     
  19. NinjaMaster

    NinjaMaster

    Joined:
    May 16, 2015
    Posts:
    7
    Yes, both the walls and NPC's have colliders.
     
  20. Defcon44

    Defcon44

    Joined:
    Aug 19, 2013
    Posts:
    400
    Thanks Tony for you'r help, i have change the scale of my prefab (this is the problem) all works good now :)

    i have a little question about navmesh & AI, what is the best plugin i can use for a dungeon generator with RFPS ?

    Thanks
     
  21. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,678
    I've never used any of the random dungeon generators with RFPS, but I've used DunGen by itself and it seems to work pretty well.
     
  22. mentolatux

    mentolatux

    Joined:
    Nov 2, 2014
    Posts:
    236
    IS WORKING WITH FPS KIT 2.0 + RFPS . IM WORKING NOW WITHOOUT ERROR
     
  23. mentolatux

    mentolatux

    Joined:
    Nov 2, 2014
    Posts:
    236
    thx man i search to make this mabye you make a video to show me is very important for me
     
  24. mentolatux

    mentolatux

    Joined:
    Nov 2, 2014
    Posts:
    236
    my friend ninja all object and terrain on map Window/Navigation and make bake
     
  25. NumPaD

    NumPaD

    Joined:
    May 23, 2015
    Posts:
    1
    Does someone know how to setup 2 cameras for the player in RFPS? I can do that to avoid the shadows bugs in any system, but the it crack the gameplay in RFPS.
     
  26. unicat

    unicat

    Joined:
    Apr 8, 2012
    Posts:
    416
    My f-key isn`t working anymore. I can`t pickup weapons , not in the demo scene and not in the webplayer.
    What could this be?
     
  27. Deppex

    Deppex

    Joined:
    May 31, 2015
    Posts:
    21
    Hi
    Is it possible to change screen resolution from Windows 10 app.
    I have tried many codes but I can not change.
    I get errors or not working.
     
  28. Takahama

    Takahama

    Joined:
    Feb 18, 2014
    Posts:
    166
    Here you go m8!

    Tutorial for inverted stuff.png

    Must be something went wrong.. Re-import package, only include imput settings.
     
    mentolatux likes this.
  29. unicat

    unicat

    Joined:
    Apr 8, 2012
    Posts:
    416
    Found it, all weapon slots where full in the 2 camera rig. After freeing some i can pickup a weapon now. Thank you Takahama.
     
  30. mentolatux

    mentolatux

    Joined:
    Nov 2, 2014
    Posts:
    236
    Hello all, i need help, how to setup friend soldiers to follow me in game
     
    Last edited: Nov 9, 2015
  31. mentolatux

    mentolatux

    Joined:
    Nov 2, 2014
    Posts:
    236
    maybe you lose Tag
     
  32. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,678
    RFPS 1.22 has a 2-camera prefab. Can you use that?

    If you're using RFPS 1.22, see the example friendly AIs. The AI script has a number that indicates whether it's a friend, an enemy type A (e.g., aliens), or enemy type B (e.g., zombies).
     
  33. Takahama

    Takahama

    Joined:
    Feb 18, 2014
    Posts:
    166
    i think he mean "i want friendly soldiers follow me"
     
  34. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,678
    I think you're right. I read that wrong. In that case, @mentolatux - I don't think RFPS has anything built-in to do this. You could write a script that uses NavMeshAgent to keep the NPC near the player. Or you could use Behavior Designer to make a behavior tree to do it. Behavior Designer has RFPS integration.
     
  35. mentolatux

    mentolatux

    Joined:
    Nov 2, 2014
    Posts:
    236
    thx for answer but im not a coder to make this, but is much cooler if we have that script , friendly soldier follow the player , also i have problem on player, not going up , here is the video ,
     
  36. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,678
    The stairs look too steep. Can you make them less steep? Or make them climbable like the ladder in the sandbox example scene.
     
  37. Takahama

    Takahama

    Joined:
    Feb 18, 2014
    Posts:
    166
    just put a invisible cube model that fit to ladders. Then incrase slope limit in FPS Rigid Body Walker.

    EDIT: i tryed to make follow thing without any scripts.
    i just put a waypotint on FPS legs and set that WP to friendly units. They follow but their walk animation never stops :D And they keep going behind me when i turn FPS camera in game :D
     
  38. Takahama

    Takahama

    Joined:
    Feb 18, 2014
    Posts:
    166
    @Azuline Studios @TonyLi
    Anyone have any idea about NPC hear range ?
    i set Listen range on any npc up to 999 and they didnt do anything (Weapon is not silent)
     
  39. mentolatux

    mentolatux

    Joined:
    Nov 2, 2014
    Posts:
    236
    great idea with waypoint , i will try and put video here if is working and with my problem SLOOP LIMIT i have 40 and now i have 90 and working good , thx friends, now im woorking to make 3 soldiers follow player and put video here verry soon, thx again
     
    Takahama likes this.
  40. mentolatux

    mentolatux

    Joined:
    Nov 2, 2014
    Posts:
    236
    sadly not working to soldier frienddly to follow player, we need script for that because rfps not have
     
  41. Takahama

    Takahama

    Joined:
    Feb 18, 2014
    Posts:
    166
    @Azuline Studios IMPORTANT!
    Drunken Lizard Games find a solution for ALL OF US!
    This free package shows how to prevent wall clip in fps view and supports shadows!
    So we can make 2 Camera Player versions with shadow support!

    https://www.assetstore.unity3d.com/en/#!/content/46548

    DLG Says:
    First Person View is an asset that allows you to have a First Person Perspective where first person objects do not clip through the environment, have a separate field of view from the environment and can receive shadows from the environment.

    Every script is well documented and well structured for you to be able to understand how everything works and be able to modify and improve it for your specific needs.
     
    Last edited: Nov 12, 2015
  42. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,678
    Here's a follow script (Follow.cs) that builds on @Takahama's idea. Add it to a friendly NPC (faction=1). Then assign the Target field (e.g., to FPSPlayer). You can tweak how frequently it checks distance from the player and how far away from the player it should stop.
    Code (csharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. /// <summary>
    5. /// Simple follow script for friendly RFPS AIs.
    6. /// Add it to your NPC and set the Target (e.g., FPSPlayer).
    7. /// (Tony Li - Pixel Crushers - 2015-11-13)
    8. /// </summary>
    9. public class Follow : MonoBehaviour {
    10.  
    11.     [Tooltip("Follow this target")]
    12.     public Transform target;
    13.  
    14.     [Tooltip("Stop this far away from the target")]
    15.     public float goalDistance = 3;
    16.  
    17.     [Tooltip("Move to the target if farther than this")]
    18.     public float followDistance = 5;
    19.  
    20.     [Tooltip("Check distance from the target at this frequency (seconds)")]
    21.     public float checkFrequency = 5;
    22.  
    23.     [Tooltip("Log debug info to console")]
    24.     public bool debug = false;
    25.  
    26.     IEnumerator Start() {
    27.         if (target == null) {
    28.             Debug.LogWarning("Target is unassigned. Not following.", this);
    29.             yield break;
    30.         }
    31.         var ai = GetComponent<AI>();
    32.         var waypointGroup = target.GetComponentInChildren<WaypointGroup>();
    33.         if (waypointGroup == null) {
    34.             var waypointGroupTransform = CreateChild(target, "WaypointGroup");
    35.             waypointGroup = waypointGroupTransform.gameObject.AddComponent<WaypointGroup>();
    36.         }
    37.         foreach (Transform child in waypointGroup.transform) {
    38.             Destroy(child.gameObject);
    39.         }
    40.         var waypoint = CreateChild(waypointGroup.transform, "Waypoint");
    41.         ai.waypointGroup = waypointGroup;
    42.         while (true) {
    43.             yield return new WaitForSeconds(checkFrequency);
    44.             var distance = Vector3.Distance(transform.position, target.position);
    45.             if (distance > followDistance) {
    46.                 var attackFinished = (bool) ai.GetType().GetField("attackFinished",
    47.                     System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance).GetValue(ai);
    48.                 if (!attackFinished) {
    49.                     if (debug) Debug.Log(name + " is too far from " + target.name + " but in combat. Not following.", this);
    50.                 } else {
    51.                     if (debug) Debug.Log(name + " is too from from " + target.name + ". Moving closer.", this);
    52.                     var ray = (transform.position - target.position).normalized;
    53.                     waypoint.position = target.position + goalDistance * ray;
    54.                     ai.StopAllCoroutines();
    55.                     ai.StartCoroutine(ai.SpawnNPC());
    56.                 }
    57.             }
    58.         }
    59.     }
    60.  
    61.     private Transform CreateChild(Transform parent, string childName) {
    62.         var child = new GameObject(childName).transform;
    63.         child.SetParent(parent, false);
    64.         child.localPosition = Vector3.zero;
    65.         child.localRotation = Quaternion.identity;
    66.         return child;
    67.     }
    68. }
     
    Last edited: Nov 14, 2015
    NeuroToxin-Studios and Defcon44 like this.
  43. Takahama

    Takahama

    Joined:
    Feb 18, 2014
    Posts:
    166
    Awesome! But script and AI crashes after attacking an enemy while i run away :p
     
  44. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,678
    Okay, I updated the script above. You can also tick a Debug checkbox to get info as it runs.

    I put the Follow script on a RobotNPC and had fun running around shooting bad guys with my new robot friend. :)
     
  45. mentolatux

    mentolatux

    Joined:
    Nov 2, 2014
    Posts:
    236
    thank you
    TonyLi is working like i want hehe,
     
  46. NinjaMaster

    NinjaMaster

    Joined:
    May 16, 2015
    Posts:
    7
    Thanks, this worked!
     
  47. SteveRyu

    SteveRyu

    Joined:
    Apr 9, 2014
    Posts:
    121
    Hi guys,
    Anyone have any idea about adding parkour system using acParkour?
    I'm not really good at coding but I'm trying my best to integrate it :p
    I want to add parkour system and jetpack(like BO3) on RFPS
     
  48. appvillas

    appvillas

    Joined:
    Aug 21, 2015
    Posts:
    12
    i Cant Fire While Playing Demo Scene?? I mean When I Click On Mouse Button Nothing Happened.
     
  49. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,678
    acParkour has a lot of code designed specifically for UFPS. You may find more success by teaming up with a programmer, getting design inspiration from acParkour, and writing a similar system from scratch for RFPS.

    Are there any errors in the Console view? Maybe an input is not defined (Edit > Project Settings > Input), or "Fire1" is not mapped to "mouse button 0".

    If you're playing inside the Unity editor, are you perhaps clicking outside the Game view?
     
  50. appvillas

    appvillas

    Joined:
    Aug 21, 2015
    Posts:
    12
    thnks for the reply that was solved but when i shot fire on enemy nothing happened to enemy and log show this error


    NullReferenceException: GetRef
    WeaponBehavior+<FireOneShot>c__IteratorF.MoveNext () (at Assets/!RFPSP/Scripts/Weapons/WeaponBehavior.cs:974)
    UnityEngine.MonoBehaviour:StartCoroutine(String)
    WeaponBehavior:Fire() (at Assets/!RFPSP/Scripts/Weapons/WeaponBehavior.cs:939)
    WeaponBehavior:Update() (at Assets/!RFPSP/Scripts/Weapons/WeaponBehavior.cs:763)
     
unityunity