Search Unity

Realistic FPS Prefab [RELEASED]

Discussion in 'Assets and Asset Store' started by Azuline-Studios, Apr 5, 2013.

  1. JACKO4590

    JACKO4590

    Joined:
    Nov 25, 2014
    Posts:
    76
    @Azuline-Studios any updates on the update? Any eta on release ??

    Thanks
     
  2. DecayGame

    DecayGame

    Joined:
    May 15, 2016
    Posts:
    86
    Hey!
    Is there a way to bring the player to a new scene ( for example : A death scene) when the player dies?
     
  3. Capitan-beanfrog

    Capitan-beanfrog

    Joined:
    Nov 21, 2016
    Posts:
    1
    looking to develop an enemy AI, restricting them to zones, determining the number I have to kill of before moving on. However I don't see much about the AI in your description, would this Kit give me what I am looking for or should I look for something else.
     
  4. JACKO4590

    JACKO4590

    Joined:
    Nov 25, 2014
    Posts:
    76
    You will have to work with it a lot to get what you want. If you are interested in quests and dialogue in your game go look at TonyLi's asset dialogue system. It integrates with this assets perfectly.
    That will help you set up how meny to kill and when to move on.

    If you want a better AI then maybe tactical shooting AI or behaviour designer if you want more of a advance AI but you need to know how to do AI trees.
     
    Last edited: Jan 9, 2017
  5. DecayGame

    DecayGame

    Joined:
    May 15, 2016
    Posts:
    86
    hey man any thought on my problem, or no?
     
  6. JACKO4590

    JACKO4590

    Joined:
    Nov 25, 2014
    Posts:
    76
    Unfortunately not. But I was keeping an eye on your post in case someone did. I would be interested in that sort of setup.

    You could take out where it restarts the level and it only brings up a panel with points, kills ect. Like minecraft.
     
  7. DecayGame

    DecayGame

    Joined:
    May 15, 2016
    Posts:
    86
    Okay Thanks :)
     
  8. Dawar

    Dawar

    Joined:
    Dec 7, 2014
    Posts:
    119
    how I will Setup Rpg and pistol with Shield for player ?
     
  9. Hormic

    Hormic

    Joined:
    Aug 12, 2014
    Posts:
    248
    I have a few questions on picking up custom items or activating custom switches.

    - How can i activate the usual RFPS - Handcursor on custom items or on activate switches?

    - How can i properly check for the use key in the code? (this is propably more a unity noob question)
    I now got it to work with
    Code (CSharp):
    1. if(Input.GetKeyDown("f"))
    which is not a good solution but it works fine, when i try it this way:
    Code (CSharp):
    1. Input.GetButton("Use"))
    it behaves strange cause it is triggered not once but endless during press

    and a last question regarding the water:
    - what is the difference between ocean and sea?
     
  10. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    9,514
    Set it up like a pickup. This way you can use RFPS's interaction system, and you don't have to check input yourself. Set the object's Tag to Usable, and set the Layer to Ragdoll/Pickups. Then add a script that has a PickUpItem() method. If you have the Dialogue System, look at the DialogueSystemOnPickUpItem script or LuaOnPickUpItem script for examples. LuaOnPickUpItem is deprecated in favor of DialogueSystemOnPickUpItem, but LuaOnPickUpItem is simpler, so it might be easier to read for an example.
     
    Hormic and A0101A like this.
  11. A0101A

    A0101A

    Joined:
    Aug 9, 2013
    Posts:
    180
    Few things to always keep in mind are : Input.GetButton checks EVERY frame for presses,

    and if you hold that button longer - it will register your every press as multiple, as long as held.
    While Input.GetButtonDown checks only for one (current) frame button press, and registers only
    one button press, after which you may continue keeping the button, but nothing will happen.
    Are you using the right one, from these 2 methods ?
    As for the water: RFPS ocean only has the extra Infinite Plane Mesh, suitable more for presenting larger volumes of water,
    eg. large lakes, or sea scenes. That being only major difference i've spotted :)

    And,,, (good you don't use keycode.dot method anymore, it's never good idea, it limits your input options only to keyboard,
    so i'd always recommend to everyone to always use Input.Get.button, or input.GetAxis methods, taking advantage of Unity's
    Input Manager entries, that can be limitless buttons / axes you want, and limitless entries, for the same names :)
     
    Last edited: Jan 9, 2017
    Hormic likes this.
  12. Hormic

    Hormic

    Joined:
    Aug 12, 2014
    Posts:
    248
    yes perfect, thank you two all is working now and all questions solved!! (for now ;))
     
  13. ApexofReality

    ApexofReality

    Joined:
    Feb 14, 2016
    Posts:
    102
    I hate how the ai shoots using 3 round bursts can you change it into full auto and it would be great if they actually aim down if youre crouched
     
    A0101A likes this.
  14. emperor12321

    emperor12321

    Joined:
    Jun 21, 2015
    Posts:
    50
    I'm trying to get a thermal scope working to see enemies through walls. Anyone able to achieve this? Maybe by changing the material for all objects tagged NPC?
     
  15. Hormic

    Hormic

    Joined:
    Aug 12, 2014
    Posts:
    248
    emperor12321 likes this.
  16. Locky

    Locky

    Joined:
    May 14, 2015
    Posts:
    86
    Update 1.24 came out today, but I noticed there are no version notes for it in the documentation. Are the changes being communicated elsewhere?
     
  17. JACKO4590

    JACKO4590

    Joined:
    Nov 25, 2014
    Posts:
    76
    Are you sure? Sorry I'm not at home to dig around but normally Azuline will post a few days before the asset store updates it.

    Edit yep they have updated the asset store. Normally they let us know. Not sure if they are just getting ready for the update.
     
    Last edited: Jan 10, 2017
  18. Locky

    Locky

    Joined:
    May 14, 2015
    Posts:
    86
    I could be dreaming, but if I am, I just downloaded version 1.24!! :)
     
  19. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    9,514
    You can click on the version number on the Asset Store page and usually get version notes. Looks like 1.24 just updates AI.cs for Unity 5.5:
     
    Locky likes this.
  20. JACKO4590

    JACKO4590

    Joined:
    Nov 25, 2014
    Posts:
    76
    Ahh so it was a hot fix update. Didn't think they would change it to V1.24 for that. I got my hopes up haha
     
  21. DecayGame

    DecayGame

    Joined:
    May 15, 2016
    Posts:
    86
    Hey quick question about the zombie. I have my own but It attacks then it goes to idle animations for like 3 whole seconds. any idea how to make the fire rate quicker?
     
  22. VoltzStudios

    VoltzStudios

    Joined:
    May 29, 2015
    Posts:
    17
    Did anyone get the asset working with any inventory besides S-Inventory?
     
  23. emperor12321

    emperor12321

    Joined:
    Jun 21, 2015
    Posts:
    50
    I've gotten parts of it working with ultimate inventory. Can't equip guns bullets directly from inventory, but can pick up, store resources etc.
     
  24. TheChairMaster64

    TheChairMaster64

    Joined:
    Aug 9, 2016
    Posts:
    37
    So i try updating to the current version of unity and my project turned to trash i couldn't even see the scene and nothing was working. i went back to 5.3.4 and got it to work. I would like to know what is the most current version of unity that RFPS will work on because i am trying to get a asset that will be the multiplayer part for the game and it requires unity 5.4.0. Thank you to anyone that can help.
     
  25. JACKO4590

    JACKO4590

    Joined:
    Nov 25, 2014
    Posts:
    76
    I'm using unity 5.5.0f3 with rfps v1.24 and all seems to be working.

    Not sure what will cause that. Have you tried all rfps example scenes?
     
  26. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    9,514
    @TheChairMaster64 - Did you update to RFPS 1.24? Azuline recently pushed out this update to support Unity 5.5.0.

    @JACKO4590 - I'm putting together an example scene for you now. To keep your dead NPCs in the scene, did you simply untick Remove Body, or does your NPC have only one collider and you assigned a prefab to Dead Replacement?
     
  27. JACKO4590

    JACKO4590

    Joined:
    Nov 25, 2014
    Posts:
    76
    @TonyLi na it's got multiple colliders. I haven't edited much of the prefab from default much.
     
  28. Weblox

    Weblox

    Joined:
    Apr 11, 2016
    Posts:
    256
    @TonyLi , I have a question for the NPCs too : Is it possible to use the newer ragdoll setup on NPCs to achieve the headshot option , while still using DeadReplacement to trigger a specified deadAnimation ? I didnt find a way to mix the setup. Thanx a lot.
     
  29. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    9,514
    It would require customizing CharacterDamage.cs. The way it's currently written, if the NPC has multiple colliders (used for headshots), it will switch the NPC to ragdoll mode. Otherwise it will remove the NPC and instantiate the deadReplacement prefab in its place. It never does both.
     
    Weblox likes this.
  30. Weblox

    Weblox

    Joined:
    Apr 11, 2016
    Posts:
    256
    @TonyLi Thnx for clearing. Hopefully we will get the option to mix both modes in the future. Working with deadReplacement and a deadAnimation is great but I always wanted the Headshot Option. Now we got headshots but the ragdoll mode really seems a bit clunky to me.
     
    Last edited: Jan 13, 2017
  31. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    9,514
    In the meantime, if you make the simple change to CharacterDamage.cs in this post, it will add an OnDie() event. You can hook up all kinds of things in that event without having to customize any other parts of the script.
     
    Weblox likes this.
  32. Weblox

    Weblox

    Joined:
    Apr 11, 2016
    Posts:
    256
    @TonyLi Thnx again. This is looking great. The Invector Template has similar Components in their setup if I'm not wrong. I will have to take a closer look into this. I suppose I will not need the RFPS Support package in this case and that I can skip the steps dealing with Persistance ?
     
  33. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    9,514
    That's correct. The changes to CharacterDamage.cs are self-contained; you don't need anything else.
     
    Weblox likes this.
  34. Weblox

    Weblox

    Joined:
    Apr 11, 2016
    Posts:
    256
    Awesome! I will try that out and see what I can achieve in my next build. Thnx for pointing this out and keep up the good work! o_O
     
  35. A0101A

    A0101A

    Joined:
    Aug 9, 2013
    Posts:
    180
    Again, will Azuline care enough to answer us here, please :
    -how soon we will have a patch, so RFPS stock Soldiers can point rifles up / down first, before starting shooting on FPS Player standing higher / lower than them ?
    At the moment, this problem is staffing my further development, as it looks very un-realistic when they shoot, right now, in this dumb "horizontal-only" way, while
    their bullets are going up or down from rifles... You guys ever heard of "AI Aim IK" ?
     
  36. Locky

    Locky

    Joined:
    May 14, 2015
    Posts:
    86
    I have a question regarding the Input Manager and the InputControl script that is part of RFPS. I noticed the Horizontal or Vertical Inputs are removed in this asset, which are used in other assets for driving and so on. I have added these back into the Input Manager, but it somehow causes the car to move forward when the back key is pressed, and the reverse when the forward key is pressed. I have searched for a generic answer and found nothing useful to solve this issue. On the surface the Input Manager seems very simple, but there is something about it that is mysterious and clearly others have an understanding of. I was hoping someone could help me to understand what I am missing? We can take the discussion off the forum if you wish. Or perhaps just point me to something that describes the Input Manager at more than a basic level. Thanks.
     
  37. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    9,514
    Did you perhaps set up the negative and positive buttons backward? You can find an example of how they should be set up here:

     
  38. Locky

    Locky

    Joined:
    May 14, 2015
    Posts:
    86
    Any chance of making RFPS compatible with Realistic Car Controller?
     
  39. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,444
    Follow up to my original post with my Rewired integration in case anyone else is interested.

    Unity 5.5.0f3 (64-bit) Windows
    Rewired 1.0.0.110
    Realistic FPS Prefab 1.24

    Changes were only made to the file: Assets\RFPSP\Scripts\Player\InputControl.cs

    ===================

    My line number references are from the original InputControl.cs file.

    On line #5 added

    Code (CSharp):
    1. using Rewired;
    On line #9 added

    Code (CSharp):
    1. // rewired specific additions
    2.     public int RewiredPlayerId = 0; // The Rewired player id of this character
    3.     private Rewired.Player Rewiredplayer; // The Rewired Player
    One line #157 added the following

    Code (CSharp):
    1.  void Awake()
    2.     {
    3.         Rewiredplayer = ReInput.players.GetPlayer(RewiredPlayerId);
    4.     }
    On lines 167 to 325 replaced all Unity input functions with Rewired versions.

    Basically change Input.GetButton to Rewiredplayer.GetButton and Input.GetAxis to Rewiredplayer.GetAxis and so on.

    Code (CSharp):
    1.  
    2.   leftHold = Rewiredplayer.GetButton("Left");
    3.   rightHold = Rewiredplayer.GetButton("Right");
    4.   forwardHold = Rewiredplayer.GetButton("Forward");
    5.   backHold = Rewiredplayer.GetButton("Back");
    6.  
    7.   moveInput = new Vector2(Rewiredplayer.GetAxis("Joystick Move X"), Rewiredplayer.GetAxis("Joystick Move Y"));
    8.   lookInput = new Vector2(Rewiredplayer.GetAxis("Joystick Look X"), Rewiredplayer.GetAxis("Joystick Look Y"));
    9.   lookX = Rewiredplayer.GetAxisRaw("Mouse X") + AccelerateInput(lookInput.x);
    10.   lookY = Rewiredplayer.GetAxisRaw("Mouse Y") + AccelerateInput(lookInput.y);
    11.  
    12.   if (Rewiredplayer.GetAxisRaw("Xbox R Trigger") > 0.1f || Rewiredplayer.GetButton("Fire"))
    13.  
    14.   if (Rewiredplayer.GetAxisRaw("Xbox L Trigger") > 0.1f || Rewiredplayer.GetButton("Zoom"))
    15.  
    16.   if (Rewiredplayer.GetAxis("Xbox Dpad X") > 0.0f){
    17.  
    18.        }else if (Rewiredplayer.GetAxis("Xbox Dpad X") < 0.0f){
    19.  
    20.   if(Rewiredplayer.GetAxis("Xbox Dpad Y") > 0.0f){
    21.  
    22.   if(Rewiredplayer.GetAxis("Xbox Dpad Y") < 0.0f){
    23.  
    24.   mouseWheel = Rewiredplayer.GetAxis("Mouse Scroll Wheel");
    25.   firePress = Rewiredplayer.GetButtonDown("Fire");
    26.   zoomPress = Rewiredplayer.GetButtonDown("Zoom");
    27.   reloadPress = Rewiredplayer.GetButtonDown("Reload");
    28.   fireModePress = Rewiredplayer.GetButtonDown("Fire Mode");
    29.        jumpHold = Rewiredplayer.GetButton("Jump");
    30.   jumpPress = Rewiredplayer.GetButtonDown("Jump");
    31.   crouchHold = Rewiredplayer.GetButton("Crouch");
    32.   proneHold = Rewiredplayer.GetButton("Prone");
    33.   sprintHold = Rewiredplayer.GetButton("Sprint");
    34.   leanLeftHold = Rewiredplayer.GetButton("Lean Left");
    35.   leanRightHold = Rewiredplayer.GetButton("Lean Right");
    36.   useHold = Rewiredplayer.GetButton("Use");
    37.   usePress = Rewiredplayer.GetButtonDown("Use");
    38.   usePressUp = Rewiredplayer.GetButtonUp("Use");
    39.  
    40.   toggleCameraHold = Rewiredplayer.GetButton("Toggle Camera");
    41.   toggleCameraDown = Rewiredplayer.GetButtonDown("Toggle Camera");
    42.   grenadeHold = Rewiredplayer.GetButton("Throw Grenade");
    43.   meleePress = Rewiredplayer.GetButtonDown("Melee Attack");
    44.   flashlightPress = Rewiredplayer.GetButtonDown("Toggle Flashlight");
    45.   holsterPress = Rewiredplayer.GetButtonDown("Holster Weapon");
    46.   dropPress = Rewiredplayer.GetButtonDown("Drop Weapon");
    47.        bulletTimePress = Rewiredplayer.GetButtonDown("Bullet Time");
    48.   deadzonePress = Rewiredplayer.GetButtonDown("Toggle Deadzone Aiming");
    49.   helpPress = Rewiredplayer.GetButtonDown("Help");
    50.   menuPress = Rewiredplayer.GetButtonDown("Main Menu");
    51.   pausePress = Rewiredplayer.GetButtonDown("Pause");
    52.  
    53.   selectNextPress = Rewiredplayer.GetButtonDown("Select Next Weapon");
    54.   selectPrevPress = Rewiredplayer.GetButtonDown("Select Previous Weapon");
    55.   selectGrenPress = Rewiredplayer.GetButtonDown("Select Next Grenade");
    56.   selectWeap1Press = Rewiredplayer.GetButtonDown("Select Weapon 1");
    57.   selectWeap2Press = Rewiredplayer.GetButtonDown("Select Weapon 2");
    58.   selectWeap3Press = Rewiredplayer.GetButtonDown("Select Weapon 3");
    59.   selectWeap4Press = Rewiredplayer.GetButtonDown("Select Weapon 4");
    60.   selectWeap5Press = Rewiredplayer.GetButtonDown("Select Weapon 5");
    61.   selectWeap6Press = Rewiredplayer.GetButtonDown("Select Weapon 6");
    62.   selectWeap7Press = Rewiredplayer.GetButtonDown("Select Weapon 7");
    63.   selectWeap8Press = Rewiredplayer.GetButtonDown("Select Weapon 8");
    64.   selectWeap9Press = Rewiredplayer.GetButtonDown("Select Weapon 9");
    65.   selectWeap0Press = Rewiredplayer.GetButtonDown("Select Weapon 0");
    66.  
    67.  
    Critical Note: Add the attached Rewired Input Manager prefab to your scene for this to work. The prefab is included in a zip file (unzip and then add to your scene). You must also own the Rewired asset for this to work.

    NOTE: Added rewired actions horizontal and vertical so it will be easier to integrate Dialogue System for Unity at a future time.

    Tested on Windows 8.1 (64-bit) with Windows standalone with keyboard/mouse and xbox 360 and xbox one controllers. Some Hotas setups and also a ThrustMaster T300RS racing wheel in combination with a mouse. Used the Realistic FPS sandbox demo scene for the test.

    For the test a new Unity project was created with Realistic FPS prefab and Rewired assets. Opened the sandbox demo scene and added the attached Rewired input manager prefab and then modified the source code in the file mentioned above.

    EDIT: 2/12/2017 updated the Rewired Input Manager prefab to better handle gamepads (via the gamepad template) based on information that was missed the first time from the original unity input manager. Also added limited support for Flight Controllers (HOTAS setups) and Flight pedals for those who are interested. Also added Racing Wheel and pedal support for those who want to try fps perspective with a racing wheel and a mouse.
     

    Attached Files:

    Last edited: Feb 13, 2017
    Hormic likes this.
  40. Yodarkana

    Yodarkana

    Joined:
    Oct 15, 2016
    Posts:
    4
    How do I get an NPC to actually move? All mine just stay still and dont do anything. I cant see anywhere on the guide telling you how to setup and use the current NPCs. Here are some screenshots.
     

    Attached Files:

  41. JACKO4590

    JACKO4590

    Joined:
    Nov 25, 2014
    Posts:
    76
    Before diving into this stuff have a look at unity tutorials. You need to bake a nav mesh so the npcs know where to walk and stuff.

    This is a default unity thing and rfps has nothing to do with it. Start with a few unity tutorials to start you off with AI then start doing your own scripts and custom codes.
     
    GMax likes this.
  42. Yodarkana

    Yodarkana

    Joined:
    Oct 15, 2016
    Posts:
    4
    And then what do I just drag it onto the zombie NPC when It is baked
     
  43. JACKO4590

    JACKO4590

    Joined:
    Nov 25, 2014
    Posts:
    76
    Yes. Put ground as static and walkable. Bake the Navigation and then it's just drag and drop and all works.
     
  44. Weblox

    Weblox

    Joined:
    Apr 11, 2016
    Posts:
    256
    @Locky The Integration for Realistic Car Controller should be somewhere in this forum already. I just can't seem to find it. It also had a solution for making AI Characters take damage if you hit them while driving. I would be happy too if someone could prepare a demo scene with the right setup for the AI part because I could not get it work, since I could not figure out where to put which colliders.
     
    Last edited: Jan 16, 2017
    Locky likes this.
  45. jons190

    jons190

    Joined:
    Sep 13, 2016
    Posts:
    215
    So a heads up. If anyone has downloaded the new 1.24 Realistic FPS prefab. it seem to work much better in Unity/ Oculus vr and I can actually build to the Gear VR device and sort walk around using a bluethooth controller (steel series XL) The button mapping is still wonky. I get nothing out of the unity input manager that makes any button remaping seem to work and the right joystick still maps as (move joystick up to turn right, move joystick down to turn left. ) But it works now, where before it didn't, so progress!!!!!!!

    Performance seems a tad lacking ...seems to run about 50 FPS on the S7 in just a basic dungeon level with baked lighting and mobile shaders.... with no monsters in yet and I'm trying to strip out all the scrips that I won't need for a FPS (3rd person, lens flare, head bob, etc...) to see if that helps performance...... on ward through the fog!
     
  46. Locky

    Locky

    Joined:
    May 14, 2015
    Posts:
    86
    I did a search on that but came up empty. At least one issue is that Realistic Car Controller relies on the standard Horizontal and Vertical inputs. Adding them back into RFPS doesn't work for some reason. There may be something else going on. Anyone had success getting them both to play together?
     
  47. Yodarkana

    Yodarkana

    Joined:
    Oct 15, 2016
    Posts:
    4
    Hey just wondering how can I get zombies to spawn randomly on my map ?
     
  48. Weblox

    Weblox

    Joined:
    Apr 11, 2016
    Posts:
    256
    @Locky You can find llJIMBOBII 's RCC Integration in two scripts >here< . One goes on your Player and the other one on the car. o_O

    Input Manager is discussed >here< . This post also has a updated package with the scripts, so you might want to use that package.

    >Here< is the script to drive over AI Agents with damage. I couldn't get this part to work myself since I didnt know where to put what colliders, and would be happy for a working example scene on how to set it up. o_O
     
    Last edited: Jan 17, 2017
    Hormic and Locky like this.
  49. Locky

    Locky

    Joined:
    May 14, 2015
    Posts:
    86
    Weblox, THANK YOU for finding those! I am been busy implementing them. I think that I am missing some crucial setting or step though. One of the images he refers to is gone (where he says "There's a few things you need to do first").

    I did download and examine his demo. I recreated the Inputs for Horizontal and Vertical. I created a new "Vehicle" layer and set that up in RCC's settings. Applied his scripts. Not sure what is going on. I may have to take a break and take a look at it with fresh eyes. But thank you for for the links. If I can get this working it would be amazing!
     
  50. TheChairMaster64

    TheChairMaster64

    Joined:
    Aug 9, 2016
    Posts:
    37
    what does 1.24 add if i retry updating?