Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

UFPS : Ultimate FPS [ RELEASED ]

Discussion in 'Assets and Asset Store' started by VisionPunk, Mar 9, 2012.

Thread Status:
Not open for further replies.
  1. Yoshimiii

    Yoshimiii

    Joined:
    Jun 25, 2014
    Posts:
    6
    Can't change muzzle flash position on Vp_FP Weapon Shooter script in Unity 5, following this tutorial
    .

    Is this a bug?
     
  2. Goofy420

    Goofy420

    Joined:
    Apr 27, 2013
    Posts:
    248
    I just tried it, and it worked for me using Unity 5.3 and UFPS 1.5.2. Make sure your dynamic objects like the muzzleflash prefab and weapon aren't flagged as static. I've also noticed a bug in Unity 5.3 where the meta files become unreadable for no rhyme nor reason why and requires restarting the editor frequently.
     
  3. Goofy420

    Goofy420

    Joined:
    Apr 27, 2013
    Posts:
    248
    If you just want a 0,1 bool of whether or not the projectile is spawning, you could try this. This will be true when the fire rate/delay allows it, and I believe it's the same as if (FPPlayer.Attack.Active + weaponShooter.ProjectileSpawnDelay + timer, etc..

    Code (CSharp):
    1. protected vp_FPPlayerEventhandler = null;
    2.  
    3. void Awake()
    4. {
    5. m_player = FindObjectOfType<vp_FPPlayerEventHandler>();
    6. }
    7.  
    8. void Update()
    9. {
    10. if (m_Player.Attack.TryStart()
    11. {
    12. //timers met, can fire
    13. }
    14. if (m_Player.Fire.Try())
    15.   {
    16. //fired the weapon
    17.   }
    18. }
    or the old way
    Code (CSharp):
    1. if (true == weaponShooter.TryFire())
    2.         {
    3. //spawning projectile
    4.         }
     
    Last edited: Dec 20, 2015
  4. Ghost_Interactive

    Ghost_Interactive

    Joined:
    Jul 8, 2015
    Posts:
    54
    Is it possible to make HP regain, like modern FPS. ufps - 1.5.2
     
  5. Goofy420

    Goofy420

    Joined:
    Apr 27, 2013
    Posts:
    248
    Code (CSharp):
    1.  
    2.  
    3. public class HealthRegen : MonoBehaviour
    4. {
    5.   public bool canRegen = false;
    6.   public float regenSpeed = 0.1f;
    7.   protected vp_FPPlayerEventHandler m_Player = null;
    8.  
    9.   void Awake()
    10.   {
    11.   m_Player = FindObjectOfType<vp_FPPlayerEventHandler>();
    12.   }
    13.  
    14.   void Update()
    15.   {
    16.   if (canRegen)//regens when true
    17.   {
    18.   if (m_Player == null || m_Player.Dead.Active) return;
    19.   float regenHealth = Mathf.Lerp(m_Player.Health.Get(), m_Player.MaxHealth.Get(), Time.deltaTime * regenSpeed);//Lerp from currrenthealth to maxHealth
    20.   m_Player.Health.Set(regenHealth);//the magic
    21.   }
    22.   }
    23. }
    24.  
     
    Last edited: Dec 21, 2015
  6. Ghost_Interactive

    Ghost_Interactive

    Joined:
    Jul 8, 2015
    Posts:
    54
    Goofy thx for reply but were should i put this code.. I m very poor in c# :(
     
  7. Goofy420

    Goofy420

    Joined:
    Apr 27, 2013
    Posts:
    248
    Just make a new script called HealthRegen.cs and attach it to the Player, although it'll work attached to anything that's activeInHierarchy. Enable the canRegen checkbox in the inspector to have it regen or uncheck it to disable regeneration. Call FindObjectOfType<HealthRegen>().canRegen = true; from an external script to enable or disable regeneration at runtime. Increase or decrease regenSpeed to make it regen slower or faster. 0.1 will regen over apoximately 10 seconds and 1 will regen within 1 second.
     

    Attached Files:

    Last edited: Dec 21, 2015
    Mazak likes this.
  8. Mazak

    Mazak

    Joined:
    Mar 24, 2013
    Posts:
    226
    In vp_FPCamera.cs

    The use of m_root should be changed to the property Root.

    Code (CSharp):
    1.     protected override void OnEnable()
    2.     {
    3.         base.OnEnable();
    4.         vp_TargetEvent<float>.Register(Root, "CameraBombShake", OnMessage_CameraBombShake);
    5.         vp_TargetEvent<float>.Register(Root, "CameraGroundStomp", OnMessage_CameraGroundStomp);
    6.     }
    7.  
    8.  
    9.     /// <summary>
    10.     ///
    11.     /// </summary>
    12.     protected override void OnDisable()
    13.     {
    14.         base.OnDisable();
    15.         vp_TargetEvent<float>.Unregister(Root, "CameraBombShake", OnMessage_CameraBombShake);
    16.         vp_TargetEvent<float>.Unregister(Root, "CameraGroundStomp", OnMessage_CameraGroundStomp);
    17.     }
     
  9. Goofy420

    Goofy420

    Joined:
    Apr 27, 2013
    Posts:
    248
    Root returns m_Root for caching the PlayerEventHandler. It's probably a requirement of delegate callback functions in vp_Component for multiple Root instances in Multiplayer.
    Code (CSharp):
    1. public Transform Root
    2.    {
    3.      get
    4.      {
    5.        if (m_Root == null)
    6.          m_Root = transform.root;
    7.        return m_Root;
    8.      }
    9.    }
     
  10. Mazak

    Mazak

    Joined:
    Mar 24, 2013
    Posts:
    226
    The problem is by not calling Root -> m_Root does not get initialized thus causing an error.

    In vp_FPCamera.cs

    If that is the case, then this is a better choice.

    Code (CSharp):
    1.     protected override void OnEnable()
    2.     {
    3.         base.OnEnable();
    4.  
    5.         if (m_Root == null)
    6.              m_Root = transform.root;
    7.  
    8.         vp_TargetEvent<float>.Register(Root, "CameraBombShake", OnMessage_CameraBombShake);
    9.         vp_TargetEvent<float>.Register(Root, "CameraGroundStomp", OnMessage_CameraGroundStomp);
    10.     }
    11.  
    12.  
    13.     /// <summary>
    14.     ///
    15.     /// </summary>
    16.     protected override void OnDisable()
    17.     {
    18.         base.OnDisable();
    19.  
    20.         if (m_Root == null)
    21.              m_Root = transform.root;
    22.  
    23.         vp_TargetEvent<float>.Unregister(Root, "CameraBombShake", OnMessage_CameraBombShake);
    24.         vp_TargetEvent<float>.Unregister(Root, "CameraGroundStomp", OnMessage_CameraGroundStomp);
    25.     }
    Edit: (after thinking about this a little)

    I don't see how using it as a delegate would do anything different. Its contained within the component and the root would always be the same.
    Also if what your saying is true then there is no need for Root and m_Root, one should always use transform.root and save the variable creation.
     
    Last edited: Dec 23, 2015
  11. Mazak

    Mazak

    Joined:
    Mar 24, 2013
    Posts:
    226
    Do they have a different place to put information other than here?
     
  12. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,657
    Mazak likes this.
  13. Muralidaran

    Muralidaran

    Joined:
    May 2, 2014
    Posts:
    93
    Hi again,

    So I am running into a new problem while trying to implement 1st/3rd person. The character I have for my player is setup with multiple meshes and they cannot be turned into a single mesh. I am using one of the MCS characters which use separate meshes for the body and clothes. I tried using MeshBaker to turn them into a single mesh but it looks really bad. My next plan was to have 2 body models, one that is just the torso and legs for 1st person and then the full 3rd person rig. When the player switches between 1st and 3rd the bodies turn on/off as needed. I tried entering this code into the vp_FPInput.cs

    Code (CSharp):
    1. // toggle 3rd person mode
    2.         if (vp_Input.GetButtonDown("Toggle3rdPerson"))
    3.             FPPlayer.CameraToggle3rdPerson.Send();
    4.  
    5.  
    6.  
    7.         if (toggle3rdPerson = false)
    8.         {
    9.             pbh = GetComponent<PlayerBodyHolder>();
    10.             pbh.playerBodyFirstPerson.SetActive(false);
    11.             pbh.playerBodyThirdPerson.SetActive(true);
    12.             toggle3rdPerson = true;
    13.         }
    14.         else if (toggle3rdPerson = true)
    15.         {
    16.             pbh.playerBodyFirstPerson.SetActive(true);
    17.             pbh.playerBodyThirdPerson.SetActive(false);
    18.             toggle3rdPerson = false;
    19.         }
    That is going in the protected virtual void InputCamera() section.
    With a new script on the body that just acts as a "Holder" for the models

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections.Generic;
    3. using System;
    4. using System.Collections;
    5.  
    6. public class PlayerBodyHolder : MonoBehaviour
    7. {
    8.  
    9.  
    10.     public GameObject playerBodyFirstPerson;
    11.     public GameObject playerBodyThirdPerson;
    12.  
    13.     // Use this for initialization
    14.     void Start () {
    15.    
    16.     }
    17.    
    18.     // Update is called once per frame
    19.     void Update () {
    20.    
    21.     }
    22. }
    but it keeps giving me errors in the pbh = GetComponent<PlayerBodyHolder>(); line.

    Can someone help me out please. Or if there is a better option please let me know.

    Thanks,
    Mura
     
  14. Goofy420

    Goofy420

    Joined:
    Apr 27, 2013
    Posts:
    248
    The simple answer is to use pbh = FindObjectOfType<PlayerBodyHolder>(); if you only have one instance of PlayerBodyHolder and PlayerBodyHolder isn't attached to the same GO as vp_FPInput but it also needs to be cached in Awake() or Start() GetComponent will look for PlayerBodyHolder on the same GameObject. GetComponentInChildren will look for it in all child GameObjects
     
  15. Goofy420

    Goofy420

    Joined:
    Apr 27, 2013
    Posts:
    248
    Also, it's better not to rewrite the base classes. You could just put it into the PlayerBodyHolder scripts Update function
    Edit: nvm I see you are deactivating the gameObject itself. This will cause problems since the shadow caster will only cast shadows of active objects.

    Code (CSharp):
    1.  
    2. These are not the codes you are looking for...
    3.  

    Just do it right the first time, one time and be done with it. Open the model in Max, extract the rig and delete the original rig. Select the main body mesh, select the edit mesh modifier and scroll down and click attach or attach list, then attach the other meshes to the body mesh, reapply the rig, apply a skin modifier to the new single mesh, click add, and select all the rig objects, done.
     
    Last edited: Jan 2, 2016
  16. Ghost_Interactive

    Ghost_Interactive

    Joined:
    Jul 8, 2015
    Posts:
    54
    i am having a serious problem, in editor game runs very fine but when i export in apk on mobile its very slow..
    on mobile main menu is ..ok. splash screen is ..ok but when level starts its very slow.. any gess how solve
    Thanks in advance
     
  17. Muralidaran

    Muralidaran

    Joined:
    May 2, 2014
    Posts:
    93
    @Goofy420 Awesome, thanks for the help. That worked great. Luckily my friend had Max so I got that taken care of.

    Now for anyone, I have been trying to solve this one for days with no luck. I picked up the FPS weapons pack because of the animations. Is there any way to get the animations to work on my arms? I changed out the arms and re positioned everything. The gun still animates but the arms don't move. I have tried parenting the new arms to the old ones, just replacing the mesh.... but nothing seems to work. Anyone know of a guide or something for doing that because I can't seem to find anything.

    Thanks.
     
  18. Goofy420

    Goofy420

    Joined:
    Apr 27, 2013
    Posts:
    248
    Sounds like the new Animations are animating the mesh instead of the rig. Click on the arms in your scene and then open the Animation window under the Window tab and see what's turned red (Broken) or yellow (Missing). Then rename your Bip object to the missing object.
     
  19. Goofy420

    Goofy420

    Joined:
    Apr 27, 2013
    Posts:
    248
    Run profiler and see how many Polys/Drawcalls are in your scene. It's not too difficult to reduce 1000 drawcalls to just a few using MeshBaker. I've done it myself and got a 1000 drawcall scene down to 50. You can use ProOptimizer to crunch the Polys using Max, or even better and free, use Mixamo's new Decimator.
     
  20. nosyrbllewe

    nosyrbllewe

    Joined:
    Oct 18, 2012
    Posts:
    182
    The developer says if you email him directly he will guarantee a response in 3 days. See this link: http://visionpunk.vanillaforums.com/discussion/1034/how-to-post-a-support-ticket#latest
     
  21. ashul

    ashul

    Joined:
    Aug 8, 2013
    Posts:
    40
    I can't find any documentation on how to add custom impact effects according to an objects tag. I tried adding it in the code like I did in a previous game but it's not working. A couple of the impact effects play at the same time and it looks very off. This is what I tried. I would really appreciate a tutorial for this! Thank you!

    //spawnimpact effect
    if(m_Hit.transform.tag=="Enemy")
    {
    if(m_ImpactPrefab !=null)
    vp_Utility.Instantiate(m_ImpactPrefab,m_Transform.position,m_Transform.rotation);
    }

    //spawndust effect
    if(m_Hit.transform.tag=="Concrete")
    {
    if(m_DustPrefab !=null)
    vp_Utility.Instantiate(m_DustPrefab,m_Transform.position,m_Transform.rotation);
    }

    //spawnspark effect
    if(m_Hit.transform.tag=="Metal")
    {
    if(m_SparkPrefab !=null)
    if(Random.value<m_SparkFactor)
    vp_Utility.Instantiate(m_SparkPrefab,m_Transform.position,m_Transform.rotation);
    }

    //spawndebrisparticle fx
    if(m_Hit.transform.tag=="Untagged")
    {
    if(m_DebrisPrefab !=null)
    vp_Utility.Instantiate(m_DebrisPrefab,m_Transform.position,m_Transform.rotation);
    }
     
  22. Goofy420

    Goofy420

    Joined:
    Apr 27, 2013
    Posts:
    248
    Use layers; layer 25 is "Enemy". You can add this to the DoHit function in vp_HittscanBullet within the Raycast method.
    Code (CSharp):
    1.  
    2. if (m_BloodSplatter != null &&  (m_Hit.transform.gameObject.layer == 25))
    3.                 vp_Utility.Instantiate(m_BloodSplatter, m_Hit.transform.position, m_Hit.transform.rotation);
    4.  
     
  23. vp_Tommy

    vp_Tommy

    Joined:
    Mar 1, 2015
    Posts:
    15
  24. Goofy420

    Goofy420

    Joined:
    Apr 27, 2013
    Posts:
    248
  25. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    Greetings!

    I have some very big news today. As some of you have noticed I've really put my head down lately and worked on a secret project. Version 1.6 of UFPS has been mysteriously delayed because of this. It's a great relief to finally be able to reveal what's been going on.

    In short, VisionPunk will be changing focus from asset development to purely game development late 2016. Instead of putting UFPS to sleep, we have found a great team to bring UFPS forward.

    Opsive, the developer of Third Person Controller and Behavior Designer, will take over as the publisher of UFPS : Ultimate FPS on January 20, 2016. VisionPunk will continue to work with Opsive on the 1.6, 1.7 and multiplayer releases of UFPS. Opsive and VisionPunk will collaborate in the design and planning of the UFPS 2.x release cycle.

    "But why?" you may ask. Well, VisionPunk was not originally envisioned as a "tools corporation". It's a small indie team that's had about 2-7 members at any given time, all really passionate about game development. UFPS has been a blast but our end goal was always to make games. Staying true to one's path, there needs to be a cutoff point sooner or later. UFPS has now been featured in a book, UFPS 1.6 and 1.7 are nearing release and year's end is always the best time to make a big change such as this for many practical reasons.

    At the same time, UFPS has a huge fanbase and enormous potential. There would be no sane reason for cancelling it. In searching for collaborators Opsive caught my interest. I was impressed by their Third Person Controller, Behavior Designer (with its incredible range of third party asset integrations and UFPS integration), their good support reputation and the stellar ratings and reviews of their assets. Opsive are obviously pros. Also, I have really enjoyed working with Justin at Opsive so far and I have full confidence in Opsive bringing UFPS into the future.

    So what will happen to UFPS?
    Only good things!
    • UFPS version 1.6, 1.7 and the 1.0 version of the multiplayer addon will be released.
    • UFPS 1.6 will contain a powerful new surface system.
    • UFPS 1.7 will be focused on VR with support for Oculus Rift and Gear VR.
    • Each release will have optimizations and bugfixes.
    • Over the coming months, Justin and I will also be designing UFPS 2, making sure to incorporate all the best practices that we both have learned over the last 3 years as Unity asset developers.

    Detailed info covering all of this

    To the UFPS community: thanks for all your help and passionate involvement in UFPS so far!
    UFPS 2 will be very hard to beat.

    Sincerely,

    Cal
     
    Last edited: Jan 20, 2016
  26. Tinjaw

    Tinjaw

    Joined:
    Jan 9, 2014
    Posts:
    518
    Opsive is an excellent choice. I have no fear that UFPS will not get the good care it deserves.
     
    VisionPunk, julianr and opsive like this.
  27. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,212
    You can switch it off on the bullet projectile. Require Damage Handler checked off.
     
    VisionPunk and jonfinlay like this.
  28. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    @Tinjaw: I'm glad you think so! I'm also confident of this. This discussion has some additional thoughts.
     
  29. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
  30. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,119
    Yes, the new forum is up and running. Unfortunately we weren't able to setup a redirect from the previous forum. Here is a new link to the post that Cal mentioned earlier.
     
  31. SniperED007

    SniperED007

    Joined:
    Sep 29, 2013
    Posts:
    345
    Any chance UFPS will support Windows Store?
     
  32. topofsteel

    topofsteel

    Joined:
    Dec 2, 2011
    Posts:
    999
    How can I set up a persistent mouse cursor / reticle in the center of the screen. I'm developing for WebGL and don't want users to have to deal with the 'hidden mouse cursor message'. I am planning to just use a dot or small circle. Mouse Cursor > Forced is a good start, but it's not bound to the center of the screen. If I remember correctly, there used to be a persistent reticle in an older version of UFPS, what ever happened to that? Thanks.

    Edit: I typically don't bring the demo levels into my project, and I use the Simple Player which doesn't have the Cross Hair component already attached. The cross hair component isn't actually the cursor.
     
    Last edited: Feb 21, 2016
  33. hakankaraduman

    hakankaraduman

    Joined:
    Aug 27, 2012
    Posts:
    353
    Is there a roadmap with eta s? Are you planning to improve fps + tps switch inside the ufps?
     
  34. vp_Tommy

    vp_Tommy

    Joined:
    Mar 1, 2015
    Posts:
    15
  35. cygnusprojects

    cygnusprojects

    Joined:
    Mar 13, 2011
    Posts:
    766
    Sorry if this has been asked before. There exists a vp_grab script to grab items and a vp_Itempickup to pickup stuff but is there a script to grab an item and put it into the inventory. I'm asking as my game has potions on shelfs and therefore the player will not run through them to pick them up.
     
  36. CanthanSnow

    CanthanSnow

    Joined:
    Jan 6, 2014
    Posts:
    7
    I have looked at the UFPS input manager and there doesn't seem to be an easy way to change control to be more like an MMO style. I want the "A" and "D" key to rotate the player rather than sideways walking. Is this something that needs to be done in code?
     
  37. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    Are you looking in this file?

    Assets\UFPS\Base\Scripts\Core\Utility\vp_Input.cs

    Then if you look at starting at 158 you can change as needed (This is with UFPS v1.5.2)

    public virtual void SetupDefaults( string type = "" )

    ...

    AddAxis("Vertical", KeyCode.W, KeyCode.S);
    AddAxis("Horizontal", KeyCode.D, KeyCode.A);
     
  38. 99thmonkey

    99thmonkey

    Joined:
    Aug 10, 2012
    Posts:
    525
    In the UFPS InputManager, click the Add Input Axis,
    • call it Mouse X for the Name,
    • put the Positive Key to M and the
    • Negative Key to N.
    See if that test works for you. It looks like it overrides the Mouse function though, so only the Mouse Y would work. It sounds like you are trying to use only the Keyboard (I don't play MMO).
     
  39. Mike1968

    Mike1968

    Joined:
    Aug 31, 2015
    Posts:
    6
    Hello.

    Sorry for my English.

    If Hero has AssaultRifle01 in his arms and if he will find another AssaultRifle01 as pickup that has 30 ammo, then nothing heppen. For example, if Hero had 30 ammo, after he had already picked up, he will remain the same 30 ammo, not 60.

    if in Unity the pickup change vp_ItemPickup/Item from AssaultRifle01 to MachinegunBullet, then it will be work correctly.

    But I do not know how to do it by script. In my script I check if Hero has AssaultRifle01 or no. If he already has AssaultRifle01, I want to add him 30 ammo.

    Help me, please.

    Thank you.
     
  40. 99thmonkey

    99thmonkey

    Joined:
    Aug 10, 2012
    Posts:
    525
    @Mike1968 In UFPS/Base/Content/Prefabs/Pickups/WeaponsHD/Ammo there is a prefab called PickupAssaultRifle01Clip. Use that for ammo pickups for that weapon.

    For future, notice how it has a vp_ItemPickup with the Item matching the bullets the weapon you are using has.
     
  41. Mike1968

    Mike1968

    Joined:
    Aug 31, 2015
    Posts:
    6
    Thank you, 99thmonkey!

    But I know the prefab PickupAssaultRifle01Clip. I'd like that:

    1. If Hero does not have AssaultRifle01 to receive it.
    2. If Hero has AssaultRifle01 alredy that his ammo increases.
     
  42. knotFF

    knotFF

    Joined:
    Apr 13, 2013
    Posts:
    66
    I am getting this error, when i am trying to switch from a Player character (prefab) that does not have a weapon to one that does:
    Code (CSharp):
    1. MissingReferenceException: The object of type 'vp_FPWeapon' has been destroyed but you are still trying to access it.
    2. Your script should either check if it is null or you should not destroy the object.
    3. vp_PlayerInventory.MissingIdentifierError (Int32 weaponIndex) (at Assets/UFPS/Base/Scripts/Gameplay/Player/vp_PlayerInventory.cs:276)
    4. vp_PlayerInventory.CanStart_SetWeapon () (at Assets/UFPS/Base/Scripts/Gameplay/Player/vp_PlayerInventory.cs:744)
    5. vp_Activity.TryStart (Boolean startIfAllowed) (at Assets/UFPS/Base/Scripts/Core/EventSystem/vp_Activity.cs:259)
    6. vp_Activity`1[System.Int32].TryStart[Int32] (Int32 argument) (at Assets/UFPS/Base/Scripts/Core/EventSystem/vp_Activity.cs:429)
    7. vp_WeaponHandler.<InitWeapon>m__9D () (at Assets/UFPS/Base/Scripts/Gameplay/Player/vp_WeaponHandler.cs:420)
    8. vp_Timer+Event.Execute () (at Assets/UFPS/Base/Scripts/Core/Utility/vp_Timer.cs:521)
    9. vp_Timer.Update () (at Assets/UFPS/Base/Scripts/Core/Utility/vp_Timer.cs:153)
     
    Last edited: Mar 8, 2016
  43. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    As you may have noted, UFPS has recently been acquired by Opsive. All UFPS support now takes place in the official UFPS forum here:
    http://www.opsive.com/assets/UFPS/forum/

    For general info about the various ways of getting help with UFPS, please see this page:
    http://opsive.com/assets/UFPS/help/

    For more detailed support info, please see this thread:
    http://opsive.com/assets/UFPS/forum/discussion/1034/how-to-post-a-support-ticket

    Sorry for the inconvenience and thanks for your interest in UFPS!
     
Thread Status:
Not open for further replies.