Search Unity

FPS Kit | Version 2.0

Discussion in 'Assets and Asset Store' started by NSdesignGames, Oct 2, 2012.

  1. Le_Hieu

    Le_Hieu

    Joined:
    Mar 26, 2011
    Posts:
    31
    thank you for your sharing. I have followed the instructions but still not complete, found no bullet casings fly
     
  2. Steve-of-Construction

    Steve-of-Construction

    Joined:
    Jan 26, 2013
    Posts:
    67
    Hey, I'm still having this trouble with the wrong killmessages and almost surrendered looking at this forum for some days.

    The code in PlayerNetworkController is correct though I've made a complete new script for enabling mecanim animations.
    I've checked it in a new build: playerDamage.disableDamage is working fine and all players have correct settings in both teams.

    Maybe there's someone who can explain the basic functions of the kit and how it takes notice of 'kills'.
    nsdesign unfortunatelly gives no support anymore :(

    Imho it would be a solution that the HitBox checks who sent the bullet and then sends a message upwards to PlayerDamage if the bullet came from anothers team member. But this would assume that every bullet sends a RPC wich would cause a lot of lag and traffic *lol*
    But FPS-Kit works completely different and my problem is to understand how it works and especially how it's noticed who made the shot.
     
  3. PixelPaw

    PixelPaw

    Joined:
    Feb 18, 2013
    Posts:
    91
    hey stan hows it going ?

    I get an error with your script :

    if(hit.transform.tag == "Blood" doDamage)

    doDamage is underlined in red
     
  4. Stan-B

    Stan-B

    Joined:
    Aug 5, 2013
    Posts:
    126
    if(hit.transform.tag == "Blood" && doDamage)
     
  5. ThrillKill

    ThrillKill

    Joined:
    Apr 7, 2014
    Posts:
    80
    I kinda got the feeling that ndesign abandoned this kit as if you look at others they are constantly improving and making it better and he hasn't posted anything in a while re this kit or hinted at releasing an upgrade. I've gone and bought the UFPS now just because of the work they are putting into it making it constantly better. The beautiful thing is UFPS is commented very well, code is a lot more advanced, a lot of protected and static variables which you don't see in this kit as the code was likely made like this on purpose to be easier for more people to follow and understand. UFPS can side load in same project as this so makes things even easier. I've almost combined the two kits together. I've changed so much of the original kit it's hardly the same thing anymore.

    I was considering looking into how/if I could release all my changes as an addon but I do have a couple scripts that are only slightly modified from the original, would get into having to delete things and essentially break the kit until you loaded in this one with the needed scripts. Now due to the UFPS code addition makes it difficult to release as this code is written really well which leaves little room to rewrite them and make it better. The AI system is way cooler then what I had going on, was impressed with the whole event system and how the kits built.

    With the additions other kits are making and improvements in general it won't belong before this is obsolete.

    Maybe NSDesign would trade the rights to release an updated and maintained code for some royalties until which time the original kits code is completely re-done. Or maybe some others here would be interested working on one.

    Update: UFPS is releasing a newer version focusing on multiplayer. AI/MULTIPLAYER -> would have to say the obsolete time is coming up rather quickly.
     
    Last edited: Jun 6, 2014
  6. ThrillKill

    ThrillKill

    Joined:
    Apr 7, 2014
    Posts:
    80

    Stan, if you don't mind I would certainly like to hear your take on switching from Photon to TNET. Bits that I have read about it said it's a bad idea for an FPS.
    If you change your exit point to be your firepoint what happens? You should see them just instantiate. You will need to have a script attached to the shell prefab to make it do stuff after it's instantiated.

    Found this example searching google. It's java but give's you the idea. Due to the nature of my shell script it has some special features and effects while i don't mind sharing basic stuff, the special spice I add is something I keep out of public forums.

    // Add this to the shell that ejects
    // Shell.js

    var force : Vector3;
    var randomFactorForce : float;
    //var gravity : float;
    var torque : Vector3;
    var randomFactorTorque : float;
    function Start () {
    rigidbody.AddRelativeForce(force *Random.Range(1, randomFactorForce));
    rigidbody.AddRelativeTorque(torque* Random.Range(-randomFactorTorque, randomFactorTorque));

    }
     
  7. johnson07

    johnson07

    Joined:
    Oct 10, 2013
    Posts:
    15
    Hello.

    if anyone needs weapons animation and great quality for your project .. you can contact me by sending me a PM here ...

    I can create any type of weapons with their animations:
    -Idle
    -Fire
    -Reload
    -takein
    -takeout

    price drift in the number, the more weapons, cheaper.

    also if you need character models.

    which any questions, feel free to send me a PM.
     
  8. Frezno

    Frezno

    Joined:
    Nov 21, 2012
    Posts:
    3
    Hello does anyone know how I would hide an object from third person view and only show it in first person view, as in the fps hands and guns. I have first person legs and I assigned them as weapon layer since it seemed that layer had some tie to it but it didn't, they can be seen across network by everyone but I only want them to be seen in first person to the person they are being used by, I'm lost.
     
  9. Stan-B

    Stan-B

    Joined:
    Aug 5, 2013
    Posts:
    126
    So far I do not see any difference, for frequent updates like transform and animation I use UDP, for the rest TCP(same way as original kit). Note that this kit has serious bug with time synchronization and it seems like photon issue (from time to time when you try to start a new game it says "draw restarting..."), I've fixed it in TNet version implementing my own mechanism. TNet does not have any kind of custom properties like in photon so you need to implement it as well. The biggest advantage of TNet is that you have the source and you are not limited to the CCU, plus you can implement server authoritative movement and hit detection.
    Why it's a bad idea, any strong argument?

    P.S. Fholm has an open source network library that I may try in future(it will be pretty easy because I use only RPC(RFC in TNet), no network time, no custom properties):
    https://github.com/fholm/udpkit

    Edit: I just found Fholm released his new network asset Bolt with mecanim replication support:
    https://www.assetstore.unity3d.com/en/#!/content/18358
    http://www.boltengine.com/
     
    Last edited: Jun 6, 2014
  10. Litwin

    Litwin

    Joined:
    Aug 15, 2013
    Posts:
    70
  11. clayster2012

    clayster2012

    Joined:
    Apr 19, 2013
    Posts:
    7
    High Im sort of new to unity, and I been trying to swipe my own weapons to the animated hands, everything seems to work but the weapons seems not to respond to the animation, Is there a script that I need to add to the weapon or is there another method that I need to take, i would buy an animated weapon pack, but my budget is limited, so Im trying to do it this way,
     
  12. Frezno

    Frezno

    Joined:
    Nov 21, 2012
    Posts:
    3
    @clayster2012
    Click your weapon that has the animations and check that you have the animation script attached to it that declares all aniamtions Fire,Reload,Idle,Takein,Takeout

    It should look like this for example.

     
  13. ThrillKill

    ThrillKill

    Joined:
    Apr 7, 2014
    Posts:
    80

    You know I went back to find out the posts where I read that and they were refering to an older version and I saw that its over 1.9 now and the problems were resolved with updates. But still good to know it was no problems to implement.

    That Bolt engine is something that I think I will likely go with over Photon and TNET. Looks pretty awesome and the fact the mecanim support is pretty sweet. I know it's beta right now so just sticking it out with photon still but having to have a different build for each photon server is getting a bit crazy so need something else. (Spose I could buy a license and all but I really don't see myself keeping photon, it's just way to lagged. 100 PING on average is pretty crazy.

    Did you guys realize how it is extremely easy to hack unity games. It's so easy to side load a script into your build and a lot of the data in this code is wide open and easily hacked. Also a down side to always patching the whole game every time you change something. I noticed NSdesign added in support for his game for players to create and upload their own maps. I am thinking that would be a lot easier having a system like that for maps optional outside the game build itself.

    BTW where did all the posts go, this was up to page 70 something last I saw and now its 36? Did a bunch of posts get wiped or something or is this just a housecleaning due to no support to this kit anymore?
     
  14. ThrillKill

    ThrillKill

    Joined:
    Apr 7, 2014
    Posts:
    80
    I was able to find the actual source files used in this kit for the hands and weapons. They were created with Blender. Personally I use 3DSMax to do the rigging then blender as it can combine all the animations into 1 FBX file. Animations dont usually work unless you rig the hands and guns other wise its not linked to anything so it will not react to animations.
     
  15. Nexonity

    Nexonity

    Joined:
    Aug 2, 2013
    Posts:
    6
    I´m having some issues destroying a game object by shooting on it. When a use a projectile such as RPG or a grenade it works fine but when I use "Normal" weapon it doesn't loose any hp at all, so i figured it must be something wrong with the bullet script/prefab? Now the problem is i cant find it.

    Here is my script for the object damage:

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class AIPlayerDamage : MonoBehaviour {
    5.  
    6.     public int hp = 100;
    7.     // Use this for initialization
    8.     void Start () {
    9.    
    10.     }
    11.    
    12.     // Update is called once per frame
    13.     void Update () {
    14.    
    15.     }
    16.  
    17.     void ApplyDamage (int damage) {
    18.         hp -= damage;
    19.        
    20.         if(hp <= 0) {
    21.             Die();
    22.         }
    23.     }
    24.        
    25.     void Die () {
    26.         Destroy(gameObject);
    27.     }
    28. }
    And a image from the inspector:
     
  16. ThrillKill

    ThrillKill

    Joined:
    Apr 7, 2014
    Posts:
    80

    Your script looks like its missing something. Wheres your method to apply damage when a bullet hits it...

    iE
    Code (csharp):
    1. Void OnCollisionEnter (Collision collision){
    2.       DoDamage (10);
    3. }
    or maybe you call damage from elsewhere? Explosion's work almost always as they are set to do damage and do damage by force ie shockwave damages all surrounding objects which most of the time doesnt require any extra scripting. Just my thoughts anyways. ( I use something like this to destroy the objects and environment for an ObjectDamageHandler, cause i like to have xplosions drops etc special fx) I use the player damage script for AI.
     
  17. Nexonity

    Nexonity

    Joined:
    Aug 2, 2013
    Posts:
    6
    Turns out the bullet collided with a trigger collider around the target, therefor no damage was applied. Thanks anyway.
     
  18. PixelPaw

    PixelPaw

    Joined:
    Feb 18, 2013
    Posts:
    91
    So what happened to the other 30+ pages of this thread ?

    Poor Stan , all his page references to help newbs ... lost...
     
    Last edited: Jun 14, 2014
  19. KingofMk98

    KingofMk98

    Joined:
    Oct 10, 2013
    Posts:
    63
    I think with the forum update, most post can fit on a page so maybe it shortened the amount of pages?
     
  20. fastattacksub

    fastattacksub

    Joined:
    Feb 23, 2014
    Posts:
    13
    I just bought this asset and i am looking forward to really getting into it.
     
  21. PixelPaw

    PixelPaw

    Joined:
    Feb 18, 2013
    Posts:
    91
    i don't know if i was hallucinating or Stan posted script to hear *HEADSHOT* when your kill shot was a headshot but i can't seem to find it anymore...

    i got it all going to the displaying wich weapon killed who and headshot if it was one.

    trying to make it work so only my character hears it , i'm so newb at coding spend all my time modeling and texturing (friggin UV maps) :S
     
    Last edited: Jun 15, 2014
  22. ThrillKill

    ThrillKill

    Joined:
    Apr 7, 2014
    Posts:
    80
    And you wont find it because It was me not Stan who posted it. It's on page 34 now.
     
  23. ThrillKill

    ThrillKill

    Joined:
    Apr 7, 2014
    Posts:
    80
    You will find this kit is a great starter kit to learn how its done but once you become accustomed to unity and C# you will quickly see the limitations. Don't get me wrong this is a beautiful example of multiplayer FPS and easy to convert into whatever you want as a learning tool. But in the end you will outgrow it.

    I am just finishing off integrating UFPS with this kit. It was a bigger job then expected. Getting the event system working was the biggest hurdle.
     
  24. ThrillKill

    ThrillKill

    Joined:
    Apr 7, 2014
    Posts:
    80
    This seems to be the case but like it was said "stan was the man" for posting the links to the pages with info for all the lazy people which won't work anymore.
     
  25. KingofMk98

    KingofMk98

    Joined:
    Oct 10, 2013
    Posts:
    63
    Yep, couldnt agree more. I learned quite a bit from what he has posted
     
  26. Essekey

    Essekey

    Joined:
    Nov 6, 2013
    Posts:
    15
    http://forum.unity3d.com/threads/fps-kit-version-2-0.153337/page-31#post-1574844
     
  27. clayster2012

    clayster2012

    Joined:
    Apr 19, 2013
    Posts:
    7
    I'm I need of help, ok I followed the tutorial of adding my own weapons, and everything works fine, but I'm wondering how to make the character holding the new weapon, when I tried the game and the other player selected the weapon, but the player isn't holding anything, how do I fix it to where you can see the players hold the new weapon?
     
  28. PixelPaw

    PixelPaw

    Joined:
    Feb 18, 2013
    Posts:
    91
    It gives me an error if i put in " && " and if i remove it my own bullets sometimes hit me but i get no errors without it.
     
  29. PixelPaw

    PixelPaw

    Joined:
    Feb 18, 2013
    Posts:
    91
    Ty !
     
  30. PixelPaw

    PixelPaw

    Joined:
    Feb 18, 2013
    Posts:
    91
    i get an error at: if(message == "HeadShot"){

    *The name 'message' does not exist in the current context*

    i dont get it i have the declaration in and i see it on gui....
     
    Last edited: Jun 18, 2014
  31. ThrillKill

    ThrillKill

    Joined:
    Apr 7, 2014
    Posts:
    80
    I bet this is an issue of copy and paste. If you copied Stans code about adding message then you will see the notifications ingame. You know:
    Code (csharp):
    1. hitBoxes.box.gameObject.GetComponent<HitBox>().message = hitBoxes.message;
    And use the stuff i posted to send the message from PlayerDamage.cs in the RPC void DoDamage. You Remember stans code again??? You know:
    Code (csharp):
    1. //add message to show weapon used and how player was killed
    2.  weapon += message;

    and then you added mine, you know:
    Code (csharp):
    1. if(!photonView.isMine){ if (message == "HeadShot")
    cause you only want to do it if its not your head being blown off.

    Obviously, "HeadShot" is whatever you called your head hitbox. So maybe you forgot something? Either that or your not doing it from DoDamage cause thats where message is eh! I don't think you put stuff in the right spot or you renamed things differently.
     
  32. ThrillKill

    ThrillKill

    Joined:
    Apr 7, 2014
    Posts:
    80
    If your using the models that came with this you will see why thats something you gotta change if your wanting to make it easy for yourself. You have to do it twice. on the networkplayer and the 3rd person. 3rd person is what other people see, first person the network is what you see.
     
  33. PixelPaw

    PixelPaw

    Joined:
    Feb 18, 2013
    Posts:
    91
    I did not copy paste ( trying to understand as i integrate it and try hard to remember it after ! ) i have everything working with stan's code only got lost somewhere in yours , i will go step by step with the things you just replied and let you know ! thx !
     
  34. BuckeyeStudios

    BuckeyeStudios

    Joined:
    Oct 24, 2013
    Posts:
    104
    is it ez to add different types of match ie.. Zombies where all players will be on one team all zombies(AI) will be on the other and spawn like COD
    Thanks
     
  35. PixelPaw

    PixelPaw

    Joined:
    Feb 18, 2013
    Posts:
    91
    Thx for the help ThrillKill , i wasn't under the doDamage rpc *
    everything working now just need to adjust the who killed who space so that the Headshot message is not out of the screen. ty !
     
  36. clayster2012

    clayster2012

    Joined:
    Apr 19, 2013
    Posts:
    7
    Ok I got it, thanks ThrillKill
     
  37. BuckeyeStudios

    BuckeyeStudios

    Joined:
    Oct 24, 2013
    Posts:
    104
    Having trouble with the room list and map list in ngui. For the map list Would I created a sprite & a label and place it on a panel and make a prefab and set up a scrollview with a grid script then clone it for every map.
     
    Last edited: Jun 21, 2014
  38. Brendonm17

    Brendonm17

    Joined:
    Dec 9, 2013
    Posts:
    43
    Hey, i was wondering how does one change the character? i remember this forum thread having like 60+ pages.... but it is telling me that this is the most recent... any help? thank you.
     
  39. Reiner

    Reiner

    Joined:
    Dec 2, 2012
    Posts:
    214
    hi i am new here with this kit read many in this forum. i have 2 problems.
    i change to DX11 then the detornator effects little buggy think any shader not correct.

    first problem i add all from bunker map to my test map in bunker map when i hit a wall or other i have bullet holes and effects. in my test map no effects no bullet holes what make i wrong.... here a screen shot from:

    http://www.dropbox.com/s/eon29snw8nkk2yq/22-06-2014 02-00-17.png

    second problem when the effect for the explosive grenate is live its look so:
    or where can i found the expolisive effekt for the nate to change with a better effekt?

    https://www.dropbox.com/s/bnzz2lt3rwzzbjo/22-06-2014 02-04-07.png


    Greetz Reiner

    Sorry my English is bad :)
     
    Last edited: Jun 22, 2014
  40. ThrillKill

    ThrillKill

    Joined:
    Apr 7, 2014
    Posts:
    80
    Think i know what your referring to. It's actually easy if you don't over think it. I did that.

    So what you do is create a gameobject prefab that you will use to add to the grid. On the prefab use your UIsprites labels whatever. Then put a script on it so you can reference it. like

    Usage: Add this script to the Prefab that will get added to your UIGrid/UIScrollView. Whenever this object is clicked it will set the values in the other script that needs to access to these values.

    Script: ObjectOnClick.cs
    ----------------------------------------------------------------------------------------------------------
    Code (csharp):
    1.  
    2. using UnityEngine;
    3. using System.Collections;
    4.  
    5. public class ObjectOnClick : MonoBehaviour {
    6.  
    7.    public UILabel theLabel1; // assign this from the inspector using the UILabel in the prefab
    8.    public UILabel theLabel2; // repeat for however many you need to access
    9.      
    10.         // This runs whenever the object gets clicked on
    11.     void OnClick () {
    12.                 // This will access whatever the gameobject is that has the script
    13.                 // It will then assign the values from this object to those of the other script
    14.                 GameObject target = GameObject.Find("GameObjectName which has the script/values to access");
    15.                 SCRIPTNAME script = target.GetComponent<SCRIPTNAME>();
    16.                 script.MYVALUE = theLabel1.text;
    17.                 script.MYVALUE2 = theLabel2.text;
    18.    }
    19. }
    20.  
    then is the connect menu you'll need something like this
    Code (csharp):
    1.  
    2. //some variables
    3.   // NGUI UIGrid for the create room and join values
    4.    public UIGrid CRGrid; // The create room grid
    5.    public UIGrid JRGrid; // The join room grid
    6.    public GameObject joinRoomObj; // The item template to add to the grid
    7.    public UILabel selectedRoomJoin; // the value of the room the player selects to join
    8.  
    9.  
    10.  
    11. if(allRooms != null && allRooms.Length > 0){ // Checks there are rooms created          
    12.        foreach(RoomInfo room in allRooms){ // run once for each room thats created
    13.          GameObject addRoomObj = NGUITools.AddChild(JRGrid.gameObject, joinRoomObj); // creates a new Grid Item
    14.          UILabel[] labels = addRoomObj.GetComponentsInChildren<UILabel>(); // Gathers the values of the prefab labels
    15.  
    16. // then i use a swtich to assign the values to the labels
    17.   switch (label.name)   { // Switch based on the name of the UILabel
    18.            case "RoomName":
    19.              label.text = room.name; // Name of the room that is created
    20.              break;
    21.            case "RoomMapName":
    22.              label.text = (string)room.customProperties["MapName"]; // Name of the room that is created
    23.              break;
    24. // and so on for all the options - like password, no spectators, no join , etc
    25.  

    and could use something like this to refresh your grid with a refresh button or whatever
    Code (csharp):
    1.  
    2.   IEnumerator ClearGrid()   {    
    3.      var items = new List<GameObject>();
    4.      foreach (Transform t in JRGrid.transform){
    5.        items.Add(t.gameObject);
    6.      }  
    7.      if (items.Count > 0){
    8.        for (int i = items.Count - 1; i >= 0; i--) {
    9.          items[i].transform.parent = null;
    10.          NGUITools.DestroyImmediate(items[i].gameObject);
    11.          items[i] = null;
    12.        }
    13.      }
    14.      yield return new WaitForEndOfFrame();
    15.      //JRGrid.transform.parent.GetComponent<UIDraggablePanel>().ResetPosition();
    16.      JRGrid.GetComponent<UIGrid>().Reposition();
    17.      yield return new WaitForEndOfFrame();
    18.      JRGrid.transform.parent.GetComponent<UIPanel>().Refresh();
    19.      yield return new WaitForEndOfFrame();
    20.    }
    21.  
    These are snippets from how I did it.
     
    Last edited: Jun 22, 2014
  41. ThrillKill

    ThrillKill

    Joined:
    Apr 7, 2014
    Posts:
    80

    first is because you have to setup label tags for all the objects or it won't do any effect. 2nd look at the projectile prefab.
     
  42. Reiner

    Reiner

    Joined:
    Dec 2, 2012
    Posts:
    214
    Thx ThrillKill works fine :)
     
  43. RedEyeFox

    RedEyeFox

    Joined:
    Jan 8, 2013
    Posts:
    27
    Why bullets do not spread when i shoot without aiming? how to fix this?:eek:

     
  44. Reiner

    Reiner

    Joined:
    Dec 2, 2012
    Posts:
    214
  45. Reiner

    Reiner

    Joined:
    Dec 2, 2012
    Posts:
    214
    in the console he told me that no remote player to player network controler / Character animation and in this field was nothing. but when i goes offline all looks fine in networkplayer. in the field the ExampleSoldier (fbx) (character animation).

    okay i dont understand.i am delete all and unpacked new then add the customer map and now its run fine again?!?

    only chages i made was a guiskin and new effeckts to the grenade, rpg projektile because there looks terrible in dx11 mode. can that be the reason. where synchronize there the explosive/projektiels over the network?! i don find it.

    https://www.dropbox.com/s/aphpdsfxs171ij1/24-06-2014%2001-13-25.png
     
  46. RedEyeFox

    RedEyeFox

    Joined:
    Jan 8, 2013
    Posts:
    27
    Do you have tag Remote?i fix this bug when i add tag Remote .
     
    Last edited: Jun 24, 2014
  47. ThrillKill

    ThrillKill

    Joined:
    Apr 7, 2014
    Posts:
    80
    I imagine that a 1/4 at least of all posts on this thread are this same question regarding the remote tag.
     
  48. Reiner

    Reiner

    Joined:
    Dec 2, 2012
    Posts:
    214
    thank you for the quick response.
    okay I read it but did not think that it is my problem.
    thought it has something to do with the effects i changed.

    I have read a lot in this forum. noticed something with this is the developer no longer replies.
    there are quite a few mods for the kit but all pretty scattered.
    would not it be cool if someone all mods etc summarizes on a page with links.
    example mecanim mod.

    you can put on this kit. think it's great that some user leave this life on! thx for your help! must say :)
     
  49. BuckeyeStudios

    BuckeyeStudios

    Joined:
    Oct 24, 2013
    Posts:
    104
    Thanks thrillkill got it working
     
  50. RedEyeFox

    RedEyeFox

    Joined:
    Jan 8, 2013
    Posts:
    27
    Please people, help me with this, why bullets do not spread? where in the scripts is the problem? o_O