Search Unity

Realistic FPS Prefab [RELEASED]

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

  1. Defcon44

    Defcon44

    Joined:
    Aug 19, 2013
    Posts:
    400
    Yes i know that but this is not my question.

    I want a trigger big or small and then the player walk in this trigger the footsteps play.

    I want the same with collider, add tag of surface for play the sound but here i want this on trigger.
     
  2. Gua

    Gua

    Joined:
    Oct 29, 2012
    Posts:
    455
    I'm using RFPS 1.21 and a love water zone mechanic, but is there a way to mark object that should float on water?
     
  3. Defcon44

    Defcon44

    Joined:
    Aug 19, 2013
    Posts:
    400
    Hi,

    You can look the Rigidbody of the prefab and change the mass i gess ;)
     
  4. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    There are some forum posts about floating objects. andeeeee posted some code a long time ago. If you just want to make an object float on water, here are the steps:
    1. Configure your object as a non-kinematic rigidbody with gravity.
    2. Determine the height of the water.
    3. Determine how much of the object is below the water level.
    4. Apply an upward force on the object equivalent to how much is below the water level.
    If the object is entirely above the water level, the force should be zero. If the object is entirely below the water level, the force should be enough to move it up.
     
  5. Gua

    Gua

    Joined:
    Oct 29, 2012
    Posts:
    455
    So basically RFPS doesn't handle that for it's water zone and I need to write custom script?
     
  6. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    I think that's correct. It uses the water zone to handle bullets that pass through water, swimming, and drowning damage. I don't think it handles floating objects. You may be able to use this code by andeeeee to make an object float on the water.
     
  7. Dawar

    Dawar

    Joined:
    Dec 7, 2014
    Posts:
    123
    use bouncy toolkit from asset store
     
  8. Gua

    Gua

    Joined:
    Oct 29, 2012
    Posts:
    455
    Mmm?

    https://www.assetstore.unity3d.com/en/#!/search/bouncy toolkit

    https://www.google.com.ua/search?q=...57.198j0j7&sourceid=chrome&es_sm=122&ie=UTF-8

    Thanks!
     
  9. DownFall

    DownFall

    Joined:
    Oct 12, 2014
    Posts:
    36
    Hello I need a little help. I want to replace the Arms on the Realistic FPS Prefab but I don't really know how to do it. Please help! I am currently using these Arms :
    https://www.assetstore.unity3d.com/en/#!/content/18922

    If anyone can help me with this it would be very appreciated!
     
  10. Baraff

    Baraff

    Joined:
    Aug 16, 2014
    Posts:
    255
    I am trying to implement mecanim for NPC's but have a couple of issues. I am just using a sample mixamo soldier to test as I assume you can't use the soldier that comes with RFPS with mecanim right?
    I have copied the MP4 from the standard soldier to the new solider.
    Here are a couple of issues I am having:
    1/ The muzzle flash is always visible.

    2/ The solider moves to a point where he tried to fire and it seems the attack animation plays once but I get this error in the console:

    NullReferenceException: Object reference not set to an instance of an object
    NPCAttack.FireOneShot () (at Assets/RFPSP/Scripts/AI/NPCAttack.cs:128)
    NPCAttack.Fire () (at Assets/RFPSP/Scripts/AI/NPCAttack.cs:110)
    AI+<Shoot>c__Iterator5.MoveNext () (at Assets/RFPSP/Scripts/AI/AI.cs:508)

    3/ When something shoots at the new soldier I get this:

    NullReferenceException: Object reference not set to an instance of an object
    CharacterDamage.ApplyDamage (Single damage, Vector3 attackDir, Vector3 attackerPos, UnityEngine.Transform attacker, Boolean isPlayer) (at Assets/RFPSP/Scripts/AI/CharacterDamage.cs:38)
    NPCAttack.FireOneShot () (at Assets/RFPSP/Scripts/AI/NPCAttack.cs:169)
    NPCAttack.Fire () (at Assets/RFPSP/Scripts/AI/NPCAttack.cs:110)
    AI+<Shoot>c__Iterator5.MoveNext () (at Assets/RFPSP/Scripts/AI/AI.cs:508)


    Is there a tut somewhere that shows how to set new mecanim NPC's up correctly? I did find one that showed a zombie, but that does not help with the soldier issues.
     
  11. Defcon44

    Defcon44

    Joined:
    Aug 19, 2013
    Posts:
    400
    Hey,

    Maybe you miss scripts, look this for how to use mecanim with RFPS 1.22 :

     
  12. Baraff

    Baraff

    Joined:
    Aug 16, 2014
    Posts:
    255
    Thanks @Defcon44, That is the one I looked at actually. Unfortunately it is for the Zombie character which I did manage to get working without a problem. The problem and errors I am having are with the Soldier style character.
     
  13. Defcon44

    Defcon44

    Joined:
    Aug 19, 2013
    Posts:
    400
    Yes i know, but this is the same things, same scripts.

    You just need to change animations ;)
     
    Last edited: Aug 20, 2015
  14. DownFall

    DownFall

    Joined:
    Oct 12, 2014
    Posts:
    36
    Sorry for the repost but

    I need a little help. I want to replace the Arms on the Realistic FPS Prefab but I don't really know how to do it. Please help! I am currently using these Arms :
    https://www.assetstore.unity3d.com/en/#!/content/18922

    If anyone can help me with this it would be very appreciated!
     
  15. Defcon44

    Defcon44

    Joined:
    Aug 19, 2013
    Posts:
    400
    Hello,

    Yes you can change the arms of the RFPS but you need to make a new animation for you'r weapon (idle, reload & ready).

    You can't change the arms without make a new animation, this is not like weapon (you can change it like you want)

    Edit: I think with the last version we can test, i check this tomorrow.
     
  16. Baraff

    Baraff

    Joined:
    Aug 16, 2014
    Posts:
    255
    Thanks @Defcon44, I have already changed both a zombie and a soldier following that video. The zombie works without errors, but the soldier has the errors/problems I mentioned above. I'm not sure what I am missing to make the soldier work correctly.
     
  17. Defcon44

    Defcon44

    Joined:
    Aug 19, 2013
    Posts:
    400
    You welcome ;)

    I have already change soldiers in my game and i don't get error :/

    Re import the soldier and restart all the steps, if you need help you can ask i ;)
     
  18. Dawar

    Dawar

    Joined:
    Dec 7, 2014
    Posts:
    123
  19. Baraff

    Baraff

    Joined:
    Aug 16, 2014
    Posts:
    255
    Thanks @Defcon44, I wil try again. I should have said before that the zombie does not have a gun so it does not fire anything. That's what I seem to be having a problem with.

    To set up a soldier, is it correct to just copy the M4 gun from the standard soldier model into the new model hierarchy?
    I think this is where the problem is.

    ===============

    UPDATE:
    Mostly working now as you described, but the muzzle flash is still always visible?

    ===
    UPDATE 2:
    Fixed. Just needed to refresh the reference after I copied the gun. Seems to be working now.

    Now just need to work out how to add a die animation.
     
    Last edited: Aug 21, 2015
    Defcon44 likes this.
  20. Defcon44

    Defcon44

    Joined:
    Aug 19, 2013
    Posts:
    400
    Hi,

    So i have test to add a new arms to the weapon animation, that works, like this :



    For the "Fire" Animation all works good, no problem, but if you look the reload / ready animation the arms don't move because she's not in the timeline (animation window) you need to animate the new arms.



    So, if you want add a new arms to RFPS you need to remap all Reload and Ready animation.

    Good luck ;)
     
    Baraff likes this.
  21. Baraff

    Baraff

    Joined:
    Aug 16, 2014
    Posts:
    255
    Is there an easy way to add flying NPC's that attack?
    It seems that things need to be attached to the navmesh to be able to attack?

    What about NPC non organic, like a tank?
     
  22. Defcon44

    Defcon44

    Joined:
    Aug 19, 2013
    Posts:
    400
    I think this is the same way :s

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

    Any ideas for my problem ?

    I repost :

    The problem is with the ground, my ground is not flat, thus if I put the ground with " sand " TAG and I add smooth to plane collider for the forest so when the player will walk on a bump in bit or in a hole the sound "dirt" or "foliage" will not play.

    I have two ideas to fix that :

    1) Create a script which detects textures of the ground then I can add a tag has this texture so when the player walks on the sand texture the sound " sand " plays.

    or

    2) Create a zone which defines a surface, when players is in this zone sounds "sand" play.

    You'r are my last chance to fix this, nobody reply me on RFPS forum :/

    If you need ask I

    Thank you
     
  23. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Set up tanks just like any other NPC but with a different model and animation clips.

    It's easiest if your flying NPCs only fly over navmeshes. In this case, just offset the model and collider up into the sky. If you need the flying NPC to fly over obstacles such as walls and lava, you'll need to replace AI.cs. You could make a copy and customize it, or you could use a different AI solution such as Behavior Designer's RFPS integration.

    You've surpassed the limit of everyone's knowledge about RFPS. :) I'll test this out today and let you know if I have any ideas.
     
    Baraff and Defcon44 like this.
  24. NeuroToxin-Studios

    NeuroToxin-Studios

    Joined:
    Dec 7, 2014
    Posts:
    68
    Has Azuline gone quiet again? Do not think I have seen a post from them since the release of 1.22
     
  25. Defcon44

    Defcon44

    Joined:
    Aug 19, 2013
    Posts:
    400
    Ok, thanks Tony ^^
     
  26. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Hi @Defcon44 - Maybe this script will help: RFPS_FootstepZone_2015-08-25.unitypackage

    The package contains an example scene and a small script named FootstepZone.cs:
    Code (csharp):
    1.  
    2. using UnityEngine;
    3.  
    4. // This script changes the footstep material when the player enters the
    5. // GameObject's trigger collider.
    6. //
    7. // To use this:
    8. //
    9. // 1. Edit FPSRigidbodyWalker. Change line 1163 from:
    10. //        FootstepsComponent.materialType = rayHit.collider.gameObject.tag;
    11. //    to:
    12. //        if (!FootstepZone.isInFootstepZone) FootstepsComponent.materialType = rayHit.collider.gameObject.tag;
    13. //
    14. // 2. Add a trigger collider.
    15. // 3. Set the Tag to the material type (e.g., Metal).
    16. // 4. Set the Layer to Ignore Raycast.
    17.  
    18. public class FootstepZone : MonoBehaviour {
    19.  
    20.     private static int inFootstepZoneCount = 0;
    21.  
    22.     public static bool isInFootstepZone { get { return inFootstepZoneCount > 0; } }
    23.  
    24.     private Footsteps footsteps = null;
    25.  
    26.     public void Awake() {
    27.         footsteps = FindObjectOfType<Footsteps>();
    28.         if (footsteps == null) {
    29.             enabled = false;
    30.         }
    31.     }
    32.  
    33.     public void OnTriggerEnter(Collider other) {
    34.         if (other.CompareTag("Player")) {
    35.             inFootstepZoneCount++;
    36.             footsteps.materialType = tag;
    37.             Debug.Log("Entering footstep zone " + name + ". New material: " + tag);
    38.         }
    39.     }
    40.  
    41.     public void OnTriggerExit(Collider other) {
    42.         if (other.CompareTag("Player")) {
    43.             inFootstepZoneCount--;
    44.             footsteps.materialType = string.Empty;
    45.         }
    46.     }
    47. }
    To use the script:

    1. Follow Azuline's tutorial to set up a new footstep type: http://azulinestudios.blogspot.com/2013/08/faq-adding-new-surface-type.html -- you only need to modify Footstep.cs and FPSRigidbodyWalker.cs. You can skip WeaponEffects.cs and ImpactEffects if you want, so start about halfway down the tutorial.

    2. Create a trigger collider. Set its Tag to your new surface type. Set the Layer to Ignore Raycast. In the example scene (in Test/FootstepZone), I created a cube trigger collider named FootstepZone. I left its renderer enabled so you can see it. I set the tag to Metal. When you enter the gray cube, it will play metal footsteps. Outside of the gray cube, it will play the default footstep sound.

    3. As described in the script above, you MUST edit FPSRigidbodyWalker.cs and change line 1163!

    EDITED: Note the new instructions (steps 2-3).
     
    Last edited: Aug 26, 2015
  27. Defcon44

    Defcon44

    Joined:
    Aug 19, 2013
    Posts:
    400
    :0 !!!! Thank you Tony ! you save me with that, you can't imagine ! :0

    That works perfectly ! But then i want to make the trigger more bigger my player can't enter in the trigger, so i set the Layer "ignoreRaycast", i can enter in the trigger but no sound play :(

    Are a little solution for this ? this is just a little things so It is not too grave.

    Thank you Again !
     
  28. Micropez

    Micropez

    Joined:
    Aug 25, 2015
    Posts:
    4
    Hi all.
    Just wanted to find out your thoughts on Behavior Designer with RFPS over iCode?
    Any one has some experience on either AI solution that will suit RFPS a little better. Basically, what I am looking for is that the AI has a more random type feel, such as if the enemy gets hit X times he runs for cover.

    I appreciate any advice!
     
  29. Defcon44

    Defcon44

    Joined:
    Aug 19, 2013
    Posts:
    400
    Hi,

    If you want an advanced AI, you can use this :

    https://www.assetstore.unity3d.com/en/#!/content/7009

    I can't help you with Behavior Designer because i don't use them :s

    I hope to have helped you :)
     
    Micropez likes this.
  30. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    I'll take a look at this today and update the script and example scene.
     
    Defcon44 likes this.
  31. Baraff

    Baraff

    Joined:
    Aug 16, 2014
    Posts:
    255
    Behavior Designer will likely allow you to do what you want. There is in fact a Cover task included in the Movement pack which comes with it. Please understand though, that to get Behavior Designer to work with RFPS, you will need to be replacing all of the AI from RFPS because they conflict with each other. I have BD but have put it aside till later. I should also say the Dev is very responsive and will answer any question very quickly if online or within the day.
     
    Last edited: Aug 25, 2015
    Micropez likes this.
  32. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Okay, I forgot that FPSRigidbodyWalker only passes through trigger colliders if they're on the Ignore Raycast or TransparentFX layers. I updated the code and example scene above.
     
  33. Micropez

    Micropez

    Joined:
    Aug 25, 2015
    Posts:
    4
    Thank you Defcon and Baraff, I really do appreciate your response.

    I have decided to try out Behavior Designer, as promising as Advanced AI looks, it is a little out of my budget this month unfortunately.

    I also had a deeper look into this forum and I see that TonyLi recommends it as well.

    Ill report back how I find it.

    Thanks again!
     
    Defcon44 likes this.
  34. Defcon44

    Defcon44

    Joined:
    Aug 19, 2013
    Posts:
    400
    You welcome :)

    Thank you again for this ! I test that tonight and i update my message :)
     
  35. Defcon44

    Defcon44

    Joined:
    Aug 19, 2013
    Posts:
    400
    All works good Tony !

    Thanks (I know That makes many of thank you ^^)
     
  36. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Happy to help!
     
    Defcon44 likes this.
  37. NeuroToxin-Studios

    NeuroToxin-Studios

    Joined:
    Dec 7, 2014
    Posts:
    68
    Tony I am having a rather trivial issue that I bet is simple to fix and I just need to open my eyes, I have added a few bolt action rifles to my game and am trying to make the player not able to shoot until the reload animation has played (pulling the bolt etc), the problem is I cannot seem to find a "delay" to stop firing for a while after a reload. I did try to mess with the Animation time but that did nothing, any ideas?
     
  38. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Hi @ShadowWarrior979 - On the Weapon Behavior, Fire Anim Speed specifies how fast to play the animation clip. A value of 2, for example, plays the animation clip and double speed. Try setting Fire Rate instead. As a test, I set the AK47's Fire Rate to 2 to make it wait 2 seconds between each shot.
     
    NeuroToxin-Studios likes this.
  39. NeuroToxin-Studios

    NeuroToxin-Studios

    Joined:
    Dec 7, 2014
    Posts:
    68
    Ok think I might just stop using RFPS here haha, knew it was something insanely simple and right in-front of me. You would not believe how long this has had me puzzled... Thanks Tony
     
  40. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    No worries! Glad I could help out.
     
    Defcon44 likes this.
  41. Defcon44

    Defcon44

    Joined:
    Aug 19, 2013
    Posts:
    400
    Hi,

    A little info, i have fixe my hold Flashlight problem.

    This is the size of "FPSWeapons", bacis = 20, i have change it to 5 and that works now ;)
     
  42. Defcon44

    Defcon44

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

    I have a problem with RFPS today (I have touch any scripts).

    I have make a new animation (New Gun), after finish my animation, i go test the new gun.

    (The problem is not here for Pistol and melee weapon)

    Now i see the problem :

    Then i take gunthe "ready" animation play but Instead of playing in the middle of the screen, she plays below on the left the screen, it is not just concerns animation because if I shoot, bullets leave the weapon, it's as if the whole weapon was turned to the left. I have the same problem then i run with it. The weapon keep this position ... 10 or 15 seconde and after that she take the good position (middle of the screen).





    Other problem, then the "Have Weapon" case is activate, then i drop weapon the "Have weapon" case don't deactivate.
    I can drop unlimited M4 or MP5, Ak47 etc ...



    Somebody with an idea please ? :s

    I repeat, i have touch ANY scripts, only make new animation :/

    All works good this afternoon and tonight this bug

    Thank you
     
  43. NeuroToxin-Studios

    NeuroToxin-Studios

    Joined:
    Dec 7, 2014
    Posts:
    68
    What animations are you using for that weapon? I also have it from the asset store but it does not come with animations
     
  44. Defcon44

    Defcon44

    Joined:
    Aug 19, 2013
    Posts:
    400
    I use the M4 Animation of RFPS
     
  45. QuadMan

    QuadMan

    Joined:
    Apr 9, 2014
    Posts:
    122
    Change Sprint position?
     
  46. TechSinsN

    TechSinsN

    Joined:
    Apr 12, 2014
    Posts:
    121
    can anyone help me with this?
    'CZ_Anim' AnimationEvent 'm_Fire' has no receiver! Are you missing a component?

    CZ is the name of my weapon
     
  47. Defcon44

    Defcon44

    Joined:
    Aug 19, 2013
    Posts:
    400
    This is not just sprint position.

    This problem appear with Rifle & Shotgun if player don't move and sprint.
     
  48. Defcon44

    Defcon44

    Joined:
    Aug 19, 2013
    Posts:
    400
    My problem is resolve.

    This is the RifleSprinting animation, Script Angle inside her change value.

    All works good now ;)
     
  49. Defcon44

    Defcon44

    Joined:
    Aug 19, 2013
    Posts:
    400
    You'r animation has "ReadyOnly" ?

    Do you have an event call "m_Fire" in this animation ?

    Because the animation "CZ_Anim" try to access to "m_Fire" inside her.
     
  50. Defcon44

    Defcon44

    Joined:
    Aug 19, 2013
    Posts:
    400
    Hi,

    i have a little problem with impact image, but only with some gameobject not all.

    The problem :



    This is .... BIG

    But not with all gameobject, for example with this car the problem is only on Doors.

    Idea ?