Search Unity

Realistic FPS Prefab [RELEASED]

Discussion in 'Assets and Asset Store' started by Azuline-Studios, Apr 5, 2013.

  1. petercoleman

    petercoleman

    Joined:
    Feb 21, 2016
    Posts:
    196
    I have been running Unity 2018.1 with RFPS for some time. There is one error message in console but it is not critical and does not prevent things working.

    Many other assets that I have or bought recently have not been updated to work with Unity 2018.1 so I have them on the shelf and cant use them.

    Unity 2018 + is a big leap forward and for me the performance improvement in particular is a big boost.

    :)
     
  2. jons190

    jons190

    Joined:
    Sep 13, 2016
    Posts:
    219
    Oh I know this error. I've had it before for sure. I just can't remember the fix off the top o my head..... Tonight I will write up a tutorial on how I am doing it. I have to map a couple new monsters. (I'm in the process of upgrading to 2018 right now and the downloads take hours!!!!!!!!!!!) What version of Unity are you on? I've mapped in 5.2, 5.6.5, 2017 and soon 2018....
     
  3. Oderus_Urungus

    Oderus_Urungus

    Joined:
    Jun 8, 2017
    Posts:
    92
    I've got my new enemies fixed in play mode as far as animations, but they walk and run animations are skating. As in when they walk or run, they're feet are skating across the floor, and they move very slowly even though the animations are correct.

    Any ideas?

    2017.2
     
  4. jons190

    jons190

    Joined:
    Sep 13, 2016
    Posts:
    219
    animation play times in either the AI script or on the animation import settings?????? I have to tweek those for my animation to ge tthem to synch with the actual walk/run speeds of the models. Also check the actual run/walk speeds in the AI script. (might be NPC attack script, i kinda forget)
     
  5. Oderus_Urungus

    Oderus_Urungus

    Joined:
    Jun 8, 2017
    Posts:
    92

    I've been fiddling with those, but haven't gotten a good result yet. I'm done for tonight. I'm going to mess around with them tomorrow.
     
  6. thatswillis

    thatswillis

    Joined:
    Jun 20, 2018
    Posts:
    4
    Hey All,
    I know this sounds simple - but I have looked everywhere?
    How do I change how much damage the weapons do?
    I looked in the scripts and the weapon pickups? the only weapons I seem to be able to change the damage on is arrows and Grenades? Where are the rest located.

    Cheers,
     
  7. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    9,601
    On the prefab in FPS Weapons > Deadzone Pivot H > Deadzone Pivot V > Weapon Pivot Yaw > Weapon Pivot V Bob > (weapons). You can set the Hierarchy's searchbar to "t:WeaponBehaviour" if you want to pare down the hierarchy view to only the weapons. It's under Damage and Firing.
     
    thatswillis likes this.
  8. Oderus_Urungus

    Oderus_Urungus

    Joined:
    Jun 8, 2017
    Posts:
    92
    @jons190
    Hey man. I've set the walk and run animation speeds in the animations themselves, the code, and the inspector. Nevertheless, my AI is still "skating" as they walk, much like they are on ice.

    Any other suggestion?
    Thanks
     
  9. jons190

    jons190

    Joined:
    Sep 13, 2016
    Posts:
    219
  10. jons190

    jons190

    Joined:
    Sep 13, 2016
    Posts:
    219
    Hey, haven't forgotton you, i'm still fighting getting unity 2018 running right....
     
  11. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    9,601
    @jons190 - I haven't used RFPSP in Unity 2018 yet, but those older shaders may not be supported. Try removing them from your FPS camera(s). If you still need the effects they provide (color correction, sun shafts, etc.), use the new post process effects instead.
     
  12. jons190

    jons190

    Joined:
    Sep 13, 2016
    Posts:
    219
    can I removed them? I thought they were hard coded in... let me try and see what happens...
     
  13. jons190

    jons190

    Joined:
    Sep 13, 2016
    Posts:
    219
    yup. if i remove them from the main camera and delete from the tree I get the 999+ null reference errors. so I have them disabled, but not removed from the camera. I can remove from the weapons camera though....
     
  14. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    9,601
    @jons190 - Unless your game needs to allow the player to toggle between single and dual camera setups, just remove the Reconfigure Prefab component from your player.

    If you need this component, then comment out every line that contains "SunShafts" or "ColorCorrectionCurves". (Put // at the beginning of the line.)
     
  15. jons190

    jons190

    Joined:
    Sep 13, 2016
    Posts:
    219
    hell... that seemed to work.... (deleting the reconfigureprefab component) I am constantly amazed at how well you know this prefab...... Anyway, I thought i needed that script to KEEP the two camera setup... I only use the two camera setup...
    Cheers mate!
     
  16. jons190

    jons190

    Joined:
    Sep 13, 2016
    Posts:
    219
    alright. I have some bandwidth to help you with this. So
    All animations are named correctly and set to humanoid?
    looping is set in the animation? (running, walk, and idle. shoot should be non- looping)
    Is your avatar setup correctly? (delete and click "generate new avitar from this model" in the animation import settings if not.


    So the monster will just 'skate' across the surface of the environment chasing the player correct?
    Does the "shoot" animation work in game play? in the new monster gets close to the player and attacks in gameplay mode?
    Will the "walk" animation play if the monster cannot find the player after a short amount of time and it will "walk back" to /close to it's point of origin?


    If so, my guess is that its something with the animation controller. Can you send a screenshot of you settings?

    did you map the new animations (from your new monster model) to the animation controller? Even though they are named the same thing o nthe zombie animation controller, you actually have to drag and drop the new animations (which should have been renamed to walk, run, idle, and shoot) onto the animation controller you are using. (either the zombie controller or a controller you cloned/duplicated from the zombie controller and renamed to something else...)

    lets start with this and work though the list. cheers!
     
  17. jons190

    jons190

    Joined:
    Sep 13, 2016
    Posts:
    219
    Oh
    oh oh,.... i have a sneaky hunch that dropped me back to a one camera setup. the one camera setup breaks on teh gearvr, but the two camera setup works fine. I don't have the gear with me to test today. but i jsut did an editor test and things look....slightly different, leading me to believe its the one camera setup. Do you how i could check this in the editor?
     
  18. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    9,601
    Glad to help!
     
    Weblox likes this.
  19. Emerald_Eel_Entertainment

    Emerald_Eel_Entertainment

    Joined:
    Mar 30, 2016
    Posts:
    120
    Hello everyone.

    I want to add/change some things to RFPSP that I have downloaded but I have a few problems but can't do here because it'd derail this thread, which I don't want to do. If anybody with experience using this kit could privately message me I'd appreciate it.

    Thanks for reading!
     
  20. 7Ye

    7Ye

    Joined:
    Dec 5, 2014
    Posts:
    17
    My congratulations to RFPSP, everything is quite fantastic.

    Now, I've been having a terrible struggle to incorporate many features of RFPSP into Behavior Designer as it overrides many AI functions (backstabbing, shield, arrows...). I scripted what I could to recover funcionality, but I'm becoming fruitless.

    Anyone with this integration, or another, has being able to bypass the need of the original AI script so the Arrows can damage (and stick to) enemies? I not even tried with the Shield for more than five minutes. Also I get terrible lags while i'm testing. But with the arrows alone I've been 6 hours tinkering with the scripts and nothing...
     
  21. thatswillis

    thatswillis

    Joined:
    Jun 20, 2018
    Posts:
    4
    Hello,

    Just wondering if anyone has a good way I could get enemies to attack an object or obstacle in addition to the player.

    I am trying to create a similar system to COD Zombies where you can erect barricades to slow enemies down. I want the enemies to stop and attack the barricade and destroy it if it is between them and the player. I noticed the Enemy prefab walks through most physical objects you put in the scene. I tried tagging the object as the player and also setting it up as a NPC of different "faction" to get them to attack it When I look through the code it is all over the place and very difficult to follow... I'm looking for what the actual attack function is so when the enemy enters the object collier I can have the enemy attack the object in the script. Or possible to create a separate script for the Enemy that calls the attack animation and attributes damage.

    Any suggestions would be appreciated.

    Cheers.
     
  22. jons190

    jons190

    Joined:
    Sep 13, 2016
    Posts:
    219
    Hey there. Just shout out. There are a bunch of gearheads on the forum that may be able to help ya out.
     
  23. jons190

    jons190

    Joined:
    Sep 13, 2016
    Posts:
    219
    I know that if you set the enemies up on different "factions" they will attack each other. Maybe you can tweak these settings somehow to get the functionality you are after.
     
  24. thatswillis

    thatswillis

    Joined:
    Jun 20, 2018
    Posts:
    4
    Thanks, but have tried that, can't seem to get it to work you can't have them "Hunt" the player and attack another faction at the same time. Cheers, though.
     
  25. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    9,601
    If you hover the mouse over the AI component's Faction field, it will show a tooltip:
    • Sets the alignment of this NPC.
    • 1 = friendly to player and hostile to factions 2 and 3
    • 2 = hostile to player and factions 1 and 3 (e.g., soldier & alien)
    • 3 = hostile to player and factions 1 and 2 (e.g., zombie).
    Although if you dig into AI.cs you'll see that there are some quirks. For example, if you tick Hunt Player, it will change the faction to 2.

    Make sure you've set up your NavMesh so NPCs can't navigate through walls. If it's a moving obstacle, such as a door that opens and closes, add a NavMeshObstacle.

    It doesn't look like the AI is designed to break down doors. Consider using replacement AI such as Behavior Designer or Emerald AI. (The Save System for RFPSP is compatible with both, btw.)
     
    Weblox likes this.
  26. naumanijaz

    naumanijaz

    Joined:
    Jul 7, 2018
    Posts:
    1
    Hi everyone,
    How can i restrict a player to carry only 2 weapons In RFPS
     
  27. Oderus_Urungus

    Oderus_Urungus

    Joined:
    Jun 8, 2017
    Posts:
    92
    Hey, sorry for the late reply. I haven't been around my PC, and won't be until tomorrow. I've looked over your list, and as far as I can remember I've done all of those things.
    My new monster will walk, but it's like he's walking on ice. That's the best I can explain it. Lol.
    Every other animation works fine, shoot included.
    If you have time tomorrow, I'll send you a DM when I'm in front of my PC.

    Thanks, bro.
     
    jons190 likes this.
  28. MaxDeMaxNL

    MaxDeMaxNL

    Joined:
    Jan 27, 2018
    Posts:
    4
    Is there any integrations with a inventory asset? And where can I find all integrations?
     
  29. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    9,601
    To my knowledge there isn't a current inventory integration. The Dialogue System for Unity has RFPSP integration. It used to provide S-Inventory integration which let you use S-Inventory with RFPSP. But S-Inventory is no longer available. The Save System for Realistic FPS Prefab is another integration that provides a save system and data persistence across scene changes.

    Other integrations that I'm aware of are Emerald AI, Behavior Designer, and Tactical Shooter AI. The Emerald AI integration is up to date; I'm not sure about the others, but they could be, too. But, sorry, no inventory systems as far as I know.
     
  30. MaxDeMaxNL

    MaxDeMaxNL

    Joined:
    Jan 27, 2018
    Posts:
    4
    Thanks!
    Can you perhaps tell me how to setup the AI's? Because they dont attack me or move.
     
  31. chelnok

    chelnok

    Joined:
    Jul 2, 2012
    Posts:
    673
    Can't you just adjust the speed in animation controller?
     
  32. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    9,601
    Check the Console window window for errors or warnings. For example, there might be a message about NavMeshes and NavMeshAgents. In this case, you'll need to build the NavMesh for your scene. If there are no errors or warnings, compare your AIs with the ones in the example scene. Carefully check the components on the GameObjects, the layers, and the tags.
     
  33. Oderus_Urungus

    Oderus_Urungus

    Joined:
    Jun 8, 2017
    Posts:
    92
    Yeah, I've adjusted the speed. It doesn't matter what I adjust it to, it still skates. Basically, the monster I have now I want to be a fast moving monster. I can adjust the animation speed to get that fast movement, and adjust the walk speed to match, but it still skates.

    I'm about to upload a vid, cause I can't explain it correctly.
     
  34. Oderus_Urungus

    Oderus_Urungus

    Joined:
    Jun 8, 2017
    Posts:
    92
    @jons190 @chelnok
    I have triggers set up, but for the sake of simplicity for the vid, I have the enemies instantiate on play. They are checked to hunt player, and are immediately going into the run animation. The walk animation skates on the terrain the same way.
    As you can see, they locate the player, orient towards him, and chase him, however, the animation is like running on ice. The shoot animation works fine, as the video shows.

    With the run animation they should be at the player very quickly, but the skating is preventing that.
     
    A0101A likes this.
  35. jons190

    jons190

    Joined:
    Sep 13, 2016
    Posts:
    219
    So he's walking (the animation plays) but he's still kinda skating along? I woould synch the walk animation speed, (ai.cs I think) with the animation speed in the animation controller. I had to do that and ended up with a bunch of highly Spasdic walkers, but the animations synch!

    Hit me up whenever. I'm online about every other day....
     
    Oderus_Urungus likes this.
  36. jons190

    jons190

    Joined:
    Sep 13, 2016
    Posts:
    219
    Yup. looks like animation speed set in the animation controller and the actual "walk speed' set inthe script are way out of synch..... I'll do a vidia for ya in 24 hours....
     
    Oderus_Urungus likes this.
  37. chelnok

    chelnok

    Joined:
    Jul 2, 2012
    Posts:
    673
    For me, if i adjust AI.cs walk anim speed, it doesn't have any effect, but if i adjust animation controller (or animation clip) speed, it'll change the speed of animation.
     
    Oderus_Urungus likes this.
  38. Oderus_Urungus

    Oderus_Urungus

    Joined:
    Jun 8, 2017
    Posts:
    92
    I've changed the actual speed of the animation clip to something ridiculous like 2, and then the enemy runs really fast, but still skates. Looks ridiculous. Lol
     
  39. Oderus_Urungus

    Oderus_Urungus

    Joined:
    Jun 8, 2017
    Posts:
    92

    Ok. I've played with different values in the script, the inspector, and the animation itself.
    For example I believe I have the walk animation itself set to 0.4, and the actual walk speed in the script set to the same.

    Did I mention I suck at animation? Lol
    Thanks for the feedback and upcoming vid, bro.
     
  40. chelnok

    chelnok

    Joined:
    Jul 2, 2012
    Posts:
    673
    If the actual moving speed (how fast monster model moves on terrain, not animation) is what you want as seen in the video, then you need to change animation controller speed for walk and run animation to, i dunno, try 0.5 or 0.2 perhaps. Then again if you want actual moving speed to be faster, change AI.cs walk speed (not walk anim speed) and run speed (not run anim speed) to something higher.

    Just play around animator controller speed for walk and run animations (try 0.01, try 5.0) and walk speed and run speed (AI script). You can forget walk anim speed and run anim speed (AI script), i think they were used in older version of RFPSP.
     
    jons190 and Oderus_Urungus like this.
  41. 7Ye

    7Ye

    Joined:
    Dec 5, 2014
    Posts:
    17
    @TonyLi So as you recommend BD for the AI improvements, can you have some questions about what I asked?

    I tried to change the Arrow To Hit NPC to no good, and I'm just thinking of just make a bold when is blocking so player is invulnerable, but that is a bad solution. I changed the script of blocking so should calculate the impact even if it not comes from a rfpsAI, I think, but maybe it isn't getting "attacker" info from the shoot.cs of BD. I'm no programmer and your scripts are quite complicated. You made a solid product but is very tight.

    BD did a bad job deactivating your AI enterly, but in my case I only want to reactivate the good use of arrows and blocking of shield and I'll be all good. Any tips?
     
  42. C_Occlusion

    C_Occlusion

    Joined:
    Jun 4, 2012
    Posts:
    42

    I got mine to work by setting the animation speed in the controller to 1 and then adjusting the Walk and Run in the AI script in the Inspector...It takes a few tries to get it right...Hope this helps...CO
     
    Last edited: Jul 8, 2018
    Oderus_Urungus likes this.
  43. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    9,601
    Hi @7Ye - I'm not the developer of Realistic FPS Prefab (RFPSP) nor of Behavior Designer (BD). Azuline Studios makes RFPSP. Opsive makes BD. I do make the Save System for Realistic FPS Prefab, which is an addon for RFPSP.

    If I can make time today, I'll try to load up RFPSP and BD and try to help anyway.
     
  44. Oderus_Urungus

    Oderus_Urungus

    Joined:
    Jun 8, 2017
    Posts:
    92

    I've played around with the walk/run animation speed, and the actual walk and run speed. Still skates.
     
  45. Oderus_Urungus

    Oderus_Urungus

    Joined:
    Jun 8, 2017
    Posts:
    92

    So you set the animation speed for wal/run to 1, then changed the actual walk/run speed in the script and inspector to a value that synced up correctly?

    I'll give this a shot. Thanks!
     
  46. C_Occlusion

    C_Occlusion

    Joined:
    Jun 4, 2012
    Posts:
    42

    I think I confused you a little bit and wanted to make sure I explained it a little better...The animation speed is set to 1 in the animation controller by opening the animation controller for the model and clicking each block and changing the speed to 1....After that open your prefab that you have in the game... Find the AI (script) section in the inspector and adjust the Walk Speed, Run Speed, Walk Anim Speed and Run Anim Speed....Mine are set to...Run Speed = 4, Walk Speed = 1, Walk Anim Speed = 1 and Run Anim Speed = 2...Hope this explains it better...If you have any problems let me know...It took me 14 days to get this figured out so I know what you are going through...CO
     
    Last edited: Jul 9, 2018
    Oderus_Urungus likes this.
  47. 7Ye

    7Ye

    Joined:
    Dec 5, 2014
    Posts:
    17
    Ah sorry, you're so helpfull around here that I got confused for a minute.

    Myself I'm making a ton of playmaker actions for RFPS that I'll put to public when I've done with the project.

    RFPS has tricky scripts and the people that don't know much programming like myself need any help can get.

    I'll get on hold the arrows/shield thing while I'm implementing all the playmaker integrations that are usefull if people are integrating rfps with other systems, because the tightly script it is.
     
  48. chelnok

    chelnok

    Joined:
    Jul 2, 2012
    Posts:
    673
    Out of curiosity, is there any difference, if you change walk / run anim speed? Asking because i can't find any use of those in code. I think those were used in earlier RFPSP versions, and dev just forget to remove them.
     
    Oderus_Urungus and C_Occlusion like this.
  49. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    9,601
    @7Ye - To set up Behavior Designer according to these instructions, you had to remove this from WeaponBehavior.cs:

    if(hit.collider.gameObject.GetComponent< CharacterDamage >()
    && hit.collider.gameObject.GetComponent< AI >().enabled){ // (remove red)

    and

    if(hit.collider.gameObject.GetComponent< LocationDamage >()
    && hit.collider.gameObject.GetComponent < LocationDamage >().AIComponent.enabled){

    To allow arrows to damage NPCs, you must also do the same in ArrowObject.cs. The code is near the bottom.

    if(hitCol.gameObject.GetComponent<CharacterDamage>()
    && hitCol.gameObject.GetComponent<AI>().enabled){

    and

    if(hitCol.gameObject.GetComponent<LocationDamage>()
    && hitCol.gameObject.GetComponent<LocationDamage>().AIComponent.enabled){


    @Oderus_Urungus - If this is any help, like @C_Occlusion wrote, the animator state's Speed controls how fast the animation plays, but has no effect on moving the GameObject in the world:

    rfpsAnim1.png

    The AI component's Run Speed and Walk Speed control how fast the GameObject's navigates through the level but have no effect on the animation speed:

    rfpsAnim2.png

    The trick is to get them in sync. First set the animator state speeds to values that look good to you. Then gradually increase the AI component's Run Speed and Walk Speed to minimize foot skating.

    (@chelnok - You're correct. Walk Anim Speed and Run Anim Speed are no longer used.)
     
  50. Oderus_Urungus

    Oderus_Urungus

    Joined:
    Jun 8, 2017
    Posts:
    92
    @TonyLi, Ah. I was wondering why it had walk anim speed and run anim speed in the inspector when they didn't seem to do anything.
    So, basically, say I set the walk animation state speed to 1, and the run animation state speed to 2, I'd then start at a low number for each in the inspector until they are in sync and not skating?
    I'm assuming I can do this in play mode, then exit play and type in the values once I find a fit?
    Or would I have to adjust in the inspector, play, exit, repeat?

    Since walk/run anim speed are no longer used, can I just comment them out in the code?

    Thanks.