FPS Kit | Version 2.0

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

  1. dreadt9

    dreadt9

    Member

    Joined:
    Jan 13, 2012
    Messages:
    140
    http://docs.unity3d.com/Documentation/ScriptReference/Renderer-isVisible.html

    Look at the last Paragraph:

    "Note that object is considered visible when it needs to be rendered in the scene. It might not be actually visible by any camera, but still need to be rendered for shadows for example. Also, when running in the editor, the scene view cameras will also cause this value to be true."
  2. AsgerR

    AsgerR

    Member

    Joined:
    Apr 27, 2012
    Messages:
    17
    I did this by using raycast. Not the most stable way to do it, but it's more economic from a coding perspective than checking if the player is within the spectrum of the camera. (little hint: cast a ray at all objects containing the tag "Remote" and ray hits, then draw the name and if the ray doesn't hit, then dont.)
  3. willemsenzo

    willemsenzo

    Member

    Joined:
    Nov 15, 2012
    Messages:
    275
    Thanks for the help guys. I haven't tried to build the game yet to see if it makes a difference but that will be my next step. If that doesn't work I will try to do this with a raycast.

    Edit: Ok making a build isn't the solution either haha. I will try it with a raycast I guess.
    Last edited: Dec 4, 2012
  4. Acolit

    Acolit

    New Member

    Joined:
    Aug 13, 2012
    Messages:
    51
    Could you make it with Photon Server?
    it's may help much
  5. exgengames

    exgengames

    New Member

    Joined:
    Aug 10, 2012
    Messages:
    25
    y have problem
    D:

    [​IMG] how to Fix ?
  6. dreadt9

    dreadt9

    Member

    Joined:
    Jan 13, 2012
    Messages:
    140
    Any way to make is so after jumping you have to wait 0.5 secounds before jumping again?
    I tried looking through FPSController but there were no input values or anything I could work with...

    Please help, Thanks
  7. NSdesignGames

    NSdesignGames

    Member

    Joined:
    Dec 29, 2010
    Messages:
    437
    Are you working with Unity 4, if so, have you downloaded new version of FPS Kit 2.0 that is compatible with it?
  8. NSdesignGames

    NSdesignGames

    Member

    Joined:
    Dec 29, 2010
    Messages:
    437
    Check script called FPSInput.js, it handle player controls
  9. dreadt9

    dreadt9

    Member

    Joined:
    Jan 13, 2012
    Messages:
    140
    Any chance there is a variable containing the number of kills a player has made?
    If not, how could I create one?
  10. AsgerR

    AsgerR

    Member

    Joined:
    Apr 27, 2012
    Messages:
    17
    There isn't any variable containing it. But you could make one by sending the same message as the whokilledwko script sends to a script containing the number of kills. You could make an array of a custom class containing name and killcount and then check if the name is equal to one of the names in the array and then do killCount++.

    Hope you understand this description else i can try to be more specific.
  11. exgengames

    exgengames

    New Member

    Joined:
    Aug 10, 2012
    Messages:
    25
    Hi ! y have other problem y created my acount y photon and start

    map the buttons do nothing [​IMG]
  12. NSdesignGames

    NSdesignGames

    Member

    Joined:
    Dec 29, 2010
    Messages:
    437
    Thats because you working with older version of FPS Kit 2.0 that is not compatible with Unity 4. You can download latest version in Asset Store
  13. exgengames

    exgengames

    New Member

    Joined:
    Aug 10, 2012
    Messages:
    25
    What Version of unity 3d y need to Run 1.2c
  14. NSdesignGames

    NSdesignGames

    Member

    Joined:
    Dec 29, 2010
    Messages:
    437
    Version 1.2c were made with Unity 3.5.6

    Latest version is 1.3, it is compatible with Unity 4
  15. exgengames

    exgengames

    New Member

    Joined:
    Aug 10, 2012
    Messages:
    25
    Hi how to add Fall Damage

    and

    I found many bugs in multiplayer

    *animations bugs in weapons jump etc
    *weapons sound
    *lag bugs Very high Lag e,e my normal ping is 200 in this game is 600 or 800
  16. Trawk

    Trawk

    New Member

    Joined:
    Dec 7, 2012
    Messages:
    4
    For animation bug you have to add the tag:

    Code (csharp):
    1. Remote
    to your project.
  17. exgengames

    exgengames

    New Member

    Joined:
    Aug 10, 2012
    Messages:
    25
    ok ok y add this and the animations is normal how to implement Fall damage from

    fpswalker enhanced

    Code (csharp):
    1.  
    2. var walkSpeed = 6.0;
    3. var runSpeed = 11.0;
    4.  
    5. // If true, diagonal speed (when strafing + moving forward or back) can't exceed normal move speed; otherwise it's about 1.4 times faster
    6. var limitDiagonalSpeed = true;
    7.  
    8. // If checked, the run key toggles between running and walking. Otherwise player runs if the key is held down and walks otherwise
    9. // There must be a button set up in the Input Manager called "Run"
    10. var toggleRun = false;
    11.  
    12. var jumpSpeed = 8.0;
    13. var gravity = 20.0;
    14.  
    15. // Units that player can fall before a falling damage function is run. To disable, type "infinity" in the inspector
    16. var fallingDamageThreshold = 10.0;
    17.  
    18. // If the player ends up on a slope which is at least the Slope Limit as set on the character controller, then he will slide down
    19. var slideWhenOverSlopeLimit = false;
    20.  
    21. // If checked and the player is on an object tagged "Slide", he will slide down it regardless of the slope limit
    22. var slideOnTaggedObjects = false;
    23.  
    24. var slideSpeed = 12.0;
    25.  
    26. // If checked, then the player can change direction while in the air
    27. var airControl = false;
    28.  
    29. // Small amounts of this results in bumping when walking down slopes, but large amounts results in falling too fast
    30. var antiBumpFactor = .75;
    31.  
    32. // Player must be grounded for at least this many physics frames before being able to jump again; set to 0 to allow bunny hopping
    33. var antiBunnyHopFactor = 1;
    34.  
    35. private var moveDirection = Vector3.zero;
    36. private var grounded = false;
    37. private var myTransform : Transform;
    38. private var speed : float;
    39. private var hit : RaycastHit;
    40. private var fallStartLevel : float;
    41. private var falling = false;
    42. private var slideLimit : float;
    43. private var rayDistance : float;
    44. private var contactPoint : Vector3;
    45. private var playerControl = false;
    46. private var jumpTimer : int;
    47.  
    48. function Start () {
    49.     myTransform = transform;
    50.     speed = walkSpeed;
    51.     rayDistance = controller.height * .5 + controller.radius;
    52.     slideLimit = controller.slopeLimit - .1;
    53.     jumpTimer = antiBunnyHopFactor;
    54.     oldPos = transform.position;
    55. }
    56.  
    57. function FixedUpdate() {
    58.     var inputX = Input.GetAxis("Horizontal");
    59.     var inputY = Input.GetAxis("Vertical");
    60.     // If both horizontal and vertical are used simultaneously, limit speed (if allowed), so the total doesn't exceed normal move speed
    61.     var inputModifyFactor = (inputX != 0.0  inputY != 0.0  limitDiagonalSpeed)? .7071 : 1.0;
    62.  
    63.     if (grounded) {
    64.         var sliding = false;
    65.         // See if surface immediately below should be slid down. We use this normally rather than a ControllerColliderHit point,
    66.         // because that interferes with step climbing amongst other annoyances
    67.         if (Physics.Raycast(myTransform.position, -Vector3.up, hit, rayDistance)) {
    68.             if (Vector3.Angle(hit.normal, Vector3.up) > slideLimit)
    69.                 sliding = true;
    70.         }
    71.         // However, just raycasting straight down from the center can fail when on steep slopes
    72.         // So if the above raycast didn't catch anything, raycast down from the stored ControllerColliderHit point instead
    73.         else {
    74.             Physics.Raycast(contactPoint + Vector3.up, -Vector3.up, hit);
    75.             if (Vector3.Angle(hit.normal, Vector3.up) > slideLimit)
    76.                 sliding = true;
    77.         }
    78.  
    79.         // If we were falling, and we fell a vertical distance greater than the threshold, run a falling damage routine
    80.         if (falling) {
    81.             falling = false;
    82.             if (myTransform.position.y < fallStartLevel - fallingDamageThreshold)
    83.                 FallingDamageAlert (fallStartLevel - myTransform.position.y);
    84.         }
    85.  
    86.         // If running isn't on a toggle, then use the appropriate speed depending on whether the run button is down
    87.         if (!toggleRun)
    88.             speed = Input.GetButton("Run")? runSpeed : walkSpeed;
    89.  
    90.         // If sliding (and it's allowed), or if we're on an object tagged "Slide", get a vector pointing down the slope we're on
    91.         if ( (sliding  slideWhenOverSlopeLimit) || (slideOnTaggedObjects  hit.collider.tag == "Slide") ) {
    92.             var hitNormal = hit.normal;
    93.             moveDirection = Vector3(hitNormal.x, -hitNormal.y, hitNormal.z);
    94.             Vector3.OrthoNormalize (hitNormal, moveDirection);
    95.             moveDirection *= slideSpeed;
    96.             playerControl = false;
    97.         }
    98.         // Otherwise recalculate moveDirection directly from axes, adding a bit of -y to avoid bumping down inclines
    99.         else {
    100.             moveDirection = Vector3(inputX * inputModifyFactor, -antiBumpFactor, inputY * inputModifyFactor);
    101.             moveDirection = myTransform.TransformDirection(moveDirection) * speed;
    102.             playerControl = true;
    103.         }
    104.  
    105.         // Jump! But only if the jump button has been released and player has been grounded for a given number of frames
    106.         if (!Input.GetButton("Jump"))
    107.             jumpTimer++;
    108.         else if (jumpTimer >= antiBunnyHopFactor) {
    109.             moveDirection.y = jumpSpeed;
    110.             jumpTimer = 0;
    111.         }
    112.     }
    113.     else {
    114.         // If we stepped over a cliff or something, set the height at which we started falling
    115.         if (!falling) {
    116.             falling = true;
    117.             fallStartLevel = myTransform.position.y;
    118.         }
    119.  
    120.         // If air control is allowed, check movement but don't touch the y component
    121.         if (airControl  playerControl) {
    122.             moveDirection.x = inputX * speed * inputModifyFactor;
    123.             moveDirection.z = inputY * speed * inputModifyFactor;
    124.             moveDirection = myTransform.TransformDirection(moveDirection);
    125.         }
    126.     }
    127.  
    128.     // Apply gravity
    129.  
    130.     // Move the controller, and set grounded true or false depending on whether we're standing on something
    131.     grounded = (controller.Move(moveDirection * Time.deltaTime)  CollisionFlags.Below) != 0;
    132. }
    133.  
    134. function Update () {
    135.     // If the run button is set to toggle, then switch between walk/run speed. (We use Update for this...
    136.     // FixedUpdate is a poor place to use GetButtonDown, since it doesn't necessarily run every frame and can miss the event)
    137.     if (toggleRun  grounded  Input.GetButtonDown("Run"))
    138.         speed = (speed == walkSpeed? runSpeed : walkSpeed);
    139. }
    140.  
    141. // Store point that we're in contact with for use in FixedUpdate if needed
    142.     contactPoint = hit.point;
    143. }
    144.  
    145. // If falling damage occured, this is the place to do something about it. You can make the player
    146. // have hitpoints and remove some of them based on the distance fallen, add sound effects, etc.
    147. function FallingDamageAlert (fallDistance : float) {
    148.     Debug.Log ("Ouch! Fell " + fallDistance + " units!");  
    149. }
    150.  
    151. @script RequireComponent(CharacterController)
  18. dreadt9

    dreadt9

    Member

    Joined:
    Jan 13, 2012
    Messages:
    140
    What variable in what script could I use to find the player that killed you. Its so I can add a killcam. So I can find that variable and make a camera search for the gameobject with that name and make it my kill camera's target. So what variable could I use?


    Thanks
  19. Trawk

    Trawk

    New Member

    Joined:
    Dec 7, 2012
    Messages:
    4
    So I'm trying to make it so player names don't show everywhere, and I saw some one recommended using a raycast, so I decided to use one.

    The thing is, the prefab NetworkPlayer is on the layer "Ignore Raycast", so you can't use raycast.

    So I changed the layer, and it messed up a bunch of stuff, like the way the player holds guns, animations, and other things...

    BUT, the player name appeared how it was suppose to... but obviously I couldn't keep it like that because it messed up a bunch of stuff.

    So if I can't use raycast, what do I do?
    Last edited: Dec 9, 2012
  20. AsgerR

    AsgerR

    Member

    Joined:
    Apr 27, 2012
    Messages:
    17
    I would recommend shooting the ray at the "Soldier" found under the network player. The reason i suggest this is because it's not layered as Ignore Raycast and that's the mesh that's being displayed when you look at other players.
  21. Trawk

    Trawk

    New Member

    Joined:
    Dec 7, 2012
    Messages:
    4
    I tried this before, and it didn't work.


    Ill retry it right now though and see if it works.


    Edit: Still not working with trying Soldier. I don't get any errors or anything, just simply doesn't work.

    Here's what I've tried:
    Code (csharp):
    1.                  if (hit.collider.gameObject.name == "Soldier"){
    Code (csharp):
    1.                  if (hit.collider.gameObject.tag == "Body"){

    Code (csharp):
    1.                  if (hit.collider.tag == "Body"){
    Last edited: Dec 10, 2012
  22. AsgerR

    AsgerR

    Member

    Joined:
    Apr 27, 2012
    Messages:
    17
    You have to do something like :
    Code (csharp):
    1.                  if (hit.collider.tag == "Blood"){
    The reason why the things you've tried doesn't work is because the soldier doesn't contain either a rigged body or a collider. So what you need to do is shoot the ray at the hitboxes that registers when a bullet hits the soldier.
  23. Trawk

    Trawk

    New Member

    Joined:
    Dec 7, 2012
    Messages:
    4
    Doing it this way would mean you have to shoot the player at least once before the name appears though, right?
  24. exgengames

    exgengames

    New Member

    Joined:
    Aug 10, 2012
    Messages:
    25
    how to add fall damage variable ?


    how AI zombies is posible ?
  25. pimpin

    pimpin

    New Member

    Joined:
    Nov 11, 2012
    Messages:
    6
    How the f do you add the weapon to the multiplayer?
  26. pimpin

    pimpin

    New Member

    Joined:
    Nov 11, 2012
    Messages:
    6
    nvm figured it out you should really let peeps know what to do
  27. NSdesignGames

    NSdesignGames

    Member

    Joined:
    Dec 29, 2010
    Messages:
    437
  28. yunspace

    yunspace

    Member

    Joined:
    Nov 8, 2010
    Messages:
    31
    Just bought this the other night, pretty cool. Setting multi-player up with my existing Photon id was a breeze.

    Out of curiosity, is this framework supported for Mobile?
  29. DLGScript

    DLGScript

    New Member

    Joined:
    Jul 15, 2012
    Messages:
    207
    how can i get the FPS Controller scripts?
  30. NSdesignGames

    NSdesignGames

    Member

    Joined:
    Dec 29, 2010
    Messages:
    437
    Hey, I am really not sure about mobile devices since I havent tested FPS Kit 2.0 there
    Most likely there will be couple of errors ( For example generic lists are not supported on mobile platform etc.)
  31. exgengames

    exgengames

    New Member

    Joined:
    Aug 10, 2012
    Messages:
    25
    Hey, that is the tutorial to add New weapon width animations
  32. NSdesignGames

    NSdesignGames

    Member

    Joined:
    Dec 29, 2010
    Messages:
    437
    Hey, check front post fot tutorials and documentations
  33. Trustrix

    Trustrix

    New Member

    Joined:
    Dec 17, 2012
    Messages:
    2
    i can't spawn with the fps kit version 2.0 of unity
    http://u3d.as/content/nsdesign-games/fp ... on-2-0/3sw

    i get this error : NullReferenceException: Object reference not set to an instance of an object
    MainMenu.Update () (at Assets/FPS Kit Version 2.0/_CustomAssets/Scripts/OtherScripts/MainMenu.js:35)

    please help!!!
  34. exgengames

    exgengames

    New Member

    Joined:
    Aug 10, 2012
    Messages:
    25
    Ey ! what is the tutorial to Add in multiplayer New weapon not is setup new weapon tutorial D:



    please y need help to add new guns

    y have 9 animated arms + guns models D:
  35. NSdesignGames

    NSdesignGames

    Member

    Joined:
    Dec 29, 2010
    Messages:
    437
    Make sure your character prefab is inside folder called Resources. Also just double click on that error, it will bring you into part of script which contain this error. From what I see looks like some variable is not assigned.
    Last edited: Dec 23, 2012
  36. NSdesignGames

    NSdesignGames

    Member

    Joined:
    Dec 29, 2010
    Messages:
    437
    Check this tutorial http://www.mediafire.com/view/?0wysaw6wrfdq4ib
  37. ZJP

    ZJP

    Member

    Joined:
    Jan 22, 2010
    Messages:
    1,570
    Hi,

    Do you have a solution to this trouble. The focus of the sniper is flattened.
    [​IMG]
  38. NSdesignGames

    NSdesignGames

    Member

    Joined:
    Dec 29, 2010
    Messages:
    437
    Hey, if you check this demo, select Sniper Rifle and Zoom you will see that scope ratio will be the same with any resolution, so yea that problem is fixed in FPS Kit 2.0
  39. ZJP

    ZJP

    Member

    Joined:
    Jan 22, 2010
    Messages:
    1,570
    This is exactly what I said to a member of our community who did not dare ask in this forum.
    Thx. ;)
    Last edited: Dec 25, 2012
  40. yunspace

    yunspace

    Member

    Joined:
    Nov 8, 2010
    Messages:
    31
    Is it possible to add a animation to the melee attack? Currently in multi-player, if one player is attacking with a knife, the model will appear to the other player as simply standing still.
  41. NSdesignGames

    NSdesignGames

    Member

    Joined:
    Dec 29, 2010
    Messages:
    437
    Hey, yea you can make your own melee animation and assign it as fire animation for multiplayer.
    Demo character dont have this animation, so it was replaces by Idle
  42. TB0Y298

    TB0Y298

    New Member

    Joined:
    Dec 25, 2012
    Messages:
    59
    Hey i have it now, but i have some issues :(
    I need help, can you?
  43. CHHOST

    CHHOST

    New Member

    Joined:
    Oct 1, 2012
    Messages:
    7
    can you help me with this issue please.

    how do i add weapons to such a list? cant find them nowhere:
    [​IMG]

    like i want the 2'nd deaghe to be a sniper etc.
  44. NSdesignGames

    NSdesignGames

    Member

    Joined:
    Dec 29, 2010
    Messages:
    437
    Just click on any element from that list and it will show you that object in Hierarchy view, than replace Deagle with any other weapon.
  45. CHHOST

    CHHOST

    New Member

    Joined:
    Oct 1, 2012
    Messages:
    7
    i figured it out :p

    BTW im having issues in multiplayer, where i cant seem to aim. when i play on a multiplayer server myself there is no issue, but once a player joins the game i cant aim (right click)
  46. NSdesignGames

    NSdesignGames

    Member

    Joined:
    Dec 29, 2010
    Messages:
    437
    Make sure your project contain tag called - Remote
    Just open tag manager and add it there
  47. TB0Y298

    TB0Y298

    New Member

    Joined:
    Dec 25, 2012
    Messages:
    59
    Hey.. Hello! i need help!
  48. NSdesignGames

    NSdesignGames

    Member

    Joined:
    Dec 29, 2010
    Messages:
    437
    How do you expect to get any help if you didn't even explain your problem?
  49. AaronVictoria

    AaronVictoria

    Member

    Joined:
    Aug 21, 2010
    Messages:
    98
    I sent you a PM.
  50. Pixmah

    Pixmah

    New Member

    Joined:
    Jan 3, 2013
    Messages:
    45
    how can i add game modes like TEAM DEATHMATCH and with scoreboard kill and death when pressing a key ??? help please