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

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,670
    Try closing AI.cs and reloading it in your editor. If it asks to fix the line endings, answer 'yes'. Unity may be reporting wrong line numbers. Also look for other errors or warnings before that one. It doesn't make sense that that line would be the first error. Good luck!
     
  2. Deki3d-Virus

    Deki3d-Virus

    Joined:
    Dec 11, 2012
    Posts:
    25
    line endings are ok i dont know how to fix when i run out of enemy sight enemy nav mesh stop , run animation continue?
     
  3. Hormic

    Hormic

    Joined:
    Aug 12, 2014
    Posts:
    251
    I would like to have the USE functionality on the Fire (Mouse button 0) Key.
    But only when no weapon is currently used by the player. (which is mostly the case in my game i guess)
    So how can i check if a weapon is in use currently or not and how can i change the input assignment accordingly?
    Thanks for hints in the right direction. :)
     
  4. TauseefCVS

    TauseefCVS

    Joined:
    Mar 28, 2016
    Posts:
    15
    hi Guys!
    I am trying to set "Realistic FPS " in moving helicopter but its drop from the helicopter and make the effect of helicopter physic
    can anyone tell me how I am resolve the issue of that .
     
  5. Deki3d-Virus

    Deki3d-Virus

    Joined:
    Dec 11, 2012
    Posts:
    25
    I finaly Fix now it is working :)
     
  6. deiong

    deiong

    Joined:
    May 24, 2013
    Posts:
    79
    i am thinking of purchasing, how hard would it be to change the way it works, I'm looking to use it to create a paintball game. so ai wouldn't die, fall over they would just be marked with paint where they got shot. and cease playing. and of course no bullets but what it hits it paints a small colored blob.
     
  7. Deki3d-Virus

    Deki3d-Virus

    Joined:
    Dec 11, 2012
    Posts:
    25
    It is not hard u just need to modify Character Damage script
     
  8. GWStudio

    GWStudio

    Joined:
    Sep 27, 2016
    Posts:
    109
    Hi everyone how can I do rocket launcher .. any tutorials to do it ?
     
  9. TauseefCVS

    TauseefCVS

    Joined:
    Mar 28, 2016
    Posts:
    15
    you can see this tutorial

     
    Deleted User likes this.
  10. Arealjighead

    Arealjighead

    Joined:
    Apr 7, 2017
    Posts:
    32
    @deiong just set HP for Ai/OP low & use Mecanim. Just change the die animations to "walking off" . As for the hit markers, you'll need a decal system
     
    Last edited: Apr 21, 2017
  11. Deleted User

    Deleted User

    Guest

    @o0neza0o You could try setting the sphere's layer to IgnoreRaycast. That's how the trigger volumes work in the demo scene.


    @Takahama, if you set the Hit Check Dist variable of ArrowObject.cs script to a higher value, the arrow object will be better able to detect collisions at higher speeds. Also, you will need to create a new projectile object (duplicate the arrow prefab) then add it to the object pool. In the WeaponBehavior.cs component for your weapon that will be firing the faster projectiles, you will need to update the Projectile Pool Index to match the array list index of the new projectile object you added to the Object Pooling Manager, with the same settings as the arrow prefab. I just did a test with this and the arrows could be fired from the MP5 at a higher velocity/lower mass and still detect collisions. Feel free to send an email if you need more help.


    @emperor12321 This sounds like it might be an input issue. You could try creating a separate project with just the off-road pickup asset and checking the input manager to see what it's expecting to be there, then merging it with the Realistic FPS Prefab's input manager settings as a starting point.


    @jons190 Good to hear you've optimized your scene. One of the biggest priorities for the Realistic FPS Prefab is performance, but the demo scene does have a lot of eye-candy for desktop systems. Other things you can try are disabling shadows, simplifying weapon impact particle effects, and using lower polygon models.


    @Hormic The default scripts check if the player is unarmed by getting a WeaponBehavior reference of the current weapon and checking the unarmed variable like this:

    Code (CSharp):
    1. if(WeaponBehaviorComponent.unarmed){
    2.     //do unarmed actions
    3. }
    This might be a good place to start. PlayerWeapons.cs also holds a reference to the WeaponBehavior.cs component of the currently equipped weapon (WeaponBehaviorComponent) whose "unarmed" variable you could check. PlayerWeapons.cs also has an integer variable called currentWeapon which equals 0 when the player is unarmed.


    @TauseefCVS The Realistic FPS Prefab player prefab is a physics object, so it will need to be supported by a moving rigidbody and collider platform on the helicopter. If that's not an option, you could release the main camera with one of the functions in MovePlayerAndCamera.cs. ReleaseMainCamera() would allow the main camera to be attached to the helicopter and move without physics, though the RFPSP features like firing/reloading would not be available. Hope that gives you some ideas.


    @deiong Arealjighead has the right idea. You could also modify AI.cs to change their behavior when hit with a paintball, such as walking off the course when hit.


    Version 1.26 of the Realistic FPS Prefab is available for download now, which fixes a few things and upgrades the navmesh agent calls for Unity 5.6. The GetTransformInfoExpectUpToDate console error should be resolved soon in a future Unity release. Thanks for your patience.
     
    Last edited by a moderator: Apr 21, 2017
  12. TauseefCVS

    TauseefCVS

    Joined:
    Mar 28, 2016
    Posts:
    15
    @Azuline-Studios
    when helicopter is moving on air and I uncheck the removePrefabRoot then "Realistic FPS" is not break from root then weapon are not aim and show the weapon on camera
    when I checked then then "Realistic FPS" is break from root but player dropdown from the air how I can set the "removePrefabRoot" where the player not break the root and not drop from air ?
     
  13. muhammadadnan0075

    muhammadadnan0075

    Joined:
    Dec 17, 2016
    Posts:
    14
    Hello everyone.
    Is it possible to use Android's Rotation Vector (Gyroscope + Orientation) sensor to control the weapon camera?
    As i see weapon camera or rather the whole player is controlled by Input Axis "Mouse X" and "Mouse Y" . Rotation vector api that I'm using gives me the quaternion x y z and w with values between (-1,1) same as input Axis. I want to control the camera look with Rotation Vector Sensor. I tried to do
    InputControl.lookX = - RotationVector.rotation.y and InputControl.lookY=RotationVector.rotation.x

    It kinda gave the camera a weird movement but I want to make the whole thing work with Sensor. I hope you got my point.
    EDIT: if my question isn't clear then let's say if i attach my rotation vector script to a camera in scene and call
    gameobject.transform.rotation = RotationVector.rotation;
    And i build this for Android then I can rotate the camera by tilting or pitching my phone.
    That's what I want for the Weapon Camera.
     
    Last edited: Apr 22, 2017
  14. webgrapx

    webgrapx

    Joined:
    Jul 21, 2015
    Posts:
    22
    Regards, someone has integrated it with FPS Weapons, thank you.
     
  15. o0neza0o

    o0neza0o

    Joined:
    Sep 6, 2015
    Posts:
    165
    Okay, few questions. I'm trying to get the AI to not be as well stupid XD. I want the AI to try and flank the player or even when the player shoots at the enemy close by to at least attack the player.

    Second question how do I get the slo mo thing to work as it appears because of my pause script it doesn't work but it works when i take off the pause script?

    Thirdly i'm trying to create objectives but they don't seem to be working that well :/.
     
  16. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    Is there a setting for adjusting the max step height so that the player can move up stairs easier?
     
  17. Arealjighead

    Arealjighead

    Joined:
    Apr 7, 2017
    Posts:
    32
    @magique Yes.Click on FPS_Main, & in FPS Player there is a section called Movement Options. Just adjust the Slope Slider up to a higher angle
     
  18. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    I adjusted Slope Limit to maximum and it doesn't change anything. It still won't go up the steps.
     
  19. Arealjighead

    Arealjighead

    Joined:
    Apr 7, 2017
    Posts:
    32
    @magique hmm. im not sure then.Is the 1st step protruding really high off the ground? maybe the steps are to large. you could always create a box collider at the angle of the steps in a new child game object in the stairs so you can adjust the angle properly
     
  20. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    I can easily add another collider, but the standard Unity FPS controller works in this scenario so I'd rather not have to add extra colliders if I don't have to.
     
  21. o0neza0o

    o0neza0o

    Joined:
    Sep 6, 2015
    Posts:
    165
    Oh guys, btw i am doing a closed alpha event and would prefer if you guys could help test the game as i would much rather your opinion. I am customizing the rfps asset to fit what i need it to but here is the site and the trailer:

    https://alternategames.wordpress.com

     
    Deleted User likes this.
  22. egem2015

    egem2015

    Joined:
    Oct 27, 2015
    Posts:
    84
    Hi again

    i am trying to use this monster asset But it has a lot of things and i need an one thing can you help me?

    ***** i want to have MP5 weapon at the start automatically and never change? ***********

    i have tried to do with deleting other weapons but i did not achieve this.

    how can i achieve this? ***** i want to have MP5 weapon at the start automatically and never change? ***********

    thanks in advance.

    King Regards.
     
  23. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Save System for Realistic FPS Prefab On Sale 30% Off

    The Save System for Realistic FPS Prefab is on sale for 30% off during the Asset Store's Biggest Sale Ever. If you want to save player info, NPCs, pickups, and destructibles across scenes and in saved games, this is a really simple, lightweight, scripting-free solution. And it's only $7 right now! :)

    (If you have the Dialogue System for Unity, you don't need the Save System for RFPSP because the Dialogue System's RFPSP Support package already comes with save capability.)
     
    Deleted User likes this.
  24. muhammadadnan0075

    muhammadadnan0075

    Joined:
    Dec 17, 2016
    Posts:
    14
    Hello Everyone.
    i just updated RFPS to 1.26 and i'm getting this strange error randomly in any scecne in Unity 5.6.0f3.
    "In order to call GetTransformInfoExpectUpToDate, RendererUpdateManager.UpdateAll must be called first."
    EDIT: i just found that this is Unity's bug in 5.6.0f3.
     
  25. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    I can't remember exactly, but I believe if you select the weapon in the project hierarchy that there is a checkbox to give the player the weapon at startup. You also have to set the amount of ammo as well.
     
    TonyLi likes this.
  26. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    @egem2015 - Drill down into FPS Main > FPS Weapons > ... MP5. It's the Have Weapon checkbox.
     
  27. HermesonBF

    HermesonBF

    Joined:
    Jun 21, 2016
    Posts:
    22
    Hello everyone! I'm using RFPSP in setting up a FPS for mobile game, however I'll need Local Multiplayer, has anyone here done it in RFPSP? I did not find anything about it in Asset's description.
     
  28. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Hi! Local multiplayer usually means a shared or split screen, like Goldeneye, Smash Bros, or TowerFall. If you mean that kind of game (if it will even fit on a mobile screen), it will require some customization of the RFPSP scripts because they assume a single player prefab controls Camera.main (the Camera GameObject whose tag is MainCamera) among other things. If you mean networked multiplayer on separate clients (e.g., separate mobile devices), it may be a tiny bit easier in some respects (the player prefab) but even harder in others (connecting, syncing, joining, etc.). To very roughly paraphrase Daniel Cook's GDC17 talk as I did in this post: It's 2-10x harder than making a single player game. Finish 4-5 single-player games first, develop a strong technical background, and make some simpler (non-RFPS) multiplayer prototypes. Then you'll be in a much better position to make a multiplayer shooter.

    In the meantime, RFPSP has lots of potential for making great single player games. There's also a post on Rewired integration a couples pages back in this thread if you want to use Rewired's mobile joystick and force feedback features.
     
    Mark_01, jons190 and Weblox like this.
  29. HermesonBF

    HermesonBF

    Joined:
    Jun 21, 2016
    Posts:
    22
    Sorry, I was referring to a Multiplayer game on the local network, thanks for the reply.
     
  30. egem2015

    egem2015

    Joined:
    Oct 27, 2015
    Posts:
    84
    Hi

    thanks for your great support.

    now i have an another problem.

    Problem is

    ****My weapons are firing automatically without firing when scene is loading.****

    what can the problem be?

    thanks in advance.

    King Regards.
     
  31. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    I'm getting an error when my player blocks an attack with the Katana.

    MissingComponentException: There is no 'ParticleSystem' attached to the "Impact_Metal" game object, but a script is trying to access it.
    You probably need to add a ParticleSystem to the game object "Impact_Metal". Or your script needs to check if the component is attached before using it.
    FPSPlayer.ApplyDamage (Single damage, UnityEngine.Transform attacker, Boolean isMeleeAttack) (at Assets/RFPSP/Scripts/Player/FPSPlayer.cs:1158)
     
  32. o0neza0o

    o0neza0o

    Joined:
    Sep 6, 2015
    Posts:
    165
    check if the particle system is attached to the Impact_Metal object
     
  33. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    There are 4 particles effects attached to it:

    sparks
    hit spark
    flash
    spark bounce
     
  34. o0neza0o

    o0neza0o

    Joined:
    Sep 6, 2015
    Posts:
    165
    hmm, thats weird. I'm not entirely sure then.
     
  35. Deleted User

    Deleted User

    Guest

    @TauseefCVS It sounds like you're on the right track, the FPS Player object is the only object that you need to attach or place on the helicopter and the other prefab objects will follow it, whether or not the Remove Prefab Root is checked. Hope that gives you some ideas.


    @muhammadadnan0075 You're right about using the Mouse X and Mouse Y values for rotating the FPS Camera view. You may need to do a conversion to euler angle input if your sensor input is in the form of a quaternion. This can be done with the Quaternion.eulerAngles function. This should give you the euler angle representation of the quaternion sensor rotation which you can then send to Mouse X and Mouse Y.

    EDIT: @muhammadadnan0075 Actually, what I mentioned above is probably not all that you need. It depends on how the gyro input is being reported. If it's a 0 to 1 value, then sending it to Mouse X and Mouse Y would work, but if it's a quaternion rotation, you might need to calculate the quaternion rotation change per frame for X and Y axes (delta rotation, usually around 0 to 1) and send the result to Mouse X and Mouse Y. Another option is to open SmoothMouseLook.cs and use the Quaternion.eulerAngle X and Y results of the gyro rotation quaternion as the rotationX and rotationY values which are the actual camera angles calculated in SmoothMouseLook.cs. Sorry I don't have a more specific example on how to do this, as I'd need to see your code and the gyro rotation output.


    @o0neza0o The AI could have some new evasion behaviors added in AI.cs. The new code would go in the AttackTarget() function, and may monitor the NPC's health or tactical situation and suspend their shooting/melee behavior while they seek cover or a new position, then resume their shooting/melee attack. Will probably add this feature in a future version, as well as random wandering and fleeing behaviors.

    It sounds like the pause script is setting the Time.timescale to 1.0 in an update loop when not paused, which would override the dynamic changing of timescale when in slow motion. When the game is paused in FPSPlayer.cs with this code:
    Code (CSharp):
    1.         if(InputComponent.pausePress && !menuDisplayed){
    2.             if(Time.timeScale > 0.0f){
    3.                 paused = true;
    4.                 pauseTime = Time.timeScale;
    5.                 Time.timeScale = 0.0f;
    6.             }else{
    7.                 paused = false;
    8.                 Time.timeScale = pauseTime;
    9.             }
    10.         }
    ...what it's doing with the pauseTime variable is remembering the speed of time when starting the pause and resuming that speed after pausing (Time.timescale = 0.0 is "paused"). What you probably need to do is change your pause script's code for managing timescale to something like this.

    It depends on the type of objectives you're trying to create. For objectives, you will need to track the player's progress towards the objective, display that information to the player, then change the game scenario when completing or failing the objectives (restart scene, next scene, open new area, etc). To track progress towards objectives, you will need to edit some of the default scripts, such as CharacterDamage.cs, when an NPC dies you could do something like enemyCount ++ and then set an objective to be complete when enemyCount exceeds the goal number. For displaying the objective information to the player, you could look at some of the HUD rendering code in the scripts and expand upon it. Hope that helps.


    @magique Arealjighead is right about adding invisible ramp colliders set to the Player Clip layer over steeper steps. This works because the Realistic FPS Prefab is a physics-driven player controller. What's happening when you can't go up bigger stairs is that the default code is trying to push a ball (bottom of player capsule) horizontally against the stair's vertical face without adding any vertical force to help roll over the top of the stair. Adding invisible ramp colliders fixes this issue, but I understand it is extra work. Thanks for your feedback, will look into adding a step height feature that detects steps and adds a vertical force to help climb stairs in a future version.


    @muhammadadnan0075 Just sent you an email about this. If anyone else wants to use Unity 5.5 in the meantime, I can send you an alternate AI.cs script that will work with Unity 5.5.


    @egem2015 I haven't seen that happen before. Do you have any gamepads, joysticks, or other peripherals connected or have you made any changes to the default project after import, such as using a scene loading script?


    @magique Thanks for bringing this up. This is a bug that made it through testing when the particle systems were updated. You can fix it by removing this code at line 1158 in FPSPlayer.cs:
    Code (CSharp):
    1. blockParticleSys.Emit(Mathf.RoundToInt(blockParticleSys.emission.rateOverTime.constant));
    Sorry about that, will upload a fixed version soon.


    Also, for the first time, the Realistic FPS Prefab is on sale in the Unity Asset Store. Now is your chance to pick up the Realistic FPS Prefab at 25% off!
     
    Last edited by a moderator: Apr 26, 2017
    Mark_01 and TonyLi like this.
  36. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    Thanks. That worked.
     
  37. eyo

    eyo

    Joined:
    Jul 12, 2012
    Posts:
    35
    Hi, were doing an on rails shooter for mobile and wondered if this asset might shortcut some development time.

    Most notably the player is taken via waypoints through the level and engages with the enemy at the waypoint, a little like Time Crisis. We would need to either disable his directional movement or slow it down while he engages and possibly disable the players look around function so he faces one way, would this be possible?
     
  38. egem2015

    egem2015

    Joined:
    Oct 27, 2015
    Posts:
    84
    Azuline Studio , Thanks for your answer

    Yes i have Control Freak asset as third party

    But there is weird thing when i disabled all Control Freak components in my scene

    *** My player's shooting animation is always playing never stopping on my android device.

    My game is working in Unity Editor properly and this problem occurs only ANDROID DEVICE.
    ***

    Meanwhile i have just sent a mail with Title

    "My player's shooting animation is always playing never stopping on my android device"

    to your email "azulinestudios@gmail.com".

    can you look at the mail?

    what can the problem be?

    thanks in advance.

    King Regards
     
    Last edited: Apr 26, 2017
  39. chelnok

    chelnok

    Joined:
    Jul 2, 2012
    Posts:
    680
    This or any other fps controller wouldn't be the best start for railshooter, but i guess you could use the AI that comes with RFPS, especially if your enemies comes in waves.

    I think something like Camera Path Animator would be more suitable: https://www.assetstore.unity3d.com/en/#!/content/617 And keep in mind you can also animate your camera with Unity's own animations. Works with simple animations for enemies too, for example moving them back and forth behind the corner or some obstacle.

    Then again, RFPS also has weapon / health system and some useful assets.
     
    eyo likes this.
  40. eyo

    eyo

    Joined:
    Jul 12, 2012
    Posts:
    35
    Thanks, funnily enough I was looking at that.
     
  41. egem2015

    egem2015

    Joined:
    Oct 27, 2015
    Posts:
    84
    Hi again.

    My problem is

    "when enemy is seeing me , player starts to move and fire automatically without touching fire button."

    how can i prevent this?

    thanks in advance.
     
  42. jons190

    jons190

    Joined:
    Sep 13, 2016
    Posts:
    260
    Just a shout out for this asset. I picked it up a few weeks ago and it's a real nice little system. Easy to implement and has all the baseline functionality you need for scene swaps and saves. It took me about an hour to setup and get running and I am a noob with C#. Highly recommend.

    But a performance question (for android) for Tony Li. So the baseline "RSPF save component" script that you attach to the RFPS player will automatically set up a Json save component on first use. It looks like this takes a slight bit of processing power to generate this for the first time. (and I am all about trying to optimize everything I can for mobile performance) Is it better to set this up manually before hand like mentioned in the docs?? Or does it make a difference?

    Also, while in gameplay mode (In the unity editor) , the games save and load just fine, but then I jump out of play mode in the the scene view, it loses all the saved game data. So that when I am back in game play mode the old game save data is missing. Should that have been serialized to the HD somewhere? Am I missing a step. Does this mean that the game data will be missing in a full build of the game once the users quits the game? I'm sure I'm missing something here.
     
  43. jons190

    jons190

    Joined:
    Sep 13, 2016
    Posts:
    260
    Hey all, I have a question for the group Where do I find the mesh/model prefabs for the weapons that are held in front of the player during playtime? I need to change the shaders to mobile (specifically for the sword and shield, katana and bow) , and for the life of me cannot find these anywhere in the files. I have found the pickups and changed those. but can't find the ones used in the active weapons (with the arms and that are shown while running around in gameplay).

    Also, along those lines, where do I find the prefabs for the wall hits and sparks? Can't seem to find those and would like to see what I could do to optimize them for mobile as well.

    Thanks in advance.
     
  44. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Thanks! :)

    Yes. It makes a very small difference the first time it's used in a play session. You can drop the Save System prefab into your scene so the Save System won't have to create one on the fly at runtime.

    You can find a little more info about saved game storage on page 13 of the manual. For Android, you'll want to use the default and save to PlayerPrefs. To save to encrypted disk files instead of PlayerPrefs (for example on desktop), remove the PlayerPrefs Saved Game Data Storer component from the Save System GameObject and add a Disk Saved Game Data Storer instead.
    As long as the player uses RFPS's main menu to save and load (set up on page 4 of the manual), the saved game data will be saved and restored.

    The game doesn't auto-save on quit, nor does it auto-load when you resume. If you want to do that, which is typical for mobile games, you could add a script like this to the Save System GameObject:

    AutoSaveLoad.cs
    Code (csharp):
    1. using UnityEngine;
    2.  
    3. public class AutoSaveLoad : MonoBehaviour {
    4.  
    5.     void Start() {
    6.         PixelCrushers.SaveSystem.LoadFromSlot(0); // When starting, load from slot 0.
    7.     }
    8.  
    9.     void OnApplicationQuit() {
    10.         PixelCrushers.SaveSystem.SaveToSlot(0); // When quitting, save to slot 0.
    11.     }
    12. }
     
  45. jons190

    jons190

    Joined:
    Sep 13, 2016
    Posts:
    260
    Hey thanks for that Tony. I wasn't thinking of doing autosaves, but..... Easy enough to implement now.



    one other question for the group. Has anyone implemented a "show how many life's are left" kinda counter in the HUD? I've looked through the board but haven't seen anything like this. I'm thinking a simple counter, maybe an icon of some sort that would show for each life left and that would show under the health meter or some such. I've just now started thinking about the HUD of my game. (maybe should have thought about this a bit sooner ;-) Gonna go see if I can backward engineer the health GUI system and see if I can't find some clues on how to implement....
     
  46. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    Is there some message, event, or callback that can conveniently tell me whether the player has started combat or combat has ended?

    [EDIT]
    Nevermind. I wrote up my own system for handling it.
     
    Last edited: Apr 27, 2017
  47. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Are you talking about "Health: 100" or a separate counter that decreases each time the player dies? RFPS doesn't keep track of this, but you could write a custom script to keep track. You could add a script like this to the FPS Player (just an example):
    Code (csharp):
    1. using UnityEngine;
    2.  
    3. public class LifeCounter : MonoBehaviour {
    4.     public int livesTotal = 3;
    5.     public static int livesLeft = 3; // Static so its value lasts across scene changes.
    6.     public UnityEngine.UI.Text livesText;
    7.     public string gameOverSceneName;
    8.  
    9.     void Start() {
    10.         livesText.text = livesLeft + "/" + livesTotal;
    11.     }
    12.  
    13.     public void Die() { // Will be automatically called by RFPS.
    14.         livesLeft--;
    15.         livesText.text = livesLeft + "/" + livesTotal;
    16.         if (livesLeft <= 0) {
    17.             // Stop the level respawner:
    18.             Destroy(GameObject.FindObjectOfType<LevelLoadFade>().gameObject);
    19.             // Load scene 0 instead:
    20.             UnityEngine.SceneManagement.SceneManager.LoadScene(gameOverSceneName);
    21.         }
    22.     }
    23. }
    Once you get that working, you'll probably want to tie it into the Save System for RFPSP. If the approach above does what you want, I can offer some tips on tying it to the Save System.
     
    Last edited: Apr 27, 2017
  48. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    Why does RFPS import Time settings and set Time Scale = 0? And how in the world does it work like that? Everything should just be frozen in time with that setting. I happened to import another asset and when I ran its demo scene everything was frozen and I eventually traced it to Time Scale = 0. Does RFPS change the Time scale dynamically during runtime for the bullet time effect? In any case, it shouldn't be setting Time scale = 0 by default.
     
  49. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Yes, RFPS controls Time.timeScale. When you open the main menu, it sets Time.timeScale to 0. In bullet time, it sets Time.timeScale to a fraction of 1.0 based on the bullet time setting.

    Time.timeScale only affects Time.deltaTime and components that rely on it, such as Animator set to Normal update mode and scripts that use Time.deltaTime. All scripts continue to receive standard Unity messages such as Update(), FixedUpdate(), etc., even when Time.timeScale is 0. It's up to the script to decide whether to observe Time.timeScale/deltaTime or not.
     
  50. o0neza0o

    o0neza0o

    Joined:
    Sep 6, 2015
    Posts:
    165
    so whats everyones tips on getting the AI to react to all of this list:
    grenades
    dead npc's
    gun shot
    noise from player