Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Realistic FPS Prefab [RELEASED]

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

  1. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,731
    I think it may work with Unity 2018 without modification. It works with 2017. If you're comfortable with scripting, you can get it to work with 2019. Otherwise, version 2.2 of Opsive's character controllers are coming out in the near future with some nice features such as being able to drive vehicles.
     
  2. Foodstamp

    Foodstamp

    Joined:
    Jun 11, 2013
    Posts:
    27
    Do you know what version of 2017? I tried with 2017.4.30f1 and 2017.3.1f1 and it gets weird on me with errors
     
  3. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,731
    What errors?
     
  4. Foodstamp

    Foodstamp

    Joined:
    Jun 11, 2013
    Posts:
    27
    I got it figured out, I was trying to mess around with the demo scene but realized I had to start a new scene

    Thank you for the help
     
  5. TheChairMaster64

    TheChairMaster64

    Joined:
    Aug 9, 2016
    Posts:
    52
    Anyone find a way for weapons to use the same/share ammo?
     
  6. SickaGamer

    SickaGamer

    Joined:
    Jan 15, 2018
    Posts:
    1,009
    Does anyone have the integration for Rucksack or inventory pro ?
     
  7. Bioman75

    Bioman75

    Joined:
    Oct 31, 2014
    Posts:
    35
    My if statement always executes "else" when my boolean is false and I have no idea why.
    Code (CSharp):
    1. public bool doublepoints;
    2.  
    3. void Awake () {
    4. doublepoints = false;
    5. }
    6.  
    7. public void "Not Important"( int goes here ){
    8.         if (doublepoints = false) {
    9.             if ("Not important") {
    10.                 Debug.Log ("At max cash, can't add " + int goes here);
    11.             } else {
    12.                 Debug.Log ("Double points isn't active");
    13.             }
    14.         } else {
    15.             if ("Not important") {
    16.                 Debug.Log ("At max cash, can't add " + int goes here);
    17.             } else {
    18.                 Debug.Log ("Double points is active");
    19.             }
    20.     }
    21. }
     
  8. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,731
    @Bioman75 - Change this:
    Code (csharp):
    1. if (doublepoints = false) {
    to this:
    Code (csharp):
    1. if (doublepoints == false) {
    A double equals sign (==) tests for equality. A single equals sign (=) assigns false to doublepoints.

    Also, check these:
    Code (csharp):
    1. if ("Not important") {
    It's probably not doing what you want it to do.
     
    Bioman75 likes this.
  9. Bioman75

    Bioman75

    Joined:
    Oct 31, 2014
    Posts:
    35
    Thank you yet again TonyLi, I cant believe I made such a simple mistake:eek:. Regarding the "Not Important" bit that was code I removed for the purpose of posting this because it wasn't important:D. Cheers
     
    TonyLi likes this.
  10. Takahama

    Takahama

    Joined:
    Feb 18, 2014
    Posts:
    166
    I want to increase a NPC's ragdoll death effect from some weapons. But when i increase "Force" value on weapon, it doesnt affect alive NPCs. Just affects non NPC physics objects and NPC ragdolls.
    I want to make it in a way that when i hit a NPC with a cannon like weapon(non explosive) it would fly few meters.

    Any idea about what do i must change to achieve such effect?
     
  11. SickaGamer

    SickaGamer

    Joined:
    Jan 15, 2018
    Posts:
    1,009
    @TonyLi Big thanks to Tony! This man is a Unity legend when it comes to his assets and not his assets, support! Love Dialogue Managers and Quest Machine! Keep up all of the integrations you do Tony. That is the reason why so many think highly of you!
     
    jons190 and TonyLi like this.
  12. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,731
    Glad I could help!
     
  13. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,731
    It will require a little scripting. It looks like you can set the NPC's CharacterDamage.ragdollActive bool to true and then apply force. To turn off ragdoll again, just set ragdollActive to false.
     
    OZAV likes this.
  14. Takahama

    Takahama

    Joined:
    Feb 18, 2014
    Posts:
    166
    Hmm, If we scrap "some weapons" part of the question, then it will be an easier task.
    Thanks!
     
  15. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,731
    You could modify WeaponBehavior to apply the same force value to NPCs. If you don't want a weapon to apply rigidbody force to an NPC, just set its force to 0.
     
  16. amansweb

    amansweb

    Joined:
    Dec 20, 2017
    Posts:
    6
    Is there a way to store health packs like grenades and use it with another key bind? (like "G" is for grenade).
     
  17. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,731
    Nothing built in. If you happen to have a license for S-Inventory (also deprecated) and the Dialogue System, you can use the Dialogue System's integration to turn health packs into items that you can store in your inventory.

    Otherwise you'll need to replace the health packs' HealthPickup script with a custom script that stores health packs instead of using them right away. And then add another script that listens for the key bind to use one of the stored health packs.
     
    SickaGamer likes this.
  18. amansweb

    amansweb

    Joined:
    Dec 20, 2017
    Posts:
    6
    Thanks a lot.
     
  19. OZAV

    OZAV

    Joined:
    Aug 9, 2013
    Posts:
    198
    Hello, the RFPS movement members, anyone seen any Unity 2020 (beta) download link yet, so we can test if the prefab management is still unfriendly since they left 2017 version ?
     

    Attached Files:

  20. OZAV

    OZAV

    Joined:
    Aug 9, 2013
    Posts:
    198

    The best (currently) is to stay with Unity 2017.4.7, for the best and easiest work and results. The new versions of Unity, past 2017 introduce the unfriendly prefab "management" which makes the prefabs work impossible and loss of our dev work hours astronomic (attention unity team here, you should know better than this, calling it "prefab management" since 2017 - it's not it - and it has to go to direct prefab management how it was up to 2017, and is what community needs back, thanks).
     

    Attached Files:

  21. SickaGamer

    SickaGamer

    Joined:
    Jan 15, 2018
    Posts:
    1,009
    RFPS works fine for me in 2019.3
     
  22. SickaGamer

    SickaGamer

    Joined:
    Jan 15, 2018
    Posts:
    1,009
    Does anyone know how to make the arrow explode on impact? Is this something that can be done natively in RFPS or by adding in via scripting?
     
  23. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,731
    Way, way back, I posted some instructions for exploding arrows here. I have no idea if the exact steps work with the latest version of RFPS. If not, it shouldn't take much to adjust.
     
  24. twangydave

    twangydave

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

    I hope you're well and you don't mind me asking a quick question about your save system as you are active in the thread.

    I'm using your excellent RFPS Save System and also the 3rd party integration for Tactical Shooter AI. Everything is functioning great and working smooth. The save system is correctly placing dead bodies for the enemies that have already been killed by the player, which is a great touch for realism.

    My question is about how to control the length of time these bodies remain in the level. I'm controlling this for the usual generated bodies through the Tactical Shooter AI base script but this does not seem to be applying to the dead bodies generated by the save script. These bodies seem to remain in the level forever. Is there a way to set a timescale for their removal through the TacticalAISaver script?

    Cheers!
     
  25. danteswap

    danteswap

    Joined:
    Oct 27, 2013
    Posts:
    158
    Wow Tony Its Great to see You Active , I will Be needing Ton Of Help From You But after some time , So Please be active , And Thanks For The Awesome Asset Currently Using In My Project In Unity 2019.3 And Everything Works Fine . :)
     
    TonyLi likes this.
  26. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,731
    Hi @twangydave - Thanks for using the Save System! Add an RFPS RemoveBody script to the dead body prefab.

    Alternatively, add a TimedEvent component to the dead body prefab. Set the Duration (in seconds) that it should stay in the scene before disappearing. Then configure the OnTimedReached() event to deactivate the GameObject.
     
    Bioman75 likes this.
  27. twangydave

    twangydave

    Joined:
    Mar 30, 2017
    Posts:
    41
    Grand! Thanks for that Tony - very much appreciated.
     
    TonyLi likes this.
  28. DAMANStudios

    DAMANStudios

    Joined:
    Jul 14, 2017
    Posts:
    5
    Hi everyone,

    we wanted to add our own flashlight for our game with the RFPSP. Everything works fine but we have a problem. When we enter in play mode, the arm with the flashlight appears correctly in the position we had defined for it. However, after some time spent on the scene, the flashlight slowly goes down for a reason that we do not know as these screenshots show! Could someone help us?
    Thank you in advance ! Capture d’écran (344).png Capture d’écran (343).png
     
    Last edited: Apr 14, 2020
  29. petercoleman

    petercoleman

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

    I am trying to integrate (or change) the default RFPS Player for a UMA avatar Character as shown in :
    The Messy Coder video tut here :


    As you can probably guess after going through the video and following the script creation instructions, I have an error preventing me from running the level - Specifically :

    Assets\RFPSP\Scripts\Player\PlayerCharacter.cs(245,31): error CS1061: 'UMADataEvent' does not contain a definition for 'addListener' and no accessible extension method 'addListener' accepting a first argument of type 'UMADataEvent' could be found (are you missing a using directive or an assembly reference?)



    And relevant code bit in RFPS PlayerCharacter.cs


    ////////////////////////*UMA INTEGRATION - Added by Peter Coleman*////////////////////////
    private DynamicCharacterAvatar _avatar;
    private bool initialized = false;

    private void Start()
    {

    _avatar = GetComponent<DynamicCharacterAvatar>();

    if (_avatar != null)

    {
    ///////////////////.addListener
    _avatar.CharacterCreated.addListener(initialize);
    _avatar.CharacterUpdated.addListener(UpdateFpObj);

    }

    }


    ---------------------------------------------

    Seems My Listener code aint working :)

    I have spent a whole day and I am worn out now - getting old and not too well at the moment and I cant fight a losing battle any more at this time so any kind help would be appreciated as always.

    I trust and hope you are all well.

    Peter Uma_FPS Player Character Error.jpg
     
  30. pagan_poetry

    pagan_poetry

    Joined:
    Feb 15, 2017
    Posts:
    83
    Maybe you miss some "using ..." derective in the beginning of the script?
     
  31. petercoleman

    petercoleman

    Joined:
    Feb 21, 2016
    Posts:
    223
    Thanks for that..... I am certainly missing something :)

    I will take another look at that now another time as I got fed up with fighting with Unity a long time ago now when they brought out the most recent versions we all now have been giving us major grief. i.e. rubbish prefab management and much more which destroyed half my hard work over the years and i am still trying to repair.

    As usual if i could find something better than RFPS I would use it but have never found anything..

    Anyone got a great suggestion :)


    Peter
     
  32. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,731
    @petercoleman - Change "addListener" to "AddListener". Instead of:
    Code (csharp):
    1. _avatar.CharacterCreated.addListener(initialize);
    2. _avatar.CharacterUpdated.addListener(UpdateFpObj);
    use this:
    Code (csharp):
    1. _avatar.CharacterCreated.AddListener(initialize);
    2. _avatar.CharacterUpdated.AddListener(UpdateFpObj);
     
  33. danteswap

    danteswap

    Joined:
    Oct 27, 2013
    Posts:
    158
    Hi Tony I need Some Help , i Want The Npc To Have One More Option To Follow Other NPC , I dont Know If Its Currently Functional in RFPS OR not , So I Have Created A bool under Follow Player named As FollowNPC , Now What I want is That when That Bool Is Checked The Npc Shoud Follow Another NPC Whose Reference will Be Provided With Some Code That will Do , So Can you Help me On The Follow Part ? Because I have Implemented Some Code In Patrol Function So While npc is Patroling If FollowNPC is Enabled Then NPC Follows Other Npc But The Problem I am Facing Is That , If I Attack The Mother NPC Then Mother NPC Comes Towards Me and then Child NPC Follows Mother, Now When Mother and Child Are both In attack Range Then Only Mother Attacks The Player and Child Just Walks Around the mother , but if player fires in that range then child also attacks so how to fix this , can you help implement something,

    here is my code That i use inside Patrol , The Problem Is that That Dont Follow Bool Never Change to True .

    Code (CSharp):
    1. void FollowNPC()
    2.     {
    3.         CanSeeTarget();
    4.         if ((target && targetVisible) || heardPlayer || heardTarget)
    5.         {
    6.             Dontfollow = true;
    7.         }
    8.         if (followCreature &&  Vector3.Distance(TransformOfNPCToFollow.transform.position, myTransform.position) > pickNextDestDist)
    9.         {
    10.             if (followCreature && Vector3.Distance(TransformOfNPCToFollow.transform.position, myTransform.position) > pickNextDestDist * 2f)
    11.             {
    12.                 speedAmt = runSpeed;//run to player if NPC is following and player is far away
    13.                 lastRunTime = Time.time;
    14.             }
    15.             else
    16.             {
    17.                 if (lastRunTime + 2.0f < Time.time)
    18.                 {
    19.                     speedAmt = walkSpeed;//walk to player if within walking distance
    20.                 }
    21.             }
    22.             InitializeAnim();
    23.             TravelToPoint(TransformOfNPCToFollow.transform.position);
    24.         }
    25.     }
    26.  

    this is Modified code in patrol


    Code (CSharp):
    1.  if (huntPlayer){
    2.                 StartCoroutine(SpawnNPC());
    3.                 yield break;
    4.             }
    5.  
    6.             if (followCreature && (!Dontfollow))
    7.             {
    8.               FollowNPC();
    9.             }
    10.             else
    11.             {//your code
    12.                  if (curWayPoint && waypointGroup){}
    13.                  else{}
    14.             }
    15.            yield return new WaitForSeconds(0.3f);
     
  34. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,731
    @danteswap - PlEasE DoN't WriTe In MiXEd CaPiTAls. It's very hard to read.

    Instead of customizing the AI script, try assigning the NPC GameObject to the AI script's playerObj variable at the end of the Start frame. For example, add a script like this to the GameObject that as the AI script:

    FollowNPC.cs
    Code (csharp):
    1. using System.Collections;
    2. using UnityEngine;
    3. public class FollowNPC : MonoBehaviour
    4. {
    5.     public GameObject followThisObj; //<-- ASSIGN IN INSPECTOR.
    6.  
    7.     IEnumerator Start()
    8.     {
    9.         yield return new WaitForEndOfFrame();
    10.         GetComponent<AI>(). playerObj = followThisObj;
    11.     }
    12. }
     
  35. Deleted User

    Deleted User

    Guest

    Hello everyone, this will be my last post here. Thank you for your interest over the years, I hope the RFPSP has helped you learn or release your games.
     
  36. SickaGamer

    SickaGamer

    Joined:
    Jan 15, 2018
    Posts:
    1,009
    Open source RFPS?
     
  37. jons190

    jons190

    Joined:
    Sep 13, 2016
    Posts:
    254
    I think it still works with 2018.4 lts...
     
  38. sebasfreelance

    sebasfreelance

    Joined:
    Aug 27, 2015
    Posts:
    227
    Have you looked to see if the batteries have run out?
    just kidding, ;)
    I love the hands, it looks great!
     
    DAMANStudios likes this.
  39. DAMANStudios

    DAMANStudios

    Joined:
    Jul 14, 2017
    Posts:
    5
    Hahaha, yeah we checked and we still have enough battery !
    Unfortunately, we still have no solution to this problem :(, anyways, thanks ! ;)
     
  40. Bioman75

    Bioman75

    Joined:
    Oct 31, 2014
    Posts:
    35
    Shame that Azuline-Studios is gone now, does anyone know why they left? Will they be developing more assets in the future or is that it?
     
  41. jons190

    jons190

    Joined:
    Sep 13, 2016
    Posts:
    254
    Hey @TonyLi

    A question for you and save system.

    I think I asked this once before, but can find the thread. Anyway. I'm setting up a new game and putting in the save system with RFPS 1.47 and have a question about the spawn point. Is there anyway to control the facing of the FPS_main when it loads up from a save point?

    I have two scenes 1 and 2. I have a scene transition manager/portal going out from scene 1 and a spawnpoint setup in scene 2. When it transition, it keep the orientation from scene 1 and applies it to scene 2, but I would like to have control over which way the new spawnpoint/ camera facing is pointing on load. I think it's keeping the orientation from scene 1 and applying it to scene 2 ont he load, but sometimes that leave my fps_main, looking right at a wall and not the open corridor I would like it facing.

    Zoiks! cheers mate!
     
  42. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,731
    Hi @jons190 - Just set the rotation of the spawnpoint. The player's saver will use its rotation.
     
  43. jons190

    jons190

    Joined:
    Sep 13, 2016
    Posts:
    254
    I thought that was the case, but for some reason It doesn't seem to be working for me. Does it key off the x pointer of the spawnppoint?
     
  44. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,731
    It uses the Y rotation.

    Take a look at the spawnpoints in the example scenes. You can play around with the Y rotation values to see how they affect the rotation when the player spawns into a scene.
     
  45. jons190

    jons190

    Joined:
    Sep 13, 2016
    Posts:
    254
    arrrg.. the Y. WHYYYYYYY?????? For some reason I got it into my head it was the x pointer. Will play around tonight when I get back to the main dev box.

    Thanks a bunch!!!!!!!
     
    SickaGamer likes this.
  46. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,731
    Glad to help. Y is the up axis, so it's the turning left/turning right rotation.
     
  47. jaberwocky

    jaberwocky

    Joined:
    Nov 28, 2016
    Posts:
    102
    Has anyone gotten RFPS to work with the open source version of Rucksack or Inventory Pro?
     
  48. petercoleman

    petercoleman

    Joined:
    Feb 21, 2016
    Posts:
    223
    Hello Everyone,

    I have an enemy in a level that I have following a Path set to Patrol Path or Patrol Once which work Fine as it should...............

    I want to use a RFPS spawner object to spawn the enemy instead and this applies in the case of other enemies too where appropriate. This works however, spawned enemies always seem to "Run" to a goal when spawned whether the target goal (Behaviour) is follow a Path or say follow player.........

    I want spawned enemies in many instances as is the case here to "Walk" a path and not be forced to have them "Run" along a Path or perhaps when the are set to follow player? I want to be able to choose whether the spawned enemy walks to its target or runs to it but it seems that this is not possible?

    Anyone know why the spawned enemies always run in this way and how we can get them to walk instead?

    Thanks for any assistance or help.

    Kindest regards

    Peter

    EDIT UPDATE :

    OK I have fixed this issue now : My enemy I am using is a spawned enemy which resides in a rfps project folder and not in the actual level and is saved there as a specific named copy of the prefab original and thus does not affect other versions of the same Enemy Model in game Yes. Because of this and the fact that RFPS uses the run speed to Patrol a path in this circumstance then I can simply change the Run Speed to the same as walk speed of the specific enemy prefab without affecting the Patrol/Run/Walk speed of any other version of it so each can have an individual behaviour speed when patrolling.

    Not sure if that makes any sense but it may help someone else :)

    Peter
     
    Last edited: May 27, 2020
  49. danteswap

    danteswap

    Joined:
    Oct 27, 2013
    Posts:
    158
    Hi tony sorry to bother again, I am currently facing a weird problem , so in some mobile devices when I fire sniper then the fire sound gets delayed overtime like for first shot its fine but after some shots the fire sound comes after like 10 - 20 seconds of firing , I tested this in my oneplus 3t where all is fine but in a low end phone like Redmi note 7 pro this problem occurs , is there any fix for this that anyone have used after facing the same problem?
     
    JamesArndt likes this.
  50. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,731
    Sorry, I haven't used RFPS on mobile. Good luck! If you find the issue, please post here in case others in the future run into the same thing.
     
unityunity