Search Unity

Realistic FPS Prefab [RELEASED]

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

  1. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Sorry, I don't know what's happening then. This is the entire script:
    Code (csharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class GrenadeBelt : MonoBehaviour {
    5.  
    6.     public GameObject grenadePrefab;
    7.  
    8.     public int grenadesLeft = 3;
    9.  
    10.     public KeyCode key = KeyCode.G;
    11.  
    12.     public float throwPower = 100;
    13.  
    14.     private void Update() {
    15.         if (Input.GetKeyDown(key) && (grenadesLeft > 0)) {
    16.             ThrowGrenade();
    17.         }
    18.     }
    19.  
    20.     private void ThrowGrenade() {
    21.         grenadesLeft--;
    22.         var player = GameObject.FindGameObjectWithTag("Player");
    23.         var clone = Instantiate(grenadePrefab, player.transform.position + player.transform.forward, player.transform.rotation) as GameObject;
    24.         clone.SetActive(true);
    25.         var rb = clone.GetComponent<Rigidbody>();
    26.         rb.AddForce(clone.transform.forward * throwPower + clone.transform.up * throwPower);
    27.     }
    28. }
    The ThrowGrenade() method decreases grenadesLeft (line 21) and instantiates the grenade (line 23). If it correctly instantiates the grenade, it should also decrease grenadesLeft.
     
  2. Defcon44

    Defcon44

    Joined:
    Aug 19, 2013
    Posts:
    400
    You don't need to be sorry ;)

    Can we ... change the "transform.forward" by "transform.backward" just for look if the grenade is launched in front of the player ?
     
  3. Gua

    Gua

    Joined:
    Oct 29, 2012
    Posts:
    455
    I have no idea what happened, but now it work fine everywhere. Thanks!
     
    Last edited: Mar 14, 2015
  4. Gua

    Gua

    Joined:
    Oct 29, 2012
    Posts:
    455
     
    Last edited: Mar 14, 2015
  5. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    That might work, but I recommend trying to figure out why the Grenade Test scene isn't working correctly. It should decrease the number of grenades left, and it should throw forward, not backward.
     
  6. NeuroToxin-Studios

    NeuroToxin-Studios

    Joined:
    Dec 7, 2014
    Posts:
    68
    Thank you very much for the run down of pros and cons Gua :) I am definitely going to use RFPS for my project
     
  7. Gua

    Gua

    Joined:
    Oct 29, 2012
    Posts:
    455
    You should know, that both plugins don't provide ability to save and load progress. This plugin can help with saving and loading for both RFPS and UFPS. https://www.assetstore.unity3d.com/en/#!/content/11672 but it will save and load only stuff related to your character. So you still need to write save & load logic for other stuff and other objects in a world.
     
  8. Defcon44

    Defcon44

    Joined:
    Aug 19, 2013
    Posts:
    400
    How i can do that :s ?
     
  9. NeuroToxin-Studios

    NeuroToxin-Studios

    Joined:
    Dec 7, 2014
    Posts:
    68
    Just curious but how do I download the Boootcamp demo? I want to see how a few bits work however it has been taken off the store and I cannot find it for the life of me
     
  10. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Thanks for the mention, @Gua ! You can save other stuff, too. Just add Persistent Data components to them. It comes with persistent data components for position (in case an object moves) and destruction (if you kill, blow up, or pick up something). There's also a template in the Scripts folder that you can fill in to save other data. If you have S-Inventory, the updated support package (on the Pixel Crushers download site) and the upcoming v1.4.8 have persistent data components for item pickups, item groups (containers), and vendor inventory.

    Test a new, empty project. Import RFPS and the grenade test package. If it works, compare it with your project.
     
  11. giraffe1

    giraffe1

    Joined:
    Nov 1, 2014
    Posts:
    302
    I am consider purchasing this asset for some time now. I noticed there have not been any updates for this asset for over 8 months. Are you planning on updating this asset for unity 5? What about simple feature like grenades and 1st person which seem easy to implement in a matter of days at most. Are you doing any significant updates considering it has been so long. I checked out the new faction system demo and it doesn't really look much different from the original faction system demo your released a while ago. Has this asset been semi-abondoned or something because I don't see much progress or even basic maintainence going on.
     
  12. Gua

    Gua

    Joined:
    Oct 29, 2012
    Posts:
    455
    @TonyLi That is an awesome news! I will defiantly look into it. Hope it has playmaker support.
     
  13. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    The Dialogue System has PlayMaker support, and you can use PlayMaker to store and retrieve data from Lua. But if you only need to record where things are and what's gone, you don't need to use PlayMaker; just add persistent position and persistent destructible components.

    The PlayMaker support doesn't raise PlayMaker events when saving and loading, but you could do that in a couple lines using the C# PersistentDataTemplate. I've added it to my to-do list for v1.4.9.
     
  14. Gua

    Gua

    Joined:
    Oct 29, 2012
    Posts:
    455
    For everyone who's using Playmaker. If you've edited smoothlook script and you still have a problem with mouse cursor. You should find PlayMakerGUI object in a scene, check and uncheck Control Mouse Cursor bool. This should fix the problem.
     
  15. Gua

    Gua

    Joined:
    Oct 29, 2012
    Posts:
    455
    @TonyLi Do you mean, you will try to implement possibility to load gameobject playmaker script "state"? I mean put it in a state it was in when game was saved. For example, if object was in a state of moving to some position when you saved the game, when you load a game it will set that script in a moving state despite the fact that it is not a start state?
     
    Last edited: Mar 16, 2015
  16. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    I'll try to make it more general.

    When you load a game or change levels in RFPS, the Dialogue System sends an "apply saved Lua data" message to all of the persistent data components in the scene. For the player, for example, this restores the position, stats, and equipment.

    I'll also have it raise an "apply saved Lua data" PlayMaker event that your PlayMaker FSMs can choose to listen for. Then your FSM can do whatever you specify, such as changing to the moving state.

    There is also a corresponding "save data to Lua" message. The Dialogue System sends this before saving a game or changing levels. I'll have it also raise an equivalent PlayMaker event.
     
    Gua likes this.
  17. LAUDSOFT

    LAUDSOFT

    Joined:
    Jan 5, 2014
    Posts:
    102
    I guess more or less everyone here knows, but for those who don't, I got this reply from the developer yesterday:

    " Work is currently underway on improving compatibility of the Realistic FPS Prefab with Unity 5. The development build we are currently working with is close to release, as there are just a few more minor issues to sort out. The next version of the asset will also include some new features and implementation of Unity's navmesh for NPC pathfinding."
     
    Mikeedee, sluice and Gua like this.
  18. Gua

    Gua

    Joined:
    Oct 29, 2012
    Posts:
    455
    If understood it correctly, this sound super awesome! When I was thinking about building save system, I've came to the conclusion that this is a very hard non trivial task for a Playmaker user, cause there is no serialization and some other complications. I've seen couple people that basically quit hobby game development when they understood how hard it is to make a decent save system for a game. Thank you for making our life much easier! You're basically a life savior or at least indie games savior ;)
     
  19. OneShotGG

    OneShotGG

    Joined:
    Nov 16, 2012
    Posts:
    225
    shameless plug (promise this will be the last time)..gonna just put this right here for you rfps guys :p

     
  20. sluice

    sluice

    Joined:
    Jan 31, 2014
    Posts:
    416
    @OneShotGG Nah, man keep 'em coming, for what I'm concern. This is sweet.
    The Katana looks fun to use! :D
     
  21. OneShotGG

    OneShotGG

    Joined:
    Nov 16, 2012
    Posts:
    225
    heh, just wait till I add the blood effects in... :p

    Trying to decide if I want to integrate blood fx directly into the system or leave it up to the client using the event system(I would still give an example if I chose to just use the event system).

    Ohh, im gonna include a turn based framework once Bloody Mess reaches the Full Release status. If you have ever used VATS in Fallout 3 you know what I am talking about. :)
     
  22. sluice

    sluice

    Joined:
    Jan 31, 2014
    Posts:
    416
    I personally think it would be neat if it was somehow implemented in the system, as long as it can easily be toggle and changed.

    Ahhh.. Fallout 3.. good memories! Talking about it: http://www.kdramastars.com/articles/78268/20150316/fallout-4-release-date.htm :rolleyes:
     
  23. OneShotGG

    OneShotGG

    Joined:
    Nov 16, 2012
    Posts:
    225
  24. RealAspireGames

    RealAspireGames

    Joined:
    Dec 24, 2013
    Posts:
    265
    Hey thought I might ask on this forum post as well! Recently I have purchased HUD waypoint system and I am having trouble getting it working with the RFPSP asset. If anyone has had success on getting HUD waypoint system to work with this support would be greatly appreciated thank you! :D
     
  25. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Did you set the waypoint's On Screen Widget and Off Screen Widget? I just ran a test and forgot to do this at first, and I had the same problem you did. But once I set them, it works fine in RFPS. (See the HUD Waypoint thread.)
     
    RealAspireGames likes this.
  26. RealAspireGames

    RealAspireGames

    Joined:
    Dec 24, 2013
    Posts:
    265
    Yea I set them to distance is that what you set them too?
     
  27. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Yup, that's what I ended up on, but I tested a couple settings to get a feel for the differences. I'll post a suggestion in the HUD Waypoint thread.
     
  28. OneShotGG

    OneShotGG

    Joined:
    Nov 16, 2012
    Posts:
    225
    Hey Tony, can Dialogue System do Skyrim/Fallout style scene state saving and loading?
     
  29. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Short answer: Yes.

    Long answer: Yes, but it only saves the data into a big string, which can optionally be saved to PlayerPrefs. You have to provide your own functionality if you want to write the string to a disk file or MySQL database or wherever you want to save it. The Dialogue System also provides a rudimentary menu to save and load games from PlayerPrefs, but it's up to you to implement any fancier kind of UI. You can read more about it here: Save System.

    Saving a game works by sending an OnRecordPersistentData message to all GameObjects in the scene. Scripts can handle this message to save information into the Dialogue System's Lua environment. The saved game string contains the contents of the Lua environment. (The Lua environment also contains the Dialogue System's core data, such as the states of all quests.)

    To load a saved game, the Dialogue System applies the saved game string back into the Lua environment, then sends OnApplyPersistentData to all GameObjects in the scene so the scripts can restore their state to what they previously recorded.

    The Dialogue System comes with "persistent data" scripts to save GameObjects' positions and whether they're active, inactive, or destroyed. The RFPS support package also comes with a persistent data script to save the player's info, such as weapons, health, thirst, ammo, and what scene the player's in. If the saved game was in a different scene, it loads that scene before sending OnApplyPersistentData. You can also write your own persistent data scripts to save other information; there's a template script with two methods (OnRecordPersistentData and OnApplyPersistentData) that you can fill in to save whatever you need to.

    The S-Inventory + RFPS support package also has persistent data scripts for S-Inventory containers, vendors, etc.
     
  30. OneShotGG

    OneShotGG

    Joined:
    Nov 16, 2012
    Posts:
    225
    So, I am going to support positional based grenade damage with bloody mess and, since I love rfps so much, I am just gonna write a grenade weapon behavior script to go with it.

    What I mean by positional based grenade damage is this:

    When the grenade explodes it will search the area and find all gameobjects that can be effected and return their distance from the explosion. It will then cast a Ray from the explosion position to each object it found. If nothing is in the way of that Ray it will then apply damage to that limb based on distance from the explosion.

    With this method I hope to achieve 2 things, grenade dismemberment that doesn't look pre-canned because body parts can "protect" others and the use of cover to avoid damage.

    Hopefully, what I have described is not too fps hungry through for mobile users (since it would be Ray casting to multiple body parts on multiple enemies).

    If it is I will give the option to fake something similar by only dismembered the 3 closest limbs or something. And just using a single Ray cast to see if the explosion is obstructed.

    This would be given to you great people for free of coarse :)
     
    Last edited: Mar 19, 2015
    TonyLi likes this.
  31. OneShotGG

    OneShotGG

    Joined:
    Nov 16, 2012
    Posts:
    225
    Thanks for the reply Tony. We were already, going to use dialogue system for our upcoming fps game, but now I feel like we could use it for the big game we are working towards (which would require what I asked).
     
    RealAspireGames likes this.
  32. RealAspireGames

    RealAspireGames

    Joined:
    Dec 24, 2013
    Posts:
    265
    I highly recommend Dialog System. Currently my team and I are working with it on an upcoming RPG game. works flawlessly! :D
     
    TonyLi likes this.
  33. llJIMBOBll

    llJIMBOBll

    Joined:
    Aug 23, 2014
    Posts:
    578
    dialogue is on my to buy next list :)
     
  34. OneShotGG

    OneShotGG

    Joined:
    Nov 16, 2012
    Posts:
    225
    Full Bloody Mess web demo video with all 6 example scenes.



    If all goes well I will have the web demo up for you guys to mess with tomorrow.
     
    Defcon44 likes this.
  35. NeuroToxin-Studios

    NeuroToxin-Studios

    Joined:
    Dec 7, 2014
    Posts:
    68
    Daaam that looks cool, is there a way to make it so some enemys can only lose certain body parts and some can lose all? also is there a way to apply it to other types of creatures with more body parts etc?
     
  36. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    BTW, for future readers who might have the same issue -- this issue was bugging me (especially since I plan to use HUD Waypoint in one of my own projects), but we figured it out. Set the Waypoint System GameObject and the widget prefabs to layer 14 (the GUI layer) so RFPS's WorldRecenter script doesn't mess with them.
     
  37. OneShotGG

    OneShotGG

    Joined:
    Nov 16, 2012
    Posts:
    225
    Yeah, you can actually do that multiple ways. One way is to turn off limb or head dismemberment (they are toggles). Another way is to set a limbs heath way above the characters health.

    Right now I have support for 16 different limbs and 1 critical spot. Head, right hand, left hand, right leg, left leg, right upper arm, left upper arm, right forearm, left forearm, upper body, lower body, extra 1, extra 2, extra 3 and extra 4

    Adding more than that is possible with a little scripting though. If you need to rename things that is possible too but requires make some small code changes as well.
     
  38. NeuroToxin-Studios

    NeuroToxin-Studios

    Joined:
    Dec 7, 2014
    Posts:
    68
    That is sweet, I will definitely be purchasing this when it is released
     
  39. OneShotGG

    OneShotGG

    Joined:
    Nov 16, 2012
    Posts:
    225
  40. Takahama

    Takahama

    Joined:
    Feb 18, 2014
    Posts:
    169
    Hi!
    i have some problems with character :/
    i cant enter trigger collider while facing to it. Only i can enter it by walking backwards or walking to left or right!
    Please help me :<
     
  41. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Hi @Takahama - While playing, select your !!!FPS Player and !!!FPS Weapons GameObjects in the hierarchy. Then watch them in the Scene view. The colliders and triggers will have green outline gizmos. Is another collider, such as a collider on a weapon that juts forward in front of the player, preventing you from entering the collider when you walk forward?
     
  42. Takahama

    Takahama

    Joined:
    Feb 18, 2014
    Posts:
    169
    Problem solved thanks for @TonyLi for pro tips
    issue is that : On the FPS Rigitbody Walker in inspector, at the bottom you see Clip Mask. Uncheck "Default" and it works :)
     
  43. pushingpandas

    pushingpandas

    Joined:
    Jan 12, 2013
    Posts:
    1,419
    Has RFPS reach EOL? No updates or new features since MONTHS. Whats up?!?
     
  44. OneShotGG

    OneShotGG

    Joined:
    Nov 16, 2012
    Posts:
    225
    There was a post a couple days ago. Azuline has full body awareness and a few more features coming. Regardless, even if it is EOL there isn't much Rfps is missing that other shooter assets have (or that you cannot easily script yourself). It's the easiest fps system out there to work with. Heck I turned it into a tps system a while back and it only took a day.

    Grenades and full body awareness are the only things I can think of that are missing and one of those is coming soon.

    IMO, UFPS has wasted a year implementing multiplayer into their asset all the while ignoring major bugs and missing features (you still can't drop a weapon for example). Especially since we live in a post Bolt world.
     
    Gua likes this.
  45. pushingpandas

    pushingpandas

    Joined:
    Jan 12, 2013
    Posts:
    1,419
    Well thanks for the information.
     
  46. RealAspireGames

    RealAspireGames

    Joined:
    Dec 24, 2013
    Posts:
    265
    Anyone know how I would create a health bar instead of using the health text that they provide?
     
  47. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Hi @godofwarfare115 - Edit HealthText.cs. As a test, I added a Unity UI slider and named it "Healthbar". Then I changed HealthText.cs to this:
    Code (csharp):
    1. //HealthText.cs by Azuline Studios© All Rights Reserved
    2. using UnityEngine;
    3. using System.Collections;
    4.  
    5. public class HealthText : MonoBehaviour {
    6.     //draw health amount on screen
    7.     public float healthGui;
    8.     private float oldHealthGui = -512;
    9.     public Color textColor;
    10.     public float horizontalOffset = 0.0425f;
    11.     public float verticalOffset = 0.075f;
    12.     public float fontScale = 0.032f;
    13.     public bool showNegativeHP = true;
    14.    
    15.     private UnityEngine.UI.Slider slider;
    16.    
    17.     void Start(){
    18.         slider = GameObject.Find("Healthbar").GetComponent<UnityEngine.UI.Slider>();
    19.         guiText.enabled = false;
    20.         oldHealthGui = -512;
    21.     }
    22.    
    23.     void Update (){
    24.         //only update GUIText if value to be displayed has changed
    25.         if(healthGui != oldHealthGui){
    26.             slider.value = healthGui / 100;
    27.             oldHealthGui = healthGui;
    28.         }
    29.     }
    30. }
     
  48. Takahama

    Takahama

    Joined:
    Feb 18, 2014
    Posts:
    169
    llJIMBOBll likes this.
  49. sluice

    sluice

    Joined:
    Jan 31, 2014
    Posts:
    416
    Azuline last message was 1 month ago (not a couple of days..;)). Anyone heard of him, since..?
     
  50. llJIMBOBll

    llJIMBOBll

    Joined:
    Aug 23, 2014
    Posts:
    578
    He said same thing in aug 2014 with same demo but without legs,

    ''As for news on the next update, progress is going well. Faction AI has been implemented with 3 faction types so far:Soldiers(#1) = friendly to player & attacks factions 2 & 3, Aliens(#2) = hostile to player and attacks factions 1 & 3, andZombies(#3) = hostile to player and attacks factions 1 & 2. A non aggressive civilian faction will also be added. We're planning on implementing friendly NPC following behavior and a wave spawning manager as well. Improvements to note about the new AI: NPCs can hear unsilenced player attacks and will investigate the sound. They also try to avoid friendly fire. Here is a web player demo with the 3 interacting factions:''

    Realistic FPS Prefab 1.22b Web Demo

    Azuline Studios, Aug 19, 2014

    So maybe in 4 or 5 months xd