Search Unity

Realistic FPS Prefab [RELEASED]

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

  1. Franciscotx56

    Franciscotx56

    Joined:
    Feb 8, 2019
    Posts:
    23
    in my own scene however with only unlimited Spawning box unticked and different NPC prefab. the Max Active NPCs variable works but NpcsToSpawn does not work.it says NPCs to spawn is 5 but is Spawning unlimited npcs .I keep killing enemies endlessly
     
  2. AzulineStudios

    AzulineStudios

    Joined:
    Feb 18, 2021
    Posts:
    31
    Ok, would you be able to send a screenshot or video of your NPC Spawner settings, or a copy of the project that is having this issue? I wasn't able to recreate this behavior in my project, thanks.
     
  3. hoschi3d

    hoschi3d

    Joined:
    Oct 4, 2014
    Posts:
    17
    Hi
    Is it by any chance possible that when reloading the weapons are held down out of the picture? So in about the same way as the gun is held to the side when running, it should be held further down when reloading?
     
  4. ProBrStalker

    ProBrStalker

    Joined:
    Aug 20, 2017
    Posts:
    65
    Yes, just adjust and configure in the component "Weapon "Behavior".
    Or, in the weapon's own animation, reducing the height until it doesn't appear in the camera.
     
  5. Franciscotx56

    Franciscotx56

    Joined:
    Feb 8, 2019
    Posts:
    23
    I realized that it is mandatory to assign the waypoint group.after doing this the problem was solved.thank you for the help.
     
  6. OZAV

    OZAV

    Joined:
    Aug 9, 2013
    Posts:
    299
    ... hello, Azuline, and forum members, we are not updated, what's the new ETA on the Store for the new version of the asset, it would be nice, now even historically - to enjoy a bit of the new improvements, as we all should, having a look at it, and re-purchase for the support purposes. Please keep us all updated, we hope you are having a great and productive RFPS week, everyone :). RDA-Junkers-JU-87-Stuka.JPG
     
    AzulineStudios and Franciscotx56 like this.
  7. AzulineStudios

    AzulineStudios

    Joined:
    Feb 18, 2021
    Posts:
    31
    Hi OZAV, apologies for the lack of updates. I've had some personal things going on that have been taking my attention. I will have some more updates soon about the new FPS asset. Working mostly on the documentation right now. Thanks for your patience.
     
  8. SickaGames1

    SickaGames1

    Joined:
    Jan 15, 2018
    Posts:
    1,270
    I can't wait to see what kind of melee for RPG games you end up adding!
     
    Franciscotx56 and OZAV like this.
  9. ProBrStalker

    ProBrStalker

    Joined:
    Aug 20, 2017
    Posts:
    65
    AzulineStudios and leandrovtd like this.
  10. leandrovtd

    leandrovtd

    Joined:
    Mar 8, 2017
    Posts:
    28
    Hi @AzulineStudios ,

    Do you have any tutorial on how to add new weapons with animated hands? I tried to adapt this (https://assetstore.unity.com/packages/3d/props/weapons/animated-fps-weapons-pack-part-1-92280) project with RFPS Prefab, but it was taking a huge proportion where it was becoming almost a new project from scratch due to the necessary adaptations to be made in the scripts.

    I think these animations here (https://assetstore.unity.com/packages/3d/props/weapons/animated-hands-with-weapons-pack-132915) are less difficult to add, right?

    Do you have any tips on how to do this?
     
    ProBrStalker likes this.
  11. alonehuntert

    alonehuntert

    Joined:
    Oct 12, 2017
    Posts:
    15
    ProBrStalker likes this.
  12. ProBrStalker

    ProBrStalker

    Joined:
    Aug 20, 2017
    Posts:
    65
    Thanks!
    Animations taken from other fps games, but modified, with other weapons, and some details to avoid copyright issues...
     
    Last edited: Aug 14, 2021
  13. ProBrStalker

    ProBrStalker

    Joined:
    Aug 20, 2017
    Posts:
    65
    Guys, I would like to clear a little doubt, how could I make the rfps work both with CharacterController, as well as its own controller?
    For example, I have a player on the server, and another on the client, and both need to have the same movement, both client and server, and for that I do the input verification through a script shared, but using booleans as inputs and not float values...
     
  14. alonehuntert

    alonehuntert

    Joined:
    Oct 12, 2017
    Posts:
    15
    Code (CSharp):
    1.     public UnityEngine.UI.Slider slider;
    2.     public int bulletsPerClip = 1;
    3.  
    4.     void Start()
    5.     {
    6.         var sliderGO = GameObject.Find("MagUI");
    7.         if (sliderGO == null) Debug.LogError("Can't find GameObject 'MagUI'");
    8.         slider = (sliderGO == null) ? null : sliderGO.GetComponent<UnityEngine.UI.Slider>();
    9.         if (slider == null) Debug.LogError("MagUI doesn't have a Slider");
    10.     }
    11.  
    12.     void Update()
    13.     {
    14.         if (ammoGui != oldAmmo || ammoGui2 != oldAmmo2)
    15.         {
    16.             if (slider != null) slider.value = Mathf.Clamp((float)ammoGui / (float)ammoGui2, 0, 1);
    17.  
    18.             if (slider == null) Debug.LogError("slider is null!");
    19.             if (slider != null) slider.value = Mathf.Clamp((float)ammoGui / 30, 0, 1);
    20.  
    21.         }
    22.  
    23.  
    I made an "ammo slider" like this, it works fine on the gun. but when i switch to pistol it is half empty

    1.png 2.png
     
    Franciscotx56 likes this.
  15. ProBrStalker

    ProBrStalker

    Joined:
    Aug 20, 2017
    Posts:
    65
    Guys, I recently updated my rfps to the current version, and I ended up having some minor issues like:

    Well, does anyone who has been through this have any suggestions for correction?
    I appreciate any help.
     
  16. AzulineStudios

    AzulineStudios

    Joined:
    Feb 18, 2021
    Posts:
    31
    Thanks, yes basic melee is implemented. You can swap out first person models and create new weapons pretty easily.

    Hi leandrovtd, there's a tutorial in the RFPS documentation about how to add new weapons, but if the packs you're implementing have different types of animations than the RFPS weapons, you might want to compare the two. Reloading and firing animations should work, but idle animations or readying animations (if not anims with stationary arms) may need to be tweaked because they are handled by coded movements.

    The simplest way to add new weapons is to parent the new meshes to the existing weapon models and hide the mesh renderer components of the original models, so the new ones inherit the original RFPS animations. To add new weapons from scratch, you'll need to also edit the animator controller references per weapon. Hope that helps.


    RFPS uses its own character controller, but you could implement Unity's character controller with some edits. To get the movement variables for the input verification, you could convert float input to bools by checking the value of the float. Something like:
    Code (CSharp):
    1. serverMoveForward = InputComponent.moveY > 0.5 ? true : false;
    2. serverMoveBackward = InputComponent.moveY < -0.5 ? true : false;

    It looks like the slider isn't getting the proper "max ammo" amount to divide the current ammo by to get your slider height percentage. Your UI script's "bulletsPerClip" value should be set to RFPS's WeaponBehavior.cs "bulletsPerClip" value. Maybe check where the UI script is reading the max ammo amount for the pistol.


    Thanks for the video ProBrStalker, the RFPS prefab uses some references which are hidden from the inspector using the "[HideInInspector]" keyword. This was done for performance reasons, but if the references get nulled, you will need to remove the "[HideInInspector]" over the variable declaration at the top of the script so you can see it in the inspector. Then if you compare the new prefab with issues, with the old one's intact references, you should be able to drag the equivalent objects to the references in the new prefab to fix the null ref errors.
     
    Last edited: Aug 17, 2021
  17. ProBrStalker

    ProBrStalker

    Joined:
    Aug 20, 2017
    Posts:
    65
    Thanks for help Azuline, I'm activated the Debug option on Player, for visualize the missing Components...
    upload_2021-8-17_21-24-28.png
     
  18. ProBrStalker

    ProBrStalker

    Joined:
    Aug 20, 2017
    Posts:
    65

    Hello, god night, how i can modify this code, for work with the FPSWalker?
    upload_2021-8-19_21-36-2.png

    and:
    upload_2021-8-19_21-36-36.png
     
    Franciscotx56 likes this.
  19. petercoleman

    petercoleman

    Joined:
    Feb 21, 2016
    Posts:
    477
    EDIT UPDATE : Fixed This Now

    Hi Everyone,

    I have been quiet lately - but still working updating my projects :)

    I have a kind of technical problem if anyone can help?

    I obviously have a lot of game objects that I shoot at and (Kill) destroy...and many destructible objects like boxes create pieces when destroyed and some deliver "Goodies" for the Player to collect e.g. Ammo or Health

    When it comes to simple objects its easy of course, However I have some more complex objects like enemy vehicles which shoot at the Player in particular that comprise a "Parent" and "Child" objects.......

    I am finding that when I shoot these more complex objects - the child objects are sometimes not "Destroyed"....

    Thus I am looking for a solution - for example I can use the RFPS breakable object script which works well on a Parent object but does not work on some child objects when the main parent is killed some children can be left behind :)...

    It seems I need to :

    1. Amend the breakable object script or similar to include the removal of Child objects or

    2. Deactivating the Parent object will remove the Parent and Children but at the moment say instantiating a deactivate prefab when an Enemy is hit is no use as when saved as such it the prefab does not keep the Game Level object to deactivate in its property setting. Such a deactivate object would have to exist in the level to be activated only when an Enemy object is hit? Not sure how I would do that?

    Looked around the web but looks like I will have to spend some more time on this and try and conjure up a script :)

    Spent some days thus far looking to get a workaround but the Child objects are Stubborn!

    Any help would be appreciated.

    By the way I have not forgotten a video I promised of the game but have been updating a lot of stuff adding more game play, characters and detail and sorting pain in the butt things like this one ;-)

    I trust you are all well

    Kind regards

    Peter
     
    Last edited: Aug 25, 2021
  20. OZAV

    OZAV

    Joined:
    Aug 9, 2013
    Posts:
    299
    Seems you can benefit from not using GetComponent, but to use GetComponentInChildren calls, maybe set as a variable, and than deparent and destroy / deactivate each child with foreach call, on main obj destruction point etc. Since GetComponentInChildren will scan through all the children parts of the object to be destroyed / deactivated. Also it's best to avoid searching for deactivated game objects in a scene since Unity will not take them into account, as we all know, so it's important when exactly do you call that deactivate function, as well, for what object. Also, you can have the simple script attached that will first deparent children of the object hit, and than give them a remaining lifetime, so, just for the some idea, but the first will be to try stop using GetComponent, but instead to use GetComponentInChildren and GetComponenstInChildren. So you can first, that way - find all children debris objects and than using foreach call - set them a remaining lifetime in a scene and what-not, maybe some effect as well, on the expiry of each, etc. So, basically: you find, than deparent and than deactivate all child objects after a set time, in which ever order of this suits better, for your situation, as without more information is hard to say, in general. RDA-CribCity-Insectoids.JPG :).
     
    Last edited: Aug 25, 2021
  21. petercoleman

    petercoleman

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

    Thanks for that.

    After struggling with the issue over a long time and the last 4 days in particular I have fixed the issue - easily by adding a small line of code at the end of the breakable object script as I had indicated above which sets the Parent object to deactivated and that ensures all Child objects also deactivate so as is often the case a simple solution is best if you can discover how to do it :)

    Unity is of course a pain in the butt as it insists on reloading every script and sometimes reloading the script assemblies also in the project every time a change is made to any script code - perhaps they have fixed this now I don't know but its another waste of a lot of time which I don't need...much more updating to do :)

    Peter
     
    OZAV likes this.
  22. petercoleman

    petercoleman

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

    I have another question if anyone can help.

    I am trying to set up a "Turret" controller that fires particles and I want to use it to kill (destroy) RFPS objects. i.e. Enemy NPC's and perhaps destroy crates, barrels and so on as the Player weapons do.

    When Using the Turret, the RFPS Player and Camera is disabled and the Turret Camera takes over.

    I have the Turret created, aiming via a camera with Mouse Look camera controller and firing with particles. When the particles hit objects they collide and the impacts push around objects. That all works....

    I have perhaps an obvious problem in that the Objects that have "Hit Points" (health) do not get killed.

    I have attached to some of the Particles fired a "ParticleCollider" script which I am trying to get to work and damage objects on collision but its beyond me it seems.....

    Anyone know any code I could add to the particles that would damage RFPS objects?

    What I have tried of my own or found just don't work :)

    Looked around the assets store but cant find a turret controller or anything else thus far that would do this as far as I can see. Looked around the web for some code but nothing much about useful in this instance?

    Thank you.

    Kind regards

    Peter
     
    Franciscotx56 likes this.
  23. OZAV

    OZAV

    Joined:
    Aug 9, 2013
    Posts:
    299
    Hello, Pete, are you using OnParticleCollision () calls ? Have you checked that: In your particle emitter for the flame damage effect, the option 'send collision messages' is ticked to on and - your objects to get killed and their sub parts containing the damage scripts are on the NPC layer (layer 13) or - at the proper layer that can detect each particle damage call properly ? That may help, if you do such system to call the damages to NPC's and non-player objects :). RDA-OuterSpaceMapsDev.JPG
     
  24. petercoleman

    petercoleman

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

    Thanks for that....much appreciated. I have send message but no tick box ? and not getting any damage....
    Not idea how this is supposed to work or what needs setting up where (on what) really so I am completely in the dark on this one....

    Another day today trying to do something which if you know how I guess should be easy to do but hard work for me....

    A well I dont give up easily :)

    After this theres a few more things I need to add to the game I need to create - so more obstacles to come. and more time spent being held up on progress. So much time kind of wasted unless one gets a useful result of course. I need to get on and finish something like a demo and video :)

    Thanks again

    Peter
     
  25. OZAV

    OZAV

    Joined:
    Aug 9, 2013
    Posts:
    299
    Here is, as explained on the screenshot, why is is important and where you can find it :). FlameThrower-CollisionMessagingEnabled.JPG
     
  26. OZAV

    OZAV

    Joined:
    Aug 9, 2013
    Posts:
    299
    OnParticleCollision-Sample.JPG
     
  27. petercoleman

    petercoleman

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

    Thanks for that...

    I have decided to give up on that approach as its too difficult and would leave other RFPS related issues to resolve it not being designed for such purposes...

    Instead I have decided to go down the route of making the Turret a "Player Weapon" for this "Ground based" Turret and have most of it working now. This allows the Turret weapon to kill all types of Enemy either terrestrial or Flying. NPC, tanks, aircraft and so on as well as allowing the Turret Weapon to Destroy any other "Destroyable objects like boxes, barrels and so on.......and of course the Enemies have no problem shooting and damaging he Player at the same time either because the Turret is held by the Player as a weapon

    It works fine except I still have a few issues to sort out like how do I freeze the Player on the spot when using the Turret and Unfreeze the player when the Turret is no longer being used so the player can go back to walking around - without carrying the Turret around with him. i.e. use only once!.....

    Its a complicated thing to do but hopefully it will be done shortly (relatively speaking...

    I will post a screen shot if I have success with this. Otherwise I will give up for now and go back to it another time:)

    Thanks a bunch

    Peter
     
  28. petercoleman

    petercoleman

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

    With respect to my Turret weapon as mentioned above anyone know how I can use a Trigger (on player enter) to "Drop" the Turret Weapon (or any other weapon for that matter) rather using the default keyboard "Backspace Key". Currently I can use a Trigger with "Destroy" which will do the trick but RFPS is not happy with that though it still works. Using "Deactivate a Weapon simply does not work as it always remains in the "Inventory once picked up unless one drops it :) So Drop via Trigger would be ideal for this and other weapons too where appropriate....

    Tried writing a script myself but had many issues as RFPS weapon and player system is so complicated for a programming idiot like me anyways ;-) and as said Unity is a pain in the butt when changing any script now so if you work via trial and error like me you have a big problem on your hands :)

    Thanks for any help.

    Kind regards

    Peter
     
  29. petercoleman

    petercoleman

    Joined:
    Feb 21, 2016
    Posts:
    477
    New Player controlled SentryGun Turret

    SentryGunTurret.jpg

    Regards

    Peter

    :)
     
    AzulineStudios likes this.
  30. JC_LEON

    JC_LEON

    Joined:
    May 20, 2014
    Posts:
    520
    i have that sentry too.. LOl cool weapon..

    btw i managed t oreturn to work with unity and isnce i have rfps , its addons( save system, and ui addon) dialgof system and so on i would t oknow if Rfps lastet version (1.45 i suppose) works correclty in unity 2020/2021 and if save system and dialog system integrates with it correctly and with now flaw in new unity version...


    plus i 'm searching for some tuts on how to change player (and i found) and arms+weapons models... i have tons of animated weapons pack purchased over the years ( and all inrobelly ones) and would to use them in my proejct...

    can someone help with this.. i'll pay if necessary..


    thanks...


    EDIT

    I imported in a blank unity 2020.3.14.f1 lts and it worked like a charm...RFPS is and always was a great asset LOL..

    btw now..

    how can i swap weapons and hands??

    is there any tutorial .. i found any..... or can please somenone "braveheart" guy can create one even privately...


    plus since i Own dialog system too is there a way to give RFPS any sort of inventory..even a basic one only for pickups maybe... i read something about s-inventory,, but i dont own it and now its deprecated so i cant purchase it anymore...

    thanks guys in advance and thanks to keep up the coomunity of this grea old unity asset..
     
    Last edited: Sep 3, 2021
  31. petercoleman

    petercoleman

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

    "how can i swap weapons and hands??"

    There is at least one video I believe about changing (replacing) RFPS weapons to ones of choice and a description of how to do it in the RFPS manual also I think :) You can probably find a Video by searching at YouTube...here....



    However its not an easy task...I changed all default weapons to my own and its a pain to do....

    In my case I use both First and Third person weapons so one then has to set up both sets of new weapons. I also added some additional types of weapon (and Ammo) too e.g. Rocket Launcher and that's a pain too :)

    Still it can be done with some (or a lot of) effort. I think others have done it so someone else may be able to help better than I.
     
  32. JC_LEON

    JC_LEON

    Joined:
    May 20, 2014
    Posts:
    520

    thanks Steve for your reply , infos and link.. i already saw that video and it's not great and not really informative.. LOL since in the video only the weapon is replaced with a new model and the dev neither showed how to replace the animations and so on .. plus i want to change both hands and weapons with my new of hands+animated weapons...

    i hope someone esle did this already and i know many of rfps dev did ti ... and it' a shame there isnt any complete workflow on how to replace weapons and hands..

    i made this in the past on my own learning project i made using a free fps kit and modified at hell to suit my needs
    but never tried on rfps

     
    ProBrStalker likes this.
  33. SickaGames1

    SickaGames1

    Joined:
    Jan 15, 2018
    Posts:
    1,270
    I wish one of you guys did a tutorial on how to swap out animations. Both melee and shooter.
     
    JC_LEON likes this.
  34. JC_LEON

    JC_LEON

    Joined:
    May 20, 2014
    Posts:
    520
    same for me... I'll be happy to pay for them..really
     
  35. ProBrStalker

    ProBrStalker

    Joined:
    Aug 20, 2017
    Posts:
    65
    Good night guys, I have 2 questions,
    to 1st:
    - How can I change the character's animations in third person without it getting out of sync?
    and the 2nd is:
    - How could I activate the FP_to_TP component in weapon behavior after pressing one more key?
    I tried this in the InputControl script:
    Code (CSharp):
    1.             if(Input.GetAxisRaw("Xbox L Trigger") > 0.1f || Input.GetButton("Zoom"))
    2.             {
    3.                 zoomHold = true;
    4.              
    5.                 if (Input.GetButtonDown("FPtoTP"))
    6.                 {
    7.                     WeaponBehaviorComponent.GetComponent<WeaponBehavior>().fpZoomForTp = enabled;
    8.                 }
    9.             }
    10.             else
    11.             {
    12.                     zoomHold = false;  
    13.                 }
    But without success, well does anyone have any ideas?
     
  36. ProBrStalker

    ProBrStalker

    Joined:
    Aug 20, 2017
    Posts:
    65
    It's not difficult, just duplicate the weapon you like and then play the model of the weapon you want as a child of the main weapon, adjust it, assign the tag and layer gun, add it to FpsWeapons.
    I can do record a tutorial about...if you're interested...
     
  37. ProBrStalker

    ProBrStalker

    Joined:
    Aug 20, 2017
    Posts:
    65
    With OneManArmy3D's FPSKit not much different from rfps, you just need to create a clone of the desired weapon, adjust, configure and insert it into the main script where all the others are attached...
     
  38. AzulineStudios

    AzulineStudios

    Joined:
    Feb 18, 2021
    Posts:
    31
    Hi everyone, just wanted to give an update on the new FPS asset. In my last post I mentioned I was working on the documentation, but there are some additional features that I've decided are needed for the initial release. A swimming system has been implemented, and working on a simple demo AI now. I will have some more info as it gets closer to being finished. Thanks for your patience.
     
  39. JC_LEON

    JC_LEON

    Joined:
    May 20, 2014
    Posts:
    520
    Thanks but oma kit single classic legato anim system..rfps now use meccanismo animatore.. plus i saw rfps has two field in its animator..ready..and so maybe tweaking is required...a complete video tutorial should be' great
     
  40. JC_LEON

    JC_LEON

    Joined:
    May 20, 2014
    Posts:
    520
    Hi i didnt know you was working on a new kit...can you share some infos about what it will be' include?...cant waitto purchase it and have funziona with it too
     
    AzulineStudios likes this.
  41. petercoleman

    petercoleman

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

    This in now complete so its over to you :)

    How to Add Custom Weapons to RFPS.

    Here are some basic instructions that may help. It is not a complete tutorial. I may update and add to this if I have time later that is if anyone is interested and you have the patience to follow in depth posts. If not then I will stop here.

    If you have an important project. As always make sure you have a current Project backup and a backup of the Player Character in case you mess up. As a side note you can also make a copy of the Player Character if you want and use that one to amend. In fact you can have as many "Player Characters" as you want in RFPS so a different one can be used in different levels :) If you want a new Player Character select the default one (MAIN) n your level and Duplicate the Character. Then Unpack or Break Prefab Instance him completely. Then rename the duplicated Player Character as you wish and drag him to the RFPS Folder. Now you have a new Player Character prefab you can use wherever you want.

    In Editor move so that the Player is in view - it helps if you can see whats going on :)

    Lesson 1 :

    Creating new custom weapons :

    1. In your Player Character drop downs find FPS Weapons and drop down the children until you come to the current "Weapons" attached to the Player.

    2. There find a current weapon that most closely resembles the new weapon type you want. e.g. "Rifle" select it and Duplicate it. Now you should find that a copy of the weapon you have duplicated has been added to the bottom of the list you are currently looking at of weapons attached to the Player. Yes. Rename the new weapon you created.

    Now the weapons listed here are deactiavted so cannot be seen in editor but you can view them attached to the Player by selecting a weapon and turning it active at its first top check box. Now you should be able to see it in Editor window attached to the Player. (You can deativate them again later if you wish as they will activate automatically at game run if and when needed). Activating one in Editor when you need to see it attached to Player is vital when setting up new weapons - otherwise you wont see whats going on with it. Yes.

    Now you have a new weapon albeit it a duplicate of an existing one so we need to change it....but first lets see if our new duplicate weapon will work...

    Now the new weapon is the last one listed here. To the left of the weapon name is its "weapon number" the last of course. Make a note of the number - write it down or remember it a moment perhaps:)

    Select the weapon and view its properties and at the top in Weapons Behavior check "Have Weapon" and "Add to Total Weaps" and also make sure also that for this instance that "Cycle Select" and "Droppable" are selected. (again you can deselect any of these tick boxes later if you want or need to).

    Now importantly go back up to FPS Weapons and in Max Weapons Add one to the total e.g. so if it says 14 change it to 15. Yes. so you have now allocated for the addition.....Then In Weapon Order add one and in the new slot drag your new weapon into the new weapon slot e.g. 15.

    In Theory you should now be able to test Run the game and when the level loads as we have indicated "Have Weapon" your Player should already have the new weapon in his hands. If this does not work exit the game and return to the Editor then in FPS Weapons you can try adding the new weapon No to the first box ""First Weapon" and run the game again. If it still does not work then oop's something is wrong - me bad :)

    Now if it did work then you can if you want now uncheck the First Weapon and Have Weapon check boxes we activated as above so that you can go back to the Player without the new weapon being called and run game with just the default weapons. If you get any console error messages at any time which prevent the game running then you should of course stop and fix them one way or another even if you have to revert what you have done and delete the new weapon too if need be. If you made a prefab of your new Player as mentioned above of course you can always delete the Player from your level and replace him from the RFPS folder. Whatever - remember do not save your work, Scene, Project or Player prefab unless you are happy with your work and have no Editor console critical errors.

    3. Now if all is well then we need to add a Pickup for the new weapon. Any mesh object with a RigidBody should suffice for the moment so you could even try adding a simple box cube. Add the RFPS "Weapon Pickup" script and add to this the new weapon No you used for your new weapon. Alternatively place in your scene near the Player any exiting similar weapon/Weapon Pickup from the RFPS folder, select it and Unpack the prefab and break any prefab instance. Now rename it and change the new pickup weapon No to your new weaopon No. Yes.........

    Finally select again your New Weapon and Uncheck "Have Weapon" and test run the game again. The Player should have no weapon in hand. Now go to your new Pickup point at it and select it (Press F) to pick it up. Hopefully that should work.

    If all is well then we can move on to the important bit.

    Lesson 2 : Please note that you can check your progress of the stages below in editor Scene View and Game View as you go and check that all seems as it should be and adjust accordingly if need be. e.g scale and positioning of weapon and all else I guess.

    Adding new custom Weapon Models with Animations :

    Some info first...When adding new custom weapons we have two choices. We can add new Weapons as described above or we could simply amend/append to current existing weapons attached to the Player which risks messing them up by changing them and later we wont have them in their default state so their set ups and settings can be referred to as we go when creating new ones. Weapon settings and set ups vary somewhat depending upon what Type of weapon it is and if we leave them alone for the moment and add new ones we can refer to them and copy their settings appropriately depending the type of weapon we are adding. Yes.

    Now a Rifle set up and settings will be different to a Pistol, Bow and Arrow or Grenade. When creating new custom Weapons some may need extensive testing, adjustments made and a lot of tweaking, others may not :) For example Custom Weapons I added include, Rocket Launcher which fires a Missile. This is not a default weapon type so it takes some head scratching and so on to get it to work - it uses a modified copy of a Grenade and has a scope zoom as does my Sniper Rifle and some other Weapons and these weapons have zoom scopes which have a Camera attached to them which renders the scene onto a scope lens. This all takes some considerable additional effort over and above default type weapons.

    To add a custom Weapon with animations you could simply as just said refer to the default Weapon types and study how they are set up and constructed and replicate the same for new weapons - not easy to keep referring back and forth and so on but that's what I did - I had no choice :) Taking screen shots to refer to can help so I have some I just grabbed I will post here which cover everything you will need to see I believe.

    If you have not attempted the Lesson 1 above to familiarize yourself with default weapon set up and just want to get on to the next part then so be it :)

    What follows would be best read in conjunction with reference to Lesson 1 above although I will add notes to the screen shots to follow. You will forgive me if I get anything wrong as Weapons as with many other things I make can be so complicated usually I can't remember later how on earth I achieve these things without considerable effort breaking down what I did when was it 4 or 5 Years ago :)

    The following presumes that you have Custom Weapon models with Animations. New Weapons will need to be imported with animations and an avatar created. Whatever in any case I would suggest that as with anything else you create a new folder and make a copy of your weapons and place them in a new folder rename them slightly if you want so as to not have them confuse either you or Unity and keep the originals intact. Yes. Custom Weapon Models need to have the Arms and Weapon as separate objects of course and you need to have .fbx format. Imported as Generic - so as to create an avatar - and with Animations imported.

    Screen shots below refer to a custom Shotgun weapon. All screen shots have red dots to indicate important properties to consider or set as shown. If you follow through all the screen shots - all set up details should be covered visually.

    Screen shot 1 : FPS Weapons : If you have already created a New Weapon as in Lesson 1 then you will already have a new weapon that you can use to update with a new Model and Animations (and when complete you can duplicate it to make another weapon as in Lesson 1 and so on). We will use your new weapon now....so in the Hierarchy Window select your new weapon Model you made which is attached to the Player and activate it so you can see it in front of the player in the Scene view as shown.
    1. Your Project and Assets Windows should look like the screen shot showing Your New Custom Weapons Models Folder as shown where the .fbx files are located.
    2. Now from your custom weapons folder select the .fbx Model with Arms and Animations you want to use into the Scene view near the Player and exiting weapon displayed. Then move it to a position to align it roughly with the existing weapon displayed. Now Scale your Custom Model if needed and adjust its position until its as near as possible scaled and positioned and rotated ro match the exiting one. You get the idea. Yes
    Now move to next screen shot.

    CustomWeapons1.jpg

    Screen shot 2 : Weapon Behavior :
    In Weapon Behaviour you should need do nothing now. e.g. If you dont have a Weapon Drop Object you can add or change it later.
    Now move to next screen shot.

    CustomWeapons2.jpg

    Screen Shot 3 : Weapon Animator :
    Now select your new weapon you made in Lesson 1 Child _ANIM as shown to the left and drop it down so you expose the existing weapon model structure itself. Your Editor Windows should now look like the screen shot.
    1. To the left of the screen shot you can see the Weapon Animator which will control the Weapon Animations e.g. Reload, Shoot. If you New Custom Weapon Model comes with an Animation Controller then in your Custom Weapon Folder find it, select it and drag it to the Controller Field. If your Custom Weapon Model does not have an Animation Controller already supplied with it then you will have to make one and add the relevant imported Animations to it.
    2. From the same folder location as 1. above find the Custom Weapon Model Avatar which should have been created when you imported its .fbx file and Drag that to the Avatar Field.
    Done here so Now move to next screen shot.

    CustomWeapons3.jpg

    Screen Shot 4 : Arm
    Now comes the important Fun and perhpas difficult part :) What we now need to do is replace the existing weapon model parts with your new custom weapon model parts. Yes.
    You should now have your two Weapon Models in Scene view displaying in the same location so it makes things difficult to see well in a confusing situation so if you want you can select your New Custom Weapon Model in its entirity and move it forward only so you can see both Weapon Models clearly. You can move it back into later. Make a note of its forward position before moving it if you wish so you can move it back later exactly where it was.

    Now both of your Weapon Models may have a different structure to mine depicted in the screen shots so you may have to use your skills of judgement when trying to "Replicate" an exiting Weapon Model Parts with equivalent New Custom Weapon Parts and different model Types may have different structure and parts. Yes. Its not Rocket Science and if something don't work as expecfted when done then dont panic and adjust things until it works. Yes.

    You should still have the existing weapon drop down model parts exposed as in the previous screen shot as you can see in this screen shot - select the Arm as shown to the left and the separate Arms should be shown selected in Scene view as in the screen shot. Here in my instance the Arms (Arm) is the first Child object in the _ANIM object drop down. It is or should be a separate object to the rest of the Weapon Parts. The rest of the weapon parts in my instance are all children of the "Gun" child object lower down in the drop down as you can see and highlighted in the next screen shot

    Now for the hard part : Attaching the new model parts. (Not Really)
    I would suggest the following : Firstly DO NOT be tempted to delete any existing Weapon Model parts if they get in the way in view at any time then just deactivate them or turn off their mesh renderer so the cant be seen in editor Scene view....
    In the Hierarchy to the left find your New Custom Weapon Model complete at its top level parent and select select it then drag it over the existing weapon object parent in the Hierarchy.

    Now select the existing weapon again and scroll down and your complete New Custom Weapon Model should be a Child of the excisting weapon at the bottom of its drop down. Check that it is. If so and that is correct you will now have an existing weapon with both complete Models attached. Yes. If something went wrong undo the procedure and put the stae of things back as they were and try again.

    If all went well and we have the two Weapon models as one then the rest is just as follows....

    We need to match the New custom weapon Parts to the existing parts and we can start with whatever part you believe in your instance is best. If your new Arm (Arms) are a Parent or not, then move the Arm (Arms) object and all of its children if any to a position if any to just one place above or below the existing weapon Arm object. (This presumes that Your new Custom Weapon Arms do not hold an Animator and we can use our existing one as in the screen shot above.)

    If all is well then you could deactivate the esiting Arm so that only your New Custom Weapon Arm (Arms) Model is seen in editor. If your custom Arms have a dfferent name then I guess it would be advisable to rename them to "Arm" as the default existing now hidden.

    Now as is the case with "ANY" Weapon object in this tutorial we are replicating and replacing at this stage it is well to point out that you should make sure that each and every new object has the same "Tags" and "Layer" set for it that matches those of the existing weapon objects or things may not work correctly :) Again good reason not to delete any existing object until all is complete and working so we can refer to their settings. Yes. Not all object parts of a weapon have the same tags and layer settings so be sure to check correctness with default existing weapons.

    Done Here Now go to next screen shot.

    CustomWeapons4.jpg

    Screen Shot 5 : Gun :
    Next Up the Gun : Now the existing Weapon Gun object is a child of _ANIM and all of the Gun parts are a Child of the Gun including the e.g. Muzzle Flash. As you can see in the attached Screen Shot.

    Now we need to do the same for the Gun as we did for the Arms previously so select your New Custom Weapon "Gun" object and any of its Child Parts and drag them next to the existing weapon Gun object. Again make sure that these New Custom Gun weapon and any child parts match the same Tag and Layer settings of the existing ones. And Lastly best if you now rename your New Custom Weapon Gun object to "Gun". Yes

    Now You should be in a position to Move your Custom Weapon Model Complete - backwards once again to Align itself to the existing weapon model. So you now have both weapions in the same position.

    With regrads to the Muzzle Flash/Muzzle Light/ FlashLight as shown in the screen shot and any other such objects your existing weapon might have for the moment you can use the existing default ones for the purpose of this excercise for your New Custom Weapon.

    Select these items in the existing weapon Gun and drag them to your New Custom Weapon Gun remebering what you have done - you can always move them back to the existing weapon Gun later if need be. If you want to use any other Muzzle Flash you have I would suggest you change/add it later.

    Now if I am correct you should be able to select the existing weapon Arm and Gun and any other visible objects and disable their mesh renderers so they cannot be seen and then in the Editor Scene view check closely to see that all of the existing weapon mesh objects are now hidden and all of your New Custom Weapon part objects are displayed including the Muzzle Flash.

    One Last thing to do is this : In the Hierarchy window to the left select the Parent of the Weapon Object under which all else lies.which should display the Weapons Behaviour and scroll down to the bottom and you should see another "Animator" not mentioned before. This should show the RFPS Default "Rifle Movement" animation controller if this Weapon is of the Rifle Type. If your Weapon is of a Pistol type then you should change this field accordingly. To do so click in the Rifle Movement field and the editor should display the RFPS folder containing the Movement Animators. If you need the Pistol Movement Animator drag it to the Editor Animator "Controller" field in view in Editor right hand side and Relace the Rifle Movement one.
    No Avatar is needed here so the field can be left empty I believe.

    CustomWeapons5.jpg

    Now you can if you want if you have not done so create your Weapon Pickup and Weapon Ammo Pickup for this Weapon... its a simple operation so I will leave that to you... All that is needed in each case is :

    1. Drag an existing default Weapon Pickup and Ammo Pickup into the Scene onto the floor so you can select them and view the properties of each.

    2. Create your new ones by using a simple mesh object of your Weapon Gun and Ammo and place them in the Scene next to the default ones you just placed there.

    3. Add to each of your new Pickups the same components as the default ones have. e.g. box collider, rigid body and correct scripts - you can copy these components from the Default Pickups and paste them to your new Pickups.

    4. Give your new Pickups a name which matches your new Weapon e.g. MyWeapon_Pickup and make sure that the New Pickups have the correct Weapon references set that match your new Custom Weapon No and so on and any object pool reference needed.

    5. Create a new folder for Pickups in your Custom Weapons folder if you dont have one then drag your two new Pickups into it to create prefabs from them. You can always edit these if they need amending.

    Leave your new Pickups in the Scene for now. The default ones you can deactivate and remove later :)

    Thats it I believe you are done so now to test what you have done in actual Game Play I would suggest that you test run the Game in Windowed mode in editor rather than maximising to full screen when testing so that if you happen to have any critical issue messages pop up in the console then its easier to quit the test run and return to editor. Yes.

    If the Game test run in editor runs without error messages then you are good to go I guess and try a full screen Maximise run but don't be too hasty :)

    If you have any error messages (critical) them you need to fix them.

    If your new weapon and pickups just do not work as expected or if you have any new weapon related console errors or both e.g. relating to RFPS something needs changing/updating.

    Bear in mind that you may have to tweak many settings relating to the new weapon (and Player) so that the weapon displays and works correctly. Mainly in the first instance does it work without Critical errors that prevent the game running or causes any other issue such as performance hits - anything else can be updated and fixed. If you cant see the weapoin in game find out why if its scale or positioning is not correct then adjust and fine tune weapon settings via the weapoins settings of RFPS. I could go on and on but thats enough me thinks :

    Have Fun :)

    Regards

    Peter

    :)
     
    Last edited: Sep 5, 2021
    owyang and AzulineStudios like this.
  42. JC_LEON

    JC_LEON

    Joined:
    May 20, 2014
    Posts:
    520
    Hi Peter and many thanks for your time, patience and effort to write this..and yes i have patience and want to read in detph posts..so dont worry e go ahead..

    Cant wait for the next one ..the animated ine with hands..

    Thanks very much..agaun6...
     
  43. SickaGames1

    SickaGames1

    Joined:
    Jan 15, 2018
    Posts:
    1,270
    Ok. Now new animations using the same arms
     
  44. ProBrStalker

    ProBrStalker

    Joined:
    Aug 20, 2017
    Posts:
    65
    Guys, how could I adjust the player's arms to match the weapon? for example, instead of modifying it in the PlayerCharacter script, you can adjust it for each specific weapon...
    upload_2021-9-4_22-47-9.png
     
  45. SickaGames1

    SickaGames1

    Joined:
    Jan 15, 2018
    Posts:
    1,270
    @AzulineStudios When you do your tutorials for RFPS 2.0, could go do one on changing out weapons and melee/shooting animations?
     
  46. petercoleman

    petercoleman

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

    For third person weapon positioning of Player arms and weapons add the default RFPS Player (if you have not changed it from its defaults) to an empty test level - look at the third person weapon set ups under the Player Hieracrchy if you need to understand how they are set up.

    Run the game in window mode but do not move the Player at start. Hit Tab to stop the game and then go to Scene view and look at the Player and his arms and weapons positioning if its correct then following the same set up and settings for third person weapons and animation should work for any Player and weapons..

    Of course it depends on numerous things - the actual Player model you use - its Avatar and the animation controllers used and the Animations used possibly for both Player and weapons. Also the correct Rifle Movement controller or Pistol Movement controller needs to be used for each weapon Type. Riffle or pistol.

    With any non default Character Player or NPC Model the body Structure and Avatar really need to be the same as default RFPS Player/Soldier model and if using non default Animations then they can vary in how they Play and display when used in RFPS or any other Player controller for that matter I guess. Same goes for weapons...

    Using non default anything can be problematic. For example I have used many different custom characters in projects with non default character body structures, avatars, animation controllers and animations and at worse they distiort the character mesh completely when animation occurs sink into the floor up to their waste or wont move or animate at all.

    Cant really see the weapon in your screen shots as its so dark but looks like its your animator or animation used.

    Everything should be able to be done in editor without need to resort to writing code or scripts just to get a Player to hold a weapon correctly.

    You just need to add the weapon set up correctly in third person weapons placed in the Players right hand or wherever the default is then in editor in scene with third person player enabled and the particular wepon set activated so that the Player holds in Scene view zoom in to the weapon in hand and scale, reposition and rotate the weapon as required - remembering that the Default weapons may be Longer in size than your weapon so their muzzle tip extend further towards the leht hand of the Player. A short weapon like an Uzzi may best need a Pistol Movement animation controller and not a Rifle one. Tweaking of weapon position and so on can be done in third person camera and weapons..

    Not sure whats correct there or if thats all nonsense or not but I tried. Its all trial and error with me :)

    Peter
     
    AzulineStudios and ProBrStalker like this.
  47. ProBrStalker

    ProBrStalker

    Joined:
    Aug 20, 2017
    Posts:
    65
    The weapon that is over there is the MP7A1...thanks, for answering, I also thought of using the pistol animation, but it would be weird so much when aiming, shooting and even holding it...
     
  48. JC_LEON

    JC_LEON

    Joined:
    May 20, 2014
    Posts:
    520
    thanks again Peter for your time... btw i managed t ofigure how to import animated weapons andi'm having fun with maximm brugimov oneshttps://assetstore.unity.com/packages/3d/characters/animated-hands-with-weapons-pack-132915
    and ironbelly ones
    https://assetstore.unity.com/packages/3d/animated-fps-starter-kit-2-91545
    https://assetstore.unity.com/packages/3d/animated-fps-starter-kit-1-67901


    but i have a question...

    since my animatedweapons have animation for run ,idle, raise lower etc... is there a way to use them insted to use the default procedural animations provided by RFPS??

    in other words is there a way to overrive the default rfps equip/unequip/run system with proper animationS?
     
  49. petercoleman

    petercoleman

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

    Not quite what you refer to here.

    I presume you refer to the Player.

    The Player Weapons have their own Animation controllers and you can open these and change the animations used to ones of your choice for say Reload, shoot and so on.

    Now I think you refer here though to what would be the default "Rifle" or "Pistol" Movement Animation controllers used by RFPS. Now you can duplicate one of these and rename in the RFPS folder where they can be found it and use it. You can open it up and look to see how its set up and in theory could change any animations you can which are exposed to you and then replace in your in the Player say the existing "Rifle Movement" animation controller with your own named one...

    The problem I see with this is that in the default RFPS Movement controllers I believe some items are not exposed so cant be changed on the "public" end i.e. in the Animation controller open/edit mode. - I guess as they are hard coded that way or its to do with the way things are imported by the RFPS software. I have not looked at the default RFPS Movement controllers in depth and how they are structured or how they actually work, how they are set up or where.

    Perhaps in fact they could be updated by the user dev I don't really know as I have not tried...

    Personally I use the default ones as they are OK for what i need so will do for me at this stage and I still have thousands of more important game content and dynamic game play mechanic things to do to progress my game where I have to add stuff that I don't have at all yet.....

    More of everything yet to add. My levels are so big I can't fill them up :) I only have 604 Thousand items in project yet and my target is 1 Million at least so much to do.

    Peter
     
    AzulineStudios likes this.
  50. JC_LEON

    JC_LEON

    Joined:
    May 20, 2014
    Posts:
    520
    ahaha yes Peter i was referring to the fact that when my player run with my aniamted pistol it uses the procedural animations from rfps and i didnt found where i must replace the run animation for wepaons to change,,,

    I saw the player movement controller but like you said it is form ther player ..i tried event to change the default sprint animation with my weapon one but with no results