Search Unity

Realistic FPS Prefab [RELEASED]

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

  1. Bagnol

    Bagnol

    Joined:
    Sep 5, 2013
    Posts:
    169
    @Greg-Bassett I haven't looked into what's involved in switching it to a custom character, but by default RFPSP has a full body awareness setup in the sample character prefab. An animated torso and legs are visible when looking down.
     
  2. javier11om

    javier11om

    Joined:
    Apr 27, 2014
    Posts:
    28
    I'm using this. You just need to animate the arms within unity, then make sure you put the right animations and put that gameobject under weapon mesh. It's actually pretty simple.
     
  3. javier11om

    javier11om

    Joined:
    Apr 27, 2014
    Posts:
    28
    What worked for me was by going to the Weapon Behavior script in the editor then scroll down to "Bobbing and Sway Amounts" and uncheck "Do weapon Roll".
     
    SuperNewbee likes this.
  4. javier11om

    javier11om

    Joined:
    Apr 27, 2014
    Posts:
    28
    Anybody get the moving platforms to work with the updated version?
     
  5. reggie_sgs

    reggie_sgs

    Joined:
    Jun 29, 2014
    Posts:
    276
    The stick wasn't pressed to the side but it was connected. Perhaps the deadzone wasn't set correctly and it was reading a tiny offset. I disconnected it and everything worked. Thanks for the tip.
     
  6. Greg-Bassett

    Greg-Bassett

    Joined:
    Jul 28, 2009
    Posts:
    628
    Oh! Wow! In the demo video it does not show any body or legs, especially noticeable when climbing the ladder and getting off at the top.
     
  7. Bagnol

    Bagnol

    Joined:
    Sep 5, 2013
    Posts:
    169
    @Greg-Bassett It sounds like the video might be an outdated one. The web demo (<- link) for v1.23 is a pretty good way to see for yourself how it works. It will probably require a bit of modification on your end to add proper climb animations for the arms and legs (it seems to just use the standard walking animation as a placeholder), but the foundation full body awareness setup is definitely there.
     
    Last edited: Aug 23, 2016
  8. Greg-Bassett

    Greg-Bassett

    Joined:
    Jul 28, 2009
    Posts:
    628
    OK, great! Just played with the web player demo and it has what I need to get started! Thanks for your help! :)
     
  9. Bagnol

    Bagnol

    Joined:
    Sep 5, 2013
    Posts:
    169
  10. llJIMBOBll

    llJIMBOBll

    Joined:
    Aug 23, 2014
    Posts:
    578
    Hey for player animations look at the VisibleBody,cs script :D
     
    Last edited: Aug 9, 2016
  11. JC_LEON

    JC_LEON

    Joined:
    May 20, 2014
    Posts:
    520
    can you help me with this?? or caN send me prefabs or animations for default weapons with this asset?
     
  12. Dawar

    Dawar

    Joined:
    Dec 7, 2014
    Posts:
    123
    hi what problem you face tell me in detail pm me
     
  13. Dionysos1111

    Dionysos1111

    Joined:
    Feb 14, 2016
    Posts:
    39
    Could anyone explain me how to add healthbars to the zombies? would really help me out.
     
  14. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,706
    1. Create a script named CharacterDamageHealthbar:
    Code (csharp):
    1. using UnityEngine;
    2.  
    3. public class CharacterDamageHealthbar : MonoBehaviour
    4. {
    5.  
    6.     public Canvas canvas;
    7.     public UnityEngine.UI.Slider slider;
    8.  
    9.     private CharacterDamage characterDamage;
    10.  
    11.     void Start()
    12.     {
    13.         if (canvas == null) canvas = GetComponentInChildren<Canvas>();
    14.         if (slider == null) slider = canvas.GetComponentInChildren<UnityEngine.UI.Slider>();
    15.         characterDamage = GetComponent<CharacterDamage>();
    16.         slider.maxValue = characterDamage.hitPoints;
    17.     }
    18.  
    19.     void Update()
    20.     {
    21.         // Update health:
    22.         slider.value = characterDamage.hitPoints;
    23.  
    24.         // Keep canvas facing camera:
    25.         if ((canvas.transform == null) || (UnityEngine.Camera.main == null)) return;
    26.         canvas.transform.LookAt(UnityEngine.Camera.main.transform);
    27.     }
    28. }
    2. Add it to your zombie.

    3. Create a world space canvas as a child GameObject of the zombie. I used these RectTransform parameters:
    • Position: (0, 2.4, 0)
    • Width: 100, Height: 25
    • Scale: (-0.01, 0.01, 1)
    4. Add a Unity UI slider to the canvas. Untick Interactable.

    That's it. The script will find the canvas and slider automatically, although you can assign it manually if you want to.
     
    llJIMBOBll and Dionysos1111 like this.
  15. Dionysos1111

    Dionysos1111

    Joined:
    Feb 14, 2016
    Posts:
    39
    That was quick!! Thanks for the reply i will try it out tomorrow.
     
  16. johny256

    johny256

    Joined:
    Mar 3, 2015
    Posts:
    259
    How do I replace the model of hands ?
     
    Dionysos1111 likes this.
  17. closetgeekshow

    closetgeekshow

    Joined:
    Jun 6, 2014
    Posts:
    125
    Is there a tutorial for changing the player model and arms? I've been struggling with how to pull that off. It's looking like I need a player model with the same legacy animations as the demo model, is that right?
     
  18. Dionysos1111

    Dionysos1111

    Joined:
    Feb 14, 2016
    Posts:
    39
    that worked like a charm, thx for this ^^

    I also got another problem, i have a boss which is kinda large so i needed to increase the attack range of this zombie.
    Now when he attacks me and another zombie is standing between us the zombie get damaged by the boss.

    how can i fix it so that enemies won't hurt eachother?
     
  19. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,706
    Create a script named AISearchMask:

    Code (csharp):
    1. using UnityEngine;
    2.  
    3. public class AISearchMask : MonoBehaviour {
    4.  
    5.     public LayerMask searchMask = ~(~(1 << 10) & ~(1 << 0) & ~(1 << 13) & ~(1 << 11) & ~(1 << 20));
    6.  
    7.     void OnEnable() {
    8.         Invoke("SetSearchMask", 0.1f);
    9.     }
    10.  
    11.     public void SetSearchMask() {
    12.         GetComponent<AI>().searchMask = searchMask;
    13.     }
    14. }
    Add it to your NPC. Open the Search Mask dropdown and de-select NPCs.
     
    Dionysos1111 likes this.
  20. TheChairMaster64

    TheChairMaster64

    Joined:
    Aug 9, 2016
    Posts:
    59
    Idk if anybody still helps on here but I do have question. I would like to ask how does the cinema camera work and how i use it to teleport and make cut scenes. And one more question how does the ActivateTrigger.cs work with animations if you could answer one of these or both it would mean a lot.
     
  21. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,706
    I haven't used the MovePlayerAndCamera script (which is on the FPS Camera GameObject), but if you enable it in the sandbox example scene you can try it out. It looks like it has this functionality:
    • Press Insert to teleport the player to the location specified by Move Pos.
    • Press Delete to release RFPS's control of the camera so you can control it elsewhere. In the sandbox scene, it moves the camera to Cinema Camera Obj.
    • Press End to do both of the above.
    You can also call its methods directly, including:
    • MovePlayer(position)
    • ReleaseMainCamera();
    • ReleaseMainCameraAndMovePlayer();
    • etc.
    It looks like those methods toggle the state back and forth. So before running a cinematic cutscene call ReleaseMainCamera(). After the cutscene call ReleaseMainCamera() again to grant control back to RFPS.
     
    EvilGremlin likes this.
  22. witcher101

    witcher101

    Joined:
    Sep 9, 2015
    Posts:
    516
    How to disable friendly fire in NPCs.
    Currently my soldier NPC can hit me if i get in his line of sight. Anyway to make both of us not hit each other
     
  23. TauseefCVS

    TauseefCVS

    Joined:
    Mar 28, 2016
    Posts:
    15
    I made a script to headshot and bodyshot but its not working i am using realistic fps and its is not detect the proper raycasthit , i am use 2 colliders(Capsule and SphereCollider) to hit that one of it parent and then in child at head to raycast it but head is not detect that
    please help me

    1. public void ApplyDamage (float damage, Vector3 attackDir, Vector3 attackerPos, Transform attacker, bool isPlayer, RaycastHit hit)
      {
      if (hitPoints <= 0.0f) {
      return;
      }


      Debug.LogWarning (GameObject.FindGameObjectWithTag ("Headshot").gameObject.name);

      if (hit.collider.GetType () == typeof(CapsuleCollider)) {

      if (hitPoints - damage > 0.0f) {
      hitPoints -= damage * damage;
      //Debug.Log (hitPoints);
      } else {
      hitPoints = 0.0f;
      }
      } else if (hit.collider.gameObject.name == GameObject.FindGameObjectWithTag ("Headshot").gameObject.name) {
      Debug.LogWarning ("Working with sphare collder");
      if (hitPoints - damage > 0.0f) {
      hitPoints -= damage * damage;
      Debug.Log (hitPoints);
      } else {
      hitPoints = 0.0f;
      }
      Debug.LogWarning (hitPoints);
      }


      attackDir2 = attackDir;
      attackerPos2 = attackerPos;



      if (hitPoints <= 0.0f) {
      Debug.Log ("print die is working");
      SendMessage ("Die");//use SendMessage() to allow other script components on this object to detect NPC death
      }
      }
     
    Last edited: Aug 10, 2016
  24. TheChairMaster64

    TheChairMaster64

    Joined:
    Aug 9, 2016
    Posts:
    59
    Thanks for the help even though i dont quite understand how all this is really done im kinda of a beginner at the whole make a game thing i dont know how to code so the rfps prefab is helping a lot ive been able to figure out and tweak a lot of things and put my own models and stuff and little tricks that use what comes with the prefab (im more a art guy no code) Once again thanks and sorry that i dont understand exactly how to use the cinema cam because im more of a visual or a very specific instructions on how to do it guy. Thanks anyway though glad for the help and i may have questions in the future.
     
  25. Dionysos1111

    Dionysos1111

    Joined:
    Feb 14, 2016
    Posts:
    39

    I have created the script and attached it to the npc and de-select the npc but he is still getting damage.
    Then i realized i use ICECreatureRFPSPAdapter to damage the player.

    Could you edit the script so that it works with the adapter? or maybe an other solution?

    Thx
     
  26. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,706
    If you contact the ICE developer, I bet they can help, since they wrote the adapter.
     
  27. Dionysos1111

    Dionysos1111

    Joined:
    Feb 14, 2016
    Posts:
    39
    Ok i will do that, thx again for the great help :)
     
  28. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,706
    Use the same AISearchMask script I posted above. Add it to your companion NPC and uncheck Player from the Search Mask.

    Did you set the layers? The child's layer must also be NPCs. Also make sure they have LocationDamage components.

    My previous reply was overly complicated. Here's the short version:
    1. At the beginning of your cinematic cutscene, call MovePlayerAndCamera.ReleaseMainCamera().
    2. Play your cinematic cutscene.
    3. At the end of your cinematic cutscene, call MovePlayerAndCamera.ReleaseMainCamera() again.
    For example, say you're using a cutscene editor like SLATE or Cinema Director. Cutscene editors like these let you call script methods, usually by adding a special entry to the timeline and then selecting a GameObject and one of its script methods. At the beginning of the cutscene timeline, call the ReleaseMainCamera() method. And do the same at the end of the cutscene timeline, too.
     
    Last edited: Aug 13, 2016
  29. witcher101

    witcher101

    Joined:
    Sep 9, 2015
    Posts:
    516
    Anyway to applyforce to instantiated ragdoll so that when char dies it blows away from wepaon force instead of just falling down.
     
  30. Mario167100

    Mario167100

    Joined:
    Jul 25, 2016
    Posts:
    49
    I actually did find a fix to this. All I had to do was press play and play around with the scale and position of the weapon. I would copy down the numbers, and then get out of testing the game. I copy and paste the numbers to change the scale and save them. BOOM! I'm done! (P.S remember to put the layer on default)
     
    EvilGremlin likes this.
  31. Mario167100

    Mario167100

    Joined:
    Jul 25, 2016
    Posts:
    49
    Okay, I have another problem. For some reason, every time I add the RFPSP to a project, the UI assets don't work. You see, every time I put down a button (And yes I checked if it was intractable) and try to press it, it doesn't work. And this only happens when I add RFPSP. I tried looking in to the problem and noticed that every time I import the RFPSP, it says it's removing previous assets, could this be the problem? Please if anyone knows how to fix this, please tell me.
     
  32. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,706
    The Horizontal and Vertical input definitions might not be set. Since RFPSP is a complete project asset, it overwrites Unity's default input definitions. RFPSP's input definitions don't include the input definitions that Unity UI expects to use.

    The first thing to do whenever something isn't running properly in Unity is to check the Console window. If it's reporting that there are no input definitions for Horizontal and Vertical, you can follow the instructions here under "Realistic FPS Prefab Setup Part 1" step #2 to add them back in. That page is for the Dialogue System's integration with RFPSP, but you only need to follow step #2 to get Unity UI working with RFPSP.
     
  33. RealAspireGames

    RealAspireGames

    Joined:
    Dec 24, 2013
    Posts:
    265
    Hello
    Just wondering if I am able to change the hand models for the weapons?
     
  34. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,706
    It already applies 2.75 units of force. If you want to apply more, inspect the NPC's CharacterDamage component and increase the Attack Force value.

    Yes, but you also have to update the corresponding animations. The instructions are on page 18 of the manual. Sorry, I don't have much experience myself with changing the models.
     
    RealAspireGames likes this.
  35. Mario167100

    Mario167100

    Joined:
    Jul 25, 2016
    Posts:
    49
    YOU ARE A GOD!!! THANK YOU SO MUCH! With all that has been happening in my life in past 2 weeks, this made me legit happy! Thank you!
     
  36. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,706
    Glad I could help! :)
     
  37. EvilGremlin

    EvilGremlin

    Joined:
    Aug 12, 2016
    Posts:
    231
    How long did that take? And didn't somebody say this is a new issue? Hope there will be a fix for this soon.
     
  38. witcher101

    witcher101

    Joined:
    Sep 9, 2015
    Posts:
    516
    Thanks
    I thought force here was otherway around, applied by zombie to us.
    Anyway to make zombie hit you when you are on top of something. Currently they just stand there eventhough they can attack my leg. I tried changing attack eye height but didnt work.
     
  39. EvilGremlin

    EvilGremlin

    Joined:
    Aug 12, 2016
    Posts:
    231
    I can almost guarantee you that is from the pathfinding AI. I mean, without seeing it I don't really know. But that is what it sounds like to me. Having a rigid body controller means the player can hop up on objects but the NPCs still need a navmesh if you aren't using something like Apex Path.
     
  40. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,706
    It might also be an issue with the layers. RFPS requires very specific layer settings. When something's not working, it's often helpful to open RFPS's sandbox demo scene and compare it to your scene.
     
  41. EvilGremlin

    EvilGremlin

    Joined:
    Aug 12, 2016
    Posts:
    231
    Is there a script for guided missiles in RFPSP? I didn't see it in the documentation. I haven't actually purchased it yet, I am still investigating my options. So I can't open it up and play with it to find out. If not, I am sure I can come up with one but I am just curious.
     
  42. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,706
    No, you'll have to script your own.
     
    EvilGremlin likes this.
  43. EvilGremlin

    EvilGremlin

    Joined:
    Aug 12, 2016
    Posts:
    231
    That's fine. Thanks for the reply.
     
  44. unity3d-studio021

    unity3d-studio021

    Joined:
    Dec 22, 2015
    Posts:
    8
    RFPS breaks fungus
    If I merge RFSpreab fungus stops
    and in play mode i get error
    ArgumentException: Input Axis Horizontal is not setup.
    To change the input settings use: Edit -> Project Settings -> Input
    UnityEngine.EventSystems.StandaloneInputModule.ShouldActivateModule () (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/EventSys tem/InputModules/StandaloneInputModule.cs:139)
    UnityEngine.EventSystems.EventSystem.Update () (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/EventSys tem/EventSystem.cs:250)

    or in some case fungus works but other things dont , like 3dscene loads but controls are broken

    HOw to get tihis thing working

    Like
     
  45. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,706
    This post has instructions for adding the missing input definitions.
     
  46. SuperNewbee

    SuperNewbee

    Joined:
    Jun 2, 2012
    Posts:
    196
    Yes. I decided to uncheck every checkmark on each script one at a time and as soon as I got to "Do weapon Roll" and unchecked it started to work properly.

    I nearly went bonkers.
     
    llJIMBOBll likes this.
  47. unity-werkstatt

    unity-werkstatt

    Joined:
    Oct 7, 2015
    Posts:
    10
    I just bought this
    Is there a way to setup npc to shoot while running
    this way they look very slow slow.
     
  48. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    Does this asset have a melee attack while having other weapons equipped. Examples include Halo 5 and Destiny where you press RB and the character slams the enemy with a right forearm or punch of some sort.
     
  49. EvilGremlin

    EvilGremlin

    Joined:
    Aug 12, 2016
    Posts:
    231
    I would recommend switching out the NPC AI and animations entirely. It is adequate for a zombie AI but not much use beyond that.

    Yes it does and it can be changed depending on the weapon too. So you can hit somebody with the butt of your rifle or use a knife if you have a pistol equipped. It is really easy to set up.
     
  50. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    Fantastic. I will definitely be giving this a try when the budget allows. I have both UFPS and ASK and while both are quite good in many ways, this looks to be even better.