Search Unity

Realistic FPS Prefab [RELEASED]

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

  1. witcher101

    witcher101

    Joined:
    Sep 9, 2015
    Posts:
    516
    Can any1 tell me how u guys change hands. I need to replace RFPS hands with other model anyway i can copy animation from rfps hands to my new hand model??
     
  2. llJIMBOBll

    llJIMBOBll

    Joined:
    Aug 23, 2014
    Posts:
    578
    You might need to remake the animations, unless your new hands have the same bones, you can try just add an animation component to your new hands and add the anims from rfps. But prob your new to manual re-animate them.
     
  3. CTPEJIOK22

    CTPEJIOK22

    Joined:
    Sep 4, 2013
    Posts:
    85
    Hi. Anyone know how to add cooperative to rfps? Maybe simple solutions?
     
  4. petercoleman

    petercoleman

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

    Thanks for that.

    Still no luck I am afraid. Still cant get the new character to activate. After more than 3 full days work :)

    The issue eludes me but as the character is effectively not responsive at all I really need to get some reaction from it to solve the problem.....

    I have a default Character in the level and if I shoot and kill it then all is fine, but if I try and kill my new character I get a crash and error message variable along the lines of.......

    "
    UnassignedReferenceException: The variable agent of AI has not been assigned.
    You probably need to assign the agent variable of the AI script in the inspector.
    UnityEngine.NavMeshAgent.Stop () (at C:/buildslave/unity/build/artifacts/generated/common/modules/AI/NavMeshAgentBindings.gen.cs:240)
    CharacterDamage.Die () (at Assets/RFPSP/Scripts/AI/CharacterDamage.cs:259)
    CharacterDamage.ApplyDamage (Single damage, Vector3 attackDir, Vector3 attackerPos, UnityEngine.Transform attacker, Boolean isPlayer, Boolean isExplosion, UnityEngine.Rigidbody hitBody, Single bodyForce) (at Assets/RFPSP/Scripts/AI/CharacterDamage.cs:187)

    "

    And therein seems to be the problem. Not sure what all that means so have no idea how to fix it. I believe I had a similar error message a long time ago but cant remember how I ever fixed it if I did :)

    If anyone knows what the error message is trying to tell me and could point me to a solution that would be very helpful and very much appreciated as I am lost for ideas by now!

    It's a bind not being able to add ones own character and in theory at least it seems it should be straight forward but seems to be far from it in reality unless one is an expert presumably, which I am not. Seems to be far more difficult than it should or need be.

    Anyway thanks for any help or advice anyone who may be able to suggest a fix or workaround for the error.

    Thanks again.

    Peter
     
  5. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
  6. petercoleman

    petercoleman

    Joined:
    Feb 21, 2016
    Posts:
    477

    Hi TonyLi,

    Thanks for that. Those are already in place. All default AI Characters and the custom one I made previously for V1.22 work fine in the same level taking advantage of those things and as far as I can see my new character is set up exactly as my previously made bespoke one as referred to.....

    I have tried two different new Characters (.fbx models) and they both wont function....

    I have been using the default Robot NPC as the basis for the new characters in all cases and basically follow the Video tutorial online which worked with tweaking for my original V1.22 Character I made which still works fine as said so I am lost except for keeping trying endlessly repeating I guess something that is'nt working now!

    Now if I make my new Character a Friendly one (faction 1) and set to Follow on Use and run level and thenn try and get the Character to follow me (f key) I also get an error mesage as follows :

    UnassignedReferenceException: The variable playerTransform of AI has not been assigned.
    You probably need to assign the playerTransform variable of the AI script in the inspector.
    UnityEngine.Transform.get_position () (at C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineTransformBindings.gen.cs:26)
    AI.CommandNPC () (at Assets/RFPSP/Scripts/AI/AI.cs:1141)
    FPSPlayer.Update () (at Assets/RFPSP/Scripts/Player/FPSPlayer.cs:925)

    Anyone know why these error mesages keep refering to "The Player" as opposed to the character itself at least thats how I read it. Seems to suggest it does not like the "Player" for some reason unless I am reading it wrongly :)

    Thanks anyway for you help.

    Peter
     
    Last edited: Nov 15, 2016
  7. canaljuegos32

    canaljuegos32

    Joined:
    Jun 29, 2015
    Posts:
    63
    Anyone used Ultimate Inventory 5 with RFPS?. I got to pick and drop objets but cant use a health item from inventory, I tried everything i could find, but did nothing. The manual say this:


    for (int i=0; i<consumeEffects.Length; i++)
    {
    if (consumeEffects == "DrinkItem")
    {
    Health code from RFPS should e here
    }
    }
     
  8. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    UnassignedReferenceException: The variable agent of AI has not been assigned.
    You probably need to assign the agent variable of the AI script in the inspector.
    UnityEngine.NavMeshAgent.Stop () (at C:/buildslave/unity/build/artifacts/generated/common/modules/AI/NavMeshAgentBindings.gen.cs:240)
    CharacterDamage.Die () (at Assets/RFPSP/Scripts/AI/CharacterDamage.cs:259)

    This means the CharacterDamage component's Die() method is getting invoked before the AI component's OnEnable() method. (Same for the other error about playerTransform.) Is the AI component enabled? If so, is the NPC perhaps getting deactivated by a MonsterItemTrap, MonsterTrigger, or similar component before the AI component gets a change to run its OnEnable() method?
     
  9. RedWo1f

    RedWo1f

    Joined:
    Jan 10, 2013
    Posts:
    5
    Weird question, but I just re-imported my RFPS asset back into my project because for some reason, my FPS Main suddenly stopped shooting after 1 bullet (on all my guns). I put a fresh prefab character back in the map with no setting changes, and he still can only fire 1 bullet on each gun, reload, and not fire again...

    This issue sort of popped up, don't know what to do. Any help would be appreciated!

    EDIT: No errors are coming up at all when this issue occurs.
     
  10. petercoleman

    petercoleman

    Joined:
    Feb 21, 2016
    Posts:
    477

    Thanks for trying to help. Still at it for 4th day :)

    At the moment I cant see any issues my end including any you mentioned above which are. Don't have any traps or anything in use and the character has the same as my other bespoke character made a long while back that works as said earlier. At the moment I can get to using the Default Robot NPC as the basis but cant allocate my Model in the object with animation field or I get the errors, so he has no animations playing. After almost 4 days I think I give up which is not like me but I don't see any reason and Unity/RFPSP cant tell me exactly what the problem is! - apparently :) so I am just knocking myself out going around in circles trying hundreds of permutations which are clearly not the root cause issue. Its probably something easy to fix if I knew what it was. I was going to buy some Character models from the Unity site for my game as I need quite a few different characters but see no point if I wont be able to get them to work with RFPS Prefab. My game is on stop now after almost 2 years of work as I need some different characters other than what comes with RFPSP out of the box.

    Ah well. I will have to wait for the next update and see if that helps but it is more likely to kill things altogether I guess. Not sure how best to update - Last Time I had to basically start from scratch as I had not done too much work on the game at that point.

    Anyway thanks very much for you help.

    UPDATE

    Just a quick one to say thank you to everyone who tried to help me...and to say I have sorted my problem now by changing my new character to Mecanim animation and by using the default Android Character as a basis to follow. Setting up separate animations and body - adding ragdoll and weapon appropriately. Never done that before but its realtively easy and works prefcectly. Yeah!

    kind regards

    Peter
     
    Last edited: Nov 16, 2016
  11. johny256

    johny256

    Joined:
    Mar 3, 2015
    Posts:
    258
    save load system and complete gui menu? start game. save game. load game??
     
  12. frankymak

    frankymak

    Joined:
    Jul 15, 2013
    Posts:
    3
    Hi.

    I would like to delete the AI.cs and NPCAttack.cs scripts

    I have implanted a new Ai for the NPC.
    But I would like you to continue receiving the bullet impacts and to die when you lose your life.

    I'm working with the prefab that has different colliders

    How can I make the LocationDamage, and Character damage.cs scripts work?
    Having the AI.cs and NPCAttack.cs scripts disabled

    thanks
     
  13. jons190

    jons190

    Joined:
    Sep 13, 2016
    Posts:
    260
    Is anyone using this prefab for oculus or gearVR? Would love to run some ideas about implementations by you if so. Thanks
     
  14. CTPEJIOK22

    CTPEJIOK22

    Joined:
    Sep 4, 2013
    Posts:
    85
    check this thread: https://forum.unity3d.com/threads/tactical-shooter-ai-asset-store-pack.305971/page-23

    there are some solutions about custom ai and adoptation. main idea - you need to add to bullets collider and send message about collision. so, you need to find bullet object at rfps and check its properties and scripts, then just copy it to new object.
     
  15. Weblox

    Weblox

    Joined:
    Apr 11, 2016
    Posts:
    277
    Hi, I am using Rfpsp for a little while now and it has been my first Project in Unity. So far I had only great experiences with this asset. Being new to Unity and no Coder at all, integrating other assets into my Project still is the hardest Part. Now I want to use RFPSP with UGUI MiniMap from here : https://www.assetstore.unity3d.com/en/#!/content/32874 .

    The asset is working good out of the box , but I'm trying to make it load/fade with the level UI. Has anyone done this already and can share how to do it ? Thanks in advance.
     
  16. llJIMBOBll

    llJIMBOBll

    Joined:
    Aug 23, 2014
    Posts:
    578
    Weblox likes this.
  17. Weblox

    Weblox

    Joined:
    Apr 11, 2016
    Posts:
    277
    @llJIMBOBll Thanks for the fast reply. As of now making the script is way beyond my scope. I was hoping to get this achieved with applying the LevelLoadFade Script somewhere to the MiniMap Prefab, but now I suppose that will not work ?
     
  18. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    The LevelLoadFade script works independently of Unity UI Screen Space - Overlay canvases. I haven't tested this (since I'm out of the office at the moment), but try changing the MiniMap Prefab's Canvas type to Screen Space - Camera.
     
  19. Weblox

    Weblox

    Joined:
    Apr 11, 2016
    Posts:
    277
    @TonyLi Thanks a lot.I cant test this immediately but I'll try that out tonight and report back. Also I am slowly learning to read through easier scripts and I noticed a

    [Hide in Inspector]
    public GameObject LevelLoadFadeobj ​

    pretty much at start of the script. Maybe its possible to unhide the GO and assign the MiniMap Prefab to the slot?
     
  20. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    No, I'm afraid that won't do it. If I recall correctly, the LevelLoadFadeobj is a GUITexture. The MiniMap Prefab is a Unity UI Canvas. The fade script assumes that a GUITexture.
     
  21. Weblox

    Weblox

    Joined:
    Apr 11, 2016
    Posts:
    277
    I see. Changing the MiniMap Prefab's Canvas type to Screen Space - Camera does indeed make it fade and load with the Level when set to MainCamera (the MiniMapCamera or the WeaponCamera wont show anything), but the Map Placement is somewhat off (as if the Map Canvas was floating around in the upper left from a 45 degree angle). I have tried to set the MiniMap to the UI Layer and also to GUICamera Layer which both creates the same output. Thanks for the help.
     
  22. JC_LEON

    JC_LEON

    Joined:
    May 20, 2014
    Posts:
    520
    did anyone manage to successful integrate ultimate inventory pro with rfps? and if yes can please some could explain how to?

    thanks
     
    VoltzStudios and Nateply like this.
  23. petercoleman

    petercoleman

    Joined:
    Feb 21, 2016
    Posts:
    477
    Is there an easy way to turn on or off the "Give all Weapons" button on the Main Menu e.g. as with the Invunerable button and choice to turn it on or off? I don't seem to be able to find one?

    Thank you for any help.

    Peter
     
  24. RangePlusOne

    RangePlusOne

    Joined:
    Dec 6, 2014
    Posts:
    123
    Hey does anyone have any tutorials they know of that hook up a car driving toolkit? So when the player goes up to the vehicle, presses F, player enters vehicle and can start driving?
     
  25. RangePlusOne

    RangePlusOne

    Joined:
    Dec 6, 2014
    Posts:
    123
    I saw this tutorial, thought you should know of it
    I dont know if it still works or not... let me know how it goes.
     
    Malbers likes this.
  26. canaljuegos32

    canaljuegos32

    Joined:
    Jun 29, 2015
    Posts:
    63
    It works but i dint find a way to use objects from inventory (im not a coder).
     
  27. txarly

    txarly

    Joined:
    Apr 27, 2016
    Posts:
    197
    Hi to all,

    i am trying to teleport the player when touches a door to an inside model(house interior) placed out of the map with a fade in/out to black effect.Anybody has achieved this or can help me ?

    Thanks
     
  28. JACKO4590

    JACKO4590

    Joined:
    Nov 25, 2014
    Posts:
    81
    You are better off going to another scene. (Scene01 -> interior_house07) Use a save system to make sure the player has all of his stuff when switching scenes. The dialogue System does a great job at this.
     
  29. txarly

    txarly

    Joined:
    Apr 27, 2016
    Posts:
    197
    well, i have my own inventory system and prefer only one scene.
     
  30. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    1. Create a C# script named "Teleporter":

    Teleporter.cs
    Code (csharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class Teleporter : MonoBehaviour {
    5.  
    6.     public Transform destination;
    7.     public float fadeInDuration = 1f;
    8.  
    9.     IEnumerator OnTriggerEnter(Collider other) {
    10.         if (other.CompareTag("Player")) {
    11.             GameObject llf = Instantiate(FindObjectOfType<FPSPlayer>().levelLoadFadeObj) as GameObject;
    12.             llf.GetComponent<LevelLoadFade>().FadeAndLoadLevel(Color.black, fadeInDuration, true);
    13.             yield return null;
    14.             other.transform.position = destination.position;
    15.             other.transform.rotation = destination.rotation;
    16.         }
    17.     }
    18. }
    2. Add it to a GameObject with a trigger collider.

    3. Create an empty GameObject at the destination position (e.g., inside the house) and assign it to the Destination field.

    Because of the way RFPS's LevelLoadFade is written, the Teleporter script must immediately cut to black (no fade out), but it can fade in.
     
    Hormic and llJIMBOBll like this.
  31. txarly

    txarly

    Joined:
    Apr 27, 2016
    Posts:
    197
    thanks tonyli
     
  32. JACKO4590

    JACKO4590

    Joined:
    Nov 25, 2014
    Posts:
    81
    Ok something i have been running around trying to do. I was wondering if anyone has set up a UI Slider for Stamina?

    I just want to know what is the easiest way to set up, and then how to implement so when you run it increases the thirst and hunger intervals

    Thanks again
    ~Justin
     
  33. RangePlusOne

    RangePlusOne

    Joined:
    Dec 6, 2014
    Posts:
    123
    Hey guys I havent been devin' lately.. I see there's a new patch for the RFPS, are the particle effect updated from the old legacy version??
     
  34. unicat

    unicat

    Joined:
    Apr 8, 2012
    Posts:
    425
    Getting this error in Unity 5.5f3 :

    Assets/RFPSP/Scripts/AI/AI.cs(622,5): error CS1622: Cannot return a value from iterators. Use the yield return statement to return a value, or yield break to end the Iteration.
     
  35. JACKO4590

    JACKO4590

    Joined:
    Nov 25, 2014
    Posts:
    81
    @unicat Click on all of those errors and put yield before them. Unity 5.5 changes the code abit. I reckon there were about 6 errors? after that it works all well
     
  36. unicat

    unicat

    Joined:
    Apr 8, 2012
    Posts:
    425
    Will try this , thank you.
     
  37. DecayGame

    DecayGame

    Joined:
    May 15, 2016
    Posts:
    86
    Hello!

    I was looking at your Bolt intergration with RFPS. I am currently trying to use Version 1.22 but on the WeaponBehaviour script on line 1112 I am supposed to put this

    1. //[TL]
    2. if ((hit.collider.GetComponentInParent<BoltEntity>() != null) || (hit.collider.GetComponentInParent<BoltAwareDamageable>() != null)) {
    3. DamagedTarget(this, new DamagedTargetEventArgs(hit.collider.gameObject, damage, direction, mainCamTransform.position));
    4. } else {
    5. (put the switch statement in here)
    6. }
    What I do not get it what goes in the (put the switch statement in here) area, which switch statement are you talking about? please help. :)

    plus i get this error : ( sorry for the big pictures ) :3


     
    Last edited: Dec 4, 2016
  38. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    Hi @DecayGame - If you're referring to the instructions in this post, the switch statement starts with these lines:

    Code (csharp):
    1.         //call the ApplyDamage() function in the script of the object hit
    2.         switch(hit.collider.gameObject.layer){
    3.             case 1://hit object is an object with transparent effects like a window
    and ends with these lines:

    Code (csharp):
    1.  
    2.             default:
    3.                 break;
    4.         }
    The errors about "DestroyEvent", "EquipEvent", etc., mean you haven't yet completed all the steps in the Bolt Assets section of that post. This section is below the code changes.

    I'm afraid I can't help much beyond that, though. I haven't touched Bolt since I put together that proof of concept, and I don't even know if I have a copy of RFPS 1.22.
     
  39. DecayGame

    DecayGame

    Joined:
    May 15, 2016
    Posts:
    86
    I was following through with the steps but I got the errors. With the DestroyEvent and EquipEvent and ect. I don't know how to fix them.
     
  40. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    After you run the steps in the "Bolt Assets" section, the compiler errors should disappear. If they don't, try this:

    1. Delete the files that you imported in the "More Scripts!" step. The project should compile cleanly after this.

    2. Follow the next steps in the "Bolt Assets" section.

    3. Reimport the "More Scripts!" package.

    Once the project compiles cleanly, continue with the "Setup Player Prefab" section, etc.
     
  41. DecayGame

    DecayGame

    Joined:
    May 15, 2016
    Posts:
    86
    Ah, I understand. I gave it a try so I deleted the More Scripts! Files and now I get this error. I did edit the WeaponBehaviour script like followed in the instructions.

     
  42. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    Did you then try the Bolt Assets section? It may be that you're going to have to ignore the errors until you get to the end of both sections (Bolt Assets and More Scripts!). They depend on each other. If one isn't set up yet, the other will throw errors until it's set up.
     
  43. DecayGame

    DecayGame

    Joined:
    May 15, 2016
    Posts:
    86
    Wait I just renamed the player and it worked. But now I get theese errors after compiling assembily.. . .
     
  44. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    @DecayGame - Hmm, I don't know. Can you make a backup of your project and then delete Assets/bold/sample? (Then select Compile Assembly again.) Back when I put together the proof of concept, I don't know if Bolt had those sample scripts. I no longer have Bolt or RFPS 1.22 installed.
     
  45. DecayGame

    DecayGame

    Joined:
    May 15, 2016
    Posts:
    86
    Alright let me give that a go.
     
  46. DecayGame

    DecayGame

    Joined:
    May 15, 2016
    Posts:
    86
    Did what you said now this happens:
     

    Attached Files:

  47. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    Double check this step:

    In the "Bolt Assets" window, create:
    • States:
      • PlayerState - with these properties:
        • FPSPlayerTransform (transform)
    Then click the green down arrow button, or select Assets > Bolt Engine > Compile Assembly.

    The error suggests that there might be a typo in the name "FPSPlayerTransform".
     
  48. DecayGame

    DecayGame

    Joined:
    May 15, 2016
    Posts:
    86
    Hey, all the errors are fixed :) I will work with this more tomorrow because it is late. Thank you.
     
  49. petercoleman

    petercoleman

    Joined:
    Feb 21, 2016
    Posts:
    477
    Hello,

    After sorting getting Custom Characters into my Game a while back I am now trying to get Custom weapons working in V1.23 without success. I have gone through the current manual procedures and watched the You Tube videos, most of which are too small to see the text detail of what is being done. As with Custom Characters I had Custom weapons working in V1.22 but no luck in V1.23.

    I have the new weapon displaying OK. Added it to the Player weapons and a new pickup for it. I added a spot in the player weapons at the end of the list as per the Manual instructions so I have 16 Items now I believe.....

    Anyway When I run the level selecting the pickup for the new weapon I collect it but it does not display. I have to scroll the mouse to display it and Unity exits back to editor in pause when it displays and I get a console error message. If I then select pause in editor to get back in the level the weapon is displayed and if I try to fire the weapon unity again takes me back to the editor - repeat select pause to get back in level again and the weapon then ejects a shell and fires? and unity exits again back to editor with additional error messages.....

    Seems like the weapon is not being found in the array correctly I am guessing but am probably way out there? Looking at the scripts the lines of code indicated don't really mean anything to me :)

    The error messages are as so and similar :

    NullReferenceException: GetRef
    WeaponBehavior.InitializeWeapon () (at Assets/RFPSP/Scripts/Weapons/WeaponBehavior.cs:915)
    PlayerWeapons+<SelectWeapon>c__Iterator24.MoveNext () (at Assets/RFPSP/Scripts/Weapons/PlayerWeapons.cs:598)

    NullReferenceException: GetRef
    WeaponBehavior.Start () (at Assets/RFPSP/Scripts/Weapons/WeaponBehavior.cs:806)

    Been at it a whole day withe exactly the same result and would appreciate any feedback or help advice if anyone has come across this issue or similar and has found a solution.

    Thanks once again in anticipation of your kind support.

    Kind regards

    Peter
     
  50. al3d

    al3d

    Joined:
    Feb 7, 2013
    Posts:
    51
    Hi,
    I just bought "Realistic Fps prefab" and I have a error message when I try to test it "Assets/RFPSP/Scripts/AI/AI.cs(622,5): error CS1622: Cannot return a value from iterators. Use the yield return statement to return a value, or yield break to end the iteration"

    I use unity 5.5 someone knows how to fix this bug ? thx