Search Unity

Realistic FPS Prefab [RELEASED]

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

  1. Weblox

    Weblox

    Joined:
    Apr 11, 2016
    Posts:
    277
    A Basic visible Player Model is already featured in RFPS. When aiming down, you will mainly see the Models Legs and Feet and your Players Arms are Part of the FPS Weapon Component. The rumors been going that Azuline is working on better features for Player body and Movement in the upcoming Version , maybe even 3rd Person but I guess that's not confirmed. Multiplayer has just been discussed at the top of page 70. ;)
     
    Last edited: Feb 3, 2017
  2. Devistute

    Devistute

    Joined:
    Aug 23, 2014
    Posts:
    32
    Hi i got an fancy question. How does one trigger custom animations within the Player Body?
    I have made an animation where the right arm reaches towards door handle, and IK then continues and grabs the handle, or it would, if the custom animation would even play. I have tried to use "Send Message" via playMaker to get the animation going, but it just wont run. What do i have to do to get it working?

    The animation is Legacy and works when previewing in Animation window.

    Edit: I have this feeling that one gotta first stop the whatever is handling the animations?
     
  3. Weblox

    Weblox

    Joined:
    Apr 11, 2016
    Posts:
    277
    So I have been looking at the Behavior Designer Integration and tried to integrate it into my Project. The small change in the AI.cs was easy to do, but in the WeaponBehavior.cs I feel a bit lost. I do find void HitObject on Line 2190 but cant seem to find the described Lines to change for Behavior Designer. Maybe some kind soul can hook me up with concrete Line numbers for the needed changes? Thanks in advance. ;)
     
  4. txarly

    txarly

    Joined:
    Apr 27, 2016
    Posts:
    197
    hi,

    Is there a way the player slides down slopes depending the angle?

    Now the friction is so high that can walk down nearly a vertical wall

    thanks
     
  5. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,690
    Try using PlayMaker's Enable Behaviour action to disable the Visible Body component on the VisibleBody GameObject before running your custom animation. The Visible Body component sets the animation state every frame in Update(). By disabling the component temporarily, you prevent it from running Update(). When you're done, re-enable the component.

    It's under the line:
    Code (csharp):
    1. case 13://hit object is an NPC
    The page is inadvertently stripping out text in angle brackets as if they're HTML tags. It should be:

    The last change is within RFPSP/Scripts/Weapons/WeaponBehavior.cs. Within the HitObject method the following lines need to be changed:
    Code (csharp):
    1. if(hit.collider.gameObject.GetComponent<CharacterDamage>() && hit.collider.gameObject.GetComponent<AI>().enabled){
    to
    Code (csharp):
    1. if(hit.collider.gameObject.GetComponent<CharacterDamage>()){
    and
    Code (csharp):
    1. if(hit.collider.gameObject.GetComponent<LocationDamage>() && hit.collider.gameObject.GetComponent<LocationDamage>().AIComponent.enabled){
    to
    Code (csharp):
    1. if(hit.collider.gameObject.GetComponent<LocationDamage>()){
    If you run into any issues using Behavior Designer with RFPS, let Opsive know. They're usually really fast with support.
    Try decreasing the FPS Player's FPS Rigid Body Walker > Slope Limit, and increase Rigidbody > Mass. There's also a Physics Material named "Player" assigned to the Rigidbody, but I'm not sure it comes into play in this scenario.
     
    Weblox likes this.
  6. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,690
    In this post, I described how to add an OnDie() event to the NPC Character Damage component. It's handy to hook up actions without having to write and maintain extra code.

    @Weblox asked for tips on adding other events. This is how to add an OnHurt() event that's invoked when the NPC is hurt but not killed:

    In CharacterDamage.cs:
    Code (csharp):
    1. public class CharacterDamage : MonoBehaviour {
    2.     public UnityEngine.Events.UnityEvent onDie;
    3.     public UnityEngine.Events.UnityEvent onHurt; // <---ADD THIS LINE!
    Around line 180, add onHurt.Invoke():
    Code (csharp):
    1.     //Kill NPC
    2.     if (hitPoints <= 0.0f){
    3.         onDie.Invoke();
    4.         AIComponent.vocalFx.Stop();
    5.         //... (omitting some lines here)...
    6.     }
    7.     else
    8.     {
    9.         onHurt.Invoke(); // <---ADD THIS LINE!
    10.     }
    11. }
    12.  
    13. //this method called if NPC has died and has more than one capsule collider for collision, so transition to ragdoll
    14. void RagDollDie(Rigidbody hitBody, float bodyForce) {
    Above, I omitted some lines of code because I don't want to actually post Azuline's source code here, but you should leave them untouched in the file.

    This will add event blocks to the top of the Character Damage component. For example, in the screenshot below I hooked up a Dialogue System Bark Trigger that plays random lines from a conversation I called "I'm Hurt Barks":




    Similarly, you can add an OnStartAttack() event to the AI component if you want to do something when the AI starts to attack.

    In AI.cs:
    Code (csharp):
    1. public class AI : MonoBehaviour {
    2.     public UnityEngine.Events.UnityEvent onStartAttack; // <---ADD THIS LINE!
    Line 823:
    Code (csharp):
    1. IEnumerator AttackTarget(){
    2.     onStartAttack.Invoke(); //<--ADD THIS LINE!
    And then you can hook up events in the same way. In the screenshot below, I hooked up a Bark Trigger to play random lines from a conversation called "Engage Enemy Barks":


     
    Hormic and Weblox like this.
  7. Weblox

    Weblox

    Joined:
    Apr 11, 2016
    Posts:
    277
    @TonyLi Thank you. With these instructions I have been able to get it done instantly and without any error. I will make a Post at the Behavior Designer Thread to let Opsive know to update their instructions and link them back to your original post. I do have some Errors inside the Behavior Tree that is coming with the RFPSP integration and the sample AI is not working. I will check Opsive for help. I can confirm that Actors with default RFPSP AI still run fine in the same Project. ;)

    @TonyLi Awesome! Both of these where exactly what I had in mind. Already applied to my Project and I feel so many possibilities with those.Thanks a lot. Edit: Maybe @Azuline-Studios can include these Code changes in future releases?

    @TonyLi Added the Dialogue System to my wishlist. I already have a Dialogue Component integrated to my Project, but it seems the System can do a lot more than just displaying linear dialogues. Also the huge list of integrations is a big plus. I wish all my Assets had the support we are getting from you. ;)

    Thanks for all the help!
     
    Last edited: Feb 4, 2017
    TonyLi likes this.
  8. Ghost_Interactive

    Ghost_Interactive

    Joined:
    Jul 8, 2015
    Posts:
    54
    @TonyLi thanks for turret suggestion. i made my own turret system (ideas from your script, added extra mouse script & a gun script) works fine.

    now i stuck in a script, if i write
    Code (CSharp):
    1. renderer = GameObject.FindWithTag("NPC").GetComponentsInChildren<SkinnedMeshRenderer>();
    gives error.

    if i write
    Code (CSharp):
    1. renderer = GameObject.FindWithTag("NPC").GetComponentInChildren<SkinnedMeshRenderer>();
    no problem. but i need all skined mesh renderer, how i do this.

    i will upload a demonstration video, after this script is done,
     
  9. txarly

    txarly

    Joined:
    Apr 27, 2016
    Posts:
    197
    Thanks TonyLi but doesn't work,any idea?
     
  10. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,690
    No, sorry; maybe someone else does?
     
  11. jons190

    jons190

    Joined:
    Sep 13, 2016
    Posts:
    260
    rspf_slope_1.png rspf_slope_2.png

    This is surely something simple, but lords I can't find the setting!!!!! So I want my fps_Main prefab to be able to walk up a "set of stairs" built from some environment/architecture titles. (see attached images) and I know it's most likely a simple setting in the Player Character settings, maybe the "slope" settings... but whatever I do, I can't seem to get it to work

    So the scenario:

    First Image:
    Step 1 Simple geometry for a level shooter type game. I have the tiles setup on a stair-like decline. FPS_main can easily walk down.

    Step 2. FPS_main in now on the lower “stair”




    Second image:
    Step 3. FPS_main turns and tries to go back up the stairs.

    Step 4. Gets caught on the stair lip going up and cannot walk up, can use jump to get up, but would like to be able to just “walk” up the incline.

    5. This must be the number to set somewhere, but alas, I know not where….

    Is this something I have to change in the player character or something to do with the nav geometry? First image:
     
  12. jons190

    jons190

    Joined:
    Sep 13, 2016
    Posts:
    260
    Also. I notice a bunch of lens flare type effects on everything. I've disabled the fog components, but it still seems there. Any idea where to look for turning that effect off?

    Thanks all!
     
  13. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,690
    Try unticking FPSRigidBodyWalker's Lower Move Friction checkbox. This makes the player slide down slopes faster. You may need to do this in combination with adjusting the player's physics material (which is assigned to the Rigidbody) as well as other Rigidbody values.

    You can fiddle with hard-coded settings in FPSRigidBodyWalker.cs, but it's probably cleaner to just cover the stairs with an invisible box collider set at an angle to match the stairs. This also lets you optimize the scene by using one collider for the entire set of stairs instead of a separate collider for each step.

    FPS Camera > Main Camera > Weapon Camera also has effects, including Bloom Optimized and Sun Shafts. These may be what you're seeing.
     
  14. Weblox

    Weblox

    Joined:
    Apr 11, 2016
    Posts:
    277
    Hi @TonyLi .Thanks for pointing all that out. I have added the new states to my Project and have been able to also expand my Pickup and Trigger Scripts with new States like OnUseItem() and OnTrigger() etc. Everything is working great and is giving RFPS so much new flexibility. Only the OnHurt() event is giving me some trouble, as it does not fire up when expected. I have looked at my CharacterDamage.cs again and I suppose I got it pasted into the wrong location. I hope not to expose too much of Azulines Code, but here is a Screenshot.

    OnHurt().PNG

    Any help on where to put the added line is much appreciated. Please let me know if I should delete the Screenshot later. Thanks a lot.
     
    Last edited: Feb 8, 2017
  15. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,690
    Hi @Weblox - I don't think your screenshot reveals too much code, but I suppose that's up to @Azuline-Studios to say.

    In your screenshot, the code should be between lines 199 and 200. (When you remove your existing OnHurt.Invoke(), this will becomes lines 198 and 199.)

    Between these lines, add:
    Code (csharp):
    1. else {
    2.     OnHurt.Invoke();
    3. }
     
    Weblox likes this.
  16. Weblox

    Weblox

    Joined:
    Apr 11, 2016
    Posts:
    277
    Hi @TonyLi

    Fixed! This particular state has already proven especially useful, as it let me quickly setup some cool effects on the AI. Thanks again for all your effort and keep up the good work. ;)
     
    Last edited: Feb 7, 2017
  17. Ghost_Interactive

    Ghost_Interactive

    Joined:
    Jul 8, 2015
    Posts:
    54
    on RFPS 1.24 how to work UI button ! health and ammo slider is working (using @TonyLi scripts), but ui button not working, cant press it.

    Any Solution for this ??
     
  18. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,690
    Does your scene have an EventSystem (GameObject > UI > EventSystem)? This is required for UI input.

    If it does, is some other UI element (perhaps an invisible one) covering the button?
     
    Ghost_Interactive likes this.
  19. Ghost_Interactive

    Ghost_Interactive

    Joined:
    Jul 8, 2015
    Posts:
    54
    thanks for your help! you are right a invisible image was on top of button,

    how to unlock the crosshair, for example i want to press m to open up a UI menu, and crosshair show. script is working
    button press M, bring the UI menu but no crosshair.
     
  20. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,690
    Can you pause the game while the menu is open? Take a look how RFPS's main menu does it. (The script is Scripts/HUD/MainMenu.cs)
     
  21. Weblox

    Weblox

    Joined:
    Apr 11, 2016
    Posts:
    277
    Hi all,

    @TonyLi Hi, I have been pretty busy with my Project lately,integrating the CharacterDamageHealthbar from your post >here< to my AI Characters.

    I did write my first useable C# Script and I have been able to apply the new States to AI and Character Damage.cs. I also found how to play a random sound from an array and tried to achieve a Character Bark System within the new States.

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class CharacterDamage : MonoBehaviour {
    5.     public UnityEngine.Events.UnityEvent OnDie; // <---ADDED THIS LINE FOR DIE EVENT
    6.     public UnityEngine.Events.UnityEvent OnHurt; // <---ADDED THIS LINE FOR HURT EVENT
    7.  
    8.  
    9.     [Tooltip("Sound effects to play when npc got hurt.")]      // <---ADDED THIS LINE FOR HURTSOUNDS
    10.     public AudioClip[] hurtSnds;                                    // <---ADDED THIS LINE FOR HURTSOUNDS
    11.     [Tooltip("Volume of sound effects when npc got hurt.")]    // <---ADDED THIS LINE FOR HURTSOUNDS
    12.     public float hurtSndsVol = 1.0f;                                // <---ADDED THIS LINE FOR HURTSOUNDS
    13.  
    14.  
    15.     private AudioSource asource;                                    // <---ADDED THIS LINE FOR HURTSOUNDS
    16.  
    17. etc.
    18.  
    19.  
    20.  
    21.     void Start()                                                        // <---ADDED THIS LINE FOR HURTSOUNDS
    22.     {                                                                   // <---ADDED THIS LINE FOR HURTSOUNDS
    23.  
    24.         asource = gameObject.AddComponent<AudioSource>();               // <---ADDED THIS LINE FOR HURTSOUNDS
    25.         asource.spatialBlend = 0.0f;                                    // <---ADDED THIS LINE FOR HURTSOUNDS
    26.     }                                                                   // <---ADDED THIS LINE FOR HURTSOUNDS
    27.  
    28.  
    29. etc.
    30.  
    31. //Kill NPC
    32.      if (hitPoints <= 0.0f){
    33.   OnDie.Invoke(); // <---ADDED THIS LINE!
    34.   AIComponent.vocalFx.Stop();
    35.  
    36.       etc...
    37.  
    38.        if(bodies.Length < 2){//if NPC is only using one capsule collider for collision, instantiate ragdoll, instead of activating existing body part rigidbodies
    39.          Die();
    40.        }else{
    41.   if (!ragdollActive){
    42.            RagDollDie(hitBody, bodyForce);
    43.   }
    44.   }
    45.      }
    46.  
    47.  
    48.  
    49.         else                        // <---ADDED THIS LINE FOR ONHURT EVENT!
    50.         {                           // <---ADDED THIS LINE FOR ONHURT EVENT!
    51.             OnHurt.Invoke();        // <---ADDED THIS LINE FOR ONHURT EVENT!
    52.  
    53.  
    54.             if (hurtSnds.Length > 0)     // <---ADDED THIS LINE FOR HURTSOUNDS!                
    55.             {                            // <---ADDED THIS LINE FOR HURTSOUNDS!
    56.                 //PlayAudioAtPos.PlayClipAt(enterSnds[Random.Range(0, enterSnds.Length)], transform.position, enterSndsVol);
    57.                 asource.PlayOneShot(hurtSnds[Random.Range(0, hurtSnds.Length)], hurtSndsVol);       // <---ADDED THIS LINE FOR HURTSOUNDS!
    58.  
    59.             }                            // <---ADDED THIS LINE FOR ONHURT EVENT!
    60.          }                               // <---ADDED THIS LINE FOR ONHURT EVENT!
    61.  
    62.     }                               // <---ADDED THIS LINE FOR ONHURT EVENT!
    63.  
    64.  
    65.  

    Doing so I realized I had to put a lot of redundant Code blocks inside the Scripts, which I rather would "outsource" to a seperate Script (for managability). Looking at your Forum Post >here< I see that you have done this with the BarkTrigger Script.

    Also I see that your BarkTrigger Script has a lot of neat Options . Any help on achieving the same would be, as always, much appreciated. I would however not have a database but rather an expandable array with sounds to specify.Thanks in advance.;)

    On a side note I now have Behavior Designer integrated in my Project. Facing some Errors at Start after getting the Movement Pack the Sample Scene is running fine and the Behavior Tree is Error free. However, the AI results are far from good. I hope it's just some settings that I am missing, but right now the default RFPS AI seems to work much better than Behavior Designer. I will make a seperate Post with a troubleshoot video for all that are interested.

    Thanx for all the help,
    Weblox
     
    Last edited: Feb 8, 2017
  22. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,690
    Hi @Weblox - Good thinking to outsource your code into a separate script. You could do something like this:

    RandomSounds.cs
    Code (csharp):
    1. using UnityEngine;
    2.  
    3. public class RandomSounds : MonoBehaviour
    4. {
    5.     [Tooltip("Sound effects to play when npc got hurt.")]
    6.     public AudioClip[] hurtSnds;
    7.  
    8.     [Tooltip("Volume of sound effects when npc got hurt.")]
    9.     public float hurtSndsVol = 1.0f;
    10.  
    11.     private AudioSource asource;
    12.  
    13.     void Start()
    14.     {
    15.         asource = gameObject.AddComponent<AudioSource>();
    16.         asource.spatialBlend = 0.0f;
    17.     }              
    18.  
    19.     public void PlayRandomSound()
    20.     {
    21.         if (hurtSnds.Length > 0)
    22.         {
    23.             asource.PlayOneShot(hurtSnds[Random.Range(0, hurtSnds.Length)], hurtSndsVol);
    24.         }
    25.     }
    26. }
    Add this script to your NPC, and assign RandomSounds.PlayRandomSound to the OnHurt() event.
     
    Weblox likes this.
  23. Weblox

    Weblox

    Joined:
    Apr 11, 2016
    Posts:
    277
    @TonyLi Thanks so much. As always, it's working like a charm. I badly messed up my CharacterDamage.cs when removing my previous made changes, but luckily I had a backup script ready. I had to quickly reassign it to my NPCs but now everything is working as i wanted it. ;)

    It's really a pleasure to have this helpful Forum and all your great support. Thnx a bunch. :)
     
    Last edited: Feb 9, 2017
    Ghost_Interactive and TonyLi like this.
  24. Klemx123

    Klemx123

    Joined:
    Jun 18, 2015
    Posts:
    1
  25. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    I just tried to use this again, but it's turned out to be a performance hog. When I reported that it was slow when I first started using it, the answer was that I could replace the AI with another solution, but this time I just made a scene with only the FPS Main in it and no AI. I've done a comparison of the frame rate with just the scene and a static camera and the same scene with FPS Main in it. On both cameras I applied the same effects. Without FPS Main I was getting around 82-83 fps. With FPS Main the frame rate plummeted to about 41 fps. That's massive. I don't know what you have going on that is so slow, but it's not good.
     
  26. Weblox

    Weblox

    Joined:
    Apr 11, 2016
    Posts:
    277
    Hi @magique

    Edited
    : RFPS has Camera Effects on the weapon Camera also, so that might have had an impact on your Test Scene.
    In Wave Survival Mode I also get a Framedrop when NPC AIs are spawning.

    Question: Should we add our NPC AI to the Pooling Manager to avoid Framratedrops, especially when spawning in wave mode ?

    Nice Game! Ingame Footage is very stylish and the Advert is hillarious too. Keep up the good work! ;)

    Hi @TonyLi
    Have been playing around with the RandomSounds and added some customization options.

    Code (CSharp):
    1.  
    2. using UnityEngine;
    3.  
    4. public class Rfpsp_BarkSounds : MonoBehaviour {
    5.  
    6.   [Tooltip("The bark sound effects to play.")]
    7.   public AudioClip[] barkSnds;
    8.  
    9.   [Tooltip("Volume of bark sound effects.")]
    10.   public float barkSndsVol = 1.0f;
    11.  
    12.   [Tooltip("Delay between times to check if bark sound should be played.")]
    13.   public float barkDelay = 3f;
    14.  
    15.   [Tooltip("Delay between times to check if bark sound should be played.")]
    16.   private float lastBarkTime;
    17.  
    18.   [Tooltip("True if bark sound should be played at 3D World Position.")]
    19.   public bool Use3dSpace = false;
    20.  
    21.   private AudioSource asource;
    22.  
    23.   void Start()
    24.   {
    25.   asource = gameObject.AddComponent<AudioSource>();
    26.   asource.spatialBlend = 0.0f;
    27.   //asource.pitch = Random.Range(0.94f, 1f);
    28.   }
    29.  
    30.   public void PlayRandomSound()
    31.   {
    32.  
    33.   if (!Use3dSpace) {
    34.   // PLAY BARK SOUND
    35.   if (lastBarkTime + barkDelay < Time.time) {  // CHECK BARK DELAY
    36.  
    37.   if (barkSnds.Length > 0)  // CHECK THAT BARK SOUND ARRAY IS GREATER THAN ZERO
    38.   {
    39.   asource.PlayOneShot(barkSnds[Random.Range(0, barkSnds.Length)], barkSndsVol);  // PLAY BARK SOUND
    40.   lastBarkTime = Time.time;  // RESET LASTBARK TIMER
    41.  
    42.   }
    43.   }
    44.   }
    45.  
    46.   else if (Use3dSpace) {
    47.   // PLAY BARK SOUND AT 3D POSITION
    48.   if (lastBarkTime + barkDelay < Time.time) {  // CHECK BARK DELAY
    49.  
    50.   if (barkSnds.Length > 0) {  // CHECK THAT BARK SOUND ARRAY IS GREATER THAN ZERO
    51.  
    52.   PlayAudioAtPos.PlayClipAt(barkSnds[Random.Range(0, barkSnds.Length)], transform.position, barkSndsVol);  // PLAY SOUND AT 3D POSITION
    53.   lastBarkTime = Time.time;  // RESET LASTBARK TIMER
    54.   }
    55.   }
    56.   }
    57.  
    58.   }
    59.   }
    60.  
    61.  
    62.  
    63.  

    Play tested & it said "no Errors" . ;)
     
    Last edited: Feb 10, 2017
    TonyLi likes this.
  27. Demonith88

    Demonith88

    Joined:
    Jun 30, 2014
    Posts:
    216
    I have a question why is my character when i equip example a handgun when i am in FPS its ok but when i change it on TPS camera its normal soldier with M3 in hand with no aim animation at all ?
     
  28. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    Thanks for the tip. Yeah, that was it. Both main and weapon cameras have tons of slow effects on them and I was adding PRISM on top of that. Once I removed those effects then fps is good again. I was ready to give up on this so a million thanks for pointing that out.
     
    Weblox likes this.
  29. Marcirazzo

    Marcirazzo

    Joined:
    Nov 27, 2015
    Posts:
    47
    Hei! When will I see the player in third person functioning?
     
  30. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    I was playing with this yesterday and 3rd person was working. There is a key you can press to switch between first and third person. I can't remember which key.

    [EDIT]
    Press C key for camera switch.

    [EDIT 2]
    Perhaps I spoke too soon. The release notes state the following:

    Early version of third person mode (incomplete player model animations).
     
    Last edited: Feb 10, 2017
    Marcirazzo likes this.
  31. Weblox

    Weblox

    Joined:
    Apr 11, 2016
    Posts:
    277
    Rumors have been going that @Azuline-Studios is working on this features for the next (bigger) update. Since the last update mainly fixed the AI Script for Unity 5.5 I suppose we might see it in the next one. Azuline doesn't seem to post too much when he's busy so this is unconfirmed,but hopefully... ;)
     
    Marcirazzo likes this.
  32. Demonith88

    Demonith88

    Joined:
    Jun 30, 2014
    Posts:
    216
    Well hawing hope is good but will see :)
     
    Weblox likes this.
  33. Marcirazzo

    Marcirazzo

    Joined:
    Nov 27, 2015
    Posts:
    47
  34. TheChairMaster64

    TheChairMaster64

    Joined:
    Aug 9, 2016
    Posts:
    59
    I probably say this everytime I make a post but I'm not a coding person so I may ask some dumb questions. Anyways I have a few things I would like to ask 1st thing is: is there anyway for enemies to be stunned after a certain amount of damage or being shot (stun annimation) 2nd thing is: is there a way for enemies to have more then one attack animation? And if it is possible to do that maybe have the option at what range from the player to play them. And the final question is: has anyone found a way to keep all your ammo guns and health (inventory) through scenes? I don't have to much money for assets and I would like to know if there is a free or cheap way of doing so.
     
  35. Weblox

    Weblox

    Joined:
    Apr 11, 2016
    Posts:
    277
    Hi, I am a Unity Beginner myself, but I will try to answer some of your Questions.

    Right now the RFPS has only basic, but reliable AI. As a Unity Beginner I tend to work with Assets that include at least a basic AI "out of the box". Mostly these AI are not too flexible but you can at least create working game levels. In RFPS you can achieve a certain amount of variety by setting the behavior to HuntPlayer/PatrolWaypoints etc. AI stun or different attack animations in RFPS would be awesome, but is currently not supported.

    Emerald AI has a working RFPS Integration and Showcase Videos on their Site. Also Forum Users have confirmed to have the integration working in their Project. They support different attack animations and a lot more. I still have to check it for myself, but I plan to give it a try. I will report back how it goes.

    @TonyLi is working on a great Save/Load System for RFPSP with more additional features. It will take care of your Player Position, Guns, PickUps, AI and Destructible objects through all your different Scenes. I hope not to spoil anything here, but I am sure he will make a Post on this Forum, when he has News to report.

    I have not tried it.Maybe Someone else? ;)
     
    Last edited: Feb 14, 2017
  36. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,690
    @TheChairMaster64 - It's pending publication on the Asset Store. I'll make a formal post when it's published. In the meantime, here's a preview of the manual in case you're interested: Save System for RFPSP Manual.
     
    Hormic and Weblox like this.
  37. Weblox

    Weblox

    Joined:
    Apr 11, 2016
    Posts:
    277
    Great to hear. Can't wait to see it in the Asset Store. This will be a huge benefit for RFPS. ;)
     
  38. Greg-Klima

    Greg-Klima

    Joined:
    Mar 20, 2013
    Posts:
    1
    Hey, I've been using the Realistic FPS prefab in my project for some time now, but I've suddenly hit a huge bug. Everything was working properly last night as I let a friend of mine play test a level, nothing was edited either. This morning I was working on my save system which is separate from the prefab and when I went to test it the player fades in but cannot move or look around and then drops the knife weapon I had equipped on them. The timescale is still 1, nothing appears in the console, and only progress I've made is I think it's something to do with the FPSRigidBodyWalker script.

    I've tried removing everything I made this morning and still no luck. What would cause the player to not move and then after the fade in drop the weapon.

    PS. The weapon is not tagged as drop-able and I've removed the drop button also.


    EDIT: Wow I'm dum. I made a script that makes the player's health not scene specific and it was starting with -3 health. So it was "dying" before it even started and didn't go to the gameover screen or anything.
     
    Last edited: Feb 15, 2017
  39. jons190

    jons190

    Joined:
    Sep 13, 2016
    Posts:
    260
    This is for Tony li .....not sure if this is the best place to post....but here goes.


    So, I downloaded your dialog/quest system eval and am integrating it with the RFPS prefab for a VR game. Mostly I needed the save game system, but am finding the Quest system comes with some fun perks. Anyway, I've been working through it for the last week or so and finally am starting to make sense of it all (I'm fairly inexperienced with C#) and just got the "load level' system working where I can transition from one level to the next..... but I hit an odd snag that I don't see covered in the docs.


    When I am in "scene 1" and at the end, run through a trigger event and transition into "scene 2" with the Realistic prefab via the save/load dialog prefab system. The realistic prefab comes into "scene 2" at a much different spot then the start of the level, where I want them to be.... (way below and to the right) I suspect this may be because I have not 'set origin point" to 1,1,1 in both scenes? But is there a way to set the coordinates to load the realistic game object anywhere in the new scene? I'm sure I'm missing something simple, but alas...it alludes me...
     
  40. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,690
    Hi @jons190 - Thanks for trying out the Dialogue System!

    In "scene 2", create an empty GameObject at the spot where you want the player to appear. Let's say you name it "Spawnpoint A".

    Then use the LoadLevel() sequencer command, and specify the spawnpoint. For example:
    • Dialogue Text: "Let's go!"
    • Sequence: LoadLevel(scene 2, Spawnpoint A)
    This is the best way to do it because you have complete control over where the player appears.

    Another way is to position the player when you design scene 2. Then make sure the FPS Player in scene 2 has a Persistent Position Data component, and that Record Current Level and Record Position In Current Level are ticked.

    If that doesn't help, please feel free to export the scenes as a unitypackage, email them to tony (at) pixelcrushers.com, and let me know what version of Unity to use. I'll be happy to take a look.
     
  41. jons190

    jons190

    Joined:
    Sep 13, 2016
    Posts:
    260

    thanks a bunch tony. will try this tonight and will be registering the asset here in a few days. 9after i actually deploy to the gearVR to make sure it runs well in mobile, been working weeks to optimize and slime down the RFPS to run on mobile) so far i love it.....
     
  42. emperor12321

    emperor12321

    Joined:
    Jun 21, 2015
    Posts:
    52
    Haven't heard from Azuline in a while. Is it typical for them to go dark while they work on an update? Or are they taking a break?
     
  43. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    I'm getting the following error when playing the demo or my own scene.

    NullReferenceException: GetRef
    VisibleBody.Update () (at Assets/RFPSP/Scripts/Player/VisibleBody.cs:250)
     
  44. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,690
    They usually check in only a few times between updates. There's a pretty lively community on this forum thread, though, to help out when people have questions.

    Does your player's visible body have an Animation component? (VisibleBody doesn't support Mecanim's Animator yet.)
     
    emperor12321 likes this.
  45. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    It's just the default setup so I assume it does. Anyway, I got rid of the error by unchecking Display Visible Body from the FPS Rigid Body Walker script. I'll have to work out what's wrong later.
     
  46. TheChairMaster64

    TheChairMaster64

    Joined:
    Aug 9, 2016
    Posts:
    59
    So I have a question I wanna make a weapon that only last a few seconds When I pick it up like a power up. Example: like a star from mario. Thanks if you can help. :) you've guys have been quite helpfull with the development of my game thanks a lot.
     
  47. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,690
    You'll have to write a script to remove it after the duration has elapsed. Unless maybe someone else has a clever idea to work around that?
     
  48. TheChairMaster64

    TheChairMaster64

    Joined:
    Aug 9, 2016
    Posts:
    59
    And if nobody knows how to do that how can I make a melee weapon have limited hits (ammo)?
     
  49. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,690
    I can recommend what to do, but I'm afraid I don't have time to write the script.
    • Add a script to the weapon (FPS Main > FPS Weapons > Deadzone... > Weapon Pivot V Bob > weapon) with an Update() method that adds Time.deltaTime to a counter. When that counter reaches a specified value, find the PlayerWeapons component and call its DropWeapon() method.

    • Edit WeaponPickup.cs. If the player picks up the weapon, or picks up ammo if he/she already has the weapon, reset the counter.
    Modify WeaponBehavior.cs. At the beginning of the HitObject() method, decrement the ammo count. (This assumes you only want to use ammo if the weapon actually hits something, not just when the player swings the weapon.) If the ammo count is <= 0, immediately exit the method.
     
    emperor12321 likes this.
  50. TheChairMaster64

    TheChairMaster64

    Joined:
    Aug 9, 2016
    Posts:
    59
    Thanks Tony even though I honestly don't know how to do any of that stuff becsuse I don't know how to code at all. I mean I know asking for scripts is kinda of a childish thing but if you saw my game I've been working on you can see I've done a few creative things with the scripts that come with the package like the remove body script I've used for messages that pop up and for gibbing effects on my eneimes for when they die and explode liked in doom or quake. The activate trigger script also has been very helpful. I get quite creative with scripts that are already there. I use what I have to any advantage I can and when I get stuck and can't do what I'm trying to do myself with the scripts already there I come here and ask for simple things and not to over the top. And so far you've helped me if not everytime but most of the time and I thank you very much for all the help you given me and others. You sir are very helpfu. Sorry if i bug anyone I'm just more of a art guy then a coder/scripter.
     
    emperor12321 likes this.