Search Unity

Realistic FPS Prefab [RELEASED]

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

  1. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    RoyS, ronaldomoon, hsxtreme and 5 others like this.
  2. GWStudio

    GWStudio

    Joined:
    Sep 27, 2016
    Posts:
    109
    hi .. how to play weapon animation in 3rd person i.e gun animation with the same time with body animation
     
  3. claudiorodriguescampos

    claudiorodriguescampos

    Joined:
    Jun 23, 2017
    Posts:
    98
    Is it possible to do knife throwing in RFPS?
     
  4. jadorks

    jadorks

    Joined:
    Jul 11, 2016
    Posts:
    10
    It should be possible. I can't try it out at the moment to see how it would be done. With the latest version of RFPSP, you should be able to reference to the bow and arrow and create the knife throwing. It's like the bow and arrow but with arms. So if you have the animations, you can follow a video on how to change a weapon in RFPSP on YouTube. But the moment I get the chance to use my PC I'll try it out and see where it goes.
     
  5. claudiorodriguescampos

    claudiorodriguescampos

    Joined:
    Jun 23, 2017
    Posts:
    98
    Ok, I understand the idea. I will try to see if it works for me.
     
    jadorks likes this.
  6. claudiorodriguescampos

    claudiorodriguescampos

    Joined:
    Jun 23, 2017
    Posts:
    98
    I try to set a new model using the config of the ZombieNPC. I just copy my model inside to the ZombieNPC, remove the ZombieRagdoll, set the ZombieController in my model, set the "ObjectWithAnims" to my model.
    For last, I set the Flesh tag and NPC layer to all children game objects of my model.

    When I run the game, the model give damage to the player and all animations are working properly, the player can hit the new model(I know because I see the blood when I hit him with the knife), but can't give damage to the new model.
    What am I doing wrong?
     
    Last edited: Jan 10, 2018
  7. Arealjighead

    Arealjighead

    Joined:
    Apr 7, 2017
    Posts:
    32
    @claudiorodriguescampos Hello. add the LocationDamage script to each limb & adjust damage multiplier accordingly
     
  8. claudiorodriguescampos

    claudiorodriguescampos

    Joined:
    Jun 23, 2017
    Posts:
    98
    It works, it works, it works. Thank you so much @Arealjighead
     
    Arealjighead likes this.
  9. OZAV

    OZAV

    Joined:
    Aug 9, 2013
    Posts:
    299
    So ... Azuline ... what's on the map for 2018 ?
    Happy New Year, everyone, as well.
    VranicStudiosCom-To-Azuline, What's new 2018.JPG
     
    erichey likes this.
  10. evanvi1997

    evanvi1997

    Joined:
    Dec 3, 2017
    Posts:
    5
    Hi there, I am currently using unity 2018 beta and RFPS 1.44. I have noticed that version 1.24 and after causes problems when I import it to Unity versions ranging from 5.2.5 to 2018. It as if it causes Unity to go nuts. My particles don't render in scene mode and sometimes playmode and timeline preview doesn't seem to work either. Oh well maybe that's only me, if you get RFPS to work with Unity 2017 please reply, Thank you!
     
  11. Arealjighead

    Arealjighead

    Joined:
    Apr 7, 2017
    Posts:
    32
    @claudiorodriguescampos Glad i could help. There is also an audio spot for head shots you can add "Squish" sound that comes with RFPS or other sounds you might have.

    @A0101A Hey. Was you able to get RFPS to work with Pick Up Truck asset? Would you mind sharing how, if so?
    I've wanted to combine the 2 prefabs for a while now, but know very little about scripting. Any insight would help
     
  12. luxregina

    luxregina

    Joined:
    Mar 3, 2015
    Posts:
    22
    Hello everyone!
    I posted here a couple years ago, when I was still working with Unity 4. Then life happened and my project went dormant. I've just reactivated it, and I'm working harder than ever.
    I'm really, really happy with Realistic FPS, it is extremely flexible to work with. I've done a lot of 2D games, and this is my first 3D game, so I'm learning 3D at the same time I'm learning the pipeline for Unity.

    I've been focusing on the environments of my game so far, but I'm about to start 'skinning' the enemies with my own models, and hopefully some major tweaks on the AI. I will most likely have questions for you guys here, I just thought I'd (re)introduce myself first.

    The project is called Beyond Kuiper (so far, may still change) and think of it like a "Destiny-lite" (sans the lootboxes! :)) screen1.png screen2.png screen3.png screen4.png
     
    Last edited: Jan 15, 2018
    ronaldomoon, OZAV, erichey and 5 others like this.
  13. petercoleman

    petercoleman

    Joined:
    Feb 21, 2016
    Posts:
    477
    Nice to see what looks like a great looking game made with RFPSP.

    I have been using Unity a couple of years and am making a Modern/Futuristic moving through to SciFi game. I have a few SciFi Levels partly developed but like the rest of the game needs much updating later when I can get the earlier levels more complete...

    Its certainly a big and long job despite putting vast numbers of hours into it...

    Attached a few screen shots of the early(ish) part of the game. I have not yet swapped out the RFPSP player/ weapons and so as yet as I concentrate on level building and other game dynamics :)

    Thanks for sharing your game screen shots.

    Peter
     

    Attached Files:

    Mark_01, TonyLi and Legorobotdude like this.
  14. Legorobotdude

    Legorobotdude

    Joined:
    Feb 19, 2016
    Posts:
    41
    erichey likes this.
  15. Ghost_Interactive

    Ghost_Interactive

    Joined:
    Jul 8, 2015
    Posts:
    54
    At last its done, on January 20 releasing a public alpha version via our FB page.
    https://www.facebook.com/GH0ST.Interactive/
    Here is a game play of the game Ghost fighter. We modified full of RFPS.Post-Processing not yet added, it will be done in next days. Thanks a lot to TonyLi and Azuline-Studios for many support.
     
    Last edited: Jan 18, 2018
    Legorobotdude likes this.
  16. jons190

    jons190

    Joined:
    Sep 13, 2016
    Posts:
    260
    Looks nice. Give a sout out as I am currently reskinning my enamies as well and know a few things. What versions are you using?
     
    artistic17 likes this.
  17. jons190

    jons190

    Joined:
    Sep 13, 2016
    Posts:
    260
    Hey Tony Li. I has sort of an RFPS and Save System Architecture question for you.



    So my problem is that I need to do a controller check, basically on the start of each scene to make sure that when somebody comes back to the game, or sets the game in pause on mobile or loads up a game that is half way played through or some such, that a controller check runs once per start of the scene.

    I currently have it setup so that it checks at the start of the game once at the beging of the game and never again..









    The way the script is setup it is its one the splash load screen for a level, checks for the controller and then if present loads the level and if not loads a secondary level that explains that the controller is not hooked up and exits. Everything works great. But I need to add this sort of loop at the start of each level for Oculus store requirements.

    Below is my play through acitecture map (made in paint so forgive the hand painted arrows)
    save_arch.jpg


    So My question to you, is there a simple way to have the Save System for RFPS only save and load the splash scenes instead of all scenes? If so, then I could simply add my existing controller check and then when the player dies or reloads the game, then it would start at whatever spash scene is for the level they are on and everything would play from there automatically. At present I can only figure out how to use the save system to save each scene (set to only save the scene/level the player is currently playing and then load from the start of that level when the player dies or comes back the the game.)

    I have no load/save menu in the game. The game just automatically saves and loads from the start of the last level you were on before you stopped the game, were killed or took off the headset and where it says "load/save here" abouve on the chart, is where i would like to put the save/load point in the play through so that I can easily get the controller check loop integrated on each level. As I don't wart the loop to have to run in undate() in the actual playlevel as I am pushing the bounds of performance as it is on those playing levels and don't want to add anything else.

    Hope this makes sense. Anyway, Cheers mate!
     
    Last edited: Jan 18, 2018
  18. jons190

    jons190

    Joined:
    Sep 13, 2016
    Posts:
    260
    Thanks man. I'm donwloading and updating today!
     
  19. luxregina

    luxregina

    Joined:
    Mar 3, 2015
    Posts:
    22
    @petercoleman > Looking very polished! Love that silo base! Do you mind if I borrow the idea for one of my environment? (feel free to say "Heck No!")

    @Legorobotdude > Love the low poly! I'm a 2D guy that has done a lot of pixel art, so the style resonates with me - My models in my game are also very low poly, I just put most of my details in the textures

    @polash > Very cool! I'm looking forward to the final results with post processing: I've realized it can make a huge difference! Be sure to post some screens or a video!

    @jons190 > I'll definitely post my questions - and I don't really know what build I'm on, I haven't updated it in a while... all I know is that it's the build that handle waves of enemies ans spawners (which were not there yet when I started the project).

    I've actually made a quick video of the environment I'm working on >


    Once this is done, I'll start the characters, but the way they are animated in RFPS is not making much sense to me: I'm a complete noob when it comes to Unity's animations.
    So far, I've used Mixamo and was able to import motion in unity, so that's what I'm considering using, but the (very short lived) attempt I made at linking animations from Mixamo and the enemies in RFPS wasn't fruitful.

    Once I'm done with the hangar, I'll model an enemy from scratch and will spend more time on this: if any of you has any advice, I'll be thankful!
     
  20. petercoleman

    petercoleman

    Joined:
    Feb 21, 2016
    Posts:
    477
    Hi luxregina,

    Not sure about "Polished" as everything to date has much more work to be done all round, additions, updating and so on. Everything will be updated and improved as much as possible governed by the scale, complexity and performance considerations...considering I am aiming for consistent gameplay at 60fps in Unity Fantastic Mode in levels that are large and complex. if there's room to make better then I will go for it sooner or later....

    "Looking very polished! Love that silo base! Do you mind if I borrow the idea for one of my environment? (feel free to say "Heck No!"

    Its actually called or intended to be what I describe as a Missile Base and what you can see extends rather more than you can see there - off camera view. The level/scene actually contains a number of Zones including the RailRoad Station Zone as seen in the other screen shot and also Yes - another Zone which is actually meant to be a Siloh, plus a Forth Zone all in one level/Scene spaced out around the open world scene.....

    Nothing new in a game containing a missile area and its all been done before. I am sure there are many games made with them so I rely on my own game content to be unique enough to make playing the game different to any other and worth playing....

    I have content which one would say has been done before considering I started making this Game over 20 years ago and when many of the original concepts had not been done on mass many times before at that time and I am still sticking to my original ideas and concepts in the main but with a twist and whatever originality I can muster....

    Whatever as it will also change over time somewhat too as development progresses the environments and game play will be different enough to any other to make it a good Play as said I believe :)

    The aim is to go commercial eventually but that remains to be seen as first I have to complete a game that I am satisfied with and that is a long way off as yet. I have about 8 levels (most divided into multiple environment Zones) completed in a basic form that I could publish as a game but would not do so in their current condition) and more levels completed to a lesser degree. Plus quite a few more planned...

    By the way as a matter of interest what AI are you using? I would like to update the RFPSP AI at some stage to improve what I have currently though its reasonable enough when set up well - I would like it to be better. Problem is I want the RFPSP benefits I have now and don't want to lose any of them but just improve the AI leaving all else working as is now. I don't want to loose any existing features or functions just add to them. I have not yet seen any AI assets that integrate with RFPSP that show any real AI (Humanoid/Soldier) Game Play action inside of RFPSP levels/games at all leave alone in depth and have not come across any videos of such. Not seen any published games showing such either. The videos here above are about all I have seen to date. Thus I have no real visual data to provide me with any real game scenario indication of what any AI asset can actually do when integrated to RFPSP... I am not going to spend a great deal of money for something that just has a text description or manual description of what it can or might be able to do....already bought some of those and they don't work for me. Assets like Emerald AI just don't give me anything in the promotional info/material to show me what they can and can't do for RFPSP games when it comes to humanoid/FPS/TP Soldier type games and what benefits they have and more importantly at what cost in terms of disadvantages if any....for that I guess I need forum feedback from places like this?

    I need to get on - more waiting to be done :)

    Peter
     
    ronaldomoon likes this.
  21. archor

    archor

    Joined:
    Sep 18, 2015
    Posts:
    9
    Anyone else deploying with UWP ? I'm getting a Crash ????

    unity 2017.1 / vs17 via uwp ...

    when deployed, it hangs after a few seconds...

    anyone else running into this ?

    ???

    Thanks
     
  22. Ghost_Interactive

    Ghost_Interactive

    Joined:
    Jul 8, 2015
    Posts:
    54
    it may cause by some scripts from other assets,i had this problem few times. make a fresh project and import RFPS.
     
  23. petercoleman

    petercoleman

    Joined:
    Feb 21, 2016
    Posts:
    477
    Hi all,

    If anyone can help, I need some help with Destructible objects in RFPSP. E.G. Boxes, Barrels and alike.....

    I have had destructible boxes and barrels working up until the latest versions of RFPSP and Unity by using non RFPSP scripts which destroy the objects when the health is zero which then spawn in replacement meshes (visually broken versions of the objects).

    Unfortunately they no longer work I guess because the older scripts may not be any longer compatible with RFPSP and Unity.

    RFPSP does not as far as I can tell support this methodology out of the box.

    I have searched via google and looked at various assets available from the asset store which may help but as is the case generally most support standard Unity controllers and methodologies whereas RFPSP does not being proprietary?

    I do not want to go buying anything that just wont work with RFPSP for this purpose as the money is better spent on something else that does :)

    Does anyone else have a solution they have found they could point me too?

    Thank you.

    Peter
     
  24. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    @petercoleman - You might be able to use RFPSP's BreakableObject script. Look at the Glass prefab to see how it works with particles. You could do the same with boxes and barrels, where the particles look like scraps of wood.

    If you want to spawn in a replacement, make it a child object and add a FadeOutDecals script to it. Then set the renderer's alpha to 0 to make it invisible until the parent is destroyed. The object will last for a specifiable duration.

    If that doesn't work, you may need to edit BreakableObject.cs and make it spawn a new object. You could add a new public variable:
    Code (csharp):
    1. public GameObject prefabToSpawn;
    and then spawn it when broken:
    Code (csharp):
    1.     IEnumerator DetectBroken () {
    2.         while(true){
    3.             if(broken){//remove breakable object if it is broken and particles have faded
    4.                 Instantiate(prefabToSpawn, transform.position, transform.rotation); //<--ADD THIS.
     
    Mark_01 likes this.
  25. petercoleman

    petercoleman

    Joined:
    Feb 21, 2016
    Posts:
    477
    Hi Tony Li,

    Thanks for all that. Much appreciated.

    Yes I had already tried the RFPSP breakable object script using particles and that works reasonably well except that I could not get the particle pieces to be a solid color but only somewhat transparent like glass for some reason and could not find where the transparency was set to fix it....

    I will have a look at your other suggestions too...not sure where I find the FadeOutDecals script but will have look around.

    Edit Update :

    I have tried :

    Editing BreakableObject.cs to include spawn the new object on destroy which will work but I had an issue where it then does not seem to destroy/remove the new object correctly from memory and I seem to have a memory leak left and reduced performance as a result. This method also results in an error in the console as "Glass" objects in the scene return an error of there not being an object indicated to replace the Glass with when destroyed. Of course I don't need any new glass object once its destroyed and the particles have done that job :)

    Ideally I need to use a copy of the BreakableObject.cs script and tried that with my own class name correctly set up and adding the relevant code as above as you suggested, however that results in the same issue as I have with my original object scripts used previously for boxes and so on which previously worked as said. That is the object e.g. box does not not return any error in console but does nothing either, so it does not reconginse its health position and does not get destroyed, and the new object to spawn therefore is not called either :) RFPSP does not recongnise these scripts are attached apparently or simply ignores them in this instance. If it would work then so too should my original scripts which did before and therein is the problem I guess that they don't.

    Think I will have to move on to something else for the moment as I have many other important things to do also and lost quite some time on this.

    Thanks again very much.

    Peter
     
    Last edited: Jan 21, 2018
  26. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    @petercoleman - If you're not always going to spawn a new object with every BreakableObject, you'll need to check if a prefab is assigned:
    Code (csharp):
    1. if (prefabToSpawn != null) Instantiate(prefabToSpawn, transform.position, transform.rotation); //<--ADD THIS.
    RFPSP looks explicitly for BreakableObject scripts, which isn't written to be subclasses, so you'll have to use this script (and not a copy) if you want to try to use its functionality.
     
  27. luxregina

    luxregina

    Joined:
    Mar 3, 2015
    Posts:
    22
    Hello everyone! I'm most likely going to make a fool of myself, but I've been battling with this all day to no avail.

    I've created a new scene, for a cutscene - I was thinking of using a new camera in that brand new scene to animate a spaceship going towards a planet.
    My camera has a flare layer, and I have a point light that has a lens flare attached (as a component, I am not using the flare property of the light itself - not that it would make a difference, I tried)
    The flare shows up in my scene AND my game window, but disappears at run time.
    My planet doesn't have a collider (and the flare still disappear, even if the only things on stage are the camera and the light)
    Also, nothing animate on that new camera: particles that are working perfectly fine in RFPSP stop animating in this new scene.
    However, if I drop my FPS Main prefab in the scene, everything works fine...
    I'm sick today with a bit of fever, so maybe I'm not thinking straight, but I'm utterly confused :)

    ascreenshot7.png
     
  28. MaliceA4Thought

    MaliceA4Thought

    Joined:
    Feb 25, 2011
    Posts:
    406
    It could be that without the main RFPS character the game never realy starts.

    RFPS "starts" the game with Time.Timescale = 0 to give everything a chance to load and flare is in post processing at end of frame and particles require frames to progress.

    Try adding a script to the version without a character that simply looks in Update() and says if Time.Timescale = 0 then set it to 1 and see if that works. I suspect you are loading the first frame but never updating it.

    I can't believe how many times this has caught me out and each time it annoys me even more:)

    M
     
  29. luxregina

    luxregina

    Joined:
    Mar 3, 2015
    Posts:
    22
    WOW! I would have never figured it out by myself! It does work indeed! Well, that was 6 hours of trying everything that I will not gain back! :)
    Thank you SOOO much!

    EDIT - for others that may struggle with the same problem, attach a script to the camera that includes

    void Update () {
    if (Time.timeScale == 0f)
    Time.timeScale = 1f;
    }
     
    MaliceA4Thought likes this.
  30. falcoware

    falcoware

    Joined:
    Nov 23, 2014
    Posts:
    4
    Hi, there used to be a text
    showed a wave/counter on the screen
    Now it is not ,how to add ?
     
  31. Esmond0

    Esmond0

    Joined:
    Nov 22, 2017
    Posts:
    8
    Hey guys,

    Is there a way to pickup an item by just being near it or standing on top of it?

    I've only been able to pick it up by looking right at it and clicking. But I would love to just run over ammo and pick it up. Maybe of it could check if I have the appropriate weapon and then pick it up. Same thing with weapons but ask first like in Halo or COD.

    Should I try and edit the Raycast or use a Trigger volume on the pickup item?
     
  32. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Add a trigger collider and this script to your pickup.
     
  33. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    If you're using the latest version of Realistic FPS Prefab, the wave text uses Unity UI. It's in FPS Main > UI Canvas > wave and wave shadow. Make sure these UI objects are still assigned to the FPS Player's FPS Player component. The wave text is only visible while the Wave Manager is running waves.
     
    Mark_01 likes this.
  34. Ryry36

    Ryry36

    Joined:
    Nov 10, 2017
    Posts:
    32
    Hi, does anybody know what I have to do to delete all of the guns? I only want the bow and swords, but as soon as I delete the guns the whole game just breaks. If I just change the weapon orders its fine, but they are just kind of annoying to have in my game when they will never be used.
     
  35. Arealjighead

    Arealjighead

    Joined:
    Apr 7, 2017
    Posts:
    32
    @Ryry36 In FPS Main locate FPS Weapons & in Weapon Order change the number to however many you want to use, 3 in your case. then just select Unarmed, sword, & bow
     
  36. GregoryAL

    GregoryAL

    Joined:
    Jul 2, 2012
    Posts:
    5
    Great asset, works flawlessly with PC or Mac.

    I had some problems after deploying to XBox One (UWP). I can look around with the right joystick but any movement with the left joystick (going along x or y) causes Xbox's Dev Mode to quit the game.

    Can anybody point me in the right direction as per why this is happening?

    - I'm using the "FPS Main" prefab "as is" on a very simple terrain.
    - Unity 2017.3
    - All updates to Win 10 and VS 2017
     
  37. petercoleman

    petercoleman

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

    Anyone have any idea how complicated or if this can be done....

    I have an inclination to try and have the option to get the onscreen weapon cross hair to change color when it is on an enemy/or civilian target.

    The reason being that at distance a character with a weapon could be and enemy or friendly and there's no way of knowing until it either attacks or does not unless of course one would have clothing or other way of it easily being recognized as enemy or not for example.

    Without a way of knowing if a character is friend or foe I might be inclined to damage or kill it before I get near e.g. for example using a sniper weapon at long range :)

    On the other hand such an aid may be a bit of a game cheat so I may not use it anyway but the option that could be used under specific scenarios might be good to have. It's not a critical necessity anyway.

    Thanks

    Peter
     
  38. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    @petercoleman - I think it would require a script, but it would be a fairly short script that just needs to run a raycast from the sights out into the world, and then change the crosshair image's color based on the faction of the AI that the raycast hits. If no one else gets to it first, I'll try to make a little time this week to put one together.
     
  39. petercoleman

    petercoleman

    Joined:
    Feb 21, 2016
    Posts:
    477
    Hi TonyLi,

    Thanks for that. Don't worry too much about it, I understand you are a very busy person and it's not a critical item as said. If and when you have any spare time.

    Remind me to give you a credit in my game for all your help if I ever get to a state of publishing it :)

    Hopefully I may have something I can publish as a game Demo or Teaser this year if I can get enough done.

    Thanks again.

    Peter
     
  40. hsxtreme

    hsxtreme

    Joined:
    Apr 14, 2017
    Posts:
    55
    The hands of the player does not receive shadows from the environment, how do I fix this? In the case it is all the time receiving direct light, which is not acceptable.
     
  41. jnbbender

    jnbbender

    Joined:
    May 25, 2017
    Posts:
    487
    Peter,
    Have a look at this - https://forum.unity.com/threads/how-to-raycast-from-enemy-to-the-player.258627/
    I didn't write a script for you but this is pretty good, just reverse the logic.
    Where he has 'sight.origin' you place the 'Vector3' at the tip of your gun.
    Where he has `chaseRange` just make it the distance you want to Raycast.
    And finally, the only if check you need is `if (rayHit.collider.tag == "Enemy") // Sprite = Color.Red (however you do it)`
     
  42. luxregina

    luxregina

    Joined:
    Mar 3, 2015
    Posts:
    22
    Hello again everyone!

    In one of my new scene that doesn't use any RFPSP asset, I have an interface that allows players to choose a destination:


    even though I set Cursor.visible = true; in start() it seems that my cursor stays hidden. If I move this instruction in update(), it stays visible, but it's somewhat locked in the center of the screen if that scene gets loaded after a scene containing RFPSP. If I load it by itself, everything's fine.

    I'm no using any of the RFPSP classes, aside for levelLoadFadeObj and I am resetting the timescale to 1. Does anyone has any idea of what could be causing my mouse cursor to lock down in the center?

    [EDIT] Eventhough the video shows I'm also using the mouselook, I deactivated it as I thought it was the script causing my cursor to lock down (it would have made sense)[/EDIT]
     
    ronaldomoon likes this.
  43. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    @petercoleman - Give this script a try:
    ColorCrosshairByTarget.cs
    Code (csharp):
    1. using UnityEngine;
    2.  
    3. [RequireComponent(typeof(FPSPlayer))]
    4. public class ColorCrosshairByTarget : MonoBehaviour
    5. {
    6.  
    7.     public Color[] factionColor = new Color[4]
    8.     {
    9.         Color.white,     // Nothing
    10.         Color.green,     // Friend
    11.         Color.red,       // Soldier/alien
    12.         Color.magenta }; // Zombie
    13.  
    14.     public float unarmedCrosshairRange = 50;
    15.  
    16.     public LayerMask unarmedCrosshairMask = (1 << 0) | (1 << 13) | (1 << 18); // Default, NPCs, Liquid Collision
    17.  
    18.     private Transform mainCamTransform;
    19.  
    20.     private FPSPlayer player;
    21.  
    22.     void Awake()
    23.     {
    24.         mainCamTransform = Camera.main.transform;
    25.         player = GetComponent<FPSPlayer>();
    26.     }
    27.  
    28.     private Vector3 lookDirection;
    29.  
    30.     void LateUpdate()
    31.     {
    32.         var shotOrigin = player.transform.position + player.transform.up * 0.8f;
    33.         var playerDist = Vector3.Distance(mainCamTransform.position, shotOrigin);
    34.         var range = (player.WeaponBehaviorComponent != null) ? player.WeaponBehaviorComponent.range : unarmedCrosshairRange;
    35.         var bulletMask = (player.WeaponBehaviorComponent != null) ? player.WeaponBehaviorComponent.bulletMask : unarmedCrosshairMask;
    36.         AI ai = null;
    37.         RaycastHit hit;
    38.         if (Physics.Raycast(mainCamTransform.position + (mainCamTransform.forward * playerDist), mainCamTransform.forward, out hit, range, bulletMask))
    39.         {
    40.             ai = hit.transform.GetComponentInChildren<AI>() ?? hit.transform.GetComponentInParent<AI>();
    41.         }
    42.         player.crosshairUiImage.color = factionColor[(ai != null) ? ai.factionNum : 0];
    43.     }
    44. }

    @luxregina - Nice-looking scene! Are you sure LevelLoadFade isn't instantiating a copy of the RFPS player that you can't see? If fading out, the script instantiates the player. When the problem occurs, try pausing the game and searching your scene for SmoothMouseLook or WeaponPivot scripts (e.g., in the Hierarchy's search bar, enter "t:SmoothMouseLook"). In RFPS, these are the 2 scripts that lock and hide the mouse. If you don't find those, then maybe some other, unrelated asset is hiding the mouse.
     
  44. petercoleman

    petercoleman

    Joined:
    Feb 21, 2016
    Posts:
    477
    Hi Tony Li,

    Thanks for that. I get an error when Unity loads : Assets/MyAssets/Scripts/ColorCrosshairByTarget.cs(4,13): error CS1041: Identifier expected, `using' is a keyword

    I tried editing the script myself to fix it but as I don't really know what I am doing I just compounded further errors :)

    Thanks again

    Peter
     
  45. witcher101

    witcher101

    Joined:
    Sep 9, 2015
    Posts:
    516
    Any1 managed to get multiplayer with RFPS. I dont mind paying another 50$ if there was an multiplayer addon
     
  46. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Try the attached version.

    Otherwise, when you copy and paste, make sure those line numbers (1., 2., 3., etc.) are not in the script. If that doesn't help, please double-click on the error message in the Console window. This will open a code editor. Take a screenshot and post it here please.
     

    Attached Files:

  47. OZAV

    OZAV

    Joined:
    Aug 9, 2013
    Posts:
    299
    @A0101A Hey. Was you able to get RFPS to work with Pick Up Truck asset? Would you mind sharing how, if so?
    I've wanted to combine the 2 prefabs for a while now, but know very little about scripting. Any insight would help[/QUOTE]
    I can get RFPS (or anything else) to work with anything, hell, even with the UFPS :). Sharing: no time right now, but: i can help you out via email, so you can share the method here for us, and RFPS community here, after you run it ok ? Contact me at my studio email i check often: oztronix@gmail.com (other spammers will be prosecuted, unless they need help with similar RFPS issues, eg cars, vehicles boats, planes, gliders, etc :) Mind ye also that i only help once with each current RFPS version, after that - you should know what to do with the every next edition *** *** for some guys here, stop calling it RFPSP, the veterans name for it is only healthy one: RFPS ! *** Enlist as a contributing soldier, and correct your posts. For rfpsp you can only get a hard foot kick in the ass from me, as much as i am concerned ... RFPS is not just an asset, it's a MOVEMENT. WE WANT YOU.jpg

    Michael.
     
    Last edited: Feb 1, 2018
    Mark_01 likes this.
  48. Arealjighead

    Arealjighead

    Joined:
    Apr 7, 2017
    Posts:
    32
  49. petercoleman

    petercoleman

    Joined:
    Feb 21, 2016
    Posts:
    477
    , seems to work like a charm

    Hi TonyLi,

    Thanks for that.

    From what I can see having briefly testing it out, seems to work like a charm out of the box.

    Thank you so much.

    Peter
     
  50. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    You're welcome! Glad I could help.
     
    Mark_01 likes this.