Search Unity

  1. Unity 2019.1 is now released.
    Dismiss Notice

Realistic FPS Prefab [RELEASED]

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

  1. JC_LEON

    JC_LEON

    Joined:
    May 20, 2014
    Posts:
    417
    @ Thanks TonyLi for your answer, yes i have Dialogue System but not S- inventory..i'll give it a look..

    abiut flashlight & batteires i havent find anythingin previous pages.. can you please redeirect me to correct links??


    new question.. is behavior designer good for smart ai??
     
  2. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    9,334
    The previous posts were about using Unity UI, not specifically about flashlights. This post has links to instructions. This post talks about using a Slider instead of a Text element for ammo.
     
  3. A0101A

    A0101A

    Joined:
    Aug 9, 2013
    Posts:
    180

    ...again - in order to get it to work, you need separate usage of ragdoll system,
    and body replacement system, because both are inbuilt in that same script,
    so you are wrong that "doesn't work" - you need to be careful before stating
    something doesn't work just because you don't know how to use it, it's a matter
    of few clicks and ticks there, only. Over here, in all our projects: it does work, btw,
    ragdoll system, and body replacement system, of that same script...the trick is
    not to mix them, for the particular character in question.
     
  4. polash

    polash

    Joined:
    Jul 8, 2015
    Posts:
    46
    @TonyLi Is it possible to show/hide a coustom layer in main camera ?

    and with your dialog system asset, can i also make voice cutscene ? No text quest for scene..
    thx a lot again for your help.
     
  5. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    9,334
    Yes, you can just change the camera's Layermask. If you want to do this dynamically in a Dialogue System conversation or cutscene, it will require a little scripting. You could write a custom sequencer command to do it.

    Yes. Just turn off subtitles. On the Dialogue Manager, untick the checkboxes in Display Settings > Subtitle Settings to turn off subtitles for all conversations. To turn off subtitles only for specific conversations, inspect the conversation in the Dialogue Editor and tick Override Display Settings. Then untick the checkboxes there.

    To play the voice audio, you can use the Audio() or AudioWait() sequencer commands. If you want to animate a character's mouth to match the voice audio, this is called lipsync. The Dialogue System's documentation has a section on this: How to Add Lipsync.
     
  6. rbm123

    rbm123

    Joined:
    May 24, 2015
    Posts:
    124
    how can I match RFPS with Tatical shooter AI ?
    the primary rfps AI is really bad!
    if this package had a good AI , could be the best template in unity asset store !
    //**// sorry fir my bad english//**//
     
  7. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    9,334
    I'm pretty sure Tactical Shooter AI doesn't have any specific integration with RFPS. (It has integration with UFPS though.)

    However, Behavior Designer has RFPS integration, and it has inexpensive Formation and Tactical add-on packs. Behavior Designer uses behavior trees, which is the type of AI used in most AAA shooters.
     
    A0101A likes this.
  8. wana7262

    wana7262

    Joined:
    Jul 2, 2012
    Posts:
    95
    is it possible to make newer version compatible with unity 4.6?
     
  9. rbm123

    rbm123

    Joined:
    May 24, 2015
    Posts:
    124
    you didn't made any AI for RFPS with this?
    if yes , will you share it with me/us?
     
  10. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    9,334
    I've only used the basic behavior tree that comes with the integration package. I don't have anything else to share. But since all of Behavior Designer's actions are available to use in your behavior trees, you could make it much more sophisticated.
     
  11. llJIMBOBll

    llJIMBOBll

    Joined:
    Aug 23, 2014
    Posts:
    552
    I think it used to be called Shooter AI, which used to work with RFPS, If you search youtube you should find an integration video. But not sure if it will work for the newer version called Tactical Shooter Ai.
     
  12. llJIMBOBll

    llJIMBOBll

    Joined:
    Aug 23, 2014
    Posts:
    552
    @Azuline Studios or Anyone else, for Weapon Roll I need the weapon to rotate on y axes and not the axes its on now. I tryed changing in code in Weapon Behaviour by changing to .y but it still rotated the original way but wouldn't stop.

    I like this feature tho, wud be cool to use for melee attacks with weapons instead of using an animation, which if you don't have you can't use this feature.

    Thanx Jimbob
     
  13. txarly

    txarly

    Joined:
    Apr 27, 2016
    Posts:
    192
    hi,

    I am trying to pause the game when i open the inventory without using "Time.timeScale = 1f;" because i want the game works normally.
    Inventory manager is my inventory script, using timescale works well.
    In the inventorymanager script below the timescale,which i disabled, i added this:

    FPSPlayerComponent.gameObject.SetActive(false);
    Cursor.lockState = CursorLockMode.Locked;
    Cursor.visible = true;

    I have some problems.Camera rotates if a i was moving the mouse just before i opened the inventory and the worst is that the mouse blinks all the time and it´s always on the center of the screen so i cannot move.

    May i have to set inactive another components or objects of the Realistis fps?I have seen something of the mouselook but havent found how to do it.


    ahh,just another silly question, is there a way to search only in this forum and not in all forums?


    Thank you

    Txarly
     
    Last edited: Jun 7, 2016
  14. llJIMBOBll

    llJIMBOBll

    Joined:
    Aug 23, 2014
    Posts:
    552
    Hey just disable smooth mouse look and re-enable after :D

    Code (CSharp):
    1. [HideInInspector]
    2.         public    SmoothMouseLook MouseLookComponent;
    3. private Transform mainCamTransform;
    4.  
    5. void Start()
    6. {
    7. mainCamTransform = Camera.main.transform;
    8.  
    9. MouseLookComponent = mainCamTransform.parent.transform.GetComponent<SmoothMouseLook> ();
    10. }
    11.  
    12. MouseLookComponent.enabled = false;
    13.  
    14.  
    15. MouseLookComponent.enabled = true;
     
    Last edited: Jun 7, 2016
  15. rbm123

    rbm123

    Joined:
    May 24, 2015
    Posts:
    124
    the shooter AI agents are as stupid as RFPS Ai agents!
    tactical SAI is the best
     
  16. llJIMBOBll

    llJIMBOBll

    Joined:
    Aug 23, 2014
    Posts:
    552
    I also have Tactical Shooter Ai, I'm gonna try to make it work with RFPS over the next few days If I can, I'll post back with how I done it. Or if you manage would you mind sharing. Thanx Man
     
  17. A0101A

    A0101A

    Joined:
    Aug 9, 2013
    Posts:
    180
    ...it will be good to get RFPS guys talk to uPieMenu guys, so we can have
    a Pie-Menu (ping-menu) inventory in RFPS, inbuilt by them, some day ...
    Basically - your asset sells that well - as you can integrate it with all
    other assets on the Store...it's the future of all Unity assets,
    and - only way it can go in the future, which is: now... Very soon,
    this will be requirement, as well, for all assets you want to sell there...
    It will be nice also - to stop dev's including "standard assets" rubbish
    in every package, to make everyone's day just coffee and code, and no
    graveyards, and layer-tag murders, after you import everyone's new idea...
    If Unity has any idea what they do - this should be a rule, like more enforced ...
     
    Last edited: Jun 7, 2016
  18. llJIMBOBll

    llJIMBOBll

    Joined:
    Aug 23, 2014
    Posts:
    552
    Hi, I made a weapon selector Ui with Pie-Menu a few months back. It's sorta hacky but could give you an idea.

    Set on your Upie Menu
    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEngine.UI;
    3. using System.Collections;
    4. using UnityStandardAssets.ImageEffects;
    5.  
    6. namespace jims
    7. {
    8.     public class jimsOpenWeaponMenu : MonoBehaviour
    9.     {
    10.         ///////////////////////////////////////////////////////////////////////////////////////////////////
    11.         ///// UNDER THE HOOD //////////////////////////////////////////////////////////////////////////////
    12.         ///////////////////////////////////////////////////////////////////////////////////////////////////
    13.    
    14.         private bool isMenuOpen = false;
    15.  
    16.         public GameObject PauseMenuPanel;
    17.         public GameObject GunMenuUi;
    18.  
    19.         public SmoothMouseLook mouse;
    20.         public PlayerWeapons playerWeapons = null;
    21.         public FPSPlayer playerComponent;
    22.         private WeaponBehavior weaponComponent = null;
    23.  
    24.         public DepthOfFieldDeprecated dof;
    25.  
    26.         //[HideInInspector]
    27.         public bool haveGun1 = false; //Combat Knife
    28.         //[HideInInspector]
    29.         public bool haveGun2 = false; //Basball Bat
    30.         //[HideInInspector]
    31.         public bool haveGun3 = false; //Pistol
    32.         //[HideInInspector]
    33.         public bool haveGun4 = false; //Deagle
    34.     //    [HideInInspector]
    35.         public bool haveGun5 = false; //Revolver
    36.     //    [HideInInspector]
    37.         public bool haveGun6 = false; //SMG
    38.         //[HideInInspector]
    39.         public bool haveGun7 = false; //Silent SMG
    40.         //[HideInInspector]
    41.         public bool haveGun8 = false; //PDW
    42.         //[HideInInspector]
    43.         public bool haveGun9 = false; //Pump-Action Shotgun
    44.         //[HideInInspector]
    45.         public bool haveGun10 = false; //Auto Shotgun
    46.         //[HideInInspector]
    47.         public bool haveGun11 = false; //LMG
    48.         //[HideInInspector]
    49.         public bool haveGun12 = false; //Assault Rifle
    50.         //[HideInInspector]
    51.         public bool haveGun13 = false; //Bolt Action Sniper
    52.         //[HideInInspector]
    53.         public bool haveGun14 = false; //Crossbow
    54.         //[HideInInspector]
    55.         public bool haveGun15 = false; //RPG8
    56.         //[HideInInspector]
    57.         public bool haveGun16 = false; //Flamer
    58.         //[HideInInspector]
    59.         public bool haveGun17 = false; //Minigun
    60.         //[HideInInspector]
    61.         public bool haveGun18 = false; //Uber LMG
    62.         //[HideInInspector]
    63.         public bool haveGun19 = false; //Uber Combat Knife
    64.         //[HideInInspector]
    65.         public bool haveGun20 = false; //Pulser
    66.     //    [HideInInspector]
    67.         public bool haveGun21 = false; //Slugger
    68.         //[HideInInspector]
    69.         //public bool haveGun22 = false; //Chainsaw
    70.         //[HideInInspector]
    71.         public bool haveGun23 = false; //M14
    72.     //    [HideInInspector]
    73.         public bool haveGun24 = false; //Uber Revolver
    74.     //    [HideInInspector]
    75.         public bool haveGun25 = false; //Sniper No Scope
    76.     //    [HideInInspector]
    77.         public bool haveGun26 = false; //Heavy Sniper
    78.     //    [HideInInspector]
    79.         public bool haveGun27 = false; //CQ16
    80.     //    [HideInInspector]
    81.         public bool haveGun28 = false; //M64C
    82.     //    [HideInInspector]
    83.         public bool haveGun29 = false; //Thumper
    84.     //    [HideInInspector]
    85.         public bool haveGun30 = false; //Wooden Axe
    86.     //    [HideInInspector]
    87.         public bool haveGun31 = false; //SledgeHammer
    88.     //    [HideInInspector]
    89.         public bool haveGun32 = false; //Spade
    90.     //    [HideInInspector]
    91.         public bool haveGun33 = false; //Shovel
    92.     //    [HideInInspector]
    93.         public bool haveGun34 = false; //Rake
    94.     //    [HideInInspector]
    95.         public bool haveGun35 = false; //Pitchfork
    96.     //    [HideInInspector]
    97.         public bool haveGun36 = false; //Hoe
    98.     //    [HideInInspector]
    99.         public bool haveGun37 = false; //Broom
    100.     //    [HideInInspector]
    101.         public bool haveGun38 = false; //Chisel
    102.     //    [HideInInspector]
    103.         public bool haveGun39 = false; //Cleaver
    104.     //    [HideInInspector]
    105.         public bool haveGun40 = false; //Hammer
    106.     //    [HideInInspector]
    107.         public bool haveGun41 = false; //HandRake
    108.     //    [HideInInspector]
    109.         public bool haveGun42 = false; //Saw
    110.     //    [HideInInspector]
    111.         public bool haveGun43 = false; //Machete
    112.     //    [HideInInspector]
    113.         public bool haveGun44 = false; //Mallet
    114.     //    [HideInInspector]
    115.         public bool haveGun45 = false; //Mallet Round
    116.     //    [HideInInspector]
    117.         public bool haveGun46 = false; //Painbrush
    118.     //    [HideInInspector]
    119.         public bool haveGun47 = false; //Pickaxe
    120.     //    [HideInInspector]
    121.         public bool haveGun48 = false; //Sickle
    122.     //    [HideInInspector]
    123.         public bool haveGun49 = false; //Trowel
    124.  
    125.         public Button Bgun1, Bgun2, Bgun3, Bgun4, Bgun5, Bgun6, Bgun7, Bgun8, Bgun9;
    126.         public Button Bgun10, Bgun11, Bgun12, Bgun13, Bgun14, Bgun15, Bgun16, Bgun17, Bgun18, Bgun19;
    127.         public Button Bgun20, Bgun21, Bgun23, Bgun24, Bgun25, Bgun26, Bgun27, Bgun28, Bgun29;
    128.         public Button Bgun30, Bgun31, Bgun32, Bgun33, Bgun34, Bgun35, Bgun36, Bgun37, Bgun38, Bgun39;
    129.         public Button Bgun40, Bgun41, Bgun42, Bgun43, Bgun44, Bgun45, Bgun46, Bgun47, Bgun48, Bgun49;
    130.  
    131.         ///////////////////////////////////////////////////////////////////////////////////////////////////
    132.         ///// START ENGINES ///////////////////////////////////////////////////////////////////////////////
    133.         ///////////////////////////////////////////////////////////////////////////////////////////////////
    134.  
    135. //        void Awake ()
    136. //        {
    137. //            playerComponent = Camera.main.GetComponent<CameraKick>().playerObj.GetComponent<FPSPlayer>();
    138. //            playerWeapons = GameObject.FindObjectOfType (typeof(PlayerWeapons)) as PlayerWeapons;
    139. //            mouse = GameObject.FindObjectOfType (typeof(SmoothMouseLook)) as SmoothMouseLook;
    140. //            dof = GameObject.Find("Weapon Camera").GetComponent<DepthOfFieldDeprecated>();
    141. //            GunMenuUi = GameObject.FindGameObjectWithTag("GunMenuUi");
    142. //          
    143. //            GunMenuUi.SetActive (false);
    144. //        }
    145.  
    146.         void Start ()
    147.         {
    148. //            playerComponent = Camera.main.GetComponent<CameraKick>().playerObj.GetComponent<FPSPlayer>();
    149. //            playerWeapons = GameObject.FindObjectOfType (typeof(PlayerWeapons)) as PlayerWeapons;
    150. //            mouse = GameObject.FindObjectOfType (typeof(SmoothMouseLook)) as SmoothMouseLook;
    151. //            dof = GameObject.Find("Weapon Camera").GetComponent<DepthOfFieldDeprecated>();
    152. //            GunMenuUi = GameObject.FindGameObjectWithTag("GunMenuUi");
    153.  
    154.             GunMenuUi.SetActive (false);
    155.         }
    156.  
    157.         private void SetMenuStatus (bool open){
    158.             isMenuOpen = open;
    159.             if (open){
    160.                 PauseMenuPanel.SetActive (false);
    161.                 GunMenuUi.SetActive(true);
    162.                 dof.enabled = true;
    163.                 Cursor.lockState = CursorLockMode.None;
    164.                 Cursor.visible = true;
    165.                 mouse.enabled  = false;
    166.                 Time.timeScale = 1;
    167.                 playerComponent.bulletTimeActive = true;
    168.                 StartCoroutine(playerWeapons.SelectWeapon(0));
    169.             }else{
    170.                 PauseMenuPanel.SetActive (false);
    171.                 GunMenuUi.SetActive(false);
    172.                 dof.enabled = false;
    173.                 Cursor.lockState = CursorLockMode.Locked;
    174.                 Cursor.visible = false;
    175.                 mouse.enabled  = true;
    176.                 playerComponent.bulletTimeActive = false;
    177.             }
    178.         }
    179.  
    180.         ///////////////////////////////////////////////////////////////////////////////////////////////////
    181.         ///// SYSTEMS GO //////////////////////////////////////////////////////////////////////////////////
    182.         ///////////////////////////////////////////////////////////////////////////////////////////////////
    183.  
    184.         void Update ()
    185.         {
    186.             if (Input.GetButtonDown ("WeaponMenu"))    {
    187.                 SetMenuStatus (!isMenuOpen);
    188.             }
    189.  
    190.             if (haveGun1 == true) {
    191.                 Bgun1.interactable = true;
    192.             } else {
    193.                 Bgun1.interactable = false;
    194.             }
    195.             if (haveGun2 == true) {
    196.                 Bgun2.interactable = true;
    197.             } else {
    198.                 Bgun2.interactable = false;
    199.             }
    200.             if (haveGun3 == true) {
    201.                 Bgun3.interactable = true;
    202.             } else {
    203.                 Bgun3.interactable = false;
    204.             }
    205.             if (haveGun4 == true) {
    206.                 Bgun4.interactable = true;
    207.             } else {
    208.                 Bgun4.interactable = false;
    209.             }
    210.             if (haveGun5 == true) {
    211.                 Bgun5.interactable = true;
    212.             } else {
    213.                 Bgun5.interactable = false;
    214.             }
    215.             if (haveGun6 == true) {
    216.                 Bgun6.interactable = true;
    217.             } else {
    218.                 Bgun6.interactable = false;
    219.             }
    220.             if (haveGun7 == true) {
    221.                 Bgun7.interactable = true;
    222.             } else {
    223.                 Bgun7.interactable = false;
    224.             }
    225.             if (haveGun8 == true) {
    226.                 Bgun8.interactable = true;
    227.             } else {
    228.                 Bgun8.interactable = false;
    229.             }
    230.             if (haveGun9 == true) {
    231.                 Bgun9.interactable = true;
    232.             } else {
    233.                 Bgun9.interactable = false;
    234.             }
    235.  
    236.             if (haveGun10 == true) {
    237.                 Bgun10.interactable = true;
    238.             } else {
    239.                 Bgun10.interactable = false;
    240.             }
    241.             if (haveGun11 == true) {
    242.                 Bgun11.interactable = true;
    243.             } else {
    244.                 Bgun11.interactable = false;
    245.             }
    246.             if (haveGun12 == true) {
    247.                 Bgun12.interactable = true;
    248.             } else {
    249.                 Bgun12.interactable = false;
    250.             }
    251.             if (haveGun13 == true) {
    252.                 Bgun13.interactable = true;
    253.             } else {
    254.                 Bgun13.interactable = false;
    255.             }
    256.             if (haveGun14 == true) {
    257.                 Bgun14.interactable = true;
    258.             } else {
    259.                 Bgun14.interactable = false;
    260.             }
    261.             if (haveGun15 == true) {
    262.                 Bgun15.interactable = true;
    263.             } else {
    264.                 Bgun15.interactable = false;
    265.             }
    266.             if (haveGun16 == true) {
    267.                 Bgun16.interactable = true;
    268.             } else {
    269.                 Bgun16.interactable = false;
    270.             }
    271.             if (haveGun17 == true) {
    272.                 Bgun17.interactable = true;
    273.             } else {
    274.                 Bgun17.interactable = false;
    275.             }
    276.             if (haveGun18 == true) {
    277.                 Bgun18.interactable = true;
    278.             } else {
    279.                 Bgun18.interactable = false;
    280.             }
    281.             if (haveGun19 == true) {
    282.                 Bgun19.interactable = true;
    283.             } else {
    284.                 Bgun19.interactable = false;
    285.             }
    286.  
    287.             if (haveGun20 == true) {
    288.                 Bgun20.interactable = true;
    289.             } else {
    290.                 Bgun20.interactable = false;
    291.             }
    292.             if (haveGun21 == true) {
    293.                 Bgun21.interactable = true;
    294.             } else {
    295.                 Bgun21.interactable = false;
    296.             }
    297. //            if (haveGun22 == true) {
    298. //                Bgun22.interactable = true;
    299. //            } else {
    300. //                Bgun22.interactable = false;
    301. //            }
    302.             if (haveGun23 == true) {
    303.                 Bgun23.interactable = true;
    304.             } else {
    305.                 Bgun23.interactable = false;
    306.             }
    307.             if (haveGun24 == true) {
    308.                 Bgun24.interactable = true;
    309.             } else {
    310.                 Bgun24.interactable = false;
    311.             }
    312.             if (haveGun25 == true) {
    313.                 Bgun25.interactable = true;
    314.             } else {
    315.                 Bgun25.interactable = false;
    316.             }
    317.             if (haveGun26 == true) {
    318.                 Bgun26.interactable = true;
    319.             } else {
    320.                 Bgun26.interactable = false;
    321.             }
    322.             if (haveGun27 == true) {
    323.                 Bgun27.interactable = true;
    324.             } else {
    325.                 Bgun27.interactable = false;
    326.             }
    327.             if (haveGun28 == true) {
    328.                 Bgun28.interactable = true;
    329.             } else {
    330.                 Bgun28.interactable = false;
    331.             }
    332.             if (haveGun29 == true) {
    333.                 Bgun29.interactable = true;
    334.             } else {
    335.                 Bgun29.interactable = false;
    336.             }
    337.  
    338.             if (haveGun30 == true) {
    339.                 Bgun30.interactable = true;
    340.             } else {
    341.                 Bgun30.interactable = false;
    342.             }
    343.             if (haveGun31 == true) {
    344.                 Bgun31.interactable = true;
    345.             } else {
    346.                 Bgun31.interactable = false;
    347.             }
    348.             if (haveGun32 == true) {
    349.                 Bgun32.interactable = true;
    350.             } else {
    351.                 Bgun32.interactable = false;
    352.             }
    353.             if (haveGun33 == true) {
    354.                 Bgun33.interactable = true;
    355.             } else {
    356.                 Bgun33.interactable = false;
    357.             }
    358.             if (haveGun34 == true) {
    359.                 Bgun34.interactable = true;
    360.             } else {
    361.                 Bgun34.interactable = false;
    362.             }
    363.             if (haveGun35 == true) {
    364.                 Bgun35.interactable = true;
    365.             } else {
    366.                 Bgun35.interactable = false;
    367.             }
    368.             if (haveGun36 == true) {
    369.                 Bgun36.interactable = true;
    370.             } else {
    371.                 Bgun36.interactable = false;
    372.             }
    373.             if (haveGun37 == true) {
    374.                 Bgun37.interactable = true;
    375.             } else {
    376.                 Bgun37.interactable = false;
    377.             }
    378.             if (haveGun38 == true) {
    379.                 Bgun38.interactable = true;
    380.             } else {
    381.                 Bgun38.interactable = false;
    382.             }
    383.             if (haveGun39 == true) {
    384.                 Bgun39.interactable = true;
    385.             } else {
    386.                 Bgun39.interactable = false;
    387.             }
    388.  
    389.             if (haveGun40 == true) {
    390.                 Bgun40.interactable = true;
    391.             } else {
    392.                 Bgun40.interactable = false;
    393.             }
    394.             if (haveGun41 == true) {
    395.                 Bgun41.interactable = true;
    396.             } else {
    397.                 Bgun41.interactable = false;
    398.             }
    399.             if (haveGun42 == true) {
    400.                 Bgun42.interactable = true;
    401.             } else {
    402.                 Bgun42.interactable = false;
    403.             }
    404.             if (haveGun43 == true) {
    405.                 Bgun43.interactable = true;
    406.             } else {
    407.                 Bgun43.interactable = false;
    408.             }
    409.             if (haveGun44 == true) {
    410.                 Bgun44.interactable = true;
    411.             } else {
    412.                 Bgun44.interactable = false;
    413.             }
    414.             if (haveGun45 == true) {
    415.                 Bgun45.interactable = true;
    416.             } else {
    417.                 Bgun45.interactable = false;
    418.             }
    419.             if (haveGun46 == true) {
    420.                 Bgun46.interactable = true;
    421.             } else {
    422.                 Bgun46.interactable = false;
    423.             }
    424.             if (haveGun47 == true) {
    425.                 Bgun47.interactable = true;
    426.             } else {
    427.                 Bgun47.interactable = false;
    428.             }
    429.             if (haveGun48 == true) {
    430.                 Bgun48.interactable = true;
    431.             } else {
    432.                 Bgun48.interactable = false;
    433.             }
    434.             if (haveGun49 == true) {
    435.                 Bgun49.interactable = true;
    436.             } else {
    437.                 Bgun49.interactable = false;
    438.             }
    439.         }
    440.  
    441.         ///////////////////////////////////////////////////////////////////////////////////////////////////
    442.         ///// SELECTING GUNS //////////////////////////////////////////////////////////////////////////////
    443.         ///////////////////////////////////////////////////////////////////////////////////////////////////
    444.  
    445.         public void SelectGun1(){
    446.             var playerWeapons = GameObject.FindObjectOfType (typeof(PlayerWeapons)) as PlayerWeapons;
    447.             if (playerWeapons.currentWeapon != 1) {
    448.                 StartCoroutine (playerWeapons.SelectWeapon (1));
    449.             }
    450.         }
    451.         public void SelectGun2(){
    452.             var playerWeapons = GameObject.FindObjectOfType (typeof(PlayerWeapons)) as PlayerWeapons;
    453.             if (playerWeapons.currentWeapon != 2) {
    454.                 StartCoroutine (playerWeapons.SelectWeapon (2));
    455.             }
    456.         }
    457.         public void SelectGun3(){
    458.             var playerWeapons = GameObject.FindObjectOfType (typeof(PlayerWeapons)) as PlayerWeapons;
    459.             if (playerWeapons.currentWeapon != 3) {
    460.                 StartCoroutine (playerWeapons.SelectWeapon (3));
    461.             }
    462.         }
    463.         public void SelectGun4(){
    464.             var playerWeapons = GameObject.FindObjectOfType (typeof(PlayerWeapons)) as PlayerWeapons;
    465.             if (playerWeapons.currentWeapon != 4) {
    466.                 StartCoroutine (playerWeapons.SelectWeapon (4));
    467.             }
    468.         }
    469.         public void SelectGun5(){
    470.             var playerWeapons = GameObject.FindObjectOfType (typeof(PlayerWeapons)) as PlayerWeapons;
    471.             if (playerWeapons.currentWeapon != 5) {
    472.                 StartCoroutine (playerWeapons.SelectWeapon (5));
    473.             }
    474.         }
    475.         public void SelectGun6(){
    476.             var playerWeapons = GameObject.FindObjectOfType (typeof(PlayerWeapons)) as PlayerWeapons;
    477.             if (playerWeapons.currentWeapon != 6) {
    478.                 StartCoroutine (playerWeapons.SelectWeapon (6));
    479.             }
    480.         }
    481.         public void SelectGun7(){
    482.             var playerWeapons = GameObject.FindObjectOfType (typeof(PlayerWeapons)) as PlayerWeapons;
    483.             if (playerWeapons.currentWeapon != 7) {
    484.                 StartCoroutine (playerWeapons.SelectWeapon (7));
    485.             }
    486.         }
    487.         public void SelectGun8(){
    488.             var playerWeapons = GameObject.FindObjectOfType (typeof(PlayerWeapons)) as PlayerWeapons;
    489.             if (playerWeapons.currentWeapon != 8) {
    490.                 StartCoroutine (playerWeapons.SelectWeapon (8));
    491.             }
    492.         }
    493.         public void SelectGun9(){
    494.             var playerWeapons = GameObject.FindObjectOfType (typeof(PlayerWeapons)) as PlayerWeapons;
    495.             if (playerWeapons.currentWeapon != 9) {
    496.                 StartCoroutine (playerWeapons.SelectWeapon (9));
    497.             }
    498.         }
    499.         public void SelectGun10(){
    500.             var playerWeapons = GameObject.FindObjectOfType (typeof(PlayerWeapons)) as PlayerWeapons;
    501.             if (playerWeapons.currentWeapon != 10) {
    502.                 StartCoroutine (playerWeapons.SelectWeapon (10));
    503.             }
    504.         }
    505.  
    506.         public void SelectGun11(){
    507.             var playerWeapons = GameObject.FindObjectOfType (typeof(PlayerWeapons)) as PlayerWeapons;
    508.             if (playerWeapons.currentWeapon != 11) {
    509.                 StartCoroutine (playerWeapons.SelectWeapon (11));
    510.             }
    511.         }
    512.         public void SelectGun12(){
    513.             var playerWeapons = GameObject.FindObjectOfType (typeof(PlayerWeapons)) as PlayerWeapons;
    514.             if (playerWeapons.currentWeapon != 12) {
    515.                 StartCoroutine (playerWeapons.SelectWeapon (12));
    516.             }
    517.         }
    518.         public void SelectGun13(){
    519.             var playerWeapons = GameObject.FindObjectOfType (typeof(PlayerWeapons)) as PlayerWeapons;
    520.             if (playerWeapons.currentWeapon != 13) {
    521.                 StartCoroutine (playerWeapons.SelectWeapon (13));
    522.             }
    523.         }
    524.         public void SelectGun14(){
    525.             var playerWeapons = GameObject.FindObjectOfType (typeof(PlayerWeapons)) as PlayerWeapons;
    526.             if (playerWeapons.currentWeapon != 14) {
    527.                 StartCoroutine (playerWeapons.SelectWeapon (14));
    528.             }
    529.         }
    530.         public void SelectGun15(){
    531.             var playerWeapons = GameObject.FindObjectOfType (typeof(PlayerWeapons)) as PlayerWeapons;
    532.             if (playerWeapons.currentWeapon != 15) {
    533.                 StartCoroutine (playerWeapons.SelectWeapon (15));
    534.             }
    535.         }
    536.         public void SelectGun16(){
    537.             var playerWeapons = GameObject.FindObjectOfType (typeof(PlayerWeapons)) as PlayerWeapons;
    538.             if (playerWeapons.currentWeapon != 16) {
    539.                 StartCoroutine (playerWeapons.SelectWeapon (16));
    540.             }
    541.         }
    542.         public void SelectGun17(){
    543.             var playerWeapons = GameObject.FindObjectOfType (typeof(PlayerWeapons)) as PlayerWeapons;
    544.             if (playerWeapons.currentWeapon != 17) {
    545.                 StartCoroutine (playerWeapons.SelectWeapon (17));
    546.             }
    547.         }
    548.         public void SelectGun18(){
    549.             var playerWeapons = GameObject.FindObjectOfType (typeof(PlayerWeapons)) as PlayerWeapons;
    550.             if (playerWeapons.currentWeapon != 18) {
    551.                 StartCoroutine (playerWeapons.SelectWeapon (18));
    552.             }
    553.         }
    554.         public void SelectGun19(){
    555.             var playerWeapons = GameObject.FindObjectOfType (typeof(PlayerWeapons)) as PlayerWeapons;
    556.             if (playerWeapons.currentWeapon != 19) {
    557.                 StartCoroutine (playerWeapons.SelectWeapon (19));
    558.             }
    559.         }
    560.         public void SelectGun20(){
    561.             var playerWeapons = GameObject.FindObjectOfType (typeof(PlayerWeapons)) as PlayerWeapons;
    562.             if (playerWeapons.currentWeapon != 20) {
    563.                 StartCoroutine (playerWeapons.SelectWeapon (20));
    564.             }
    565.         }
    566.  
    567.         public void SelectGun21(){
    568.             var playerWeapons = GameObject.FindObjectOfType (typeof(PlayerWeapons)) as PlayerWeapons;
    569.             if (playerWeapons.currentWeapon != 21) {
    570.                 StartCoroutine (playerWeapons.SelectWeapon (21));
    571.             }
    572.         }
    573. //        public void SelectGun22(){
    574. //            var playerWeapons = GameObject.FindObjectOfType (typeof(PlayerWeapons)) as PlayerWeapons;
    575. //            if (playerWeapons.currentWeapon != 22) {
    576. //                StartCoroutine (playerWeapons.SelectWeapon (22));
    577. //            }
    578. //        }
    579.         public void SelectGun23(){
    580.             var playerWeapons = GameObject.FindObjectOfType (typeof(PlayerWeapons)) as PlayerWeapons;
    581.             if (playerWeapons.currentWeapon != 23) {
    582.                 StartCoroutine (playerWeapons.SelectWeapon (23));
    583.             }
    584.         }
    585.         public void SelectGun24(){
    586.             var playerWeapons = GameObject.FindObjectOfType (typeof(PlayerWeapons)) as PlayerWeapons;
    587.             if (playerWeapons.currentWeapon != 24) {
    588.                 StartCoroutine (playerWeapons.SelectWeapon (24));
    589.             }
    590.         }
    591.         public void SelectGun25(){
    592.             var playerWeapons = GameObject.FindObjectOfType (typeof(PlayerWeapons)) as PlayerWeapons;
    593.             if (playerWeapons.currentWeapon != 25) {
    594.                 StartCoroutine (playerWeapons.SelectWeapon (25));
    595.             }
    596.         }
    597.         public void SelectGun26(){
    598.             var playerWeapons = GameObject.FindObjectOfType (typeof(PlayerWeapons)) as PlayerWeapons;
    599.             if (playerWeapons.currentWeapon != 26) {
    600.                 StartCoroutine (playerWeapons.SelectWeapon (26));
    601.             }
    602.         }
    603.         public void SelectGun27(){
    604.             var playerWeapons = GameObject.FindObjectOfType (typeof(PlayerWeapons)) as PlayerWeapons;
    605.             if (playerWeapons.currentWeapon != 27) {
    606.                 StartCoroutine (playerWeapons.SelectWeapon (27));
    607.             }
    608.         }
    609.         public void SelectGun28(){
    610.             var playerWeapons = GameObject.FindObjectOfType (typeof(PlayerWeapons)) as PlayerWeapons;
    611.             if (playerWeapons.currentWeapon != 28) {
    612.                 StartCoroutine (playerWeapons.SelectWeapon (28));
    613.             }
    614.         }
    615.         public void SelectGun29(){
    616.             var playerWeapons = GameObject.FindObjectOfType (typeof(PlayerWeapons)) as PlayerWeapons;
    617.             if (playerWeapons.currentWeapon != 29) {
    618.                 StartCoroutine (playerWeapons.SelectWeapon (29));
    619.             }
    620.         }
    621.         public void SelectGun30(){
    622.             var playerWeapons = GameObject.FindObjectOfType (typeof(PlayerWeapons)) as PlayerWeapons;
    623.             if (playerWeapons.currentWeapon != 30) {
    624.                 StartCoroutine (playerWeapons.SelectWeapon (30));
    625.             }
    626.         }
    627.  
    628.         public void SelectGun31(){
    629.             var playerWeapons = GameObject.FindObjectOfType (typeof(PlayerWeapons)) as PlayerWeapons;
    630.             if (playerWeapons.currentWeapon != 31) {
    631.                 StartCoroutine (playerWeapons.SelectWeapon (31));
    632.             }
    633.         }
    634.         public void SelectGun32(){
    635.             var playerWeapons = GameObject.FindObjectOfType (typeof(PlayerWeapons)) as PlayerWeapons;
    636.             if (playerWeapons.currentWeapon != 32) {
    637.                 StartCoroutine (playerWeapons.SelectWeapon (32));
    638.             }
    639.         }
    640.         public void SelectGun33(){
    641.             var playerWeapons = GameObject.FindObjectOfType (typeof(PlayerWeapons)) as PlayerWeapons;
    642.             if (playerWeapons.currentWeapon != 33) {
    643.                 StartCoroutine (playerWeapons.SelectWeapon (33));
    644.             }
    645.         }
    646.         public void SelectGun34(){
    647.             var playerWeapons = GameObject.FindObjectOfType (typeof(PlayerWeapons)) as PlayerWeapons;
    648.             if (playerWeapons.currentWeapon != 34) {
    649.                 StartCoroutine (playerWeapons.SelectWeapon (34));
    650.             }
    651.         }
    652.         public void SelectGun35(){
    653.             var playerWeapons = GameObject.FindObjectOfType (typeof(PlayerWeapons)) as PlayerWeapons;
    654.             if (playerWeapons.currentWeapon != 35) {
    655.                 StartCoroutine (playerWeapons.SelectWeapon (35));
    656.             }
    657.         }
    658.         public void SelectGun36(){
    659.             var playerWeapons = GameObject.FindObjectOfType (typeof(PlayerWeapons)) as PlayerWeapons;
    660.             if (playerWeapons.currentWeapon != 36) {
    661.                 StartCoroutine (playerWeapons.SelectWeapon (36));
    662.             }
    663.         }
    664.         public void SelectGun37(){
    665.             var playerWeapons = GameObject.FindObjectOfType (typeof(PlayerWeapons)) as PlayerWeapons;
    666.             if (playerWeapons.currentWeapon != 37) {
    667.                 StartCoroutine (playerWeapons.SelectWeapon (37));
    668.             }
    669.         }
    670.         public void SelectGun38(){
    671.             var playerWeapons = GameObject.FindObjectOfType (typeof(PlayerWeapons)) as PlayerWeapons;
    672.             if (playerWeapons.currentWeapon != 38) {
    673.                 StartCoroutine (playerWeapons.SelectWeapon (38));
    674.             }
    675.         }
    676.         public void SelectGun39(){
    677.             var playerWeapons = GameObject.FindObjectOfType (typeof(PlayerWeapons)) as PlayerWeapons;
    678.             if (playerWeapons.currentWeapon != 39) {
    679.                 StartCoroutine (playerWeapons.SelectWeapon (39));
    680.             }
    681.         }
    682.         public void SelectGun40(){
    683.             var playerWeapons = GameObject.FindObjectOfType (typeof(PlayerWeapons)) as PlayerWeapons;
    684.             if (playerWeapons.currentWeapon != 40) {
    685.                 StartCoroutine (playerWeapons.SelectWeapon (40));
    686.             }
    687.         }
    688.  
    689.         public void SelectGun41(){
    690.             var playerWeapons = GameObject.FindObjectOfType (typeof(PlayerWeapons)) as PlayerWeapons;
    691.             if (playerWeapons.currentWeapon != 41) {
    692.                 StartCoroutine (playerWeapons.SelectWeapon (41));
    693.             }
    694.         }
    695.         public void SelectGun42(){
    696.             var playerWeapons = GameObject.FindObjectOfType (typeof(PlayerWeapons)) as PlayerWeapons;
    697.             if (playerWeapons.currentWeapon != 42) {
    698.                 StartCoroutine (playerWeapons.SelectWeapon (42));
    699.             }
    700.         }
    701.         public void SelectGun43(){
    702.             var playerWeapons = GameObject.FindObjectOfType (typeof(PlayerWeapons)) as PlayerWeapons;
    703.             if (playerWeapons.currentWeapon != 43) {
    704.                 StartCoroutine (playerWeapons.SelectWeapon (43));
    705.             }
    706.         }
    707.         public void SelectGun44(){
    708.             var playerWeapons = GameObject.FindObjectOfType (typeof(PlayerWeapons)) as PlayerWeapons;
    709.             if (playerWeapons.currentWeapon != 44) {
    710.                 StartCoroutine (playerWeapons.SelectWeapon (44));
    711.             }
    712.         }
    713.         public void SelectGun45(){
    714.             var playerWeapons = GameObject.FindObjectOfType (typeof(PlayerWeapons)) as PlayerWeapons;
    715.             if (playerWeapons.currentWeapon != 45) {
    716.                 StartCoroutine (playerWeapons.SelectWeapon (45));
    717.             }
    718.         }
    719.         public void SelectGun46(){
    720.             var playerWeapons = GameObject.FindObjectOfType (typeof(PlayerWeapons)) as PlayerWeapons;
    721.             if (playerWeapons.currentWeapon != 46) {
    722.                 StartCoroutine (playerWeapons.SelectWeapon (46));
    723.             }
    724.         }
    725.         public void SelectGun47(){
    726.             var playerWeapons = GameObject.FindObjectOfType (typeof(PlayerWeapons)) as PlayerWeapons;
    727.             if (playerWeapons.currentWeapon != 47) {
    728.                 StartCoroutine (playerWeapons.SelectWeapon (47));
    729.             }
    730.         }
    731.         public void SelectGun48(){
    732.             var playerWeapons = GameObject.FindObjectOfType (typeof(PlayerWeapons)) as PlayerWeapons;
    733.             if (playerWeapons.currentWeapon != 48) {
    734.                 StartCoroutine (playerWeapons.SelectWeapon (48));
    735.             }
    736.         }
    737.         public void SelectGun49(){
    738.             var playerWeapons = GameObject.FindObjectOfType (typeof(PlayerWeapons)) as PlayerWeapons;
    739.             if (playerWeapons.currentWeapon != 49) {
    740.                 StartCoroutine (playerWeapons.SelectWeapon (49));
    741.             }
    742.         }
    743.  
    744.     }
    745. }
    Set on Each Weapon

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. namespace jims
    5. {
    6.     public class JimsSetWeaponDrop : MonoBehaviour
    7.     {
    8.         jimsOpenWeaponMenu WM;
    9.         public bool haveGun1 = false; //Combat Knife
    10.         public bool haveGun2 = false; //Basball Bat
    11.         public bool haveGun3 = false; //Pistol
    12.         public bool haveGun4 = false; //Deagle
    13.         public bool haveGun5 = false; //Revolver
    14.         public bool haveGun6 = false; //SMG
    15.         public bool haveGun7 = false; //Silent SMG
    16.         public bool haveGun8 = false; //PDW
    17.         public bool haveGun9 = false; //Pump-Action Shotgun
    18.         public bool haveGun10 = false; //Auto Shotgun
    19.    
    20.         public bool haveGun11 = false; //LMG
    21.         public bool haveGun12 = false; //Assault Rifle
    22.         public bool haveGun13 = false; //Bolt Action Sniper
    23.         public bool haveGun14 = false; //Crossbow
    24.         public bool haveGun15 = false; //RPG8
    25.         public bool haveGun16 = false; //Flamer
    26.         public bool haveGun17 = false; //Minigun
    27.         public bool haveGun18 = false; //Uber LMG
    28.         public bool haveGun19 = false; //Uber Combat Knife
    29.         public bool haveGun20 = false; //Pulser
    30.    
    31.         public bool haveGun21 = false; //Slugger
    32.         public bool haveGun23 = false; //M14
    33.         public bool haveGun24 = false; //Uber Revolver
    34.         public bool haveGun25 = false; //Sniper No Scope
    35.         public bool haveGun26 = false; //Heavy Sniper
    36.         public bool haveGun27 = false; //CQ16
    37.         public bool haveGun28 = false; //M64C
    38.         public bool haveGun29 = false; //Thumper
    39.         public bool haveGun30 = false; //Wooden Axe
    40.    
    41.         public bool haveGun31 = false; //SledgeHammer
    42.         public bool haveGun32 = false; //Spade
    43.         public bool haveGun33 = false; //Shovel
    44.         public bool haveGun34 = false; //Rake
    45.         public bool haveGun35 = false; //Pitchfork
    46.         public bool haveGun36 = false; //Hoe
    47.         public bool haveGun37 = false; //Broom
    48.         public bool haveGun38 = false; //Chisel
    49.         public bool haveGun39 = false; //Cleaver
    50.         public bool haveGun40 = false; //Hammer
    51.    
    52.         public bool haveGun41 = false; //HandRake
    53.         public bool haveGun42 = false; //Saw
    54.         public bool haveGun43 = false; //Machete
    55.         public bool haveGun44 = false; //Mallet
    56.         public bool haveGun45 = false; //Mallet Round
    57.         public bool haveGun46 = false; //Painbrush
    58.         public bool haveGun47 = false; //Pickaxe
    59.         public bool haveGun48 = false; //Sickle
    60.         public bool haveGun49 = false; //Trowel
    61.    
    62.         void Start(){
    63.             WM = GameObject.FindObjectOfType (typeof(jimsOpenWeaponMenu)) as jimsOpenWeaponMenu;
    64.         }
    65.  
    66.         public void RemovePickupJim (){  
    67.             jimsOpenWeaponMenu WM = GameObject.FindObjectOfType (typeof(jimsOpenWeaponMenu)) as jimsOpenWeaponMenu;
    68.             if (haveGun1 == true) {
    69.                 WM.haveGun1 = false;
    70.             }
    71.             if (haveGun2 == true) {
    72.                 WM.haveGun2 = false;
    73.             }
    74.             if (haveGun3 == true) {
    75.                 WM.haveGun3 = false;
    76.             }
    77.             if (haveGun4 == true) {
    78.                 WM.haveGun4 = false;
    79.             }
    80.             if (haveGun5 == true) {
    81.                 WM.haveGun5 = false;
    82.             }
    83.             if (haveGun6 == true) {
    84.                 WM.haveGun6 = false;
    85.             }
    86.             if (haveGun7 == true) {
    87.                 WM.haveGun7 = false;
    88.             }
    89.             if (haveGun8 == true) {
    90.                 WM.haveGun8 = false;
    91.             }
    92.             if (haveGun9 == true) {
    93.                 WM.haveGun9 = false;
    94.             }
    95.            
    96.             if (haveGun10 == true) {
    97.                 WM.haveGun10 = false;
    98.             }
    99.             if (haveGun11 == true) {
    100.                 WM.haveGun11 = false;
    101.             }
    102.             if (haveGun12 == true) {
    103.                 WM.haveGun12 = false;
    104.             }
    105.             if (haveGun13 == true) {
    106.                 WM.haveGun13 = false;
    107.             }
    108.             if (haveGun14 == true) {
    109.                 WM.haveGun14 = false;
    110.             }
    111.             if (haveGun15 == true) {
    112.                 WM.haveGun15 = false;
    113.             }
    114.             if (haveGun16 == true) {
    115.                 WM.haveGun16 = false;
    116.             }
    117.             if (haveGun17 == true) {
    118.                 WM.haveGun17 = false;
    119.             }
    120.             if (haveGun18 == true) {
    121.                 WM.haveGun18 = false;
    122.             }
    123.             if (haveGun19 == true) {
    124.                 WM.haveGun19 = false;
    125.             }
    126.            
    127.             if (haveGun20 == true) {
    128.                 WM.haveGun20 = false;
    129.             }
    130.             if (haveGun21 == true) {
    131.                 WM.haveGun21 = false;
    132.             }
    133.             if (haveGun23 == true) {
    134.                 WM.haveGun23 = false;
    135.             }
    136.             if (haveGun24 == true) {
    137.                 WM.haveGun24 = false;
    138.             }
    139.             if (haveGun25 == true) {
    140.                 WM.haveGun25 = false;
    141.             }
    142.             if (haveGun26 == true) {
    143.                 WM.haveGun26 = false;
    144.             }
    145.             if (haveGun27 == true) {
    146.                 WM.haveGun27 = false;
    147.             }
    148.             if (haveGun28 == true) {
    149.                 WM.haveGun28 = false;
    150.             }
    151.             if (haveGun29 == true) {
    152.                 WM.haveGun29 = false;
    153.             }
    154.            
    155.             if (haveGun30 == true) {
    156.                 WM.haveGun30 = false;
    157.             }
    158.             if (haveGun31 == true) {
    159.                 WM.haveGun31 = false;
    160.             }
    161.             if (haveGun32 == true) {
    162.                 WM.haveGun32 = false;
    163.             }
    164.             if (haveGun33 == true) {
    165.                 WM.haveGun33 = false;
    166.             }
    167.             if (haveGun34 == true) {
    168.                 WM.haveGun34 = false;
    169.             }
    170.             if (haveGun35 == true) {
    171.                 WM.haveGun35 = false;
    172.             }
    173.             if (haveGun36 == true) {
    174.                 WM.haveGun36 = false;
    175.             }
    176.             if (haveGun37 == true) {
    177.                 WM.haveGun37 = false;
    178.             }
    179.             if (haveGun38 == true) {
    180.                 WM.haveGun38 = false;
    181.             }
    182.             if (haveGun39 == true) {
    183.                 WM.haveGun39 = false;
    184.             }
    185.            
    186.             if (haveGun40 == true) {
    187.                 WM.haveGun40 = false;
    188.             }
    189.             if (haveGun41 == true) {
    190.                 WM.haveGun41 = false;
    191.             }
    192.             if (haveGun42 == true) {
    193.                 WM.haveGun42 = false;
    194.             }
    195.             if (haveGun43 == true) {
    196.                 WM.haveGun43 = false;
    197.             }
    198.             if (haveGun44 == true) {
    199.                 WM.haveGun44 = false;
    200.             }
    201.             if (haveGun45 == true) {
    202.                 WM.haveGun45 = false;
    203.             }
    204.             if (haveGun46 == true) {
    205.                 WM.haveGun46 = false;
    206.             }
    207.             if (haveGun47 == true) {
    208.                 WM.haveGun47 = false;
    209.             }
    210.             if (haveGun48 == true) {
    211.                 WM.haveGun48 = false;
    212.             }
    213.             if (haveGun49 == true) {
    214.                 WM.haveGun49 = false;
    215.             }
    216.         }
    217.  
    218.     }
    219. }
    Set On the Weapon Pickup
    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. namespace jims
    5. {
    6.     public class JimsSetWeaponPickup : MonoBehaviour
    7.     {
    8.         jimsOpenWeaponMenu WM;
    9.         public bool haveGun1 = false; //Combat Knife
    10.         public bool haveGun2 = false; //Basball Bat
    11.         public bool haveGun3 = false; //Pistol
    12.         public bool haveGun4 = false; //Deagle
    13.         public bool haveGun5 = false; //Revolver
    14.         public bool haveGun6 = false; //SMG
    15.         public bool haveGun7 = false; //Silent SMG
    16.         public bool haveGun8 = false; //PDW
    17.         public bool haveGun9 = false; //Pump-Action Shotgun
    18.         public bool haveGun10 = false; //Auto Shotgun
    19.    
    20.         public bool haveGun11 = false; //LMG
    21.         public bool haveGun12 = false; //Assault Rifle
    22.         public bool haveGun13 = false; //Bolt Action Sniper
    23.         public bool haveGun14 = false; //Crossbow
    24.         public bool haveGun15 = false; //RPG8
    25.         public bool haveGun16 = false; //Flamer
    26.         public bool haveGun17 = false; //Minigun
    27.         public bool haveGun18 = false; //Uber LMG
    28.         public bool haveGun19 = false; //Uber Combat Knife
    29.         public bool haveGun20 = false; //Pulser
    30.    
    31.         public bool haveGun21 = false; //Slugger
    32.         public bool haveGun23 = false; //M14
    33.         public bool haveGun24 = false; //Uber Revolver
    34.         public bool haveGun25 = false; //Sniper No Scope
    35.         public bool haveGun26 = false; //Heavy Sniper
    36.         public bool haveGun27 = false; //CQ16
    37.         public bool haveGun28 = false; //M64C
    38.         public bool haveGun29 = false; //Thumper
    39.         public bool haveGun30 = false; //Wooden Axe
    40.    
    41.         public bool haveGun31 = false; //SledgeHammer
    42.         public bool haveGun32 = false; //Spade
    43.         public bool haveGun33 = false; //Shovel
    44.         public bool haveGun34 = false; //Rake
    45.         public bool haveGun35 = false; //Pitchfork
    46.         public bool haveGun36 = false; //Hoe
    47.         public bool haveGun37 = false; //Broom
    48.         public bool haveGun38 = false; //Chisel
    49.         public bool haveGun39 = false; //Cleaver
    50.         public bool haveGun40 = false; //Hammer
    51.    
    52.         public bool haveGun41 = false; //HandRake
    53.         public bool haveGun42 = false; //Saw
    54.         public bool haveGun43 = false; //Machete
    55.         public bool haveGun44 = false; //Mallet
    56.         public bool haveGun45 = false; //Mallet Round
    57.         public bool haveGun46 = false; //Painbrush
    58.         public bool haveGun47 = false; //Pickaxe
    59.         public bool haveGun48 = false; //Sickle
    60.         public bool haveGun49 = false; //Trowel
    61.    
    62.         void Start(){
    63.             WM = GameObject.FindObjectOfType (typeof(jimsOpenWeaponMenu)) as jimsOpenWeaponMenu;
    64.         }
    65.  
    66.         public void PickupJim (){  
    67.             jimsOpenWeaponMenu WM = GameObject.FindObjectOfType (typeof(jimsOpenWeaponMenu)) as jimsOpenWeaponMenu;
    68.             if (haveGun1 == true) {
    69.                 WM.haveGun1 = true;
    70.             }
    71.             if (haveGun2 == true) {
    72.                 WM.haveGun2 = true;
    73.             }
    74.             if (haveGun3 == true) {
    75.                 WM.haveGun3 = true;
    76.             }
    77.             if (haveGun4 == true) {
    78.                 WM.haveGun4 = true;
    79.             }
    80.             if (haveGun5 == true) {
    81.                 WM.haveGun5 = true;
    82.             }
    83.             if (haveGun6 == true) {
    84.                 WM.haveGun6 = true;
    85.             }
    86.             if (haveGun7 == true) {
    87.                 WM.haveGun7 = true;
    88.             }
    89.             if (haveGun8 == true) {
    90.                 WM.haveGun8 = true;
    91.             }
    92.             if (haveGun9 == true) {
    93.                 WM.haveGun9 = true;
    94.             }
    95.        
    96.             if (haveGun10 == true) {
    97.                 WM.haveGun10 = true;
    98.             }
    99.             if (haveGun11 == true) {
    100.                 WM.haveGun11 = true;
    101.             }
    102.             if (haveGun12 == true) {
    103.                 WM.haveGun12 = true;
    104.             }
    105.             if (haveGun13 == true) {
    106.                 WM.haveGun13 = true;
    107.             }
    108.             if (haveGun14 == true) {
    109.                 WM.haveGun14 = true;
    110.             }
    111.             if (haveGun15 == true) {
    112.                 WM.haveGun15 = true;
    113.             }
    114.             if (haveGun16 == true) {
    115.                 WM.haveGun16 = true;
    116.             }
    117.             if (haveGun17 == true) {
    118.                 WM.haveGun17 = true;
    119.             }
    120.             if (haveGun18 == true) {
    121.                 WM.haveGun18 = true;
    122.             }
    123.             if (haveGun19 == true) {
    124.                 WM.haveGun19 = true;
    125.             }
    126.        
    127.             if (haveGun20 == true) {
    128.                 WM.haveGun20 = true;
    129.             }
    130.             if (haveGun21 == true) {
    131.                 WM.haveGun21 = true;
    132.             }
    133.             if (haveGun23 == true) {
    134.                 WM.haveGun23 = true;
    135.             }
    136.             if (haveGun24 == true) {
    137.                 WM.haveGun24 = true;
    138.             }
    139.             if (haveGun25 == true) {
    140.                 WM.haveGun25 = true;
    141.             }
    142.             if (haveGun26 == true) {
    143.                 WM.haveGun26 = true;
    144.             }
    145.             if (haveGun27 == true) {
    146.                 WM.haveGun27 = true;
    147.             }
    148.             if (haveGun28 == true) {
    149.                 WM.haveGun28 = true;
    150.             }
    151.             if (haveGun29 == true) {
    152.                 WM.haveGun29 = true;
    153.             }
    154.        
    155.             if (haveGun30 == true) {
    156.                 WM.haveGun30 = true;
    157.             }
    158.             if (haveGun31 == true) {
    159.                 WM.haveGun31 = true;
    160.             }
    161.             if (haveGun32 == true) {
    162.                 WM.haveGun32 = true;
    163.             }
    164.             if (haveGun33 == true) {
    165.                 WM.haveGun33 = true;
    166.             }
    167.             if (haveGun34 == true) {
    168.                 WM.haveGun34 = true;
    169.             }
    170.             if (haveGun35 == true) {
    171.                 WM.haveGun35 = true;
    172.             }
    173.             if (haveGun36 == true) {
    174.                 WM.haveGun36 = true;
    175.             }
    176.             if (haveGun37 == true) {
    177.                 WM.haveGun37 = true;
    178.             }
    179.             if (haveGun38 == true) {
    180.                 WM.haveGun38 = true;
    181.             }
    182.             if (haveGun39 == true) {
    183.                 WM.haveGun39 = true;
    184.             }
    185.        
    186.             if (haveGun40 == true) {
    187.                 WM.haveGun40 = true;
    188.             }
    189.             if (haveGun41 == true) {
    190.                 WM.haveGun41 = true;
    191.             }
    192.             if (haveGun42 == true) {
    193.                 WM.haveGun42 = true;
    194.             }
    195.             if (haveGun43 == true) {
    196.                 WM.haveGun43 = true;
    197.             }
    198.             if (haveGun44 == true) {
    199.                 WM.haveGun44 = true;
    200.             }
    201.             if (haveGun45 == true) {
    202.                 WM.haveGun45 = true;
    203.             }
    204.             if (haveGun46 == true) {
    205.                 WM.haveGun46 = true;
    206.             }
    207.             if (haveGun47 == true) {
    208.                 WM.haveGun47 = true;
    209.             }
    210.             if (haveGun48 == true) {
    211.                 WM.haveGun48 = true;
    212.             }
    213.             if (haveGun49 == true) {
    214.                 WM.haveGun49 = true;
    215.             }
    216.         }
    217.  
    218.     }
    219. }
    In Weapon Pickup.cs i changed some code
    Code (CSharp):
    1. JimsSetWeaponPickup JimPick;
    2.  
    3. void Start (){
    4.         JimPick = GetComponent<JimsSetWeaponPickup>();
    5. }
    6.  
    7. void PickUpItem ()
    8. {
    9.         JimsSetWeaponPickup JimPick = GetComponent<JimsSetWeaponPickup>();
    10.  
    11. //select the weapon after picking it up
    12.             //PlayerWeaponsComponent.StartCoroutine(PlayerWeaponsComponent.SelectWeapon(WeaponBehaviorComponent.weaponNumber));
    13.             //update the total weapon amount in PlayerWeapons.cs
    14.             PlayerWeaponsComponent.UpdateTotalWeapons();
    15.             //remove pickup item from game world and play sound
    16.             RemovePickup();
    17.  
    18.             JimPick.PickupJim(); ///// NEWLY ADDED
    19. }
    20.  
    :D
     
  19. txarly

    txarly

    Joined:
    Apr 27, 2016
    Posts:
    192

    Thank you JIMBOB, you are the best.The rotation problem is fixed, but the mouse flickers all the time and cannot move it.
    It seems there is a bug in 5.3 with the cursor in play mode , some people experiment flickering, or maybe i have the code in the update() inside a Switch(state) ,i don´t know really.
     
  20. A0101A

    A0101A

    Joined:
    Aug 9, 2013
    Posts:
    180
    Thanks, JIM, always good to hear from you... (+1 !) :)
    ...adding immediately, to my RFPS adventures, will have some time
    next week, for some dive-in, dive-out... (Come on, guys, if you
    have something, and is tested to work with RFPS, share it here)...
    ***The best day in your life is - the one you shared something, and it works ...
    :)
     
    Last edited: Feb 5, 2018
    Defcon44 likes this.
  21. Dawar

    Dawar

    Joined:
    Dec 7, 2014
    Posts:
    116
    hi !! one small question
    how to remove legs
     
  22. snowboardkid

    snowboardkid

    Joined:
    Jun 16, 2013
    Posts:
    17
    Uncheck the "Display Visible Body" box on the FPS Player object.
     
    Dawar likes this.
  23. Dawar

    Dawar

    Joined:
    Dec 7, 2014
    Posts:
    116
    thank you bro working
     
  24. Dawar

    Dawar

    Joined:
    Dec 7, 2014
    Posts:
    116
    I have very strange error
    the animator working with sandbox scene
    but not working in empty scene
    please tell me how to fix this issue
     
  25. egem2015

    egem2015

    Joined:
    Oct 27, 2015
    Posts:
    35
    Hi everybody

    i bought this asset and control-freak and i integrated both.

    But there is a problem in mobile.

    i am trying sandbox scene and game is so slow and responses my touches very slow.

    i changed the quality settings to simple but nothing changed.

    how can i solve this problem?

    can you help me?

    thanks in advance.
     
  26. TauseefCVS

    TauseefCVS

    Joined:
    Mar 28, 2016
    Posts:
    14
    because that scene is very heavy and have a lots of draw calls and fps is very minimum that's why touches working but GPU and CPU rendering is very slow you can use that thing in new scene then its working properly
     
  27. miguelmacias

    miguelmacias

    Joined:
    Apr 14, 2016
    Posts:
    16
    hey guys i download a map from the asset store and in certain areas the mouse player will stop moving and only mouse allowed to move but player stays stuck... happends in near objects and also near door corners...
     
  28. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    9,334
    Your player's Capsule Collider is probably getting stuck on another collider in the map. When this happens, pause the game and inspect the area in the Scene view. You may need to adjust colliders around the sticking points or add new, invisible colliders to prevent the player from moving too deep into them.
     
  29. miguelmacias

    miguelmacias

    Joined:
    Apr 14, 2016
    Posts:
    16
    is there way to adjust the rfps player camera for it to not allow that...?
     
  30. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    9,334
    Sorry, I don't think so. It sounds like it's just the way the level geometry is.
     
  31. lolclol

    lolclol

    Joined:
    Jan 24, 2013
    Posts:
    170
    how to replace the main fps player ? Also is there any gui tutorial for ammo,health bar ?
     
  32. llJIMBOBll

    llJIMBOBll

    Joined:
    Aug 23, 2014
    Posts:
    552
  33. thegamerguynz

    thegamerguynz

    Joined:
    Apr 1, 2016
    Posts:
    20
    Is there a way to change visible body component?
     
  34. lolclol

    lolclol

    Joined:
    Jan 24, 2013
    Posts:
    170
    i mean to say how can i change the default fps player in RFPS prefab with my own fps character ? is there any tutorial ?
     
  35. llJIMBOBll

    llJIMBOBll

    Joined:
    Aug 23, 2014
    Posts:
    552
    ah, I'm not sure about a tutorial but, all you need is your player body in legacy with legacy animations the same name as the original player, then you need to make 2 copies of your player.

    1 is for third person mode, and the other is for 1st person mode

    Third person mode doesn't need editing but the first person copy does, you need to split the head and arms. Best tool I found was FPS Mesh Tool, it will split the head arms and body to separate materials, then on the first person player mesh on the materials change from 3 to 1, this will keep the body material of the player.

    Then just apply the same scripts as the original and drag to the visible body gameobject.

    Make a copy of the original Visible body gameobject, as you can use it for reference if you get stuck.

    :D
     
  36. lolclol

    lolclol

    Joined:
    Jan 24, 2013
    Posts:
    170
    Sir can you make a video tutorial ? it would be great :)
     
  37. miguelmacias

    miguelmacias

    Joined:
    Apr 14, 2016
    Posts:
    16
    Quick question:
    i made a second scene but i will like to save the guns and bullets remaining when passed i got everything execpt when i load the second scene the guns and everything dissapear from player.. can this be possible to keep them on every level?
     
  38. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    9,334
    You'll need to write a script that records the player's current weapons and ammo before leaving the first level, and then applies that information after entering the second level. (Or, if you have the Dialogue System, just use its RFPS Support package.)
     
  39. wana7262

    wana7262

    Joined:
    Jul 2, 2012
    Posts:
    95
    any chance to have unity 4.6 support????
     
  40. polash

    polash

    Joined:
    Jul 8, 2015
    Posts:
    46
    Game Test v.02 IGI : Ghost Fighter


    added Thermal Cam :p , just work on Player, will add ai model later (used default)
    Thanks a lot @TonyLi for helping with many scripts. Without him i could not came so far :D
     
    Last edited: Jun 13, 2016
  41. Marcirazzo

    Marcirazzo

    Joined:
    Nov 27, 2015
    Posts:
    46
    In the new version of RFPS, where is player height mod?
     
  42. llJIMBOBll

    llJIMBOBll

    Joined:
    Aug 23, 2014
    Posts:
    552
    Look under Fps RigidBodyWalker :D, you can change camera height too
     
  43. servinova

    servinova

    Joined:
    Jan 7, 2013
    Posts:
    10
    Hello everyone.

    As you can make the enemy soldier fired without moving from site?

    Thank you
     
  44. Takahama

    Takahama

    Joined:
    Feb 18, 2014
    Posts:
    161
    i didnt get any answer, so im asking again,
    My all scenes are on pause mode without RFPS Player.
    i wanna make a cutscene but without RFPS Player in scene nothing works! its just like i press ESC and pause the game..
     
  45. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    9,334
    Does the Console log contain any errors or warnings?

    Does it behave this way when you play the scene directly from the editor, or only when you arrive in the scene from another scene?

    You can add this script to a GameObject to see if the game is paused:
    Code (csharp):
    1. using UnityEngine;
    2.  
    3. public class ShowTimeScale : MonoBehaviour {
    4.     void OnGUI() {
    5.         GUILayout.Label("Time.timeScale=" + Time.timeScale);
    6.     }
    7. }
    If it shows that timeScale is 0, the game is paused.

    Try an empty scene, or deactivate all the GameObjects in your cutscene scene. Gradually add/activate GameObjects until you find the one that's causing the problem.
     
  46. Marcirazzo

    Marcirazzo

    Joined:
    Nov 27, 2015
    Posts:
    46
    I'm not sure, but I think thath with RFPS Project Settings --> Time --> Time Scale is set to 0. Change it to 1.
     
    Takahama likes this.
  47. Marcirazzo

    Marcirazzo

    Joined:
    Nov 27, 2015
    Posts:
    46
    With Player height mod, all the values were automatically changed for the player's dimension. Now, it's impossible by changing individually camera heights, capsule heights and model heights. Solution?
     
  48. Takahama

    Takahama

    Joined:
    Feb 18, 2014
    Posts:
    161
    Well.. that was the problem! Fixed! Thanks @Marcirazzo !
    @TonyLi

    EDIT: @Azuline Studios please fix it on next versions =_=
     
  49. polash

    polash

    Joined:
    Jul 8, 2015
    Posts:
    46
    @TonyLi , need your help again
    need help on a script,
    what i want is, player enter a collider, press & hold button for 7 sec. (use on rfps) a animation will play, witch is atachted on object... door object
    on UI a slider bar will fill up from 0 to 100

    tryed many door script (found on youtube) to edit not working...
     
  50. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    9,334
    I'm out of the office, so I'm not able to test this script, but here's something to try:

    AnimationTimer.cs:
    Code (csharp):
    1. using UnityEngine;
    2.  
    3. public class AnimationTimer : MonoBehaviour {
    4.  
    5.     [Tooltip("Only activate if a GameObject with this tag enters the trigger.")]
    6.     public string playerTag = "Player";
    7.  
    8.     [Tooltip("Timer bar slider.")]
    9.     public UnityEngine.UI.Slider slider;
    10.  
    11.     [Tooltip("Increment the slider when this button is held down.")]
    12.     public string buttonName = "Fire1";
    13.  
    14.     [Tooltip("Player must hold the button down for this many seconds.")]
    15.     public float holdTime = 7f;
    16.  
    17.     [Tooltip("Control this Animator when the timer bar is full.")]
    18.     public Animator animator;
    19.  
    20.     [Tooltip("Set this trigger on the Animator when the timer bar is full.")]
    21.     public string animatorTrigger = "Open";
    22.  
    23.     private float elapsedTime = 0f;
    24.     private bool isPlayerInTrigger = false;
    25.     private bool isDoorOpen = false;
    26.  
    27.     void Start() {
    28.         slider.gameObject.SetActive(false);
    29.     }
    30.  
    31.     void OnTriggerEnter(Collider other) {
    32.         if (other.CompareTag(playerTag)) {
    33.             isPlayerInTrigger = true;
    34.             elapsedTime = 0;
    35.             slider.gameObject.SetActive(false);
    36.             slider.value = 0;
    37.         }
    38.     }
    39.  
    40.     void OnTriggerExit(Collider other) {
    41.         if (other.CompareTag(playerTag)) {
    42.             isPlayerInTrigger = false;
    43.             elapsedTime = 0;
    44.             slider.gameObject.SetActive(false);
    45.         }
    46.     }
    47.  
    48.     void Update() {
    49.         if (isPlayerInTrigger && Input.GetButton(buttonName)) {
    50.             elapsedTime += Time.deltaTime;
    51.             if (elapsedTime < holdTime) {
    52.                 slider.value = elapsedTime / holdTime;
    53.             } else if (!isDoorOpen) {
    54.                 isDoorOpen = true;
    55.                 slider.gameObject.SetActive(false);
    56.                 animator.SetTrigger(animatorTrigger);
    57.             }
    58.         }
    59.     }
    60. }
    How to use it: (assuming it compiles; again, I'm out of the office)

    1. Set up a GameObject with an Animator. Assign an Animator Controller with a trigger parameter. For example, the GameObject could be a door. The Animator Controller could have a trigger parameter named "Open" that plays an animation to open the door.

    2. Set up a UI slider.

    3. In Unity's Input Manager, define the input button that the player must hold.

    4. Set up a GameObject with a trigger collider. Add the script above. Assign:
    • Slider: The UI slider you set up.
    • Button Name: The input button you defined in #3 above.
    • Hold Time: The number of seconds the player must hold down the input button.
    • Animator: The GameObject with the Animator component (e.g., door).
    • Animator Trigger: The animator trigger parameter to set.
     
    Last edited: Jun 24, 2016
    SteveRyu likes this.