Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Realistic FPS Prefab [RELEASED]

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

  1. HNR2

    HNR2

    Joined:
    Nov 24, 2020
    Posts:
    1
    Hey i hope someone can help me here. Is there any "relatively easy" way to implement a staggering/getting hit animation to the enemies when they get shot in rfps? Sadly I'm not really experienced enough to come up with my own solution so some help would very much be appreciated.
     
  2. alonehuntert

    alonehuntert

    Joined:
    Oct 12, 2017
    Posts:
    15
    hi i am working on rfps stealth killing system and i found a resource on the internet and edited it for myself. but it didn't work, this code works when I throw it somewhere that is not AI.cs, but if the enemy has AI.cs code, my code doesn't work, can you tell me what's the problem?


    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4.  
    5. public class KillStil : MonoBehaviour {
    6.  
    7.     Transform player;                           //? the player ptransform;
    8.     public Animator anim;                          //? the  Enemy Animator;
    9.     public Transform killPosition;                  //? the transfom The player must be present in it;
    10.     public AudioClip Choking, Bodydrop, Bodydrop2;  //? the bady sfx
    11.     public AudioSource audioSource;
    12.  
    13.  
    14.     public void SetParent()
    15.     {
    16.         //! Set the booling Kill true to Playe tha animatin and playe the audioClip Choking sfx;
    17.         anim.SetBool("Kill",true);
    18.         audioSource.PlayOneShot(Choking);
    19.     }
    20.     public void UnSetParent()
    21.     {
    22.         //! set the booling kill false
    23.         anim.SetBool("Kill", false);
    24.     }
    25.  
    26.  
    27.     //? the function for playing body sfx When the body collides the ground;
    28.     public void BodyDrop(int index)
    29.     {
    30.         switch (index)
    31.         {
    32.             case 1:
    33.                 audioSource.PlayOneShot(Bodydrop);
    34.                 break;
    35.             case 2:
    36.                 audioSource.PlayOneShot(Bodydrop2);
    37.                 break;
    38.         }
    39.      
    40.     }
    41.     //! checking  if the player enter to trigger
    42.     private void OnTriggerEnter(Collider other)
    43.     {
    44.         //! if player enter to trigger we Get The Stealth_KillBehaviour scrpte from the player
    45.         if (other.CompareTag(TagManager.Player))
    46.         {
    47.            //! we set the enemy scripte and the kill position to player scripte;
    48.             other.GetComponent<Stealth_KillBehaviour>().Enemy = this;
    49.             other.GetComponent<Stealth_KillBehaviour>().KillPosition = killPosition;
    50.             player = other.transform;
    51.         }
    52.     }
    53.  
    54.     //! checking  if the player Exit to trigger
    55.     private void OnTriggerExit(Collider other)
    56.     {
    57.  
    58.         //! if player exit the trigger ,we set the player null;
    59.         if (other.CompareTag(TagManager.Player))
    60.         {
    61.             player = null;
    62.         }
    63.     }
    64. }
    65.  
    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4.  
    5. public class Stealth_KillBehaviour : MonoBehaviour
    6. {
    7.  
    8.     // Use this for initialization
    9.     public KillStil _Enemy;             //? killstill Scripte;
    10.     public Transform KillPosition;      //? the transfom The player must be present in it;
    11.     public float time;                  //? the Coroutine Time;
    12.     public Animator anim;
    13.  
    14.     public KillStil Enemy
    15.     {
    16.         get { return _Enemy; }
    17.         set { _Enemy = value; }
    18.     }
    19.    
    20.     void Start () {
    21.         //! Subscribe and register this behaviour as  behaviour.
    22.        anim=this.GetComponent<Animator>();
    23.     }
    24.          
    25.     // Update is called once per frame
    26.     void Update () {
    27.         if (Input.GetKeyDown(KeyCode.F) && Enemy!=null )
    28.         {
    29.  
    30.           //! change the position and rotation of the player
    31.             this.transform.position = KillPosition.position;
    32.             this.transform.rotation = KillPosition.rotation;
    33.  
    34.             //! checking  if the position and rotation of the player is change it;
    35.             if(this.transform.position == KillPosition.position && this.transform.rotation == KillPosition.rotation)
    36.             {
    37.              
    38.                
    39.                 //! playe animation Kill
    40.                 anim.SetTrigger("Kill");
    41.                 _Enemy.SetParent();
    42.  
    43.                 //! start the coroutine
    44.                 StartCoroutine(EndKillStealth());
    45.             }
    46.         }
    47.     }
    48.  
    49.    
    50.     IEnumerator EndKillStealth()
    51.     {
    52.         //write 4 seconds
    53.         yield return new WaitForSeconds(time);
    54.      
    55.  
    56.         //! set the enemy  and the kill position equle null
    57.         _Enemy = null;
    58.         KillPosition=null;
    59.     }
    60. }
    61.  
     
  3. rainbowmirza

    rainbowmirza

    Joined:
    Jul 25, 2020
    Posts:
    21
    Hi,
    Whenever I Set the TimeScale ts to 0.1 or something like this, It automatically goes to 1 after some Time. Do anyone knows in Which Script this is Happening?
     
  4. petercoleman

    petercoleman

    Joined:
    Feb 21, 2016
    Posts:
    475
    Hi Everyone,

    At last I have some zombies :) Here's a Screenshot of the RFPSP one and there are a number of others too as well as other new Characters in the Game to add to the large number of different characters.

    This from as you can see a apocalypse level which is in keeping with the story :)

    Grab 20210314115559 w1280h547 x1193y107z1129r77.jpg

    Peter
     
    OZAV, AzulineStudios and rainbowmirza like this.
  5. petercoleman

    petercoleman

    Joined:
    Feb 21, 2016
    Posts:
    475
    Hi rainbowmirza,

    I am no expert but Time Scale should indeed be set to 1, I believe....

    Why would you want to set it to 0.1

    Peter
     
    OZAV likes this.
  6. rainbowmirza

    rainbowmirza

    Joined:
    Jul 25, 2020
    Posts:
    21
    I am making Slow motion bullet time Effect for Sniper, That's Why I have to lower Time Scale for a slow motion effect when Camera follows Bullet. Just like you see in other Sniper Games. Till now, I've made Camera which follows Bullet After being shot, a Motion effect, Background Blur Effect and an incomplete Time Scale changing system.
     
  7. AzulineStudios

    AzulineStudios

    Joined:
    Feb 18, 2021
    Posts:
    31
    Hi @paulojsam, since I don't have access to the original AzulineStudios account, the RFPSP can't be updated. I've been trying to get access again, but apparently it isn't technically possible. As a result of this and other issues I've described in previous posts, I'll be releasing a redesigned FPS asset that improves on RFPS in a lot of ways. I think the new asset will be ready in a month or two, maybe sooner, maybe later, depending on how smoothly things go, but the majority of the work is done.

    Hi @HNR2, the NPC's animations are set in the Ai.cs script. Every time the behavior changes, it updates the NPC's animator controller. If you wrote some stagger logic, you could modify Ai.cs to stop the NPC, and pass the stagger state to the NPC animator controller to play the stagger animation. By doing a search for the text ".set" in Ai.cs, you'll see where the animator controller state and triggers are being set. This might not be relatively easy, like you said, but it's possible by modifying the Ai.cs script. I will look into including this feature in the new FPS asset.

    Hi @alinuryt, the script probably doesn't work when it's attached to an object with an Ai.cs component because the Ai.cs script is overwriting the animations that the stealth kill script is trying to play. The NPC animator controller also needs to have the animations and variables that are being set in the new script. Your question is similar to HNR2's in that the Ai.cs script would need to be modified so it's not trying to overwrite the NPC animation controller state, or move the NPC when they should be stationary. This can be done by editing the Ai.cs script, but you might need to experiment a bit.

    Hi @rainbowmirza, in RFPS, the FPSPlayer.cs script manages the Time.timescale value starting around line 498. The timescale is being set to zero when paused, and also being set for the default bullet-time feature. To activate the default bullet time feature when you're firing a sniper bullet and depending on how you're referencing FPSPlayer.cs, you could call the ActivateBulletTime method of FPSplayer.cs like this:

    Code (CSharp):
    1. FPSPlayerComponent.StartCoroutine(FPSPlayerComponent.ActivateBulletTime(sloMoTime));
    Hope that helps
     
    OZAV likes this.
  8. rainbowmirza

    rainbowmirza

    Joined:
    Jul 25, 2020
    Posts:
    21
    Thank You! It Worked!
     
    AzulineStudios likes this.
  9. SickaGames1

    SickaGames1

    Joined:
    Jan 15, 2018
    Posts:
    1,268
    Quick vid of RFPS, S-Inventory and Dialogue System integration. Wish the new FPS would have some of these options ;)
     
  10. rainbowmirza

    rainbowmirza

    Joined:
    Jul 25, 2020
    Posts:
    21
    Nice Gameplay, at 1:07 What is wrong with Your Audio Listener? It is Continuously Going Left and Right or Maybe It's your audio source...?
     
    OZAV likes this.
  11. Bioman75

    Bioman75

    Joined:
    Oct 31, 2014
    Posts:
    92
    Wish I had the latest version of S-Inventory :(
     
  12. SickaGames1

    SickaGames1

    Joined:
    Jan 15, 2018
    Posts:
    1,268
    Here is a video of some of the melee "RPG" elements that I use. Azuline: the S-Inventory code isn't rocket science and you could probably come up with this in a week. Would be nice if RFPS2 could do all of this ;)
     
    OZAV and AzulineStudios like this.
  13. ProBrStalker

    ProBrStalker

    Joined:
    Aug 20, 2017
    Posts:
    65
    Hello everyone, everything good?
    I will publish some images of my project which I have been working on for a long time ... (4 years +)
    Well, the project is a remake inspired by another game called SURVIVALz, it is an indie project ... because I worked on it myself for a long time ... but now there are other people helping me to develop it ...
    Well, the game will take place in Siberia, where the player, in addition to dealing with the cold, will have to deal with hostile creatures as well as other hostile or friendly players ...

    Youtube Cinemachine:


    Game website: https://redskygamesstudio.wixsite.com/website

    Images:
     
  14. rainbowmirza

    rainbowmirza

    Joined:
    Jul 25, 2020
    Posts:
    21
    Congratulations! Environment looks Awesome.
     
  15. OZAV

    OZAV

    Joined:
    Aug 9, 2013
    Posts:
    298
    To change the skybox on the fly ? Skyboxes come as materials basically, so this is a great convenience in that regard. One good idea will be by simply: to change the skybox's asigned material, on the fly. To also mention - the Skyboxes are also edited by selecting their material in their material folder they come with. This is a good place to start - so knowing this - just to chose the best method or utility by which you want to do that, for editor tests or setup from there, for the scene.
    using UnityEngine;
    using System.Collections;

    public class gui : MonoBehaviour {

    public Material mat;
    public Material mat1;
    string name="DAY";

    void Start () {
    }

    void Update () {
    }

    void OnGUI() {
    if (GUI.Button(new Rect(10, 10, 150, 100), name)){
    if (name=="DAY"){
    RenderSettings.skybox = new Material(mat);
    name="NIGHT";
    if (GameObject.Find("sun"))
    GameObject.Find("sun").GetComponent<Light>().intensity=0.12f;
    if (GameObject.Find("DIRECTIONAL LIGHT"))
    GameObject.Find("DIRECTIONAL LIGHT").GetComponent<Light>().intensity=0.12f;
    }
    else {
    RenderSettings.skybox = new Material(mat1);
    name="DAY";
    if (GameObject.Find("sun"))
    GameObject.Find("sun").GetComponent<Light>().intensity=1f;
    if (GameObject.Find("DIRECTIONAL LIGHT"))
    GameObject.Find("DIRECTIONAL LIGHT").GetComponent<Light>().intensity=1f;
    }
    print (mat);
    }
    }
    } :). RDA-The-JU-87-Stuka-AxisAircraft-Parked.JPG
     
    Last edited: Apr 18, 2021
  16. petercoleman

    petercoleman

    Joined:
    Feb 21, 2016
    Posts:
    475
    Hi OZAV,

    Thanks for that.

    Yes I have already done that. I already had a script in my project folder that could change the Skybox material in real time as well as control ambient lighting change and fog properties at the same time :) See attached Screen shot showing a night scene and you can compare that with the daytime screen shot of same scene posted a little earlier above....

    At the same time I now also turn on the street lights (bulbs) where appropriate.

    Night time Screen Shot with post processing turned on :

    City Heights 2.jpg

    Now moved on just updated my Game Menu to add graphics - Game Options. and moving ahead.....

    As I mentioned a while back I was waiting for Unity 2020 LTS and wished to port my project to that if possible...

    I can now report that is done so my version is now Unity 2020 LTS. Took a couple of days to port but this version of Unity is a big improvement for my game making. Seems to be very stable and smooth as well as an improvement in quality and no loss of performance. Additionally it plays better with the latest version of UMA and my other assets add on are happier and more stable with this version of Unity so I will stick with this now for some time at least.....

    Perhaps until I can get you a game Demo out :)

    regards

    Peter
     
    AzulineStudios and OZAV like this.
  17. OZAV

    OZAV

    Joined:
    Aug 9, 2013
    Posts:
    298
    ... it's great to hear about 2020 LTS up, thanks for notifying the community here, and the scouting ahead that way. Just a question on everyone's mind, we need to know you are positive there is no that new "prefab admin" bully feature in 2020 LTS ? ... in which case would be worth trying it for the 2017 LTS projects migration ... Also looks like you can soon release a community version of that skybox changing system / script, maybe it could be very simple version when you can, so we can all upgrade from there and update everyone back here, with better made versions from there, much appreciated. "If a computer program would be intended to be made completely in English - it would prove impossible to do it". (Murphy's rules) :).
     
  18. petercoleman

    petercoleman

    Joined:
    Feb 21, 2016
    Posts:
    475
    Hi OZAV,

    2020 LTS : I am afraid the prefab system is still the same naughty one nobody likes. However after my having a nightmare with my previous version 2020 TTS is a big improvement to me. Seemingly very stable as I have not killed it yet :)

    Don't get me wrong I would not suggest anyone port to it if they are happy with the version they are currently using, but I could not go backwards so had to go for it. It is still full of "Known Issues" effectively bugs but none have cropped up that would kill my sessions as yet. I can say that as with previous recent versions there are many things in it that are a pain in the butt as well as the prefab system....The Unity is busy pop up in particular as I am still spending a lot of time watching Unity being "Busy" instead of being able to get on. Its like a never ending dialogue with it. Waiting, waiting, waiting - please keep up with me Unity. No way, but then no computer can keep up with me as I am frantic and want to work away at speed. I have a lot to do and no time to wait for any computer program to keep up....

    Perhaps its just a fact that my game and levels are large and complex with now 535 thousand objects in the project folder and Unity has a lot to process and load to levels and that my computer system is not powerful enough - which it is not, thus I cant blame it all on Unity - progress being slow. I do a lot every day but could do more if things other than me were faster....

    Still onwards we go....

    The SkyBox Changer I made up is a prefab I made simply by attaching a script/component to an empty game object......

    Unfortunately I could not give it to anyone as firstly it as part of an asset which controls the script via a .DLL and I don't have the script as a .cs file - it is added to my prefab as a component listed in the .DLL I can tell you how I have it - it comes with an asset I have had for a long time called "Adventure Toolkit" which I use quite a lot for a variety of things I cant get anywhere else. Unfortunately its not Free.

    I looked around the web for a solution script but could not find an easy solution so used what I had and its so easy I don't really need do anything just indicate the new SkyBox Material and ambient light and fog parameters if I want to change those too.

    As I am at it here's another screen shot not seen here before of the first level in the game. This is where the game starts. It has what one may describe as a Cut scene which then merges to the Player control. What has a pond and some vegetation have to do with my game you may ask? The answer is all will be revealed when you play it :)

    JacksStory.jpg

    Peter
     
    OZAV and AzulineStudios like this.
  19. GamePro

    GamePro

    Joined:
    Jul 16, 2012
    Posts:
    36
    hello, when the new RFPS will be published on assets store. i am waiting for it. please update me.

    thanks for providing such an awesome kit.
     
    OZAV and AzulineStudios like this.
  20. AzulineStudios

    AzulineStudios

    Joined:
    Feb 18, 2021
    Posts:
    31
    That's a good idea SickaGamer, the first version of the new asset will include basic FPS inventory, but it would be pretty easy to make an addon or optional pack that adds more of an RPG-like inventory. Will add this to the list.

    Wow neat setting and environment, ProBrStalker. Keep up the great work!

    Hi GamePro, thanks for the encouragement. The new FPS asset is probably a month or two away. Working on the final details. The initial version will be more FPS-focused, with more features to be added later. I've been putting a lot of thought into the design of the new asset and it is easy to work with and plays well. The progress updates will get more frequent when it's closer to being ready. Here's a screenshot from a test level:

    screen.jpg
     
  21. SickaGames1

    SickaGames1

    Joined:
    Jan 15, 2018
    Posts:
    1,268
    Got the new Main Menu, Game Menu, Quest System and Save System all working now. Thanks @TonyLi The Dialogue System or Quest Machine are both worth the $$.

     
    AzulineStudios and TonyLi like this.
  22. SickaGames1

    SickaGames1

    Joined:
    Jan 15, 2018
    Posts:
    1,268
    idibil, OZAV and AzulineStudios like this.
  23. SickaGames1

    SickaGames1

    Joined:
    Jan 15, 2018
    Posts:
    1,268
  24. rainbowmirza

    rainbowmirza

    Joined:
    Jul 25, 2020
    Posts:
    21
    Hi All,
    Anyone knows how to add Sniper Scope Zoom in and Out in RFPS? And How to use UI Image as a Scope?
     
  25. OZAV

    OZAV

    Joined:
    Aug 9, 2013
    Posts:
    298
    ... umm ... yep ... that's really a great news, our congrats, to Azuline, we are very happy to hear it. New version with inventory will come very handy, just when we have been thinking with some player-specific inventory items that can be a pre-requisites to be found around the maps, in order to operate some vehicles around the (now huge, thanks to rfps) - RDA world :). RDA-CapturingStukaAircraft-03-1.JPG
     
    AzulineStudios likes this.
  26. OZAV

    OZAV

    Joined:
    Aug 9, 2013
    Posts:
    298
    True, UFPS is very self contained, requires expert knowledge or above and continuous live support, and is not very modular as RFPS is. Further - if UFPS can be called modular at all - in your case: why not consider to move to RFPS, with coming new edition ?
     
  27. OZAV

    OZAV

    Joined:
    Aug 9, 2013
    Posts:
    298
    // === To: 'Brazilian pro stalker"
    // === In Unity, NEVER use .keycode method, bind code always to InputManager,
    // === and than in InputManager - assign any button/axe - to anything you want
    // === ONE VERSION - THINKING THIS WAY, WE HOPE IT HELPS. -OZAV-

    public class InputForWhatever () { // or your class name here ...

    // your main #C declarations, bools and what-nots, first here, the actors involved ...

    // than here, as usual in #C - who does what and how exactly ...

    if (Input.GetButton("Left")){ // button support - right way - no .key code methods !
    }
    if (Input.GetAxis("LeftRightAndJaw")>0.12f)){ // remember the gamepad support ...
    }
    if (Input.GetAxis("LeftRightAndJaw")<=0.12f)){ // remember the gamepad support ...
    }
    if (Input.GetButton(UpAndForward")) {
    }
    if (Input.GetAxis(UpDownForwardBack")>0.12f) {
    }
    if (Input.GetAxis(UpDownForwardBack")<=0.12f) {
    }
    if (Input.GetButton("DownAndBack")){
    }
    if (Input.GetButton("Right")) {
    }
    ... Etc, etc, so, any of this as you can adopt in your code practices will help you and Unity community to code any input things properly, and that's why Unity's InputManager exists as well. Edit-ProjectSettings-Inputmanager . The .keycode method limits your players only to keyboard controls, so ... ... ... Death to dot.keycode method - once and forever. Lovely day on the RFPS Academy forum today, everyone :).
     
    Last edited: Mar 30, 2021
    Mark_01 likes this.
  28. OZAV

    OZAV

    Joined:
    Aug 9, 2013
    Posts:
    298
    See these instructions we wrote for you on this image. please, your effort to get a copy of TSAI will solve all your problems, to integrate it with RFPS is very easy and has instructions inside for doing it, as well. Aim to stop using stock RFPS characters primarily as the AI soldiers soon as possible as well, while the player object and it's abilities is the most important, good luck with everything, we hope it helps, this asset includes stagger function and how long you want it to last every time on AI soldiers hit and comes with their own animations, inbuilt for it as well. This is the only Unity asset having truly complete AI 1 solution on the AAA quality, with all other features needed such as vaulting, n a v mesh links, cover, turning objects over, formations, fire avoidance, AI team leader and followers, friendly AI - and everything else you may need for the non-player AI needs in Unity project developments. It works well with RFPS and UFPS and other systems as well, to mention, as we all hope it will return to the store (officially) in the near future (community is damaged so much by asset being unsupported - so called "deprecated" - at the moment, but meantime you can try as advised). TSAI, OriginalStoreImage.JPG
     
    Last edited: Mar 30, 2021
  29. SickaGames1

    SickaGames1

    Joined:
    Jan 15, 2018
    Posts:
    1,268
    Last edited: Mar 30, 2021
    OZAV likes this.
  30. AzulineStudios

    AzulineStudios

    Joined:
    Feb 18, 2021
    Posts:
    31
    To add different zoom levels to the sniper scope view in RFPS, you'd need to create a new input event like "zoom in" or "zoom out" then change the "NextFov" value in Ironsights.cs, when the zoom in/out button is pressed. Apologies that I don't have a more specific tutorial on how to do this rainbowmirza, but the new FPS asset will handle scopes like you described.

    For a UI image scope zoom, the process will look something like this: move sniper model to player eye level->fade in black overlay->deactivate sniper model->zoom camera FOV->activate scope UI image->fade back in from black overlay. Process is reversed for zooming out.

    Good advice OZAV, the upcoming FPS asset is using Unity's input package system, which allows for editing inputs from the inspector and easy cross-platform support :) There is still an input manager script like in RFPS, which reads the inputs from Unity's input component and sends them to the rest of the scripts.

    As far as implementing the new weapon models, you could duplicate the katana/knife/sword and shield weapon objects under the FPS Weapons object, swap out the models and their animations in their animator controller with the new ones, and add the new objects to the PlayerWeapons.cs component's Weapon Order list. There is a simple guide in the RFPS docs, but I can help if you have more questions.

    For using the RFPS AI spawner with Emerald AI NPCs, you could edit the NpcSpawner.cs and WaveManager.cs scripts to interface with the Emerald AI NPCs, but you'll need to get familiar with both so you can merge them.

    A general-use NPC spawner is a good idea though. I'll take that approach with the new asset so it works with the default NPCs, but doesn't require them.
     
    OZAV likes this.
  31. rainbowmirza

    rainbowmirza

    Joined:
    Jul 25, 2020
    Posts:
    21
    Thank You Very Much, After waiting a couple Days for Answer, I finally Used Update method for this to work. I didn't add any new Input, But I just added a Script "SniperSlider.cs" to my Sniper:
    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using UnityEngine.UI;
    5.  
    6. public class SniperSlider : MonoBehaviour
    7. {
    8.     [SerializeField] AudioClip tickSound;
    9.     [SerializeField] AudioSource audioSource;
    10.  
    11.     public static SniperSlider sniperSlider;
    12.     [SerializeField] public GameObject ScopeUI;
    13.     [SerializeField] float zoomFOV;
    14.     [SerializeField] public GameObject sliderUI;
    15.     [SerializeField] LayerMask LayerMaskWhileUIActive;
    16.     WeaponBehavior WeaponBehaviorComponent;
    17.  
    18.     bool isZoomState = false;
    19.  
    20.     private void Awake()
    21.     {
    22.         WeaponBehaviorComponent = this.GetComponent<WeaponBehavior>();
    23.  
    24.         //audioSource = this.GetComponent<AudioSource>();
    25.         sniperSlider = this;
    26.     }
    27.     private void Update()
    28.     {
    29.         //Debug.Log(FPSPlayer.instance.zoomed);
    30.         //sliderUI.GetComponent<Slider>().value = this.GetComponent<WeaponBehavior>().zoomFOV;
    31.         sliderUI.GetComponent<Slider>().value = WeaponBehaviorComponent.zoomFOV;
    32.         if (FPSPlayer.instance.zoomed)
    33.         {
    34.             //if (isZoomState == false)
    35.             //{
    36.                 ScopeUI.SetActive(true);
    37.                 sliderUI.SetActive(true);
    38.                 isZoomState = true;
    39.                 Camera.main.cullingMask = LayerMaskWhileUIActive;
    40.                 //StartCoroutine(ActivateUI());
    41.             //}
    42.         }
    43.         else
    44.         {
    45.             //if (isZoomState == true)
    46.             //{
    47.                 Camera.main.cullingMask = Camera.main.GetComponentInParent<ReconfigurePrefab>().mainOneCamMask;
    48.                 ScopeUI.SetActive(false);
    49.                 sliderUI.SetActive(false);
    50.             //}
    51.         }
    52.     }
    53.     public void ChangeFOV(float newValue)
    54.     {
    55.         //this.GetComponent<WeaponBehavior>().zoomFOV = newValue;
    56.         WeaponBehaviorComponent.zoomFOV = newValue;
    57.             audioSource.PlayOneShot(tickSound, 0.3f);
    58.         if(newValue <= 3)
    59.         {
    60.             WeaponBehaviorComponent.zoomSensitivity = 0.01f;
    61.         }
    62.         else if(newValue <= 5)
    63.         {
    64.             WeaponBehaviorComponent.zoomSensitivity = 0.04f;
    65.         }
    66.         else if(newValue <= 7.5)
    67.         {
    68.             WeaponBehaviorComponent.zoomSensitivity = 0.06f;
    69.         }
    70.     }
    71.     //IEnumerator ActivateUI()
    72.     //{
    73.     //    yield return new WaitForSeconds(0.5f);
    74.     //        ScopeUI.SetActive(true);
    75.     //        sliderUI.SetActive(true);
    76.     //        isZoomState = !isZoomState;
    77.     //}
    78.    
    79. }
    80.  
    Using Update Method for this was not a good approach, But I was unable to find that Exactly where WeaponBehaviour.zoomed is being changed.

    Thanks For your Answer Azuline!
     
    OZAV and AzulineStudios like this.
  32. alonehuntert

    alonehuntert

    Joined:
    Oct 12, 2017
    Posts:
    15
    Hello, I want to add bomb count and bullet slider to the game. How can I do it?
     

    Attached Files:

  33. petercoleman

    petercoleman

    Joined:
    Feb 21, 2016
    Posts:
    475
    Hi Everyone,

    I have something of a technical question if anyone can help?

    I am using UMA integrated with RFPS and all works very well.

    I use UMA characters for passive civilians and allies. Some of these carry weapons which they don't use in an aggressive mode as they are "Guards" as it were and do not attack other NPC's and others do not attack them.

    I am now adding to these aggressive UMA characters : potentially both allies and "Enemies" these now work well but I have one issue to solve....When they fire a Weapon the weapon "Fire Sound" plays, however it is not playing correctly in as much as its Sound "Range" is limited to a small distance perhaps a range of 5 - 10 when the enemy UMA character has a shoot range of 25 - 30 so when they fire and the muzzle flash appears there is no sound heard by the Player unless either the player or enemy move closer to one another :)

    Anyone have any idea why this happens with the UMA characters and how I can force the Fire Sound Range to be greater.

    I am looking around now for a solution in scripts and settings and so on. I can think of a possible workaround but see a potential issue with it so would rather just find a fix without such a solution and get RFPS itself to do it nicely :)

    Thanks for any help.

    Regards

    Peter
     
  34. SickaGames1

    SickaGames1

    Joined:
    Jan 15, 2018
    Posts:
    1,268
    I figured out how to make a Player healer out of a AI. Below is my RFPS/S-Inventory/Dialogue System/Emerald AI game.

     
    AzulineStudios and TonyLi like this.
  35. OZAV

    OZAV

    Joined:
    Aug 9, 2013
    Posts:
    298
    ... umm ... such sliders are normally locked to some fixed range in their editor scripts, so ranges limiting is almost never done in the any main script. But it's done in their editor scripts for each such script they come with. You probable need to look first in the editor script, for that script, so find that range entry in the header and just extend the numbers there to whatever more up and down, from (-) few billion to (+) few billion that you want more. Yes it can be set there as a lot +positive and a lot into -minus as well if you want to. It very rarely being locked entry in the main scripts themselves. So, for our tip here, you will first check for that issue in their editor scripts for each such script where you run into any locked limit range you don't like. So, those both places are to look for and where it might be done :). RDA-CapturingStukaAircraft-02.JPG
     
  36. petercoleman

    petercoleman

    Joined:
    Feb 21, 2016
    Posts:
    475
    Hi OZAV,

    Not sure what you refer to by "editor scripts" and sliders here? if you mean public properties in editor attached to RFPS Character scripts then I see no reference to Fire Sound Range as such for an RFPS weapon fire sound :) Nor indeed have I found one in RFPS NPC AI scripts. The Characters (Enemies) behaviors are controlled by RFPS not UMA and all works fine except the weapon fire sound range.

    I have as said an Idea for a workaround which may work though the issue I see with it is that I would need to create a separate fire sound (Audio Source) which would effectively give me two fire sounds which is undesirable. Yes I can remove the RFPS one (in editor) but then RFPS complains its missing. I could give it a "Silent Sound (no Volume)" which would work perhaps but that would still require two fire sounds playing at the same time on the same weapon firing which is undesirable even if it might solve the issue its just bad practice.

    Hope that makes some sense :)

    Edit Update : OK I have sorted this now. As all of my Characters use my own system to instantiate a Muzzle Flash for weapons when fired (so an NPC can have any weapon with any associated shoot weapon effects) for UMA NPC Characters I have created Individual Muzzle Flash for each weapon and attached the Fire Sound to that. Works fine and fixed the issue.

    Regards

    Peter
     
    Last edited: Apr 9, 2021
    AzulineStudios and OZAV like this.
  37. AzulineStudios

    AzulineStudios

    Joined:
    Feb 18, 2021
    Posts:
    31
    Hi alinuryt, in the PlayerWeapons.cs component, there is a variable called currentGrenade, which you can use to get the player's currently equipped grenade by some code like this:

    Code (CSharp):
    1. grenadeOrder[currentGrenade].GetComponent<WeaponBehavior>().ammo
    You can use the ammo variable to draw a UI element that displays the current grenade ammo on screen. It looks like the screenshot you posted has the UI element tilted with perspective. You can achieve that effect by making the UI element render in world space and offsetting its yaw rotation from the camera's yaw rotation. Hope that helps.
     
    OZAV likes this.
  38. SickaGames1

    SickaGames1

    Joined:
    Jan 15, 2018
    Posts:
    1,268
    I am thinking about moving to 2020.3 LTS...is there any issues with RFPS with that version?
     
  39. petercoleman

    petercoleman

    Joined:
    Feb 21, 2016
    Posts:
    475
    Hi SickaGamer,

    I have ported my main shooter project to Unity 2020 LTS recently...around a month ago as I had been having growing issues with my previous version so had little choice.

    I can only tell you what I have found personally.....

    For me it seems to be perhaps the most stable version I have used to date.

    Of course there are always issues with any Unity version which are usually documented in the release notes and or Known issues info at the download page area of Unity.

    Upgrading a project can be a daunting task though. so best to make sure you have a good backup (or more than one) before installing and opening any project with an updated version in case you decide to go back to your earlier version and have a backup you can use for that as insurance. You could try opening a project of "Little Importance" if you have one to test it out before opening your any main project(s).

    It took me a while to Update my own project and sort any problems in doing so, however it fixed numerous issues I was having with my earlier version and I have not had a serious issue, crash or show stopper yet in using it....

    Excepting on upgrading my project I found that it did not like Pro Builder "Quick Edit" and would not run with it so I deleted that folder entirely as it was not really needed and that fixed the issue. Bear in mind it may not be happy with some older assets or scripts and it may remove items or try and update some older scripts and you may need to update some assets or replace scripts that no longer work for you if they cause critical errors....I have some non critical console warning messages crop up intermittently which has always been the case with Unity versions so that's nothing new. Unity and my project still run fine.

    The only complaint I really would say I had was that 2020 LTS is "Different" so it seems to have a different Rendering pipe line which caused my Scene rendering to be changed and visually I have had to address that via rendering settings, Scene Lighting and so on for most scenes which is a bit of a pain but there you go. I found that it works better in Rendering Scenes if you have some post processing set on your main camera but there may be a price to pay for that in game performance so a balance in all things rendering related may need to be found. No post processing may mean one has to work harder at getting a Scene to render visually to your liking adjusting and fine tuning stuff that affects that. Cant have it all ways I guess.

    Anyway personally as said I find it stable so don't have to worry so much about when Unity might crash and kill my project ;-) I don't save If in doubt if any issues crop up I don't or cant fix there and then for safety and backup reasonably often. e.g. perhaps after two weeks work.or so.

    I find Unity 2020 LTS at least as fast as any previous recent issue and perhaps faster both in editor and at game run.

    What is really needed is a Faster computer ;-)

    Overall I find it the best Version I have used to date due to being apparently more stable to date and somewhat happier with my projects heavy demands.

    Its a matter for anyone to decide for themselves if Updating is worth the effort, time or risk. With a safe project backup one can always go back to an earlier version but I would not recommend trying to "Downgrade" any Unity project Version saved with a later version using Unity Hub for instance that's asking for problems. If you need go back to an earlier versions always use a Backed up version and use the same version it was created in to open it and always make sure you have at least one safe and fully working project copy saved safe somewhere.

    If updating a project to 2020 LTS then as with any update, once you are happy that its works well with your project and have fixed any critical issues then back it up and keep it separate to any backup of any earlier version backup. So you have two Unity versions backups at least until sure its OK to delete any safe backups.

    Hope that helps.

    Have fun all.

    Regards

    Peter
     
  40. alonehuntert

    alonehuntert

    Joined:
    Oct 12, 2017
    Posts:
    15
    I tried the code and it didn't work.
    What I want to add to the game is to write the number of bombs left on the canvas on the UI. And
    add bullet slider. (please help I'm tired)
     
  41. Bioman75

    Bioman75

    Joined:
    Oct 31, 2014
    Posts:
    92
    Why don't you look at how RFPS gets the current weapons ammo count and then get it as a string? If I remember correctly whats posted above was how I did it when I used RFPS.
     
  42. rainbowmirza

    rainbowmirza

    Joined:
    Jul 25, 2020
    Posts:
    21
    I've done this in my Game, I'll send you the script tomorrow as I'm not in office at this time.
     
    OZAV likes this.
  43. alonehuntert

    alonehuntert

    Joined:
    Oct 12, 2017
    Posts:
    15
    okey thank you
     
  44. rainbowmirza

    rainbowmirza

    Joined:
    Jul 25, 2020
    Posts:
    21
    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEngine.UI;
    3.  
    4. public class GrenadesText : MonoBehaviour
    5. {
    6.     PlayerWeapons PlayerWeaponsComponent;
    7.  
    8.     int oldAmmo;
    9.     int currentAmmo;
    10.     Text textComponent;
    11.  
    12.  
    13.     private void Start()
    14.     {
    15.         textComponent = this.GetComponent<Text>();
    16.         PlayerWeaponsComponent = GameObject.FindObjectOfType<PlayerWeapons>().GetComponent<PlayerWeapons>();
    17.         currentAmmo = PlayerWeaponsComponent.grenadeOrder[PlayerWeaponsComponent.currentGrenade].GetComponent<WeaponBehavior>().ammo;
    18.         oldAmmo = 0;
    19.         UpdateText();
    20.     }
    21.  
    22.     private void Update()
    23.     {
    24.  
    25.         currentAmmo = PlayerWeaponsComponent.grenadeOrder[PlayerWeaponsComponent.currentGrenade].GetComponent<WeaponBehavior>().ammo;
    26.         if(oldAmmo != currentAmmo)
    27.         {
    28.             //Debug.Log("Current ammo is: " + currentAmmo);
    29.             //textComponent.text = currentAmmo.ToString();
    30.             UpdateText();
    31.             oldAmmo = currentAmmo;
    32.         }
    33.  
    34.     }
    35.     private void UpdateText()
    36.     {
    37.         //Here Update your UI and perform other actions like Changing Color, Triggering Event etc
    38.         textComponent.text = currentAmmo.ToString();
    39.  
    40.     }
    41. }
    42.  
    Attach this Script to your UI Text.
     
  45. OZAV

    OZAV

    Joined:
    Aug 9, 2013
    Posts:
    298
    ... and, btw, the scripts should be shared here for the RFPS community as well, not just privately, if it helps everyone. People seemingly always 'forget' that we all can always release such stuff here, as your (whatever 1 point what) community version, for each case. You ARE good enough to have such releases, as we all should, and the members here WILL help to have them improved from there as well :). RDA-Dismembering-Works.JPG
     
    AzulineStudios and Mark_01 like this.
  46. paulojsam

    paulojsam

    Joined:
    Jul 2, 2012
    Posts:
    573
    any news on the release of realistic fps 2?
     
  47. AzulineStudios

    AzulineStudios

    Joined:
    Feb 18, 2021
    Posts:
    31
    Hi paulojsam, animations for the new FPS asset are finished, just working on the demo scene and documentation now. The initial version will be focused on the FPS aspect, with new features to be added later. I'll see if I can post a demo or video soon to give you guys an idea of what to expect.
     
    owyang, JamesArndt, Bioman75 and 2 others like this.
  48. paulojsam

    paulojsam

    Joined:
    Jul 2, 2012
    Posts:
    573
    thank you that would be helpfull. Regarding integration with previous packages, like emerald ai, lockpicks and soo on, they will still be compatible?
     
  49. SickaGames1

    SickaGames1

    Joined:
    Jan 15, 2018
    Posts:
    1,268
    @AzulineStudios I'd love some integrations :) Word on the street is Invector is making an AI for Cover and shoot type of thing. Might want to keep them and their FSM AI solution in mind as well :)
     
  50. AzulineStudios

    AzulineStudios

    Joined:
    Feb 18, 2021
    Posts:
    31
    Sure paulojsam, since the upcoming asset is a new codebase, there would need to be new integrations, but there are similar naming conventions to RFPS and improved code which would make integrations pretty straightforward.

    Nice, as for integrations it's basically about interfacing the needed variables/events and ensuring compatibility. The upcoming asset will probably include a simple demo AI, but integrations with more advanced AI would be great.

    Here's a video, it's a work in progress and still uses some RFPS assets, which will be replaced in the final version. The level in the video is by Dmitrii Kutsenko.