Search Unity

  1. Calling all beginners! Join the FPS Beginners Mods Challenge until December 13.
    Dismiss Notice
  2. It's Cyber Week at the Asset Store!
    Dismiss Notice

Realistic FPS Prefab [RELEASED]

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

  1. Defcon44

    Defcon44

    Joined:
    Aug 19, 2013
    Posts:
    400
    Hi Azuline!

    This is a very great upgrade here !

    I want the release :D
     
  2. OneShotGG

    OneShotGG

    Joined:
    Nov 16, 2012
    Posts:
    225
    Hey ShinfoK,

    Do you plan on releasing your inventory system to the asset store? I would definitely pay for one that was integrated into RFPS prefab and included crafting.
     
    RealSoftGames likes this.
  3. Litwin

    Litwin

    Joined:
    Aug 15, 2013
    Posts:
    60
    @Azuline Studios
    - Do you have plans to add multiplayer system?
    - Could add leg view or complete body from character?
    - Weapon customization?
    - You can improve the system for sniper?
     
    Last edited: May 30, 2014
  4. ShinfoK

    ShinfoK

    Joined:
    Feb 6, 2014
    Posts:
    282
    Anyone with some scripting knowledge able to give me a hand here? I have a script to randomly spawn weapons (I want it to work with food/drink/health too but not sure how). How would I go about using this with RFPS?

    Code (csharp):
    1.  
    2. using UnityEngine;
    3. using System.Collections;
    4.  
    5. public class weaponspawn : MonoBehaviour {
    6.  
    7. GameObject gunPrefab;
    8. float spawnTime = 30.0f;
    9. Transform spawnPoint;
    10. private GameObject gunInstance;
    11. private bool  pickedUp;
    12. private float timeLeft;
    13.  
    14. void Start (){
    15.     timeLeft = spawnTime; // You don't need to have weapons from the beginning
    16.     Spawn(); // Call the function to spawn the first weapons
    17. }
    18.  
    19. void Update (){
    20.     if(timeLeft > spawnTime || !pickedUp){
    21.         timeLeft = spawnTime;
    22.     }else if(timeLeft <= 0){
    23.         timeLeft = 0;
    24.         Spawn();
    25.     }
    26.     if(Input.GetKeyDown(KeyCode.E)  !pickedUp){
    27.         PickupWeapon(); // Write your function that equips the weapon
    28.         Destroy(gunInstance); // Destroy the instance not the prefab/reference!!!
    29.         pickedUp = true;
    30.         Spawn(); // Spawn them if they got picked
    31.     }else{
    32.         timeLeft-=Time.deltaTime; // Reduce the time counter
    33.     }
    34. }
    35.  
    36. void Spawn (){
    37.     if(timeLeft > 0){
    38.         return;
    39.     }
    40.     gunInstance = Instantiate(gunInstance,spawnPoint.position,spawnPoint.rotation); // Make an instance of the weapon
    41.     pickedUp = false;
    42.     timeLeft = spawnTime; // Reset the time needed to the normal amount of time
    43. }
    44. }
    45.  
    This is converted form JS (so probably got plenty of errors).

    Original is:
    Code (csharp):
    1.  
    2. #pragma strict
    3. var gunPrefab : GameObject;
    4. var spawnTime : float = 30.0;
    5. var spawnPoint : Transform;
    6. private var gunInstance : GameObject;
    7. private var pickedUp : boolean;
    8. private var timeLeft : float;
    9.  
    10. function Start (){
    11.     timeLeft = spawnTime; // You don't need to have weapons from the beginning
    12.     Spawn(); // Call the function to spawn the first weapons
    13. }
    14.  
    15. function Update (){
    16.     if(timeLeft > spawnTime || !pickedUp){
    17.         timeLeft = spawnTime;
    18.     }else if(timeLeft <= 0){
    19.         timeLeft = 0;
    20.         Spawn();
    21.     }
    22.     if(Input.GetKeyDown(KeyCode.E)  !pickedUp){
    23.         PickupWeapon(); // Write your function that equips the weapon
    24.         Destroy(gunInstance); // Destroy the instance not the prefab/reference!!!
    25.         pickedUp = true;
    26.         Spawn(); // Spawn them if they got picked
    27.     }else{
    28.         timeLeft-=Time.deltaTime; // Reduce the time counter
    29.     }
    30. }
    31.  
    32. function Spawn(){
    33.     if(timeLeft > 0){
    34.         return;
    35.     }
    36.     gunInstance = Instantiate(gunInstance,spawnPoint.position,spawnPoint.rotation); // Make an instance of the weapon
    37.     pickedUp = false;
    38.     timeLeft = spawnTime; // Reset the time needed to the normal amount of time
    39. }
    40.  
     
  5. Defcon44

    Defcon44

    Joined:
    Aug 19, 2013
    Posts:
    400
    Hi !

    I have one question about the next text : Ammo, Healt, Help.

    I want to know, can i add a GUISkin for this text ?

    If YES how ?

    Thanck's
     
  6. blueLED

    blueLED

    Joined:
    Jan 5, 2014
    Posts:
    102
    I like all the new changes/updates! Great work :)
     
  7. thenamesace

    thenamesace

    Joined:
    Jan 25, 2014
    Posts:
    157
    Hi Dev Guy can not pm you can you pm me please interested in your system :)
     
  8. Defcon44

    Defcon44

    Joined:
    Aug 19, 2013
    Posts:
    400
    Hi !

    i want to know were is on the FPSplayer this script :

    Ammo.c#
    Healt.c#
    Help.c#

    Because i want to add or change color but i don't know were is it. :/

    No on the camera or player.

    Tell me please :)

    Thanck's
     
  9. Andy Charlie

    Andy Charlie

    Joined:
    May 31, 2013
    Posts:
    31
    I don´t remember the names, (I'm not in my main computer right now) but search in the assets something like "ammoText" and "healtText" prefabs, then select one and you gonna see in the inspector window the variables that you can edit, in this case the color
     
  10. ShinfoK

    ShinfoK

    Joined:
    Feb 6, 2014
    Posts:
    282
    Anyone got any better ideas for setting footsteps on terrain a bit better? The current system doesn't seem to favour terrain changes in texture at all.
     
  11. Defcon44

    Defcon44

    Joined:
    Aug 19, 2013
    Posts:
    400
    Thanck's for your help Andy Charlie :)

    But i can't add a GUI Skin :(
     
  12. Andy Charlie

    Andy Charlie

    Joined:
    May 31, 2013
    Posts:
    31
    The comment I reply says "Because i want to add or change color", and nothing about GUI Skin.
    To add a GUI Skin, I recomend to make one by yourself, because the GUI art made in Unity looks really bad, soo "unAAA" and boring, even the GUI solutions in the assets store looks really "S***ti". The best is to think in a cool and original GUI/HUD idea (imagine the colors, shapes, alpha, font, etc) then make the graphics art in photoshop or similar software, export the graphics to unity, make a new empy game object and add a GUI Texture component in this game object, add your GUI graphics in the "Texture" field (I recomend use PNG. format) and be sure that this game object is in the layer 14, the GUICamera layer. Finaly just adjust the GUI and the ammo and healt text, and change the font of those to one you like.
     
  13. Azuline-Studios

    Azuline-Studios

    Joined:
    Apr 5, 2013
    Posts:
    203
    Thanks for the support guys :) ShinfoK, an improved sniper system with multiple zoom levels is definitely on the list for a future version.


    NPCs interacting with other NPCs is something we plan to implement in a future version as well, Takahama. This will involve adding some variables to identify which faction the NPC is a member of and an updated AI.cs script with code that allows the NPC to scan for targets and determine if the target is a friend or enemy. An AI manager script could be written to handle some of these interactions too.

    NPCs hearing the player's attacks and a silenced option for the weapons might make it into the next version, as it would be a fairly straightforward addition. Thanks for your feedback!


    Hi Litwin, we would like to implement a multiplayer system, but it will take some time, as we are laying the groundwork with some other features first like third person and testing prefab activation/deactivation and multiple instances of the player prefabs.

    We will be doing some testing with having a player model visible in the first person view. One way to go about this would be to remove the current weapon model system and use a Mecanim character model that rotates its arms to stay in alignment with the camera. Another option that we would prefer is to keep the current weapon model positioning and animation code, and animating a character model so that only the animated torso and legs are visible in first person view.

    Weapon customization is possible and would probably be done after a GUI/inventory system is complete, to allow for a visual way to add attachments to weapons.

    An improved sniper system is on the list, with possibly an option for the regular ironsights style zooming, or a sniper sight overlay that covers the whole screen.


    Here is an edited script, ShinfoK, so all that's needed is to attach it to a game object and drag a pickup prefab object from the Project Library to the gunPrefab field of the script that will spawn at the game object position after spawnTime:

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class weaponspawn : MonoBehaviour {
    5.  
    6.    public GameObject gunPrefab;
    7.    public float spawnTime = 30.0f;
    8.    public GameObject gunInstance = null;
    9.    private float timeLeft;
    10.  
    11.    void Start (){
    12.      timeLeft = 0; // You don't need to have weapons from the beginning
    13.    }
    14.  
    15.    void Update (){
    16.      if(timeLeft > spawnTime || gunInstance){
    17.        timeLeft = spawnTime;
    18.      }else if(timeLeft <= 0){
    19.        timeLeft = 0;
    20.        Spawn();
    21.      }
    22.  
    23.      if(!gunInstance){
    24.        timeLeft-=Time.deltaTime; // Reduce the time counter
    25.      }
    26.    }
    27.  
    28.    void Spawn (){
    29.      // Make an instance of the weapon
    30.      gunInstance = Instantiate(gunPrefab,transform.position,transform.rotation) as GameObject;
    31.      timeLeft = spawnTime; // Reset the time needed to the normal amount of time
    32.    }
    33. }
    34.  

    You might want to read this Unity Answers post with discussion about detecting terrain textures. We will be looking into adding this feature for footsteps on terrains in a future version too.


    Hi Defcon44, Andy Charlie has the right idea with editing the GUI texts. The current GUI texts can have their fonts and colors changed. To re-skin them, the GUI would need to be rendered with textures. To edit the font and color of the GUI Texts, you can navigate to the Objects/HUD folder in the project library and edit the HungerText, AmmoText, HealthText, ect. objects. If you click on the arrow to the left of these objects, you'll see a child object which is identical to the parent except that they use a black font color and slight offset to render the shadows behind the text. Hope that helps.
     
    Takahama and ShinfoK like this.
  14. ShinfoK

    ShinfoK

    Joined:
    Feb 6, 2014
    Posts:
    282
    Much appreciated! I'll ask this over on answers but figured I'll ask here too since it's your script (but I don't want to overwhelm you with requests!).

    Is it possible to set an array of weapons from a list, set it to choose a defined amount (say, 12 in the list, choose 3 from that list to spawn), and then once those items have been picked up (pickup removed), wait the defined time and spawn again another random 3 spawns?

    One thing I should mention, because of the way my inventory system works, the item is actually "placed" onto the player, so it is still active. Perhaps I need a trigger zone. Or perhaps "destroy" the game object when picked up, and a new one created? I'm not sure :/

    Sorry if I'm asking too much. I really appreciate all the help you've given for this asset!
     
    Last edited: Jun 5, 2014
  15. Defcon44

    Defcon44

    Joined:
    Aug 19, 2013
    Posts:
    400
    Hello :)

    Thanck's Azuline for your reply :)

    So i want (In the future) add a shield systeme on my game but how i can this ?

    Thanck's


    -----------------------------------------------------------------

    I use the HUD Waypoint pack for objectif on the camera.
    BUT with the simple camera all works fine or in the demo scene of the HUD pack this work too, but with the main camera nothing work :(

    I have copy and paste value of the simple camera to main camera but always nothing.

    The probleme is player camera i'm sure but where is the probleme ?

    Thanck's
     
    Last edited: Jun 5, 2014
  16. ShinfoK

    ShinfoK

    Joined:
    Feb 6, 2014
    Posts:
    282
    Got your tags/layers set correctly?
     
  17. Takahama

    Takahama

    Joined:
    Feb 18, 2014
    Posts:
    162
    @Azuline Studios
    Hello again!
    1) its possible to make NPCs can follow waypoint only one time without looping ?
    2) please make Friendly NPCs can follow us :D
    3) When we enter a building, its possible to NPC's find their way how to get in ?
    Thanks!
     
    Last edited: Jun 7, 2014
  18. Defcon44

    Defcon44

    Joined:
    Aug 19, 2013
    Posts:
    400
    yes all is correct :(
     
  19. ShinfoK

    ShinfoK

    Joined:
    Feb 6, 2014
    Posts:
    282
    I was going to try HUD Waypoint as well, so I'll have a play with it at some stage and get back if someone else doesn't beat me to it.
     
  20. Defcon44

    Defcon44

    Joined:
    Aug 19, 2013
    Posts:
    400
    Ok thanck's
     
  21. Reiner

    Reiner

    Joined:
    Dec 2, 2012
    Posts:
    211
  22. hannm

    hannm

    Joined:
    Dec 26, 2013
    Posts:
    15
    love the work, but i keep having a issue with making a new NPC i followed the guide but my NPS stands there and doesnt move or stands there with its arms out, are you able to do a quick video showing us how its done???


    thanks heaps
     
  23. Defcon44

    Defcon44

    Joined:
    Aug 19, 2013
    Posts:
    400
    Your character is on legacy animation ?
     
  24. hannm

    hannm

    Joined:
    Dec 26, 2013
    Posts:
    15
    indeed it is, i even tried a few diff FBX models as a test but they all have the same result.
     
  25. hannm

    hannm

    Joined:
    Dec 26, 2013
    Posts:
    15
    there any chance you got do a quick video on it? or detailed screen shots? would be amazing :)
     
  26. JC_LEON

    JC_LEON

    Joined:
    May 20, 2014
    Posts:
    439
    TheDevGuy can you PM me due I cannot Pm to you..I'm interested in your fps/inventory system,,

    thank in advance
     
    RealSoftGames likes this.
  27. ShinfoK

    ShinfoK

    Joined:
    Feb 6, 2014
    Posts:
    282
    You mean the inventory system he is selling for $25 that includes other assets such as RFPS assets and NGUI assets? There's a reason he keeps getting his account locked.
     
  28. JC_LEON

    JC_LEON

    Joined:
    May 20, 2014
    Posts:
    439
    Aah.. ok
    can you tell and link me that asset so I can have an idea ?

    thanks..
     
  29. ShinfoK

    ShinfoK

    Joined:
    Feb 6, 2014
    Posts:
    282
    RFPS Multiplayer :D



    TPawnzer is helping me with networking in my project. Got some bare bones stuff tonight, and it's starting to take form.
     
    Defcon44 likes this.
  30. Defcon44

    Defcon44

    Joined:
    Aug 19, 2013
    Posts:
    400
    Very nice !
     
  31. JC_LEON

    JC_LEON

    Joined:
    May 20, 2014
    Posts:
    439
    thanks..very nice
     
  32. JC_LEON

    JC_LEON

    Joined:
    May 20, 2014
    Posts:
    439
    thanks but I dont see it in asset store....
     
  33. Reiner

    Reiner

    Joined:
    Dec 2, 2012
    Posts:
    211
    @ShinfoK which network packet you use? PUN? or the new Bolt
     
  34. ShinfoK

    ShinfoK

    Joined:
    Feb 6, 2014
    Posts:
    282
    PUN.
     
  35. Reiner

    Reiner

    Joined:
    Dec 2, 2012
    Posts:
    211
    @ShinfoK i can help you add a Network Player Prefab when you want
     
  36. Devision4

    Devision4

    Joined:
    Jan 12, 2013
    Posts:
    1,329
    Yes please help me with Network! That would be awesome
     
  37. poison77

    poison77

    Joined:
    Dec 24, 2013
    Posts:
    39
    Any news on update ? When can we expect one? Thanks.
     
  38. Azuline-Studios

    Azuline-Studios

    Joined:
    Apr 5, 2013
    Posts:
    203
    No problem ShinfoK, did you get an answer on this yet? It seems that you could use an array of three int variables to store the random weapon selections using the Random.Range function (and do a check to prevent repeated weapons). Then for each member of your first array with the three int vars, iterate through another array holding all of your weapon references using a for statement and select the weapon from the array that corresponds with the random int var of that array member. Once you have your three random weapon references (reached the end of the array) you can spawn them or place them in your player's inventory like you mentioned. This is a rough explanation, but this is how I would approach writing the code for what you described.


    For the sheild system, do you mean like a shield that the player can raise to defend against attacks, Defcon44? Something like this could be done by adding a new weapon type to the WeaponBehavior.cs script that could use the zoom/raise sights button to raise the shield. When the shield is raised, you could add some code to FPSPlayer.cs which would bypass or lessen the damage that the player receives from attacks in the ApplyDamage() function.

    If you are trying to render some HUD Waypoint GUI elements on the screen and are using the weapon camera, you might want to set the layer of the GUI /HUD rendering objects to layer 14, the GUICamera layer, so they will be rendered by the weapon camera, which has a higher depth than the main camera. Feel free to let us know if you have any more questions about this.


    Hi Takahama, an option for non-looping patrols is a good idea and we just added this feature to the AI.cs script. It will be available in the next version by clicking the Patrol Once box below the Do Patrol box of the AI.cs script component of the NPCs.

    Friendly NPCs will be added in a future version. This should be available as a faction var that NPCs will use to determine which targets to attack and which ones to ignore or follow.

    Better pathfinding is also on the list for a version after the upcoming one, which will make the NPCs much smarter at navigating their surroundings. In the next update, the AI.cs script has been improved so that the NPCs move more aggressively to the last position that they saw the player, which makes them a bit more challenging. Thanks for your feedback!


    Thanks hannm, if the NPC isn't moving, there might be a component configuration issue with the NPC prefab object. If the NPC model stays in the T pose, then the animations of the character model aren't being read and played correctly. When making a new NPC, we suggest duplicating an existing NPC prefab object, to make set up of the object components easier.

    Then you can drag your character model over the duplicated NPC object to make it a child of the root NPC object. If the model's Animation component is not attached to the root object of the model, you can drag the object with the Animation component from the Hierarchy view over the Object With Anims field of the AI.cs script, so that the script will know where to locate the walk, run, shoot, and idle animations to play for the NPC.

    There are a few ways to set up the NPC character models, depending on how they have been rigged in the 3D app and which object the Animation Component is located on for the model. Sometimes it is on the root object of the model, and sometimes it is one or two levels in. We added the Object With Anims var to the AI.cs script to help make this easier to set up.

    We do plan to make some new tutorial videos after the next version is complete that should demonstrate this process better. In the meantime, you can send us an email or PM with any specific questions. Thanks for your patience.


    Nice job of the multiplayer mode guys, looks great!


    Work on the next version is going well. We're just finishing the prone stance feature and after some final testing, it should be uploaded to the Asset Store this month. We will definitely keep you guys updated on our progress!
     
    Last edited: Jun 12, 2014
    Takahama and ShinfoK like this.
  39. wheelbarrow

    wheelbarrow

    Joined:
    Sep 12, 2011
    Posts:
    140
    Hey guys, I'm having a bit of a problem inserting my own weapon into the game; when I put the new prefab mesh over my duplicated weapon (the one with the anim.suffix, as per the docs), instead of taking on its transform and scale etc, it actually gets bigger in size, and is spun 180 degrees so it's facing backwards. The prefab I'm using has the correct initial direction etc, and I haven't scaled it at all prior to dragging it into the scene, so why is this happening?
    Way too many pages to troll through in this thread to see if this has been asked before, so apologies if it has. Thanks.
     
  40. Defcon44

    Defcon44

    Joined:
    Aug 19, 2013
    Posts:
    400
    Hi Guys !

    I have filmed few TUTO for Realistic FPS:

    - Add a new melee weapon
    - Add a new pistol
    - Add a new rifle pistol
    - Add a new weapon with other animation
    - Add a scope
    - Create a weapon and ammo prefab

    LINK

    If you have any question, ask me :)

    PS: Other video will be upload on the night.
    Bad connection :(
     
  41. Defcon44

    Defcon44

    Joined:
    Aug 19, 2013
    Posts:
    400
    3 new video add in the night :)

    This is :

    - Add a scope
    - Add a new melee weapon
    - Add a new rifle pistol

    LINK
     
    ShinfoK likes this.
  42. ShinfoK

    ShinfoK

    Joined:
    Feb 6, 2014
    Posts:
    282
    Nice work, Defcon.

    I'm going to start experimenting with a projectile weapon (bow) today, I'll post back with how I go.
     
    Defcon44 likes this.
  43. Defcon44

    Defcon44

    Joined:
    Aug 19, 2013
    Posts:
    400
    Yearh of course !

    Nice idea :)

    We can add a RPG or grenade launcher =p

    Oh ! and i have upload 2 new video :

    - Add a new weapon with other animation
    - How to create a new weapon and ammo prefab


    Link
     
  44. ShinfoK

    ShinfoK

    Joined:
    Feb 6, 2014
    Posts:
    282
    For those looking for something similar, I haven't modified the script yet (just testing at the moment), but I've been using the CharacterDamage script on a tree prefab, with a dead replacement of 3 logs prefab, that also have CharacterDamage, with a dead replacement of a Planks prefab, which hooks up to my inventory. Currently useless at the moment, but I'll be using for a crafting system (still working on it), which will contribute to a building system (already got it, just trying to integrate it properly with RFPS).

    I'm thinking until crafting is complete, I might hook it up with the excellent Dialogue System by TonyLi, to exchange wood planks for building supplies with an NPC.

     
    RealSoftGames, Takahama and Defcon44 like this.
  45. Defcon44

    Defcon44

    Joined:
    Aug 19, 2013
    Posts:
    400
    Oh My God !

    Shinfok ! I love your game :O

    Look is really good !

    And very good idea for the tree !
     
    ShinfoK likes this.
  46. hannm

    hannm

    Joined:
    Dec 26, 2013
    Posts:
    15
    any news on a quick vid on making new NPS even if u reuse a old model? ill send PM
     
  47. Defcon44

    Defcon44

    Joined:
    Aug 19, 2013
    Posts:
    400
    Hi Everybody !

    I want use this PACK in my project.

    BUT i don't how i can because i have import the prefab on my scene
    but I do not know how to connect the healt script in the progressbar:/

    No idea?

    Thank you
     
  48. Defcon44

    Defcon44

    Joined:
    Aug 19, 2013
    Posts:
    400
    I have a new problem with a gun.

    I have create animation for M60 and my prefab M60 is here :

    Prefab:



    Animation:



    But after take the weapon I would like that the weapon remains fixed and the player with.

    In the blow having taken the weapon the prefab would have to disappear leaving the place has the animation and once the fixed weapon to leave the prefab appears has the same position.

    I thought has a system " activate / deactivate " but not being to code I can make nothing.

    A person sees what I want to say? An idea?

    Thanck's
     
  49. Takahama

    Takahama

    Joined:
    Feb 18, 2014
    Posts:
    162
  50. Defcon44

    Defcon44

    Joined:
    Aug 19, 2013
    Posts:
    400