Search Unity

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:
    12,701
    Doh, sorry, I was unclear. Just drop the script file into your project. You don't need to attach it to anything.
     
  2. jons190

    jons190

    Joined:
    Sep 13, 2016
    Posts:
    260
    Hey gotcha! I think I figured it all out lastnight. Worked on it till about 3 am and finally looked up and all the error messages were cleared from the console! Whoot whoooo! The main error was when I did the gloabal search and replace I caught a few of the" move.input.x" type statements. Once I cleaned that up it all seemed to work. I can't do a build till this afternoon tot he gearVR to see if it all mapped right, but it looks good so far. Thanks for all your help I may have to give you a point or two on the game once it releases ;-)
     
    Last edited: Mar 24, 2017
    TonyLi likes this.
  3. J_Mawuks

    J_Mawuks

    Joined:
    Jan 28, 2016
    Posts:
    7
    Hello,
    I was hoping that I could get a guide on how to successfully set up vr for rfpsp. I'm new to rfpsp. Aside that more tips concerning this topic would be useful:)
     
  4. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,701
    Hi! RFPSP works with VR headsets, but it has the same challenges as any first-person VR experience. Here are a few tips:
    • Turn off the FPS Player's Horizontal Bob and Vertical Bob. These will give you bad motion sickness in VR.

    • Locomotion (movement) is still an unsolved problem in VR. When VR is active in RFPSP, your body can be facing one direction while your head (camera) is facing another. It feels very disorienting to press the forward button and not actually move in the direction that you're looking. You'll probably want to write a script that synchronizes the body's rotation to match the camera's rotation. This way the player's body will always be facing the direction that he's looking. Alternatively, you could sync up only when moving. If you're not handy with scripting, you'll need to finding someone to help with that. I wish I could help out, but my time's tied up for a while. If you get it working, it would be nice if you'd consider posting it here to share with others.

    • RFPSP uses GUI Text for HUD elements such as health and ammo. You can find the GUI Text prefabs in RFPSP/Objects/HUD. For VR, you'll probably want to move them closer to the center of the view area because VR headsets have a smaller field of view. I'm not the RFPSP developer, but I posted some info on using Unity UI if you want to use that instead. You can find it here and here.
     
    J_Mawuks likes this.
  5. J_Mawuks

    J_Mawuks

    Joined:
    Jan 28, 2016
    Posts:
    7
    Hello once again,
    Thank you for the tips. I wanted to successfully set it up. I was reading through the forums and I saw a post concerning this topic, but it was outdated (v1.6. here). Since the latest is 1.24, what would be the most advisable method of setting this up. And again thanks for the tips. Also if possible, the script for making the body face the direction of the camera or can I just disable the body component
     
    Last edited: Mar 25, 2017
  6. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,701
    Azuline wrote those instructions before Unity have native VR support. In the current version of Unity, you can simply enable VR support using these steps.

    By "body", I mean the FPS Player GameObject, not the third person body model. You can't disable this. You'll need to write a script to re-orient it to match the camera's rotation, or live with it facing its own direction independent of the camera.
     
    J_Mawuks likes this.
  7. jons190

    jons190

    Joined:
    Sep 13, 2016
    Posts:
    260
    Hey there J_Mawuks. So first question: What VR SDK are you using? I have been working with RFPS and GearVR/Rift for a couple months now. RFPS works fairly well in VR. (the 1.24 release, 1.23 had some layering issues that I never sorted out) There are a few gotchas. If you are on mobile VR, there is a bunch of stuff you have to disable on the prefab to get anywhere near close enough of a framerate. Also the UNITY control schema that RFPS uses DOES NOT TRANSLATE well into android/ mobile. You'll have to get Rewired working to be able to map out control schemas on Mobile. (I just got this working with the help of Tony LI) Let me know what SDK you are on and I can give you some lists of what you may need....

    Also: To quote Tony Li: By "body", I mean the FPS Player GameObject, not the third person body model. You can't disable this. You'll need to write a script to re-orient it to match the camera's rotation, or live with it facing its own direction independent of the camera.

    This is the step I am working on currently. It is a BIG gotcha. But there is already some code in RFPS shooter that does this. I am sniffing through now, but I believe if you hit the "insert" key to get a different binding to the camera (weapon view????) that works REALLY well for gaze input. Just out of box, you get an odd binding where you get "the body and the shoulders" that move with the joy sticks on a controller and then your head is "free looking" It gets disorientated real quick. You can look 180 degrees behind you and still have your body facing forward, and your shoulders at a 45 degree angle and you lose track of what and where you are facing real quick. Anyway Let me know and I'll help where I can.

    Cheers mate!
     
    J_Mawuks and TonyLi like this.
  8. Raistlin2015

    Raistlin2015

    Joined:
    Apr 4, 2015
    Posts:
    27
    Hello, I am having trouble getting NPC's to spawn. I have the Waive Manager and the NPC Spawner in the scene along with the Way-point object. I have all scripts and objects linked where the in-scene scripts ask for them. When I start the game I get a warm up counter and a waive beginning sound and a count of the waive number and number of NPC's left in the waive but no actual NPC's are actually instantiated. I also tried with the Example Waive Spawner in the RFPSP/Objects/NPCs/Managers and Examples directory. What am I doing wrong?
     
  9. J_Mawuks

    J_Mawuks

    Joined:
    Jan 28, 2016
    Posts:
    7
    Actually, it's for android. And thank you for showing your concern. Also to Tony Li
     
  10. Raistlin2015

    Raistlin2015

    Joined:
    Apr 4, 2015
    Posts:
    27

    Ok I figured it out. The FPS Camera on the FPS Main Game Object needs to have the "single instance" NPC items loaded into index 0 followed by the Faction Spawners Game Object in index 1 and the Wave Spawner in index 2.
     
    jons190 likes this.
  11. J_Mawuks

    J_Mawuks

    Joined:
    Jan 28, 2016
    Posts:
    7
    Does anyone have the release notes for v. 1.24 or contact with Azuline Studios concerning the version:)
     
  12. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,701
    To get version notes, you can click on the version number on the product's Asset Store page. The version notes for 1.24 are:

     
    J_Mawuks likes this.
  13. jons190

    jons190

    Joined:
    Sep 13, 2016
    Posts:
    260
    "Actually, it's for android."

    So Oculus or Cardboard? ( not that it really matters for 80% of it all.....) I'll put together a checklist of stuff I have figured out and post it to you in a bit. Just getting sat down in the studio for the day and am going to be tackling integrating Tony Li's dialogue /save and quest system and working on fixing some of the RFPS full axis spin in VR issues (where you can look 180 behind you while moving forward /disorientation stuff) this week. <C#> Something, something ...vector.move.something.....</C#>

    So, you can export the RFPS sandbox straight to android VR. It's not at all optimized for mobile VR and will throw the thermal throttle on an android device within the first 10 minutes, but it will work almost right out of the box, so to speak and you can easily start optimizing it by stripping some of the visual scripts (bloom, lens flare, intiasile) and disabling "showing full 3d body", changing the shaders over to mobile, etc.

    But...... you'll have trouble with the controls once in VR. You'll need a bluetooth controller to map all the RFPS controls (gearvr only has 5 built in control point sand Cardboard headsets only have one) and that controller WILL NOT WORK OUT OF BOX. It's not a RSPF issue, but rather an UNITY/android issue (now this is for Oculus SDK and Cardboard, but I have not tried the new google daydream SDK yet) The control mapping somehow gets lost with the export with these SDK's and/or the android =unity controller mapping do not fully translate well. This is a known issue in the Unity /VR community and the one quick way to fix this is use the Rewired plugin.

    I spent maybe two weeks working to get the Unity internal controller mapping to work and..... got it to kinda work, but it never fully did (I have a number of Bluetooth controllers to test on and never got a consistent control mapping across all of them ) however, it took maybe 48 hours to get rewired mostly working (with the excellent help of Tony Li)
    (see post from just a few days back on this exact threat on getting rewired workingwith RFPS )

    and it now works with all my controllers and I am wiring up the user assignment code and GUI so end users can map their controllers anyway they want.

    Now, there is a bit of coding that needs done to lock down the main RFPS prefab with the proper virtual tracking and movement schema and that is almost dependent on your game. Are you FPSing? Teleporting? Gazeing? 360 single point spining? I'm doing a FPS fantasy game (http://huesgfx.com/firedrake) so I am working on getting the FPS type movement going. Anyway, hope this helps.
     
    Last edited: Mar 26, 2017
    J_Mawuks and chelnok like this.
  14. J_Mawuks

    J_Mawuks

    Joined:
    Jan 28, 2016
    Posts:
    7
    Thank you so much for this info. Be sure to try it out when I get close to my pc. And yes it is the typical fps game.
     
  15. Deki3d-Virus

    Deki3d-Virus

    Joined:
    Dec 11, 2012
    Posts:
    25
    I have this Error in Unity 5.5.2f1 how to fix?

    NullReferenceException: Object reference not set to an instance of an object
    AI+<AttackTarget>c__Iterator3.MoveNext () (at Assets/RFPSP/Scripts/AI/AI.cs:927)
    UnityEngine.SetupCoroutine.InvokeMoveNext (IEnumerator enumerator, IntPtr returnValueAddress) (at C:/buildslave/unity/build/Runtime/Export/Coroutines.cs:17)
     
  16. TheChairMaster64

    TheChairMaster64

    Joined:
    Aug 9, 2016
    Posts:
    59
  17. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,701
    Does your NPC have a NavMeshAgent? It's required.
    Nice! I liked seeing the "In The Beginning" part, which shows how far the game's come along.

    Have you considered a face overlay like in Doom? Just an idea. I don't know if it would add anything, or detract from the immersion, or even be too much of a ripoff of Doom.
     
  18. TheChairMaster64

    TheChairMaster64

    Joined:
    Aug 9, 2016
    Posts:
    59
    I thought about the face thing as well but I wouldn't know how to do the coding for it to make the face change as the player takes damage or heals and I still dont know how to make GUI scale with screen and resolution like how ammo and health do so ya I wouldn't know how to do since I can't code rip xD. Plus I honestly don't know what my main character is gonna look like fully yet but I have a idea of it. It's going to be a castlevania/military/ Sci fi medieval look to him but I'll need to work on it a bit in some concept art stuff :) Devil May Cryish character you could say idk I got a bunch of weird stuff in plan.
     
    Last edited: Mar 29, 2017
  19. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,701
    If you make a Unity UI Canvas and add a Canvas Scaler component, it should scale to resolution. If you end up wanting to make a face that changes with the player's health (assuming that actually fits with your game design), let me know and I'll try to post some tips.
     
  20. TheChairMaster64

    TheChairMaster64

    Joined:
    Aug 9, 2016
    Posts:
    59
    Thanks again Tony I'll do some testing later
     
  21. Deki3d-Virus

    Deki3d-Virus

    Joined:
    Dec 11, 2012
    Posts:
    25
    yes my npc work fine this error only hapen when i add waypoint group to npc...
     
  22. JACKO4590

    JACKO4590

    Joined:
    Nov 25, 2014
    Posts:
    81
    Has anyone heard from @Azuline-Studios yet regarding this next update? like maybe an eta on when they think it will be released?
    Going by the website the last few years thay have been taking 10 to 11 months to bring out an update. The last update was 22nd of April so that is almost 12 month ago. So is there an update coming soon and do we know what features are going to be included?

    This being kept in the dark has had me waiting since the end of last year and i was wondering if there are still alive and well.
     
  23. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,701
    I talked with Azuline last month, just prior to releasing the Save System for RFPS. They're still working on the next update. I don't know their timeline or what features they're including, except they'll probably include an OnDie() UnityEvent in CharacterDamage.cs.
     
    Hormic and Weblox like this.
  24. Novacane89

    Novacane89

    Joined:
    May 3, 2013
    Posts:
    15
    Hi there,

    I have been building my knowledge in RFPSP for over a year and a half now and have learnt alot of things, I also have enhanced my AI significantly ..... added Multiple Random Attack Animations per melee character,added multiple random sound effects to each character with their random pitches, Added the ability to randomly decide to run away if NPC health is below 100, Added Hit Reaction Animations that gets randomly triggered and sets an UpperBody mask weight to 1 for the brief reaction time so that the reaction does not affect the leg anims,Added custom "GRAB" animations that gets triggered randomly by an AI to grab you if they are close enough ( with an exit 3 button code linked to a timer) before you get killed, I absolutely love this package and the FPS control is WAY better than UFPS. However i am struggling with one annoying issue regarding the AI with RFPS.... And that is the SLIDING of the AI characters... And im talking about AFTER you have synced the animations and speeds.. Firstly - I noticed that When an NPC sees you FOR THE FIRST TIME since the level was loaded it will tend to slide toward you before the run animation gets triggered. a small delay but annoying none the less, A strange way i have found a way to fix this was to create a small script that included all the NPC's in the level into a GameObject array and then Setting the FPS Player as active target just after the level is loaded, THey give a brief reaction and then coninues to their idle mode but then when they see you they dont give that little slide before the run animation is triggered. Does anyone have an example on how you could use this AI script with Blend tree Animations connected to agent speed? or even an example of how i would go about preparing this AI script for use with Root motion animations.

    Best Regards
    Novacane89 -Graham Indy developer and Real-time television broadcast graphic designer/programmer for Vizrt
     
  25. Weblox

    Weblox

    Joined:
    Apr 11, 2016
    Posts:
    277
    Hi @Novacane89 ,

    I'm afraid I can't help you with the sliding AI issue, but I am pretty sure you will find help on this forum. The changes you made to the RFPS AI really are awesome. Are you using Mecanim or Legacy ?

    I always wanted these features for RFPS AI but have never been able to get there. Can you post some more Info on how you implemented those features into your Project? I have integrated Emerald AI for use with animals and wildlife, but for wave survival mode I still use RFPS AI and having multiple attack animations would be awesome! ;)

    Awesome too ! I suppose this has been hard to implement. Please make a video to showcase.

    Cheers, Weblox.
     
  26. Deleted User

    Deleted User

    Guest

    Hey everyone, apologies for my absence lately. Development of the Realistic FPS Prefab has been slower this year, but it is still underway. Thank you very much for your continued interest and support, it means a lot. A new update has been uploaded and is going through the review process. This can usually take a few days to a week before it's available to download from the Asset Store. The new version 1.25 will be compatible with Unity 5.2.5 and 5.5.1+ and includes many fixes and improvements:
    • All legacy particle emitters replaced with Shuriken particle systems.
    • Removed World Collision layer for simpler setup of scenes. Player and weapons just interact with the Default layer now.
    • Added On Die event to CharacterDamage.cs for the RFPSP Save System by Pixel Crushers.
    • Added ApplyDamageEmerald function to FPSPlayer.cs for compatibility with Emerald AI by Black Horizon Studios.
    • Added input dead zone and smoothing to joystick control when sprinting and strafing to prevent excessive zig-zagging.
    • Fixed reload animation not playing if hiding weapon/climbing interrupts automatic reload.
    • Added audio engine check to allow weapon fire if audio engine is not running.
    • Fixed AI hunting behavior.
    • Added crouchWalkYposition and weaponWalkYposition to WeaponBehavior.cs to allow customizing of vertical weapon position when walking or crouching.
    • Made vertical pivot bob scale properly with joystick input.
    • Clamped Joystick and WASD input to prevent exceeding of maximum movement speed.
    • Added subtle Perlin Noise to Ironsights.cs for more natural variation of weapon and camera position bobbing.
    • Replaced unneeded sphere cast for AI line of sight check with ray cast for increased performance.
    • Reduced pivot bobbing when moving and deadzone-aiming.
    • Added a jumping and landing animation to weapons.
    • Reduced complexity of tree shadows in demo scene for performance gain.
    • Fixed weapon smoke position when bullet time is active and player starts sprinting.
    • Spotlights from weapons no longer shine on weapon models.
    • Smoothed zooming transition to prevent jerky movement with rapid zooming/unzooming.
    • Improved smoothing of shield blocking transition.
    • Improved rotation of camera when dead zone/free-aiming.
    • Improved barrel smoke emission code to allow for customization of barrel smoke emission duration.
    • Fixed third person toggle button not working correctly at low frame rates.
    The next version will mostly be focused on replacing legacy animation components with Mecanim animators and the completion of third person mode character animations. Also, if you haven't checked out TonyLi's Save System for the Realistic FPS Prefab, you should have a look! It's easy to set up and very well done!


    This sounds like it might be something to do with the code from 1.21. You might want to try keeping the "capsule.radius * 0.90f" fix, but moving the capsule cast down to compensate for the decreased radius, so the bottom of the capsule cast still reaches down a small amount past the player's capsule collider, so it can detect the grounded state properly?

    If you have access to new versions of the scripts, the code below in FPSRigidBodyWalker.cs might be the key:

    Code (CSharp):
    1.     void Update(){
    2.         capsuleCheckRadius = capsule.radius * 0.9f;
    I'll have a look at recreating & fixing this issue and let you know either here or by email.


    Great work with your additions to the NPC AI. What you're describing with the sliding characters sounds like it might be a bug with the initialization of animation transition/blending. Will do some tests and provide a fix.
     
    magique, TonyLi, Novacane89 and 3 others like this.
  27. J_Mawuks

    J_Mawuks

    Joined:
    Jan 28, 2016
    Posts:
    7

    Hello.
    So the Mecanim animators and the completion of third person mode animations would be available in the next update? If so, when is the next update? And anyways can't wait to get my hands on 1.25
     
  28. JACKO4590

    JACKO4590

    Joined:
    Nov 25, 2014
    Posts:
    81
    So is there any word on multiplayer being worked on yet?
     
    Novacane89, emperor12321 and J_Mawuks like this.
  29. Novacane89

    Novacane89

    Joined:
    May 3, 2013
    Posts:
    15
    @Azuline-Studios Excited about the update, Will back up my project Just in Case xD! Keep up the good work. Thanks for noting the Bug to do with Initializing the animations for AI when seeing FPS Player for the first time since level load. You have our support all the way and thank you for the comment regarding my additions !

    If you implement support for root motion in your AI i would make an additional donation! (just planting a seed of thought!)

    @Weblox I am converting all my AI characters to Mecanim now and have implemented random attack animations for mechanim using a blendtree instead of the shoot animation and inside the blend tree it is set to 1D (1 dimentional) with my various attack anims as different blends, then a randomly generated Integer between 0 and AttackAnims Array.Length gets to decide what blend to use for that attack at that specific point in time.

    Before when my animations were still Legacy i used this technique..

    On my AI Character gameObject that contained the Animation Component, you select the Animation Component and expand the size of the animations array, you then drag in your additional attack animations...

    After that you go to the IENumerator Shoot()
    and under if(!Mecanim)
    you declare an int Decider = Random.Range(0,AmountOfAnimations).

    You then do a case statement on the Decider int and for example case 1 = anim 1
    case 2 = anim 2 and so on...

    Set clip AnimationsArray[decider] followed by .Play().

    I prefer using mechanim now and the blend trees are awesome
     
    Last edited: Apr 1, 2017
    Franciscotx56, Hormic and Weblox like this.
  30. Novacane89

    Novacane89

    Joined:
    May 3, 2013
    Posts:
    15
    The Grab feature was done in a similiar way but the Grab attack Animation clip itself had an Event trigger stored at the end of the grab animation to trigger a public method that ran a check to see if the player was within reach, And if so..
    Set enemy hand mounted cam = FPS Camera.GetComponent<MovePlayerAndCamera>().CinemaCameraObj
    Trigger the ToggleCinemaCamera() public method of the FPS player Camera object that releases FPS camera to secondary Cinema Camera AND trigger enemy SuccessfullGrab Animation... .ELSE --Player too far.. resume normal behaviour
     
    Last edited: Apr 1, 2017
    Weblox likes this.
  31. Weblox

    Weblox

    Joined:
    Apr 11, 2016
    Posts:
    277
    @Novacane89 Thanks for the reply and all the informations.
    The Mecanim setup seems to be the way to go, now that Azuline announced to focus on Mecanim Animators. I have not been playing around with blend trees alot, but once I get there I will definitely try to setup something similar.

    Now I am excited for the new RFPS Update and having made some changes to the AI Scripts (for the Unity Events) and such, I hope to figure out a good way to Upgrade my Project without losing the settings in all my Prefabs... ;)
     
    Novacane89 likes this.
  32. petercoleman

    petercoleman

    Joined:
    Feb 21, 2016
    Posts:
    477
    I was really looking forward to this 1.25 version Update with a view to moving my game developments forward, updating to a newer Unity version and buying a lot more assets to improve all aspects of my games. Assets for Improved water, skies, terrain, perhaps TonyLi's Save System and or Dialogue system, more advanced AI (Emerald perhaps) and more.

    Been using RFPSP for about 2 years but put dev on hold almost six months ago waiting for this release and the anticipated completion of third person mode character animations. Unfortunately I am disappointed after waiting a year since the last major release and having no idea if and when it may ever make it into RFPSP.

    There's nothing in V1.25 that I could not have lived without but really needed the TP completion as for me personally its a must for my games especially for my Fantasy/Medieval game project as I cant live with the current restricted FPS option which looks quite unprofessional to me personally on screen during gameplay.

    I have already purchased another quite expensive TP controller asset but would prefer to use my original choice of RFPSP as overall its a more complete system with better integration with other assets. All it lacks as a critical item to me is credible TP (character) gameplay.

    No idea where I go from here.

    No idea if and when an update to complete of third person mode character animations may come along?

    Still in the dark on that one.

    I have no idea if as an end user could possibly update it themselves or how to do it, ( I do create my own Characters for RFPSP, Mecanim Animations ) or how difficult it might be but I am not an expert programmer and believe it best that an asset developer is the best person to do that.

    Neither do I have any idea if there is another quality asset that could be easily integrated with RFPSP to replace/add to the current lack of completed TP?

    Stuck between a rock and a hard place at the moment.

    Peter
     
    J_Mawuks and emperor12321 like this.
  33. J_Mawuks

    J_Mawuks

    Joined:
    Jan 28, 2016
    Posts:
    7

    Hello Peter.
    I agree with you on the tp. But rfpsp also lacks easy integration with free multiplayer assets such as unet and photon pun free. That would all I'll for my multiplayer fps game.

    Jerome
     
  34. unity-werkstatt

    unity-werkstatt

    Joined:
    Oct 7, 2015
    Posts:
    10
    Hi all
    I really disagree on this one You cannot expect everything form Azuline guy, because as project grows it is harder and harder to keep all things on same level of development.

    Multiplayer is really not as easy as You think . I started with RFPSP but i have had to make so much changes i can not keep up with updates here so i have to do a lot of things on my own , means i am not siting and wait for him to do it for me because some time ago I have paid one time fee. C'mon guys lot of them here expect everything on plate and to have AAA game with almost no effort . If this is that easy why big studios would employ hundreds of workers, when one guy can do it all by him self.I could say a lot more since i have same problem my client expect lot of things for really short amount of time and as project is near completion it is really much harder to comply to all their requests, especially when they don't a clue about any type of programming. Their maximum of understanding is : " if this -> that , if that -> something else, else if not that ... make some script that will do that ... :) "

    and for petercoleman this could be solution for U
    hope it will help


    or try TPC with emerald otr behaviour designer

    or You can start with this one
    make Your own FPS /TPS controler

    here is all You need for start ;)

    I didn't mean to offend anyone here, maybe for someone my words will sound harsh, but statement : " I am not a programmer but i want this to work in my way ...", leads to a solution either learn to code or hire someone to do it for U

    Kindest regards
     
    Last edited: Apr 4, 2017
    Malbers, Weblox and chelnok like this.
  35. Deckard_89

    Deckard_89

    Joined:
    Feb 4, 2016
    Posts:
    316
    @petercoleman

    Hmm, sorry if I misunderstood you here, but why are you using RFPS as the basis for third person gameplay? The third person mode is more of an extra and is really not the focus of the tool. If I were you I'd use a dedicated third person system as a starting point, and integrate it with an AI plug-in.
     
  36. TheChairMaster64

    TheChairMaster64

    Joined:
    Aug 9, 2016
    Posts:
    59
    Hey idk if it's possible but is there a way to trigger something in one scene from another for example: I find a new gun I walk into a trigger placed on it and now that it's triggered it will appear in a gun room in a hub world.
     
  37. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,701
    If you're using the Dialogue System, set a Dialogue System variable true when the player enters the gun trigger. (Add a Lua Trigger set to OnTriggerEnter.) In the hub world scene, add a Persistent Active Data component that activates the gun pickup if the variable is true.

    If you're not using the Dialogue System, you can do something similar. Define a variable in a script. The quick-and-dirty way to do it is to make the variable static so its value sticks around when you change scenes. In a Start() method in the hub world scene, check the variable value and activate or deactivate the gun pickup accordingly.
     
    Mark_01 and Deleted User like this.
  38. o0neza0o

    o0neza0o

    Joined:
    Sep 6, 2015
    Posts:
    165
    Hey, i have got this problem with wave manager where i add more spawning points i get this problem

    IndexOutOfRangeException: Array index is out of range.
    WaveManager+<StartWave>c__Iterator0.MoveNext () (at Assets/RFPSP/Scripts/AI/WaveManager.cs:153)

    UnityEngine.SetupCoroutine.InvokeMoveNext (IEnumerator enumerator, IntPtr returnValueAddress) (at C:/buildslave/unity/build/Runtime/Export/Coroutines.cs:17)
    UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
    WaveManager:Start() (at Assets/RFPSP/Scripts/AI/WaveManager.cs:101)
     
  39. o0neza0o

    o0neza0o

    Joined:
    Sep 6, 2015
    Posts:
    165
    okay, i fixed the problem but since i added my pause menu and took away rfps main menu the bullet time slomo dont work :/
     
  40. Takahama

    Takahama

    Joined:
    Feb 18, 2014
    Posts:
    169
    Hello!
    i just noticed new version's bullet tracers are way too slow. There is any way to incrase its velocity ? and make it look like NPC tracer ?
    EDIT: Found it. its on "Simulation Speed"
     
    Last edited: Apr 6, 2017
  41. Deleted User

    Deleted User

    Guest

    No problem @Novacane89, thanks for bringing this up. This fix will be included in the next version. Will look into root motion for NPCs. It turns out the NPC animation issue was related to the AI logic update interval. The NPC AI only updates every 300ms instead of every frame, which would be slow and unnecessary, but it can cause some bugs like you noticed. To fix it you can add these variables to AI.cs:

    Code (CSharp):
    1.     private bool animInit;//to bypass normal AI update interval for correct animation initialization
    2.     private bool animInitialized;//to only initialize animations once
    Then add this function:

    Code (CSharp):
    1.     //For when an NPC starts moving from a stationary/idle stance.
    2.     //This function bypasses normal AI Logic interval of 300ms (for efficiency) and runs the next AI logic pass immediately in the next frame.
    3.     //Doing this prevents NPCs from sliding on the ground when first encountering target or player (prevents delay in movement anim init).
    4.     private void InitializeAnim(){
    5.         if(!animInit && !animInitialized){
    6.             animInit = true;
    7.             animInitialized = true;//to only initialize anims once
    8.         }else{
    9.             animInit = false;
    10.         }
    11.     }
    Then, call this function when the NPC goes from stationary to moving animation in these locations in AI.cs:

    Code (CSharp):
    1.                     if(!orderedMove){
    2.                         speedAmt = walkSpeed;
    3.                     }else{
    4.                         speedAmt = runSpeed;
    5.                     }
    6.                     InitializeAnim();
    7.                     TravelToPoint(startPosition);
    Code (CSharp):
    1.                             speedAmt = runSpeed;
    2.                             lastRunTime = Time.time;
    3.                     }else{
    4.                         if(lastRunTime + 2.0f < Time.time){
    5.                             speedAmt = walkSpeed;
    6.                         }
    7.                     }
    8.                     InitializeAnim();
    9.                     TravelToPoint(playerObj.transform.position);
    Code (CSharp):
    1.                 //search for player if their attacks have been heard
    2.                 if(heardPlayer && (target == playerTransform || target == FPSWalker.leanObj.transform)){
    3.                     InitializeAnim();
    4.                     speedAmt = runSpeed;
    5.                     SearchTarget(lastVisibleTargetPosition);
    6.                 }
    Code (CSharp):
    1.                 //search for target if their attacks have been heard
    2.                 if(heardTarget){
    3.                     InitializeAnim();
    4.                     speedAmt = runSpeed;
    5.                     SearchTarget(lastVisibleTargetPosition);
    6.                 }
    Code (CSharp):
    1.             }else{
    2.                 InitializeAnim();
    3.                 target = playerTransform;
    4.                 speedAmt = runSpeed;
    5.                 TravelToPoint(target.position);
    6.             }
    Code (CSharp):
    1.                     SetSpeed(speedAmt);
    2.                     agent.speed = speedAmt;
    3.                 }
    4.  
    5.                 InitializeAnim();
    6.                 speedAmt = runSpeed;
    7.  
    8.                 Vector3 forward = myTransform.TransformDirection(Vector3.forward);
    Code (CSharp):
    1.                         if(timeout > Time.time){
    2.                             InitializeAnim();
    3.                             speedAmt = runSpeed;
    4.                             SetSpeed(speedAmt);
    5.                             SearchTarget(lastVisibleTargetPosition);
    Then, this line of AI.cs:

    Code (CSharp):
    1. yield return new WaitForSeconds(0.3f);
    ...at the end of the function StandWatch() and AttackTarget() needs to be changed to:

    Code (CSharp):
    1.             if(animInit){
    2.                //only wait one frame till next pass so animations will be initialized now, instead of in 0.3 second normal AI calculation delay
    3.                 yield return null;
    4.             }else{
    5.                yield return new WaitForSeconds(0.3f);//wait 0.3 seconds (not every frame) untill next AI calculation (for efficiency)
    6.             }
    ...so InitializeAnim() will skip the AI update delay when it needs to.


    I understand your frustration at the pace of development lately petercoleman and I apologize that it has affected your timeline. I don't like to give excuses, but Azuline Studios is a very small operation, consisting of one person basically, and development was slower last year due to personal reasons. The Realistic FPS Prefab is the result of years of learning and hard work and remains a priority even if there are slow times in development. Regardless, I appreciate that you are waiting for more Realistic FPS Prefab features to be implemented when there are other more popular and complete assets available. Letting my supporters down is the last thing I want to do.

    As for your question on a timeline for the completion of third person and Mecanim animations, I can't give an exact date, but I would hope a month or so. Part of the delay with the last update was related to experimenting with new features and making decisions on the best compromise between performance, ease of use, and visual quality. For example, an early version of the particle emission script was not efficient, so it was scrapped and the current method was researched and implemented, which only needs one particle emitter for every emission of that type in the scene.

    Most of the main features and decisions for third person mode have been made, so it is now more about setting up the animation controller and creating appropriate animations for the different character actions and states. This is also a first step towards multiplayer mode, where other player characters are visible as an animated character model from the player's perspective. Thanks for your patience.


    If you keep the MainMenu.cs component, but uncheck the "Use Main Menu" box, does bullet time feature still work?


    Thanks Takahama, I noticed this too.

    A small update will be released next week which fixes a few remaining issues from 1.25:
    • Fixed delay of NPC movement animation when first moving from stationary position.
    • Fixed gun smoke not playing after being interrupted by offhand throw.
    • Fixed obsolete navmesh agent calls in Unity 5.6.
    • Improved frame rate independence of vertical weapon bobbing animation.
     
    Last edited by a moderator: Apr 9, 2017
    Mark_01, Weblox and chelnok like this.
  42. Arealjighead

    Arealjighead

    Joined:
    Apr 7, 2017
    Posts:
    32
    Hello all,
    Im having trouble when i add my own weapons. I've worked out several weapons with RFPS but for some reason i cant use the magazine mesh that comes with the new guns. anyone else had trouble with this & know what i can do to fix it? For instance, Im using the free PM-40 pistol(no animations included) & can get the animation to work with the PM40 slide using RFPS animation provided for the 1911 pistol. But cant get the PM40 magazine animation to work. It doesn't show the magazine, just the animation. i have to use the 1911 magazine that comes with RFPS. Any ideas?
    ive popped on here from time to time for some help with RFPS, this forum has helped out a lot. So thanks to everyone on here that provides help. I've searched for a solution for this, as I'm sure it has been asked before, but cant find one.
     
  43. Takahama

    Takahama

    Joined:
    Feb 18, 2014
    Posts:
    169
    Hey @Azuline-Studios no worries! You're just a human like us, its our nature :D
    Anyways i got an issue since bows released. (i didnt tryed yet but i think its still a thing)
    i want to make weapons use projectile that has bullet drop effect and velocity. But when i apply it to guns there is few problems!
    1. After scene starts, first shot doesnt deal damage to enemy, but second and all other bullets work as intended. How can i fix it ?
    2. While close to wall or anything i fire my gun and i see pickup icon just like arrow has. I changed stay timer to 0 but it still appears for few miliseconds.

    Thanks!
     
    Last edited: Apr 7, 2017
    Deleted User likes this.
  44. o0neza0o

    o0neza0o

    Joined:
    Sep 6, 2015
    Posts:
    165
    Hey @Azuline-Studios I deleted the script by accident when i placed my pause menu in the project as when i disabled it before it kept interfering with the pause menu but i will try it again.
     
  45. jons190

    jons190

    Joined:
    Sep 13, 2016
    Posts:
    260
    ----------------------------------------------
    April 8th 2017: Oh oh! Something changed! So a new version of Rewired is out and something is different now and broke this integration package I just sat down to do some work on my levels and rewired had been working perfectly for the last few weeks and now it's not!!!!!. Like an Idiot I took the upgrade to the new version of rewired a few days back and it looks like it's a major upgrade, not just a bug fix and some of the core functionality must have changed. Unfortunately, It seemed to break all my rewired prefabs that I had built on this integration package of Tony Li's!

    Damb! I'm going to try and go through it to try and find the error's tonight as this halted my store roll out! So far, just doing a quick walk through of these steps, it looks like it works just fine, until you go to map some actions in Rewired (the rewired input manager) and none of the RFPS v1.24 controls will come up under the "actions" setting in rewired so that you can map controls to actions.

    Let this be a lesson for everyone! If isn't not broke, don't fix it. Don't upgrade your prefabs from the store MID PROJECT! It's an old dev axiom that I didn't follow and it got me! (and oddly enough, why I haven't upgraded to the new version of RFPS!!!!!!! Why didn't I listen to myself!!!!!!)
     
  46. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,701
    Are you using version control, or making backups? Can you grab a copy of your prefab from an older version/backup?

    I just updated to Rewired 1.1.0.0 (released April 6), and it seems to work okay with the test scene I made in my Rewired integration post. I can add new action mappings. In the prefab I included my with example integration package, I threw all the RFPS actions in the "Default" Action Category. Could your Rewired Editor perhaps be looking at a different action category?

     
  47. Arealjighead

    Arealjighead

    Joined:
    Apr 7, 2017
    Posts:
    32
    hey fellas,
    any idea why the magazine animation with a new gun wont work, but the slide/receiver will? i really want to use the new magazines that come with other models for more variety, but cant seem to get them to work, it will play the animation but it shows nothing, i have to use the magazine or clip from RFPS that resembles the gun the most, which sometimes isn't the best fit. any ideas at all?
     
  48. petercoleman

    petercoleman

    Joined:
    Feb 21, 2016
    Posts:
    477
    Hello @Azuline-Studios said :

    "I understand your frustration at the pace of development lately petercoleman and I apologize that it has affected your timeline. I don't like to give excuses, but Azuline Studios is a very small operation, consisting of one person basically, and development was slower last year due to personal reasons. The Realistic FPS Prefab is the result of years of learning and hard work and remains a priority even if there are slow times in development. Regardless, I appreciate that you are waiting for more Realistic FPS Prefab features to be implemented when there are other more popular and complete assets available. Letting my supporters down is the last thing I want to do.

    As for your question on a timeline for the completion of third person and Mecanim animations, I can't give an exact date, but I would hope a month or so. Part of the delay with the last update was related to experimenting with new features and making decisions on the best compromise between performance, ease of use, and visual quality. For example, an early version of the particle emission script was not efficient, so it was scrapped and the current method was researched and implemented, which only needs one particle emitter for every emission of that type in the scene.

    Most of the main features and decisions for third person mode have been made, so it is now more about setting up the animation controller and creating appropriate animations for the different character actions and states. This is also a first step towards multiplayer mode, where other player characters are visible as an animated character model from the player's perspective. Thanks for your patience."

    Thanks for your kind reply to my questions and for the feedback to other members here which is very much appreciated...

    Fully understand the nature of the beast and the pressures developing RFPS Prefab with a small team or single developer.

    Very helpful to receive the feedback regarding the further Third Person progress to come and the continued development of RFPS Prefab which I will continue to support. I look forward to progressing my games dev with it.

    Thank you.

    Peter



     
  49. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    As Tony Li mentioned are you using version control or have a backup?

    Based on your earlier post (msg 3643 in this thread) are you still using these versions?

    Unity: 5.4.of3
    RFPS 1.24
    Rewired trial

    Curious what version of Rewired trial that you started from? I have not had an issue upgrading to latest Rewired 1.1.0 release. My use is strictly a desktop usage but I do not recall any problem updating Rewired in a long time (I think I safely say it has been years since I had any issue). I have not tried Tony Li's integration package however.

    My version of Unity is different that I used for my original Rewired integration then the version of Unity you are currently using. These are the versions I had started with originally.

    Unity 5.5.0f3 (64-bit) Windows
    Rewired 1.0.0.110
    Realistic FPS Prefab 1.24
     
  50. Deleted User

    Deleted User

    Guest

    Great Work! You know the Realistic FPS Prefab very well and the artwork is amazing. Looks like you're well on your way to making your own game.


    Nice job experimenting with projectile weapons. For your second question, you can comment out the "transform.gameObject.tag = "Usable";" lines in ArrowObject.cs to prevent projectiles from being picked up like arrows. This should be made into check box option in the inspector. I will have to look into your second question. Have you changed many parameters of the arrow object to get them to behave like bullets, such as increasing Projectile Force in WeaponBehavior.cs or decreasing mass of the projectile object? This might affect the default behavior of the arrows and probably needs to be tested some more.


    You should be able to use another magazine model by activating the M1911 object and clicking on the magazine model in the scene view (see attached pic) then add the new magazine model as a child of the Magazine object, set its layer to the Gun layer, and uncheck the box to deactivate the original Mesh Renderer component of the Magazine object. This way, your new model should stay in the position of the original magazine and inherit its animated positions. Hope that helps.



    Also I overlooked two more steps for the AI animation fix I mentioned in my previous post. Sorry about that. This line of AI.cs:

    Code (CSharp):
    1. yield return new WaitForSeconds(0.3f);
    ...at the end of the function StandWatch() and AttackTarget() needs to be changed to:

    Code (CSharp):
    1.             if(animInit){
    2.                 //only wait one frame till next pass so animations will be initialized now, instead of in 0.3 second normal AI calculation delay
    3.                 yield return null;
    4.             }else{
    5.                 yield return new WaitForSeconds(0.3f);//wait 0.3 seconds (not every frame) untill next AI calculation (for efficiency)
    6.             }
    ...so InitializeAnim() will skip the AI update delay when it needs to.
     

    Attached Files:

    Mark_01 likes this.