Search Unity

Realistic FPS Prefab [RELEASED]

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

  1. Weblox

    Weblox

    Joined:
    Apr 11, 2016
    Posts:
    277
    @venderant
    Please examine the AI in the Demo Scene. You need to look at their Skeletons / bones. When creating the ragdoll the Ragdoll Wizzard adds a Capsule Collider , a rigidbody and a Character Joint Component to the limbs. RFPS needs also the Location Damage Script on the limbs.

    When you create new AI characters with a ragdoll you need to find those limbs (e.g.: NeckHead/Spine3/Pelvis/etc.) and add the Location Damage Script to them. Add Component --> type in ""Location Damage" and add it.
     
    Last edited: Sep 24, 2017
  2. llJIMBOBll

    llJIMBOBll

    Joined:
    Aug 23, 2014
    Posts:
    578
    In a previous version not looked at new version yet, but on the parent of the main camera the was a camera component that had the size you could adjust on there, also if I remember somewhere on the weapons parent too, then on the model set the scale to 1 and now when you play it shouldn't auto set back to 20 scale :D.
    I think this is done for if you want 1 camera setup so it doesn't clip, I didn't really see major issue tho when I done it.
     
  3. Arealjighead

    Arealjighead

    Joined:
    Apr 7, 2017
    Posts:
    32
    @venderant Gotcha. I just looked into the newest version with NPCs & now see what your talking about. It looks like the newest version you dont need a Capsule Collider like on previous version. You do now need the ragdoll set up & LocationDamage script attached to each limb. If you have successfully created a ragdoll for your new NPC just add LocationDamage.cs to each limb( you can use the search bar in Project to locate it easy.) **Keep in Mind how much damage you want each limb to take & apply it under Damage Multiplier in the LocationDamage.cs script**. For instance RFPS has NPCzombie head with 10 Damage Multiplier & a thigh of only .9. You can expand Joint1/Bip01/Bip01Pelvis in NPCzombie to get a idea of the damage to apply to each limb. Hope this helps.

    **After adding a new NPC i noticed with each LocationDamage script you add you must select the new NPC you are creating in Ai Component in the LocationDamage script or else your new NPC will not take damage ( Location Damage.cs will not work). Simply click on the little dot next to Ai Component in the script & select the new NPC you are adding. Also add Squish audio sound to Head Shot to the head.

    @Weblox Ohh ok, Thanks
     
    Last edited: Sep 24, 2017
    Weblox likes this.
  4. maxaud

    maxaud

    Joined:
    Feb 12, 2016
    Posts:
    177
    @Azuline-Studios sent me an email response with a fix, looks like it will be fixed in the next version
     
    Weblox likes this.
  5. Arealjighead

    Arealjighead

    Joined:
    Apr 7, 2017
    Posts:
    32
    @maxaud good deal. I haven't ran into this problem yet though. It must only be with certain models. For instance the PM40 pistol & AKM rifle worked for me.
     
    Last edited: Sep 24, 2017
  6. llJIMBOBll

    llJIMBOBll

    Joined:
    Aug 23, 2014
    Posts:
    578
    I tested new version last night and there seems to be some bug where if you hold space with weapon out, the weapons does a roll on z pos, there used to be a weapon roll toggle but thats seems to be removed now.. does anyone have a solution for this whats causing it cheers?
     
  7. witcher101

    witcher101

    Joined:
    Sep 9, 2015
    Posts:
    516
    Hi Tony can you create a multiplayer addon for RFPS. As it is most requested feature and ppl would gladly pay for it
     
    erichey and coverpage like this.
  8. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,706
    Thanks for the vote of confidence. But multiplayer is quite complicated to do right. A multiplayer addon would probably be more expensive than RFPS itself, and currently it would require several customizations to the RFPS scripts. It might be better to petition Azuline Studios to write the multiplayer addon because they could change the RFPS scripts to accommodate it.
     
    erichey, chelnok and TheMessyCoder like this.
  9. Weblox

    Weblox

    Joined:
    Apr 11, 2016
    Posts:
    277
    Has anyone successfully changed the Player Model? I tried my best but had no luck. The Visible Body seems to have been removed and I am unsure how to proceed.

    Hi, please take a look at

    this post

    Maybe that can help also with this Issue. If yes then Azuline seems to have a fix in the next Version. Maybe @maxaud can post the fix here too.
     
    Last edited: Sep 25, 2017
    llJIMBOBll likes this.
  10. jessejarvis

    jessejarvis

    Joined:
    Aug 9, 2013
    Posts:
    303
    I have changed the player model from the military figure to Adam Adventurer.

    You need to disable the "Player Character Model" child object of the "FPS Main", then drop your fbx or prefab model into the FPS Main. Once you do that, position it right, add PlayerCharacter.cs to it (or in my case copy and paste it over from the original), remove the "Alternate Body Material" in the inspector and copy over the "Third Person Weapons" object underneath the player model.

    I believe the details are in the Documentation and they go more into detail, that's just the rough instructions.

    On a semi-related note though, does anybody got this working with UMA?

    I set this up for UMA but in PlayerCharacter.cs in the Start() function, it gets mad that there is no "HumanBodyBones.Head" because the UMA character hasn't (yet) initialized.

    Idk how to get it to setup the character (after) it has initialized.

    Edit: Nvm.. it was super simple, I was just overthinking it as usual.

    All I did was move all the of PlayerCharacter.cs Start() content into SetupPlayerContent() and then call that on a "CharacterCreated" event on the DynamicCharacterAvatar. Done.

    Oh, and add a:

    if(!anim)
    return;

    in the Update() function.

    Still have to think of a way to position the player weapons on a UMA character though (like make weapon points), as when a character's size changes the position will change too.

    Edit 2: And apparently the anims are messed up. Well at least the bow is very noticeably messed up. Torso is twisted too much and arm is out of place.
     
    Last edited: Sep 26, 2017
    RobsonFMaciel and Weblox like this.
  11. crimsonmortis

    crimsonmortis

    Joined:
    Feb 21, 2016
    Posts:
    63
    I sm very new to unity and picked up some assets that "TheMessyCoder" use in tutorials. When I try to launch RFPS on unity 2017 1f, I get +999 compile error mostly for nullrefrence.

    This is the same for all demos. I tried adding standard unity assets for effects, environment, etc. One at a time with no change. Am i missing a required dependency? Sure it is my fault due to ignorance but unable to figure out where to start.
     
  12. Arealjighead

    Arealjighead

    Joined:
    Apr 7, 2017
    Posts:
    32
    @crimsonmortis Try starting a new project then add RFPS asset only & see what happens. It shouldn't have that many errors. Im using the same version of Unity(2017.1.f1)
     
  13. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,706
    @crimsonmortis - I just confirmed that it works in Unity 2017.1.1 also. You shouldn't need to add anything extra. Try what @Arealjighead recommended (import RFPS into a new, empty project). It will report some yellow warnings, but it should compile just fine, and when you play the sandbox scene it shouldn't report any red errors at all. If it does, please post a few of them here so we know what errors you're talking about. You can click on an error in the Console window, press Ctrl+C to copy to the clipboard, and then paste it into a reply.
     
    Weblox likes this.
  14. crimsonmortis

    crimsonmortis

    Joined:
    Feb 21, 2016
    Posts:
    63
    I have tried adding asset when I name project and I have tried starting a project blank no assets at load then importing results are the same.

    http://paste.ubuntu.com/25619043/

    That is the log file it is large so may take a minute to open.

    Got up this morning uninstalled Unity, manually deleted any left over folders rebooted computer, reinstalled, and exact same result.


    Ok got everything working! Like I said VERY new to unity I assumed nullrefrence meant something was missing did not occur to me to REMOVE anything. So in case any other newbs ,rookies like myself have the 999+ compile errors:

    Remove directional light, and main camera then load RFPS.. Simple mistake that most would assume some one knew better then to make but like I said new. So excuse me gonna go play with my new toy!
     
    Last edited: Sep 26, 2017
  15. venderant

    venderant

    Joined:
    Aug 16, 2017
    Posts:
    8
    Arealjighead and Weblox like this.
  16. Weblox

    Weblox

    Joined:
    Apr 11, 2016
    Posts:
    277
    @jessejarvis Thanks for the hints. That seems to work fine. However the weapons positioning doesn't fit any of my humanoid models. The "Player Character" Script has a "Weapon Model Parent Angles" Parameter that sets the "Third Person Weapons" - Rotation Transform at runtime, did you have to modify the values to fit your new character?

    Also the looking Angles on my new Character do not fit very well, especially when aiming. I had to set all "M Looking Angles" to zero to get a better fit. Is this expected or am I doing something terribly wrong?

    Sadly I havent used UMA yet, but as it seems you already figured it out. :D
     
    Last edited: Sep 27, 2017
  17. Emerald_Eel_Entertainment

    Emerald_Eel_Entertainment

    Joined:
    Mar 30, 2016
    Posts:
    120
    I updated RFPSP and began testing it in a new Unity project. I noticed that whenever I reposition the view model for each weapon, when I enter Play mode and try to fire a weapon, it does not fire. I can only fire once I have sprinted, and when I stop sprinting I can fire again.

    I don't know if this is a bug or not, but normally with the shotgun prefab it scatters multiple bullets with a particular spread, but when I aim down the sights and fire again the spread is much smaller and more precise. Is that supposed to happen?

    I disabled some of the camera bob anims and rifle and pistol pivot animations, and when I sprint backwards, then forwards, the procedural movement of the weapons stop.
     
  18. romandutov

    romandutov

    Joined:
    Sep 18, 2015
    Posts:
    16
    Hello @TonyLi, @Azuline-Studios
    I think I found a bug in your asset (Realistic FPS). It is difficult to catch, but when the player runs, they shoot at him and at this time the game stops (the player pauses) (Time.timescale = 0) and if after some time to continue playing, the rotation of the weapon behaves in a strange way https://imgur.com/a/4ZqaD
     
    Last edited: Sep 29, 2017
  19. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,706
    @romandutov - That'll be something the developer, Azuline Studios, will have to answer.


    Pixel Crushers at Unite Austin

    We'll be at Unite Austin next week. If you're there, please stop by our booth to say hi and enter for a chance to win a copy of the Dialogue System, Love/Hate, Save System for Realistic FPS Prefab, or Quest Machine!
     
    99thmonkey and TheMessyCoder like this.
  20. MTDues

    MTDues

    Joined:
    Mar 27, 2014
    Posts:
    27
    Guys this asset supports Photon ,,,means i can use it in my multiplayer game or not ?
     
  21. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,706
    No, currently it doesn't support multiplayer unless you customize the scripts yourself to handle multiplayer.
     
  22. Strolski

    Strolski

    Joined:
    Jan 9, 2017
    Posts:
    48
    I'm trying to make use of the fade out object, but even after reading the script and the brief explanation on the documentation, I can not figure out how to make use of this.

    In addition, is it also possible to somehow add a trigger as the fade out occurs? I basically want to use an object like a medpack, change it out for a "Power Core" which will be placed in some kind of generator, when the power core is picked up, I want it to trigger an alarm sound, which can easily replace the medpack pickup sound, but I also want it to trigger a fade out and if possible an explosion and load credits.

    Is this possible using the assets available? Bare in mind, I am no coder lol, I'm making a game fully based on asset adjustment, not scripting for the most part. I'm using RFPS for just about every aspect of my goals and this ending scene is the last thing I'm trying to figure out.
     
  23. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,706
    I'm afraid RFPS's LevelLoadFade script can't do this without modification. However, you could use a cutscene sequencer like Timeline, SLATE, Cinema Director, or uSequencer. These usually come with actions to fade, play audio, and load new scenes. You could also use the Dialogue System, but it would be overkill unless your game has conversations.
     
  24. Strolski

    Strolski

    Joined:
    Jan 9, 2017
    Posts:
    48
    I'm looking to not spend any more money at this point, already dumped a few hundred into this project and I plan on releasing it for free. What is the purpose of the levelload script/object?
     
  25. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,706
    Timeline is free (built into Unity), but you'd need to upgrade to Unity 2017.1 if you're not there yet. RFPS's LevelLoadFade fades in from black when the scene starts. When the player dies, the script fades to black and then reloads the same level.
     
  26. Strolski

    Strolski

    Joined:
    Jan 9, 2017
    Posts:
    48
    Aaaah, yeah I'm on the newest Unity. I'll check out Timeline, I feel like I'm about to enter a world of hurt for a simple ending lol
     
  27. Strolski

    Strolski

    Joined:
    Jan 9, 2017
    Posts:
    48
    So timeline is scary for the moment lol Is there some minor adjustment to the code in the levelload script that will just trigger a scene change to a credits scene? I have the Enhanced Trigger Box asset, I'm not sure if that helps the situation. I can have the trigger asset handle the removal of "the core" and trigger of alarm, but then I want the screen to fade and load the credits.
     
  28. coverpage

    coverpage

    Joined:
    Mar 3, 2016
    Posts:
    385
    Very happy with this one.
     
    Legorobotdude, jons190 and TonyLi like this.
  29. Emerald_Eel_Entertainment

    Emerald_Eel_Entertainment

    Joined:
    Mar 30, 2016
    Posts:
    120
    Wow that looks great! Where did you find those urban environment assets? Or did you make them yourself? :eek:

    The rain is a nice touch, though I think the singular droplets could be made a bit smaller. The puddles also need little droplet ripples too. Great work. :)
     
    coverpage likes this.
  30. coverpage

    coverpage

    Joined:
    Mar 3, 2016
    Posts:
    385
    Thanks I didn't model it. I'm using prodcedural city generation Cscape by @olix4242
     
  31. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,706
    If no one else has posted some code before I get back from Unite, please remind me and I'll see what I can do.
     
  32. jons190

    jons190

    Joined:
    Sep 13, 2016
    Posts:
    260
    Unity 5.4.3fx; RFPS 1.24; Pixel Crusher Save System 1.?; GEAR VR/Oculus utilities 1.15 (running a couple version back...But it all works together nicely and am not looking to upgrade the tools anytime soon except for the Oculus SDK...)


    Hi all. Happy Sunday.


    So I have a few questions about the monster mechanics in RFPS. I’m using RFPS for a mobile VR game and have it running very well, but have hit an odd snag that I can’t seem to figure out. When in VR mode the monsters get too close to the camera on Melee attacks and cause some clipping on the monsters and generally make the experience uncomfortable having the monsters so close in combat.. I want to push the player and the monsters apart just slightly, so that in vr mode they are not so close to the field of focus

    This effect is not seen in the Unity editor when in play mode, but just when ported over to the gear VR. It has something to do with the VR SDK camera interpolation, which is a bit of a black box top me.

    I’ve been tweaking with some of the various functions within the player prefab and monster prefab but haven’t found the right solution yet and was wondering if anyone has some thoughts or advice

    Things I have been tweaking, but not noticing much difference.

    So on the standard Zombie monster there seems to be a capsule collider of mysterious function, which I assume is for the monster “hit zone” i.e: the barrier when the player prefabs weapon impact the monster.

    Then the monster has a nav mesh agent which I assume is the thing I need to adjust so that when it collides with the player nav mesh agent , it stops the two from moving closer together.

    Then there is the “attack range” setting in the AI script on the monster, which I assume increases the range of when the monster would attack allowing them to not have to close too close to the player to initiate the attack.

    I also have a character controller on the monster prefab that seems to adjust the range when playing with it's radius ever so slightly when I adjust it, although in my mind it should not make any difference...

    And none of these seem to really effect much.

    So when I adjust the mysterious capsule colllider it seems it moves the monster out, but then the range of the RFPS prefab melee weapons do not seem to connect and the monsters seem to be slightly out of range to initiate their own attack (they never attack, but constantly try to shuffle closer)

    If I change the nav mesh radius on the player or monster, it does not seem to effect how close the two come together.


    Anyway, it seems like I am missing something simple, but it eludes me. I just need to move the two out a few feet in game space so that it looks more natural in the VR camera.





    Secondly…..

    How exactly does the monster object pool work.

    Currently I have my 3d levels setup with about 20 melee based monsters (all based off the standard zombie monster) and then I have the monsters setup with the “monster trigger” script so that only about three or four monsters are “active” at a time.

    I.E there are three monsters in a room, behind a closed door and the trigger is set up right outside the door so the monsters are not active, until the player walks through the door and all the rest of the monsters in the level are inactive, locked in limbo with their own monster triggers, so their AI scripts aren’t running.

    Then the “remove body script” is on the monsters, so when they die, at some point the bodies are removed, freeing up vert count and CPU time, for the next round of monsters’

    Then I have about five – six rooms per level set up this way. This allows the 15-20 monsters to be “cocked” without actually being turned on, allowing for better performance. (or so I think, but frankly I’m not sure how RFPS manages these monster triggers) Since having all the monsters live and turned “on” at the start of the level seems to have too much performance issues for mobile VR.

    But now I am wondering if I could get better performance out of using the object pooler but have no idea how any of that works really in RFPS. Does anyone know of a tutorial that walks through this, or even if there is a performance gain to be had?

    It seems like I get a performance shutter, with my monster layout, when the player walks through the trigger and the monsters are “turned on/or instantiated” and even sometimes when the remove body script is run. And I wonder if the object pooler would help with that shudder.


    Anyway, I always welcome everyones thoughts as I figure this stuff out. I’m still a noob when it comes to all this.
     
  33. Strolski

    Strolski

    Joined:
    Jan 9, 2017
    Posts:
    48
    So I'm getting this error all of a sudden:

    Assets/RFPSP/Image Effects/Environment/Water (Basic)/Scripts/WaterBasic.cs(7,18): error CS0101: The namespace `UnityStandardAssets.Water' already contains a definition for `WaterBasic'

    It won't let me continue until it is resolved. I think it happened around when I added the standard assets for environment, but I deleted all of unity standard assets from my project and I'm still getting the error
     
  34. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,706
    Hi @jons190 - Increase the AI component's Shoot Range. A value of 10 might be good for VR.

    The object pooler would have the same issue. The shudder is because the AI script has to do a lot of startup stuff when the NPC is activated. You could try splitting it into two separate triggers that the player is likely to enter one after the other but not on the exact same frame.
     
  35. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,706
    Make a backup of your project, then try deleting the folder RFPSP / Image Effects / Environment / Water (Basic). RFPSP ships with a copy of some of the standard assets. They can conflict if you import standard assets on your own.
     
  36. Strolski

    Strolski

    Joined:
    Jan 9, 2017
    Posts:
    48
    So I deleted and reimported it, it appears to have solved the problem, but now my running audio is not working, jumping, firing, swapping weapons and such all has audio, but movement has none.

    Should I be wiping my fps controller and placing in a new one?
     
  37. Strolski

    Strolski

    Joined:
    Jan 9, 2017
    Posts:
    48
    Actually, I just tried deleting the prefab and dragging in a new one and I still have the lack of movement audio
     
  38. Strolski

    Strolski

    Joined:
    Jan 9, 2017
    Posts:
    48
    Sorry for the triple post, I rebooted my PC and the audio works fine now, all problems solved, thanks.
     
  39. jons190

    jons190

    Joined:
    Sep 13, 2016
    Posts:
    260



    Ahhhh this is a great idea. Thanks for that. The things you have to do to work around stuff is always fun. Every project I have ever worked on in my life, has some kind of element of work arounds and hacks. Gotta love it. Be sure to let us know how the Austin conference goes. Travel safe!
     
  40. Strolski

    Strolski

    Joined:
    Jan 9, 2017
    Posts:
    48
    So I'm wondering if there is a way to make picking up a specific object trigger an audio clip using the rfps interaction pick up system. I want to have data drives that when you pick one up it triggers a specific audio file to play. I know rfps has the play sound on enter trigger which I believe plays an audio file when you enter an area. I'm not sure if there is a way I can merge this with item pickups to get the outcome I'm looking for.
     
  41. Strolski

    Strolski

    Joined:
    Jan 9, 2017
    Posts:
    48
    Actually now that I think about it, each item has a pickup sound, I'm wondering if I can somehow create a separate pickup item for each audio player, set the pickup sound to the audio file I want it to play. I am using voice actors to narrate my story via data logs to be picked up throughout the story.
     
  42. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,706
    Try this script:

    PickupEvent.cs
    Code (csharp):
    1. using UnityEngine;
    2. using UnityEngine.Events;
    3.  
    4. public class PickupEvent : MonoBehaviour {
    5.     public UnityEvent onPickUp = new UnityEvent();
    6.  
    7.     void PickUpItem() {
    8.         onPickUp.Invoke();
    9.     }
    10. }
    Add it to your pickup item. This will add an event block, similar to a UI Button's OnClick() event. You can point it to an audio source that plays a sound such as a data log.
     
  43. Strolski

    Strolski

    Joined:
    Jan 9, 2017
    Posts:
    48
    You're awesome.

    Ok, I attached an audio clip to it. Mad the item useable in tags, I then tried to activate it and got nothing. I then tried also attaching an ammo pickup script, then tried activating again, the item picked up but still gave no audio. What am I missing here?

    upload_2017-10-2_19-29-33.png
     
  44. Strolski

    Strolski

    Joined:
    Jan 9, 2017
    Posts:
    48
    I then realized the no function spot. So I tried adding audio in the function spot, put the name of the audio clip and still nothing. Attached ammo pickup script, still nothing.
     
  45. Strolski

    Strolski

    Joined:
    Jan 9, 2017
    Posts:
    48
  46. venderant

    venderant

    Joined:
    Aug 16, 2017
    Posts:
    8
    Does anyone have any advice about using full-screen shaders with the dual-camera setup? My scenes are too large to use the single camera setting. Would applying the same shader to both cameras work?
     
  47. Strolski

    Strolski

    Joined:
    Jan 9, 2017
    Posts:
    48
    If we can figure this one out, I also have a second request if it is at all possible and costs you no time, I noticed that when I replace the pickup audio clip with my own audio clip, it plays the audio clip on pickup. However, If I set the item to remain, which I want it to remain so the player can play it again if they want to come back to it, if the player activates it more than once while the audio is already playing, it begins another layer of the same audio and both are now playing at once. This can get hectic quick. Any way to have it where when it is activated it play, but if it is activated again while it is playing, it stops the current audio and starts it over? Or better yet, if it is activated again while it is playing, it stops, then you have to activate it again to get it to play. It may or may not actually be easier to take the pickup script and add in a few lines to add the stop and play again function and just relabel the script for the purpose of datalogs. I feel like this would be too much work for you to code on a whim.
     
    Last edited: Oct 3, 2017
  48. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,706
    I think we can kill two birds with one stone here. Add an audio source to your scene, such as on the FPSCamera. Then add three events in this order:
    • FPSCamera : AudioSource.Stop
    • FPSCamera : AudioSource.clip (assign your clip)
    • FPSCamera : AudioSource.Play
    Here's an example:

    It will restart the audio. It would take a bit more custom coding to stop it without restarting.
     
  49. Strolski

    Strolski

    Joined:
    Jan 9, 2017
    Posts:
    48
    This is beautiful, and I wanted it to restart when stopped. Now, this audio won't get cut into by any other nearby effects right? Such as a sparking power station or nearby creature growls or background music?
     
  50. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,706
    Right. It'll be playing on its own audio source. (The one you'll add to FPSCamera or wherever.) Other audio sources, such as growls and background music, will be completely independent.
     
    Mark_01 likes this.