Search Unity

Realistic FPS Prefab [RELEASED]

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

  1. Arealjighead

    Arealjighead

    Joined:
    Apr 7, 2017
    Posts:
    32
    @Oderus_Urungus Nice. Glad i could help.

    @magique I know you can delete the sleeves in the weapon prefabs, but the gloves are apart of the texture. You could try painting gloves on the UMA texture since it will be in third person anyway & fine detail wont matter as much. Otherwise I believe you would have to add new arm models to each weapon.
     
    Last edited: Mar 20, 2018
    magique likes this.
  2. vincent_lade

    vincent_lade

    Joined:
    Sep 17, 2017
    Posts:
    45
    Tried a few things out involving the Canvas Scaler, though it effects other things like the map/subtitles on different screens. Is there a way to disable the Horizontal Offset and Vertical Offset on the AmmoText script and just have it locked/scaled with Rect Transform like a UI object under Canvas?
     
  3. moria15

    moria15

    Joined:
    Feb 25, 2011
    Posts:
    400
    sorry didn't look at that as I was using a forced 3rd person view so that the arms and hands part was irrelevant, but i would have thought it was no more difficult than changing models normally.. biggest issue would be finding arms etc that matched your character.

    M
     
  4. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,736
    No worries. For our current game we're going with just first person mode only and no visible player body. I'll look deeper into all this when we start the next chapter of our game and allow 3rd person mode.
     
  5. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,736
    @Azuline-Studios Is there information anywhere on what features will be added to next upgrade? I'm planning for the future and am curious about possible features we might see. If you're open to suggestions I think it would be great to see some climbing features, especially in 3rd person mode.
     
  6. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,736
    Is there a way to prevent RFPS from using hit markers on NPCs? Hit markers look fine on walls and other static objects, but with the way an NPC's colliders are set up, it looks very odd to see hit markers basically floating in air all around them.
     
  7. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,022
    I think you can just remove the Canvas Scaler, and set the Rect Transforms' anchors to the edges of the screen instead.
     
  8. VE_GAME

    VE_GAME

    Joined:
    Mar 13, 2014
    Posts:
    39
    Hi

    Save System for RFPSP can store the number of waves?
    Let's say I have 10 waves on one scene
    I passed 5, the rest to save.
     
  9. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,022
    Hi,
    Not yet. You're the first one to request this. I'll make sure it gets added to the next version.
     
    jons190 likes this.
  10. VE_GAME

    VE_GAME

    Joined:
    Mar 13, 2014
    Posts:
    39
    Thanks
     
  11. JC_LEON

    JC_LEON

    Joined:
    May 20, 2014
    Posts:
    442
    Hi tony...i purchased your save system for rfps today .but i didnt use it yet,,, i would to ask is save system support save between scenes and if i can have multiple save and choose them form a save/load menu??

    thanks
     
  12. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,022
    Hi @JC_LEON - Thanks! Yes, it saves between scenes. Use the Scene Portal component to change scenes. This tells the Save System to save information, and it also uses the scene transition / optional loading screen. The demo scenes include Scene Portals.

    Yes, you can have multiple saves. You can save as many slots as you want. The example code for RFPS's main menu only saves in slot 0, but you can extend it or replace it to save more slots.
     
    magique likes this.
  13. JC_LEON

    JC_LEON

    Joined:
    May 20, 2014
    Posts:
    442

    hi Tony and many thanks for your reply.. i'll try and hope can sucessefully manage to use it.. thanks again
     
  14. JC_LEON

    JC_LEON

    Joined:
    May 20, 2014
    Posts:
    442
    Hi again... as you know which is better inventory system i can easily integrate with rfps??
    if i eventually purchase dialog system is there a way with that asset to create an inventory system that works fine with rpfs??
     
  15. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,022
    Hi @JC_LEON - The Dialogue System includes a special integration package for RFPS plus S-Inventory, but unfortunately S-Inventory has been deprecated. If you bought a license for S-Inventory before it was deprecated, you can use it. Otherwise I'm afraid it would take some work to make another inventory system integrate with RFPS's ammo, weapon, health, hunger/thirst, and pickups. It may be easier to design your game to use what RFPS offers instead of using a full inventory system.
     
  16. twangydave

    twangydave

    Joined:
    Mar 30, 2017
    Posts:
    34
    Hi Tony, hope you're well. The thing we all dread happened and a total PC meltdown has had me out of the game for a couple of months. Luckily I was well backed up and everything seems to have re-imported to my new PC fine. One oddity is that RFPS is not creating any of its inputs and the unity input manager is default. If I create them manually they work fine but there is a lot of them and there is a lot of ground for error as I don't have anything to work from. Is there a way to force the package to re-create it's inputs rather than doing it all manually?
     
  17. JC_LEON

    JC_LEON

    Joined:
    May 20, 2014
    Posts:
    442

    thanks again tony for your answer...i really dont need a full inventory system lik you said but instead a simple inventory system to use pickups choose weapons etc..i dont need crafting system for example..
    Sincerly i bought s-iventory and have it on my asset list but really didnt like it if i remebmber correctly.. but i'll give to it another try..
    otherwise i need to find another simple solution..but i dont know which..
     
  18. jons190

    jons190

    Joined:
    Sep 13, 2016
    Posts:
    243
    I don't think so. I had to really rip a lot out of the main package to get it to run on mobile. It's a "fun" game figuring out what you can strip and whoat not to. If you ever get there, shoot me an email and I'll walk you through what I know when it comes to stripping out features.
     
  19. llJIMBOBll

    llJIMBOBll

    Joined:
    Aug 23, 2014
    Posts:
    558
    I have integrated RFPS and Inventory pro latest version, if you need it... The weapons are not equip like armour, I made so I can place in the hotbar, if I press the key 1-10 to select the weapon and press it again to hide it. Made for weapons, ammo, health and food/thirst.

    Place On any Object or player in scene; (This is to reference to select which weapon and add ammo)
    Code (CSharp):
    1. public class Jims_Menu : MonoBehaviour
    2.         {
    3. protected static Jims_Menu m_Instance = null;
    4.         public static Jims_Menu Instance
    5.         { get {    if (m_Instance == null)
    6.                 m_Instance = FindObjectOfType<Jims_Menu>();
    7.                 return m_Instance;
    8.             }
    9.  
    10.             set {
    11.                 m_Instance = value;
    12.             }
    13.         }
    14.  
    15.             protected PlayerWeapons m_PlayerWeapons = null;
    16.             public PlayerWeapons PlayerWeapons
    17.             { get {    if (m_PlayerWeapons == null)
    18.                     m_PlayerWeapons = FindObjectOfType<PlayerWeapons>();
    19.                     return m_PlayerWeapons;
    20.                 }
    21.             }
    22. protected void Awake()
    23.         {
    24.             if (Instance == null)
    25.                 Instance = this;
    26.         }
    27.  
    28.  
    29.         public void SelectWeaponInventory (int Weapon)
    30.         {
    31.             PlayerWeapons.weaponOrder [Weapon].gameObject.GetComponent<WeaponBehavior> ().haveWeapon = true;
    32.  
    33.             PlayerWeapons.StartCoroutine(PlayerWeapons.SelectWeapon (Weapon));
    34.         }
    35.  
    36.         public void AddAmmoInventory (int Weapon, int AmmoToAdd)
    37.         {
    38.             PlayerWeapons.weaponOrder [Weapon].gameObject.GetComponent<WeaponBehavior> ().ammo += AmmoToAdd;
    39.             }
    40.         }
    Weapons
    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using System.Collections.Generic;
    4. using Devdog.General;
    5. using Devdog.InventoryPro;
    6.  
    7.  
    8. public partial class Jims_RFPSWeaponItemType : InventoryItemBase
    9. {
    10.     public Devdog.General.AudioClipInfo pickupSound;
    11.     public uint WeaponNumber = 0;
    12.  
    13.  
    14.     public override GameObject Drop ()
    15.     {
    16.         //Reduce or remove an element from the character slot
    17.         var skillbarCols = PlayerManager.instance.currentPlayer.inventoryPlayer.skillbarCollection;
    18.         if (skillbarCols.useReferences) {
    19.             for (uint i = 0; i < skillbarCols.collectionSize; i++) {
    20.                 if (skillbarCols [i].item == this) {
    21.                     skillbarCols.NotifyItemRemoved (this, this.ID, i, 999);
    22.                     skillbarCols [i].item = null;
    23.                     skillbarCols [i].Repaint ();
    24.                 }
    25.             }
    26.         }
    27.  
    28.         //Select No Gun Once Dropped
    29.         if(Jims_Menu.Instance.PlayerWeapons.currentWeapon == (int) WeaponNumber)
    30.             Jims_Menu.Instance.SelectWeaponInventory ((int) 0);
    31.  
    32.         //Set HaveWeapon to false, it will reset to true once re-equip
    33.         Jims_Menu.Instance.PlayerWeapons.weaponOrder [(int)WeaponNumber].gameObject.GetComponent<WeaponBehavior> ().haveWeapon = false;
    34.  
    35.         return base.Drop();
    36.     }
    37.  
    38.     public override int Use ()
    39.     {
    40.         var used = base.Use ();
    41.         if (used < 0) {
    42.             return used;
    43.         }
    44.  
    45.  
    46.         //Select Weapon to Use
    47.         if (Jims_Menu.Instance.PlayerWeapons.currentWeapon == (int)WeaponNumber)
    48.             Jims_Menu.Instance.SelectWeaponInventory ((int)0);
    49.         else
    50.             Jims_Menu.Instance.SelectWeaponInventory ((int)WeaponNumber);
    51.  
    52.  
    53.  
    54.         //Reduce or remove an element from the character slot
    55.         var skillbarCols = PlayerManager.instance.currentPlayer.inventoryPlayer.skillbarCollection;
    56.         if (skillbarCols.useReferences) {
    57.             for (uint i = 0; i < skillbarCols.collectionSize; i++) {
    58.                 if (skillbarCols [i].item == this) {
    59.                     skillbarCols.SetItem (i, this, true);
    60.                     if (currentStackSize == 0) {
    61.                         skillbarCols.NotifyItemRemoved (this, this.ID, i, 1);
    62.                         skillbarCols [i].item = null;
    63.                         skillbarCols [i].Repaint ();
    64.                     }
    65.                     break;
    66.                 }
    67.             }
    68.         }
    69.  
    70.         if (itemCollection != null) {
    71.             if (currentStackSize <= 0) {
    72.                 itemCollection.NotifyItemRemoved (this, ID, index, 1);
    73.                 itemCollection.SetItem (index, null, true);
    74.             }
    75.  
    76.             itemCollection [index].Repaint ();
    77.         }
    78.  
    79.         return 0;
    80.     }
    81.  
    82.     public override bool PickupItem ()
    83.     {
    84.         bool pickedUp = base.PickupItem ();
    85.         if (pickedUp) {
    86.             transform.position = Vector3.zero;
    87.             AudioManager.AudioPlayOneShot (pickupSound);
    88.         }
    89.         return pickedUp;
    90.     }
    91.  
    92.     public override LinkedList<ItemInfoRow[]> GetInfo()
    93.     {
    94.         var list = new LinkedList<ItemInfoRow[]>();
    95.         list.AddLast(new ItemInfoRow[]{
    96.             //new ItemInfoRow("Weight", (weight * currentStackSize).ToString()),
    97.             //new ItemInfoRow("Required level", requiredLevel.ToString()),
    98.             new ItemInfoRow("Category", category.name),
    99.         });
    100.  
    101.         var extraProperties = new List<ItemInfoRow>();
    102.         foreach (var property in stats)
    103.         {
    104.             var prop = property.stat;
    105.             if (prop == null)
    106.             {
    107.                 continue;
    108.             }
    109.  
    110.             if(prop.showInUI)
    111.             {
    112.                 if(property.isFactor && property.isSingleValue)
    113.                     extraProperties.Add(new ItemInfoRow(prop.statName, (property.floatValue - 1.0f) * 100 + "%", prop.color, prop.color));
    114.                 else
    115.                     extraProperties.Add(new ItemInfoRow(prop.statName, property.value, prop.color, prop.color));
    116.             }
    117.         }
    118.         if(extraProperties.Count > 0)
    119.             list.AddFirst(extraProperties.ToArray());
    120.         var extra = new List<ItemInfoRow>(0);  
    121.         if (extra.Count > 0)
    122.         {
    123.             list.AddFirst(extra.ToArray());
    124.         }
    125.  
    126.         return list;
    127.     }
    128. }
    Ammo
    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using System.Collections.Generic;
    4. using Devdog.General;
    5. using Devdog.InventoryPro;
    6.  
    7.  
    8. public class Jims_RFPSAmmoItemType : InventoryItemBase
    9. {
    10.     public Devdog.General.AudioClipInfo pickupSound;
    11.     public Devdog.General.AudioClipInfo addAmmoSound;
    12.     public uint[] WeaponNumber;
    13.     public uint AmmoToAdd = 10;
    14.  
    15.  
    16.     public override GameObject Drop ()
    17.     {
    18.         //Reduce or remove an element from the character slot
    19.         var skillbarCols = PlayerManager.instance.currentPlayer.inventoryPlayer.skillbarCollection;
    20.         if (skillbarCols.useReferences) {
    21.             for (uint i = 0; i < skillbarCols.collectionSize; i++) {
    22.                 if (skillbarCols [i].item == this) {
    23.                     skillbarCols.NotifyItemRemoved (this, this.ID, i, 999);
    24.                     skillbarCols [i].item = null;
    25.                     skillbarCols [i].Repaint ();
    26.                 }
    27.             }
    28.         }
    29.  
    30.         return base.Drop();
    31.     }
    32.  
    33.     public override int Use ()
    34.     {
    35.         var used = base.Use ();
    36.         if (used < 0) {
    37.             return used;
    38.         }
    39.  
    40.         foreach(uint WN in WeaponNumber)
    41.         {
    42.             Jims_Menu.Instance.AddAmmoInventory ((int)WN, (int)AmmoToAdd);
    43.         }
    44.  
    45.         AudioManager.AudioPlayOneShot (addAmmoSound);
    46.  
    47.         //Remove 1 from current Stack
    48.         currentStackSize--;
    49.  
    50.         //Reduce or remove an element from the character slot
    51.         var skillbarCols = PlayerManager.instance.currentPlayer.inventoryPlayer.skillbarCollection;
    52.         if (skillbarCols.useReferences) {
    53.             for (uint i = 0; i < skillbarCols.collectionSize; i++) {
    54.                 if (skillbarCols [i].item == this) {
    55.                     skillbarCols.SetItem (i, this, true);
    56.                     if (currentStackSize == 0) {
    57.                         skillbarCols.NotifyItemRemoved (this, this.ID, i, 1);
    58.                         skillbarCols [i].item = null;
    59.                         skillbarCols [i].Repaint ();
    60.                     }
    61.                     break;
    62.                 }
    63.             }
    64.         }
    65.  
    66.         if (itemCollection != null) {
    67.             if (currentStackSize <= 0) {
    68.                 itemCollection.NotifyItemRemoved (this, ID, index, 1);
    69.                 itemCollection.SetItem (index, null, true);
    70.             }
    71.  
    72.             itemCollection [index].Repaint ();
    73.         }
    74.  
    75.         NotifyItemUsed(1, true);
    76.         return 1;
    77.     }
    78.  
    79.     public override bool PickupItem ()
    80.     {
    81.         bool pickedUp = base.PickupItem ();
    82.         if (pickedUp) {
    83.             transform.position = Vector3.zero;
    84.             AudioManager.AudioPlayOneShot (pickupSound);
    85.         }
    86.         return pickedUp;
    87.     }
    88.  
    89.     public override LinkedList<ItemInfoRow[]> GetInfo()
    90.     {
    91.         var list = new LinkedList<ItemInfoRow[]>();
    92.         list.AddLast(new ItemInfoRow[]{
    93.             //new ItemInfoRow("Weight", (weight * currentStackSize).ToString()),
    94.             //new ItemInfoRow("Required level", requiredLevel.ToString()),
    95.             new ItemInfoRow("Category", category.name),
    96.         });
    97.  
    98.         var extraProperties = new List<ItemInfoRow>();
    99.         foreach (var property in stats)
    100.         {
    101.             var prop = property.stat;
    102.             if (prop == null)
    103.             {
    104.                 continue;
    105.             }
    106.  
    107.             if(prop.showInUI)
    108.             {
    109.                 if(property.isFactor && property.isSingleValue)
    110.                     extraProperties.Add(new ItemInfoRow(prop.statName, (property.floatValue - 1.0f) * 100 + "%", prop.color, prop.color));
    111.                 else
    112.                     extraProperties.Add(new ItemInfoRow(prop.statName, property.value, prop.color, prop.color));
    113.             }
    114.         }
    115.         if(extraProperties.Count > 0)
    116.             list.AddFirst(extraProperties.ToArray());
    117.  
    118.  
    119.         var extra = new List<ItemInfoRow>(0);
    120.         if (extra.Count > 0)
    121.         {
    122.             list.AddFirst(extra.ToArray());
    123.         }
    124.  
    125.         return list;
    126.     }
    127. }
    Health
    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using System.Collections.Generic;
    4. using Devdog.General;
    5. using Devdog.InventoryPro;
    6.  
    7.  
    8. public class Jims_RFPSHealthItemType : InventoryItemBase
    9. {
    10.     public Devdog.General.AudioClipInfo pickupSound;
    11.     public Devdog.General.AudioClipInfo consumeSound;
    12.     public Devdog.General.AudioClipInfo deniedSound;
    13.  
    14.     public float HealthToRestore = 10f;
    15.  
    16.  
    17.     public override GameObject Drop ()
    18.     {
    19.         //Reduce or remove an element from the character slot
    20.         var skillbarCols = PlayerManager.instance.currentPlayer.inventoryPlayer.skillbarCollection;
    21.         if (skillbarCols.useReferences) {
    22.             for (uint i = 0; i < skillbarCols.collectionSize; i++) {
    23.                 if (skillbarCols [i].item == this) {
    24.                     skillbarCols.NotifyItemRemoved (this, this.ID, i, 999);
    25.                     skillbarCols [i].item = null;
    26.                     skillbarCols [i].Repaint ();
    27.                 }
    28.             }
    29.         }
    30.  
    31.         return base.Drop();
    32.     }
    33.  
    34.     public override bool PickupItem ()
    35.     {
    36.         bool pickedUp = base.PickupItem ();
    37.         if (pickedUp) {
    38.             transform.position = Vector3.zero; // Reset position to avoid the user from looting it twice when reloading (reloading temp. enables the item)
    39.             AudioManager.AudioPlayOneShot (pickupSound);
    40.         }
    41.         return pickedUp;
    42.     }
    43.  
    44.     public override int Use ()
    45.     {
    46.         var used = base.Use ();
    47.         if (used < 0) {
    48.             return used;
    49.         }
    50.  
    51.  
    52.         var dmgHandler = PlayerManager.instance.currentPlayer.gameObject.GetComponent<FPSPlayer> ();
    53.         if (dmgHandler != null)
    54.         {
    55.             if (dmgHandler.hitPoints != dmgHandler.maximumHitPoints) {
    56.                 dmgHandler.hitPoints += HealthToRestore;
    57.                 AudioManager.AudioPlayOneShot (consumeSound);
    58.             } else {
    59.                 AudioManager.AudioPlayOneShot (deniedSound);
    60.                 return 0;
    61.             }
    62.         }
    63.  
    64.         //Remove 1 from current Stack
    65.         currentStackSize--;
    66.  
    67.         //Reduce or remove an element from the character slot
    68.         var skillbarCols = PlayerManager.instance.currentPlayer.inventoryPlayer.skillbarCollection;
    69.         if (skillbarCols.useReferences) {
    70.             for (uint i = 0; i < skillbarCols.collectionSize; i++) {
    71.                 if (skillbarCols [i].item == this) {
    72.                     skillbarCols.SetItem (i, this, true);
    73.                     if (currentStackSize == 0) {
    74.                         skillbarCols.NotifyItemRemoved (this, this.ID, i, 1);
    75.                         skillbarCols [i].item = null;
    76.                         skillbarCols [i].Repaint ();
    77.                     }
    78.                     break;
    79.                 }
    80.             }
    81.         }
    82.  
    83.         if (itemCollection != null) {
    84.             if (currentStackSize <= 0) {
    85.                 itemCollection.NotifyItemRemoved (this, ID, index, 1);
    86.                 itemCollection.SetItem (index, null, true);
    87.             }
    88.  
    89.             itemCollection [index].Repaint ();
    90.         }
    91.  
    92.         //  NotifyItemUsed(1, true);
    93.         return 1;
    94.     }
    95.  
    96.     public override LinkedList<ItemInfoRow[]> GetInfo()
    97.     {
    98.         var list = new LinkedList<ItemInfoRow[]>();
    99.         list.AddLast(new ItemInfoRow[]{
    100.             //new ItemInfoRow("Weight", (weight * currentStackSize).ToString()),
    101.             //new ItemInfoRow("Required level", requiredLevel.ToString()),
    102.             new ItemInfoRow("Category", category.name),
    103.         });
    104.  
    105.         var extraProperties = new List<ItemInfoRow>();
    106.         foreach (var property in stats)
    107.         {
    108.             var prop = property.stat;
    109.             if (prop == null)
    110.             {
    111.                 continue;
    112.             }
    113.  
    114.             if(prop.showInUI)
    115.             {
    116.                 if(property.isFactor && property.isSingleValue)
    117.                     extraProperties.Add(new ItemInfoRow(prop.statName, (property.floatValue - 1.0f) * 100 + "%", prop.color, prop.color));
    118.                 else
    119.                     extraProperties.Add(new ItemInfoRow(prop.statName, property.value, prop.color, prop.color));
    120.             }
    121.         }
    122.  
    123.         if(extraProperties.Count > 0)
    124.             list.AddFirst(extraProperties.ToArray());
    125.  
    126.         var extra = new List<ItemInfoRow>(1);
    127.         if (HealthToRestore != null)
    128.         {
    129.             extra.Add(new ItemInfoRow("Restores ", HealthToRestore.ToString() + " Health"));
    130.         }
    131.  
    132.         if (extra.Count > 0)
    133.         {
    134.             list.AddFirst(extra.ToArray());
    135.         }
    136.  
    137.         return list;
    138.     }
    139. }
    Food/Drink
    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using System.Collections.Generic;
    4. using Devdog.General;
    5. using Devdog.InventoryPro;
    6.  
    7.  
    8. public class Jims_RFPSHungerThirstItemType : InventoryItemBase
    9. {
    10.     public Devdog.General.AudioClipInfo pickupSound;
    11.     public Devdog.General.AudioClipInfo consumeSound;
    12.     public Devdog.General.AudioClipInfo deniedSound;
    13.  
    14.     public float HealthToRestore = 100f;
    15.     public bool IsHungerItem = true;
    16.     public float HungerToRestore = 100f;
    17.     public bool IsThirstItem = true;
    18.     public float ThirstToRestore = 100f;
    19.  
    20.  
    21.     public override GameObject Drop ()
    22.     {
    23.         //Reduce or remove an element from the character slot
    24.         var skillbarCols = PlayerManager.instance.currentPlayer.inventoryPlayer.skillbarCollection;
    25.         if (skillbarCols.useReferences) {
    26.             for (uint i = 0; i < skillbarCols.collectionSize; i++) {
    27.                 if (skillbarCols [i].item == this) {
    28.                     skillbarCols.NotifyItemRemoved (this, this.ID, i, 999);
    29.                     skillbarCols [i].item = null;
    30.                     skillbarCols [i].Repaint ();
    31.                 }
    32.             }
    33.         }
    34.  
    35.         return base.Drop ();
    36.     }
    37.  
    38.     public override bool PickupItem ()
    39.     {
    40.         bool pickedUp = base.PickupItem ();
    41.         if (pickedUp) {
    42.             transform.position = Vector3.zero; // Reset position to avoid the user from looting it twice when reloading (reloading temp. enables the item)
    43.             AudioManager.AudioPlayOneShot (pickupSound);
    44.         }
    45.         return pickedUp;
    46.     }
    47.  
    48.     public override int Use ()
    49.     {
    50.         var used = base.Use ();
    51.         if (used < 0) {
    52.             return used;
    53.         }
    54.  
    55.  
    56.         var dmgHandler = PlayerManager.instance.currentPlayer.gameObject.GetComponent<FPSPlayer> ();
    57.         if (dmgHandler != null) {      
    58.        
    59.             if (IsHungerItem) {
    60.  
    61.                 if (dmgHandler.hungerPoints <= 0.0f && !dmgHandler.usePlayerHunger) {
    62.                     AudioManager.AudioPlayOneShot (deniedSound);
    63.                     return 0;
    64.                 }
    65.            
    66.                 if (dmgHandler.hungerPoints - HungerToRestore > 0.0) {
    67.                     dmgHandler.UpdateHunger (-HungerToRestore);
    68.                 } else {
    69.                     dmgHandler.UpdateHunger (-dmgHandler.hungerPoints);
    70.                 }
    71.  
    72.                 //restore player health by healthToRestore amount
    73.                 if (dmgHandler.hitPoints + HealthToRestore < dmgHandler.maximumHitPoints) {
    74.                     dmgHandler.HealPlayer (HealthToRestore);
    75.                 } else {
    76.                     dmgHandler.HealPlayer (dmgHandler.maximumHitPoints - dmgHandler.hitPoints);
    77.                 }
    78.             }
    79.  
    80.             if (IsThirstItem) {
    81.  
    82.                 if (dmgHandler.thirstPoints <= 0.0f && !dmgHandler.usePlayerThirst) {
    83.                     AudioManager.AudioPlayOneShot (deniedSound);
    84.                     return 0;
    85.                 }
    86.  
    87.                 if (dmgHandler.thirstPoints - ThirstToRestore > 0.0) {
    88.                     dmgHandler.UpdateThirst (-ThirstToRestore);
    89.                 } else {
    90.                     dmgHandler.UpdateThirst (-dmgHandler.thirstPoints);
    91.                 }
    92.  
    93.                 //restore player health by healthToRestore amount
    94.                 if (dmgHandler.hitPoints + HealthToRestore < dmgHandler.maximumHitPoints) {
    95.                     dmgHandler.HealPlayer (HealthToRestore);
    96.                 } else {
    97.                     dmgHandler.HealPlayer (dmgHandler.maximumHitPoints - dmgHandler.hitPoints);
    98.                 }
    99.             }
    100.  
    101.             AudioManager.AudioPlayOneShot (consumeSound);
    102.         }
    103.  
    104.  
    105.  
    106.         if (dmgHandler.usePlayerThirst && dmgHandler.usePlayerHunger || dmgHandler.usePlayerThirst && !dmgHandler.usePlayerHunger || !dmgHandler.usePlayerThirst && dmgHandler.usePlayerHunger) {
    107.             //Remove 1 from current Stack
    108.             currentStackSize--;
    109.    
    110.  
    111.             //Reduce or remove an element from the character slot
    112.             var skillbarCols = PlayerManager.instance.currentPlayer.inventoryPlayer.skillbarCollection;
    113.             if (skillbarCols.useReferences) {
    114.                 for (uint i = 0; i < skillbarCols.collectionSize; i++) {
    115.                     if (skillbarCols [i].item == this) {
    116.                         skillbarCols.SetItem (i, this, true);
    117.                         if (currentStackSize == 0) {
    118.                             skillbarCols.NotifyItemRemoved (this, this.ID, i, 1);
    119.                             skillbarCols [i].item = null;
    120.                             skillbarCols [i].Repaint ();
    121.                         }
    122.                         break;
    123.                     }
    124.                 }
    125.             }
    126.  
    127.             if (itemCollection != null) {
    128.                 if (currentStackSize <= 0) {
    129.                     itemCollection.NotifyItemRemoved (this, ID, index, 1);
    130.                     itemCollection.SetItem (index, null, true);
    131.                 }
    132.  
    133.                 itemCollection [index].Repaint ();
    134.             }
    135.  
    136.             //  NotifyItemUsed(1, true);
    137.             return 1;
    138.         } else
    139.             return 0;
    140.     }
    141.  
    142.     public override LinkedList<ItemInfoRow[]> GetInfo ()
    143.     {
    144.         var list = new LinkedList<ItemInfoRow[]> ();
    145.         list.AddLast (new ItemInfoRow[] {
    146.             //new ItemInfoRow("Weight", (weight * currentStackSize).ToString()),
    147.             //new ItemInfoRow("Required level", requiredLevel.ToString()),
    148.             new ItemInfoRow ("Category", category.name),
    149.         });
    150.  
    151.         var extraProperties = new List<ItemInfoRow> ();
    152.         foreach (var property in stats) {
    153.             var prop = property.stat;
    154.             if (prop == null) {
    155.                 continue;
    156.             }
    157.  
    158.             if (prop.showInUI) {
    159.                 if (property.isFactor && property.isSingleValue)
    160.                     extraProperties.Add (new ItemInfoRow (prop.statName, (property.floatValue - 1.0f) * 100 + "%", prop.color, prop.color));
    161.                 else
    162.                     extraProperties.Add (new ItemInfoRow (prop.statName, property.value, prop.color, prop.color));
    163.             }
    164.         }
    165.  
    166.         if (extraProperties.Count > 0)
    167.             list.AddFirst (extraProperties.ToArray ());
    168.  
    169.         var extra = new List<ItemInfoRow> (2);
    170.         if (IsHungerItem) {
    171.             if (HungerToRestore != null) {
    172.                 extra.Add (new ItemInfoRow ("Restores ", HungerToRestore.ToString () + " Hunger"));
    173.             }
    174.         }
    175.         if (IsThirstItem) {
    176.             if (ThirstToRestore != null) {
    177.                 extra.Add (new ItemInfoRow ("Restores ", ThirstToRestore.ToString () + " Thirst"));
    178.             }
    179.         }
    180.  
    181.         if (extra.Count > 0) {
    182.             list.AddFirst (extra.ToArray ());
    183.         }
    184.  
    185.         return list;
    186.     }
    187. }
    In PlayerWeapons.cs Comment out some lines of code
    Around line 357
    Code (CSharp):
    1. //                //select weapons with number keys
    2. //                if (InputComponent.holsterPress) {
    3. //                    if(currentWeapon != 0){StartCoroutine(SelectWeapon(0));}
    4. //                }else if (InputComponent.selectWeap1Press && weaponOrder.Length - 1 > 0) {
    5. //                    if(currentWeapon != 1){StartCoroutine(SelectWeapon(1));}
    6. //                }else if (InputComponent.selectWeap2Press && weaponOrder.Length - 1 > 1) {
    7. //                    if(currentWeapon != 2){StartCoroutine(SelectWeapon(2));}
    8. //                }else if (InputComponent.selectWeap3Press && weaponOrder.Length - 1 > 2) {
    9. //                    if(currentWeapon != 3){StartCoroutine(SelectWeapon(3));}
    10. //                }else if (InputComponent.selectWeap4Press && weaponOrder.Length - 1 > 3) {
    11. //                    if(currentWeapon != 4){StartCoroutine(SelectWeapon(4));}
    12. //                }else if (InputComponent.selectWeap5Press && weaponOrder.Length - 1 > 4) {
    13. //                    if(currentWeapon != 5){StartCoroutine(SelectWeapon(5));}
    14. //                }else if (InputComponent.selectWeap6Press && weaponOrder.Length - 1 > 5) {
    15. //                    if(currentWeapon != 6){StartCoroutine(SelectWeapon(6));}
    16. //                }else if (InputComponent.selectWeap7Press && weaponOrder.Length - 1 > 6) {
    17. //                    if(currentWeapon != 7){StartCoroutine(SelectWeapon(7));}
    18. //                }else if (InputComponent.selectWeap8Press && weaponOrder.Length - 1 > 7) {
    19. //                    if(currentWeapon != 8){StartCoroutine(SelectWeapon(8));}
    20. //                }else if (InputComponent.selectWeap9Press && weaponOrder.Length - 1 > 8) {
    21. //                    if(currentWeapon != 9){StartCoroutine(SelectWeapon(9));}
    22. //                }
    Around line 533
    Code (CSharp):
    1. //        if(index != 0){//if a weapon is selected, prevent unarmed/null weapon from being selected in selection cycle
    2. //            weaponOrder[0].GetComponent<WeaponBehavior>().haveWeapon = false;
    3. //        }
     
    Last edited: Mar 25, 2018
    Kats4, erichey, TonyLi and 1 other person like this.
  20. twangydave

    twangydave

    Joined:
    Mar 30, 2017
    Posts:
    34
    Hi Tony,

    No need to reply. I've managed to fix this by copying the inputmanager.asset file from the project settings of a previous backup. Happy days!
     
  21. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,022
    Glad you were able to get it working again. Thank goodness for backups!
     
    twangydave likes this.
  22. JamesArndt

    JamesArndt

    Joined:
    Dec 1, 2009
    Posts:
    2,690
    I'm experiencing a weird behavior when I'm strafing and running around and zooming in over the iron sights. It's like the weapon breaks free of the system or something. Has anyone else seen this behavior before? Great package by the way!

     
  23. twangydave

    twangydave

    Joined:
    Mar 30, 2017
    Posts:
    34
    You may have toggled 'Free Aim' it does that I seem to remember.
     
    JamesArndt likes this.
  24. JamesArndt

    JamesArndt

    Joined:
    Dec 1, 2009
    Posts:
    2,690
    You wouldn't happen to know where I can find that toggle? There are a LOT of scripts, but I'm assuming it's on the Player Weapons script.

    EDIT - I realize you might be referring to a hotkey I'm hitting on the keyboard. Now the mystery deepens.
     
  25. llJIMBOBll

    llJIMBOBll

    Joined:
    Aug 23, 2014
    Posts:
    558
    Z is default input key for free aiming and for free zooming their is a bool on the Weapon Pivot script a bool called Deadzone Zooming disable that, the weapon pivot script is the first gameobject child to the FPS Weapons gameobject
     
    JamesArndt likes this.
  26. CyberRon

    CyberRon

    Joined:
    Feb 23, 2017
    Posts:
    3
    Hi autor and other users.
    Your "Realistic FPS Prefab" is extra but complicated.
    Record more videos tutorials.
    How create the prefab "FPS Main"? Step by step please.
    PDF guide is definitely not enough.
     
  27. A0101A

    A0101A

    Joined:
    Aug 9, 2013
    Posts:
    192
    Good one, JIM, thanks for sharing :)
    I have some good results here, on the RFPS Zip Line System i am working on, it will be my community release here, (date: to be announced here, TBA), trying to pack it as the simplest-smallest asset, so you guys can (hopefully) just drop the prefab in a scene, rotate/resize it a bit, and go for fun - down (up) the line. (it works from it's green end - to red one, so it can be used that way). Also if you have XInputDotNetPure dll in your plugins (x_86, and x _64 folders, and activated properly), you will have gamepad vibrations also, for it, i've coded that too, and you can later expand on that code, +learn something, as well. Proud to have it all in one script, and very SIMPLE, so i hope it can help just any RFPS based project ... When you see it here on the thread, some times this year, in it's community V1.0, - - - so - - - lOOky, lOOky around this year :).
     
    Last edited: Mar 27, 2018
  28. A0101A

    A0101A

    Joined:
    Aug 9, 2013
    Posts:
    192
    ... in the cases like this or ANY screw up you've made with the FPS Main Player - 1: make a new, fresh scene, 2: put in your backup FPS Main player, form the backup (you have made it, haven't you ?) And see if the problem persists first, before you think it's somehting wrong with your code (99% cases - it never is) :)
     
  29. A0101A

    A0101A

    Joined:
    Aug 9, 2013
    Posts:
    192
    ... Just saw this, and it happens a lot, it's just an Unity updates issue (as normal, between each one) ... try a build in an earlier (or newer) Unity version ... nope - there are no ugly Gemlins in your closet, learning the code :) ***i say this million times around, guys: be analytical, do not panic on the 1-st thought, "thou shalt remain calm, your code is: good" :).
     
  30. A0101A

    A0101A

    Joined:
    Aug 9, 2013
    Posts:
    192
    It-AlreadyWorks.JPG ... as for the messing up with Unity camera, and adding tons of 3-rd party camera blends and effects, and what-not - i like and keep only Default Unity camera, with no scripts on it, it's still the best, to see the art 100% as it is, if for any effects - go with Unity published ones, there are tons of them in the Standard Assets, and are all optimized by Unity, they are not any worse than anything you can purchase, and than - still have nearly - the same :) I don't understand why some people buy tons of 3-rd party stuff, which Unity does and has, anyways... it does the same ... my RFPS camera is clean :)
     
    Last edited: Mar 27, 2018
  31. Oderus_Urungus

    Oderus_Urungus

    Joined:
    Jun 8, 2017
    Posts:
    96
    Alright, I have suddenly just had 56 errors pop up on the BloomAndFlares script. I've reimported and refreshed the script, to no avail. Anyone else having this issue?

    Thanks.
     
  32. SpacemanSam13

    SpacemanSam13

    Joined:
    Dec 22, 2016
    Posts:
    7
    Does anyone know how to disable the rendering of the first person body (the animated legs and torso)?

    My game is goin to be in third person and it seems like the body for for the First Person player body seems to render at the same time as the Third Person player body. This leaves me with a player that acts as it should, but there is a headless, armless torso that renders at the same time in the same space and is visible when aiming and on death. I can fix it by starting the game, pausing, going back to scene view, going to the Player Clone and disableing the mesh render, so i know its something simple that im probably overlooking in the FPS player or somewhere in the FPS Main. I'm thinking that somewhere in the FPS Player or FPS Main there has to be somekind of option or toggle that im missing and i've simply overlooked. Any help is very much appreciated!

    First pic is an example of the problem, second pic is after i've paused, gone to scene view, disbaled mesh render on playerclone, then reentered the game. aodfix1.png aodfix2.png
     
  33. llJIMBOBll

    llJIMBOBll

    Joined:
    Aug 23, 2014
    Posts:
    558
    If its from RFPS you can remove from the ReconfigurePrefab.cs, and then remove all image effects and start again fresh,,

    Code (CSharp):
    1.  
    2. void Start () around line 52
    3. //        SunShaftsComponent = MainCamera.GetComponent<UnityStandardAssets.ImageEffects.SunShafts>();
    4. //        ColorCorrectionCurvesComponent = MainCamera.GetComponent<UnityStandardAssets.ImageEffects.ColorCorrectionCurves>();
    5. //        BloomOptimizedComponent = MainCamera.GetComponent<UnityStandardAssets.ImageEffects.BloomOptimized>();
    6.  
    7. Update around line 70
    8. //            SunShaftsComponent.enabled = false;
    9. //            ColorCorrectionCurvesComponent.enabled = false;
    10. //            BloomOptimizedComponent.enabled = false;
    11.  
    12. Around line 97
    13. //            SunShaftsComponent.enabled = true;
    14. //            ColorCorrectionCurvesComponent.enabled = true;
    15. //            BloomOptimizedComponent.enabled = true;
    16.  
     
    Last edited by a moderator: Mar 28, 2018
    Oderus_Urungus likes this.
  34. Oderus_Urungus

    Oderus_Urungus

    Joined:
    Jun 8, 2017
    Posts:
    96

    Thanks. Worked like a charm!
     
    Last edited by a moderator: Mar 28, 2018
  35. vincent_lade

    vincent_lade

    Joined:
    Sep 17, 2017
    Posts:
    45
    Not necessarily related to RFPS but how would someone go about hiding or greying-out a "Continue" button on the Main Menu if there's no save data to reference? My concern is someone playing the game for the first time seeing a clickable "Continue" on the main title screen and getting confused.

    RFPS related: Anyway to have the HealthText or AmmoText write directly to a UI Text on the Canvas? Don't like having it separate from my other interface objects.
     
  36. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,022
    What menu are you talking about? Are you using a third party asset such as the Save System for RFPS? In general, you'll want to check if a saved game exists. If not, disable or hide the "Continue" button like the Save System does with the "Load Game" button that it adds to RFPS's main menu.

    Yes. For health text, create two UI Text GameObjects. Add a HealthText script to each one, set up like like the prefab's "health" and "health shadow" GameObjects. Then assign them to the FPS Player's Health Ui Obj and Health Ui Obj Shadow.
     
  37. JamesArndt

    JamesArndt

    Joined:
    Dec 1, 2009
    Posts:
    2,690
    I'm using Easy Main Menu with RFPS right now. I'm trying to use the Easy Main Menu in game pause menu. Basically only used when the user hits the Escape key. I have discovered if I remove the "MainMenu.cs" script (RFPS) from the FPS Camera object within the player hierarchy I can eliminate the RFPS menu that pops in-game. However I'm looking through the Easy Main Menu's "UI_Controller.cs" script that is on the "Gameplay UI" prefab in my scene. I see that a function called "openPauseMenu() is setting the time scale to almost zero, so the entire gameplay scene should be frozen in space. For some reason it isn't and my player can fire their weapon and run around in this state so I'm kind of at a loss for why that is happening. I would like to sort out this time scale issue though.

    EDIT - I observed something very strange happening. Just to diagnose what was happening with the Time Scale I opened up the Time Manager in the Inspector to see what the Time Scale value was when I hit the escape key in-game (while it's running). The Time Scale would go to almost zero as it's told to do in the "openPauseMenu()" function within "UI_Controller.cs", but then it smoothly lerps back to 1 again! All while still in a paused state.

    So with all of that said...what are the areas I need to look for that might be modifying Time Scale in RFPS or at least affecting things when hit the Escape key?
     
  38. hsxtreme

    hsxtreme

    Joined:
    Apr 14, 2017
    Posts:
    55
    Legorobotdude likes this.
  39. JC_LEON

    JC_LEON

    Joined:
    May 20, 2014
    Posts:
    442

    many thanks for your share mate.. but i'm not definitely want touse inventory pro in my project ..i dont own it and sincerly I found it very complicated to my needs but thanks again for the infos..

    btw is there a way can I downlood a previous version of rfps ?? I dont want to use new animation system but the legacy one .and I know that lastest version with old system was 1.27 or so on..

    I contacted azuline studios with my invoice number but did not received any response..
    if is someone of you that can share it with my it will be very appreciated..i can send my invoice number for my purchase of rfps of course
     
  40. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,022
    Your best bet is to edit FPSPlayer.cs's Update() method. If Easy Main Menu is open (e.g., if its PauseGame GameObject is active), immediately exit Update().
     
    JamesArndt likes this.
  41. Oderus_Urungus

    Oderus_Urungus

    Joined:
    Jun 8, 2017
    Posts:
    96
    I'm noticing that shadows do not accurately reflect the new wepons placed. For example, I copied the katana weapon, and replaced it with a spiked baseball bat. When I select the bat, the shadow still shows the katana shadow, and not the bat shadow.

    I know I can just turn the shadows off, but it just looks way more interesting and realistic with them on. Any suggestions?

    Another issue is when swimming in water, if I look up to the surface while under water it looks like the surface of the water is is covered in oil. (the water looks normal when viewing it from a land perspective) I know jack about writing shaders, as I've only written one before, so does anyone know the fix?

    Thanks!
     
  42. greene_tea92

    greene_tea92

    Joined:
    Jun 26, 2017
    Posts:
    17
    Anybody know which script controls the bullet time?
     
  43. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,022
    FPSPlayer.cs Update().
     
  44. Anydaytv

    Anydaytv

    Joined:
    Feb 28, 2018
    Posts:
    18
    This has a big issue associated with it.
    I tried this method and am getting flooded with

    Exception: Bone not found.
    UMA.UMASkeleton.GetRotation (Int32 nameHash) (at Assets/UMA/Core/StandardAssets/UMA/Scripts/UMASkeleton.cs:615)
    UMA.PoseTools.UMAExpressionPlayer.Update () (at Assets/UMA/Core/StandardAssets/UMA/Scripts/UMAExpressionPlayer.cs:88)

    This stack trace couldn't be less helpful...
    Anyone have any idea what this is?

    I notice that the animations in my test do not reflect with the video, and the gloves still show in first person?
     
  45. llJIMBOBll

    llJIMBOBll

    Joined:
    Aug 23, 2014
    Posts:
    558

    The shadows are from the 3rd person weapons, change the katana on third person weapons and should be how u want :D
     
    Oderus_Urungus likes this.
  46. kenamis

    kenamis

    Joined:
    Feb 5, 2015
    Posts:
    340
    Are you using an UMA ready model/race?
     
  47. Anydaytv

    Anydaytv

    Joined:
    Feb 28, 2018
    Posts:
    18
    Yes. The standard Human UMA.
    By itself I get no errors, attached to RFPS I get flooded.

    Here's a screenshot:
     
    Last edited: Mar 30, 2018
  48. kenamis

    kenamis

    Joined:
    Feb 5, 2015
    Posts:
    340
    I suggest you recheck the steps from the video and/or try to provide more information. What UMA version are you using? what Unity version?
    It would be. Please in a spoiler/code tag.

    Alternatively, you could PM me or move to the UMA forum so we don't clutter this one.
     
  49. Jake-Morgan

    Jake-Morgan

    Joined:
    Mar 31, 2018
    Posts:
    7
    How to increase camera deflection when taking damage?
     
  50. JC_LEON

    JC_LEON

    Joined:
    May 20, 2014
    Posts:
    442
    no one can share the 1.27 version of rpfs or the lastest with the old animation system?
     
unityunity