Search Unity

Realistic FPS Prefab [RELEASED]

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

  1. emperor12321

    emperor12321

    Joined:
    Jun 21, 2015
    Posts:
    52
    Hey I've been having errors using RFPS with my inventory asset (Ultimate Inventory C#)
    Anyone have solutions to this or another, similar inventory?
    I'm not a coder but I could attach a few problematic lines, i think it has to do with the GUI
     
  2. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    There are some tricks to get inventory GUIs and RFPS to play nicely, free up the cursor at the proper time, synchronize with RFPS's GUI, etc. If you have the Dialogue System for Unity, it includes integration with S-Inventory and a specific integration package for S-Inventory with RFPS.

    If you don't have the Dialogue System for Unity, here's its S-Inventory Support sub-package. It won't compile without S-Inventory and the Dialogue System for Unity, but feel free to dig through the code for anything that might be helpful.
     
  3. DownFall

    DownFall

    Joined:
    Oct 12, 2014
    Posts:
    36
    How do I add a HUD the one on their now is very ugly. please help :)
     
  4. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    In the folder RFPSP/Objects/HUD, there are a number of prefabs. The RFPS player uses these prefabs for the HUD. They use legacy GUI Text and GUI Textures. You can modify them to change their appearance somewhat, such as changing the font style and color, the position, and even adding additional components or child GameObjects if you want to add a frame for example.

    If you want to use the new Unity UI instead of legacy GUI Text and GUI Texture, you'll need to modify the scripts.
     
  5. DownFall

    DownFall

    Joined:
    Oct 12, 2014
    Posts:
    36
    i'm not really a good scritper :/
     
  6. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    You can still change the appearance dramatically by tweaking the prefabs' GUITexts and GUITextures in the editor, no scripting needed. :)
     
  7. TopThreat

    TopThreat

    Joined:
    Aug 7, 2012
    Posts:
    136
    Hi Everyone,

    Does anyone know of a way to pass the settings for things like invert mouse, FOV, the camera settings, etc. from a Start menu to the FPS Camera and Player if there seperate FPS Players in every scene? For instance, I can have a FPS Player start in the menu scene and then keep it from destroying and all of the changes stick, but if I load a scene without bringing my FPS Player in the new FPS Player would have it's own settings for the above items already.

    Would the best way to do this be to create some kind of script that fires on loading the scene, set the variables the player wants (FOV changed to 70 for instance) and then have those change the values on the FPS Prefab in each scene as the player reaches it?

    How would you solve this problem?

    Thanks!
     
  8. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    I'd save the settings to PlayerPrefs. This is exactly what PlayerPrefs was designed for. Then add a script to your FPS Player prefab that reads PlayerPrefs in Start and applies the settings.
     
  9. unicat

    unicat

    Joined:
    Apr 8, 2012
    Posts:
    425
    Does this work with Unity 5.2 ? I only see a black screen if i start my game. I`m using the 1 camera Setup.
     
  10. unicat

    unicat

    Joined:
    Apr 8, 2012
    Posts:
    425
    Aah, camera depth was set to -1 by default. Set it to 0 works now.
     
    TonyLi likes this.
  11. DownFall

    DownFall

    Joined:
    Oct 12, 2014
    Posts:
    36
    thank you so much you saved me man! and I want to add multiplayer is that possible to add to RFPSP? or should I just wait till it gets updated?
     
  12. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    I recommend waiting until it gets updated. Multiplayer is really hard to add, and it takes a lot of scripting. Save it for the sequel to your current game. :)
     
  13. DownFall

    DownFall

    Joined:
    Oct 12, 2014
    Posts:
    36
    alright :) and is saving hard to do also ? :3
     
  14. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    The Dialogue System for Unity includes a save system for RFPS that doesn't require any scripting. I'm sure there are other options, too. Most of them will probably require scripting, but look around and see what fits your needs.
     
  15. DownFall

    DownFall

    Joined:
    Oct 12, 2014
    Posts:
    36
    awesome thanks :)
     
  16. TheCuBnIcK_UNITY

    TheCuBnIcK_UNITY

    Joined:
    Nov 1, 2015
    Posts:
    6
    Guys, how to do RFPS on the UI. For example health, ammo, hunger, thirst and all that. The very same with the UI I don't know. This who knows, please help! Sorry I very bad know English, so I translated this translator!
    ==============================================================
    Ребят, как сделать RFPS на UI. К примеру здоровье, патроны, голод, жажда и все такое. Сам же с UI я не знаком. По этому кто знает, прошу помочь!
     
  17. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Here's a tutorial for ammo text: http://www.pixelcrushers.com/how-to-use-unity-ui-for-ammo-text-in-realistic-fps-prefab/

    It was written for RFPS v1.21. The line numbers will be different for RFPS v1.22.

    You will also need to know how to use Unity UI: https://unity3d.com/learn/tutorials/topics/user-interface-ui
     
  18. TheCuBnIcK_UNITY

    TheCuBnIcK_UNITY

    Joined:
    Nov 1, 2015
    Posts:
    6
    But my code
    Code (CSharp):
    1. //AmmoText.cs by Azuline Studios© All Rights Reserved
    2. using UnityEngine;
    3. using System.Collections;
    4.  
    5. public class AmmoText : MonoBehaviour {
    6.     //draw ammo amount on screen
    7.     public int ammoGui;//bullets remaining in clip
    8.     public int ammoGui2;//total ammo in inventory
    9.     private int oldAmmo = -512;
    10.     private int oldAmmo2 = -512;
    11.     public Color textColor;
    12.     public float horizontalOffset = 0.95f;
    13.     public float verticalOffset = 0.075f;
    14.     [HideInInspector]
    15.     public float horizontalOffsetAmt = 0.78f;
    16.     [HideInInspector]
    17.     public float verticalOffsetAmt = 0.1f;
    18.     public float fontScale = 0.032f;
    19.  
    20.     void OnEnable(){
    21.         horizontalOffsetAmt = horizontalOffset;
    22.         verticalOffsetAmt = verticalOffset;  
    23.         GetComponent<GUIText>().fontSize = Mathf.RoundToInt(Screen.height * fontScale);
    24.         oldAmmo = -512;
    25.         oldAmmo2 = -512;
    26.     }
    27.    
    28.     void Update(){
    29.         //only update GUIText if value to be displayed has changed
    30.         if((ammoGui != oldAmmo) || (ammoGui2 != oldAmmo2)) {
    31.             GetComponent<GUIText>().pixelOffset = new Vector2 (Screen.width * horizontalOffsetAmt, Screen.height * verticalOffsetAmt);
    32.            
    33.             GetComponent<GUIText>().text = "Ammo : "+ ammoGui.ToString()+" / "+ ammoGui2.ToString();
    34.            
    35.             GetComponent<GUIText>().material.color = textColor;
    36.             oldAmmo = ammoGui;
    37.             oldAmmo2 = ammoGui2;
    38.         }
    39.    
    40.     }
    41. }
    And it is not like what is written on the site about UI with ammo!
     
  19. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    The tutorial also gives line numbers for 1.22:
    Code (csharp):
    1. //AmmoText.cs by Azuline Studios© All Rights Reserved
    2. using UnityEngine;
    3. using System.Collections;
    4.  
    5. public class AmmoText : MonoBehaviour {
    6.     // ... (lines cut) ...
    7.     public float fontScale = 0.032f;
    8.     public UnityEngine.UI.Text uiText = null; // <--- ADD THIS LINE (1/2)
    9.  
    10.     void OnEnable(){
    11.         // ... (lines cut) ...
    12.  
    13.     void Update(){
    14.         // ... (lines cut) ...
    15.             oldAmmo2 = ammoGui2;
    16.             if (uiText != null) uiText.text = ammoGui.ToString(); // <-- ADD THIS (2/2)
    17.         }
    18.  
    19.     }
    20. }

    You must also edit WeaponBehavior.cs. Follow the tutorial to do it. (Please don't post the entire script to the forum.)
     
    Last edited: Nov 1, 2015
  20. TheCuBnIcK_UNITY

    TheCuBnIcK_UNITY

    Joined:
    Nov 1, 2015
    Posts:
    6
    Hmm... I'm not updated
     
  21. TheCuBnIcK_UNITY

    TheCuBnIcK_UNITY

    Joined:
    Nov 1, 2015
    Posts:
    6
    Hmm. I looked and I have 1.22, but why I do not have these lines?
     
  22. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    I edited my reply above. You must add 2 lines to AmmoText.cs and 2 lines to WeaponBehavior.cs.
     
  23. TheCuBnIcK_UNITY

    TheCuBnIcK_UNITY

    Joined:
    Nov 1, 2015
    Posts:
    6
    I will try that if what I will write to you
     
  24. TheCuBnIcK_UNITY

    TheCuBnIcK_UNITY

    Joined:
    Nov 1, 2015
    Posts:
    6
     
  25. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    You must follow the steps in the tutorial exactly. Don't add AmmoText.cs to any GameObjects. It's already on the AmmoText prefab.
     
  26. mentolatux

    mentolatux

    Joined:
    Nov 2, 2014
    Posts:
    240
    yess, thx man
    is workingggg
     
  27. BigLouis1971

    BigLouis1971

    Joined:
    Mar 26, 2014
    Posts:
    107
    This package looks fantastic. I plan to get it later this week. I would like to know if there's any Android or PC published games using this kit. I would like to know how this kit looks in Android.
     
  28. Takahama

    Takahama

    Joined:
    Feb 18, 2014
    Posts:
    169
    There many games on Android platform using RFPSP!
    i dont have enough time i only find one user making games with RFPSP. Here is the list:
    Alien Faceoff
    Zombie Range
    Zombie Infection
    Zombie D

    EDIT: Found another user's RFPS game.
    FPS-Zombie Crime City Survival
     
    Last edited: Nov 2, 2015
    Deleted User likes this.
  29. zugsoft

    zugsoft

    Joined:
    Apr 23, 2014
    Posts:
    453
    I made 2 games with RFPS

    I added Rocket launcher, Flamethrower, destruction, drive a buggy
    https://play.google.com/store/apps/details?id=net.lowcostapp.vi2

    I added bloom effect, multiplayer
    https://play.google.com/store/apps/details?id=net.lowcostapp.deathdust
     
    Last edited: Nov 2, 2015
    Deleted User likes this.
  30. BigLouis1971

    BigLouis1971

    Joined:
    Mar 26, 2014
    Posts:
    107
    Thanks to both of you for such quick and informative responses. Those are all pretty good games.

    I hope you don't mind to tell us how are sales going!
     
    Last edited: Nov 2, 2015
  31. zugsoft

    zugsoft

    Joined:
    Apr 23, 2014
    Posts:
    453
    For Android :
    I earn 6$ by month with inApp, and 25$ with Ads(Admob)

    For Windows Phone :
    8$ with inApp and 17$ with Ads(Admob+Pubcenter)

    For iOS : Something like nothing


    The dedicated server cost me $40 by month(OVH)
    So I earn $16 by month.
     
    Last edited: Nov 2, 2015
  32. BigLouis1971

    BigLouis1971

    Joined:
    Mar 26, 2014
    Posts:
    107
    May I ask who provides the ads and who host your server?
     
  33. Defcon44

    Defcon44

    Joined:
    Aug 19, 2013
    Posts:
    400
    Hello guy's,

    What's up ? :)

    I have a little problem with the size of my player, i use the "Random Dungeon Generator" for my game and my FPS Player is too small (a little) :




    As you can see the player is a little too small but if i change the size of the player then i spawn i can't move :/
    And if i get the size like 1: 1: 1 i can walk :S

    Are an idea please ?

    Thanks :)

     
  34. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    @Defcon44 - Can you make the room prefabs smaller instead?
     
  35. Defcon44

    Defcon44

    Joined:
    Aug 19, 2013
    Posts:
    400
    No i can't, i don't have any settings about the size of the generated level
     
  36. TopThreat

    TopThreat

    Joined:
    Aug 7, 2012
    Posts:
    136
    Hi, I have looked but cannot find a step height setting (for climbing stairs or going up a sidewalk. Is there one I am just missing somewhere?

    Thanks!
     
  37. Destroid123

    Destroid123

    Joined:
    Sep 29, 2015
    Posts:
    7
    Hey...I bought your asset yesterday....and i have this problem called "Odd Tag in Cleanup" everytime i use your spawner
     
  38. DownFall

    DownFall

    Joined:
    Oct 12, 2014
    Posts:
    36
    S - Inventory I have the item save checked but when I relaunch the game the items are invisable and when I drop it nothing is there help!!
     
  39. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    (I'm not the RFPS dev; just trying to help if I can.)
    Scale the individual tiles. What system are you using? In Daedalus, I think you can created a scaled prefab and assign it to the Map Behaviour. Similarly in DunGen, you can scale your Tile GameObject and save it as a prefab.

    It's hard-coded into FPSRigidBodyWalker.cs. Jump down to about line 550, which is in the FixedUpdate() method. Play with the values in this section:
    Code (csharp):
    1. //manage the CapsuleCast size and distance for frontal collision check based on player stance
    Are you using the Dialogue System for Unity's Realistic FPS Prefab / S-Inventory Integration? If so, then untick Save and Load on the S-Inventory GameObjects, and use the Dialogue System's save system like in the example scene in Third Party Support/S-Inventory/RFPS S-Inventory. If you need any help with this, just let me know.

    If you're not using the Dialogue System for Unity, I suggest posting on the S-Inventory thread.
     
  40. DownFall

    DownFall

    Joined:
    Oct 12, 2014
    Posts:
    36
    thank you so much man. Il give it a go
     
  41. DownFall

    DownFall

    Joined:
    Oct 12, 2014
    Posts:
    36
    when I drop it on the example scene nothing shows up :l
     
  42. DownFall

    DownFall

    Joined:
    Oct 12, 2014
    Posts:
    36

    This is what happens when I hover over it and I am not using Dialogue System. But the save and load is checked it the InventoryManager. When i drop the Item nothing appears. The Image isn't there either just the name :?
     
  43. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Looks like an S-Inventory configuration issue. I bet the developer can help you if you post the screenshot to his thread (see the link in my previous reply). Good luck!
     
  44. Defcon44

    Defcon44

    Joined:
    Aug 19, 2013
    Posts:
    400
    I use the "Random Dungeon Generator", i go check in the settings for the scale :)
     
    Last edited: Nov 3, 2015
  45. DownFall

    DownFall

    Joined:
    Oct 12, 2014
    Posts:
    36
    alright link to the developer page please ? :)
     
  46. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    The S-Inventory developer is SoumiDelRio, and the S-Inventory thread page is here. :)
     
  47. Defcon44

    Defcon44

    Joined:
    Aug 19, 2013
    Posts:
    400
    I have check the settings again and no i don't have any "scale" setting for the generated level :s
     
  48. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    I haven't used that product. I skimmed over the documentation. It looks like it uses hard-coded dungeon tiles of 6x6x8 units. If you contact the developer, perhaps they can provide some suggestions.
     
  49. Defcon44

    Defcon44

    Joined:
    Aug 19, 2013
    Posts:
    400
    Hum ... :s

    Any solution to make a bigger RFPS Player ?
     
  50. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    You can play around with the camera position on the FPSCamera object and the FPSRigidBodyWalker.cs script. If you make the camera higher, it should have the same effect as making the player bigger. If you're using a body model, you may need to scale it up.