Search Unity

Realistic FPS Prefab [RELEASED]

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

  1. Hammre

    Hammre

    Joined:
    May 23, 2016
    Posts:
    10
    Tony, finally got around to implementing the save system and it worked like a charm. Would have been even easier if I had started with it :) Really like the flexibility of using it as an out of the box solution with prefabs, or calling things directly from your own scripts.
     
    jons190 likes this.
  2. Weblox

    Weblox

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

    is there a way to use the RFPS - "Faction war" and "Wave survival" with Emerald AI Agents ? :confused:

    As of now the wave spawners will only spawn the first NPC load of Emerald Agents, but killing does not seem to unregister them from the wave manager and the wave spawners will not continue to spawn. Also the number of "remaining NPCs" does not decrease...

    As always - thanx in advance. Any help is much appreciated! :cool:
     
  3. NickNovell

    NickNovell

    Joined:
    Apr 27, 2017
    Posts:
    51
    Hello to all. I am trying to create a trigger so when the player enters, change its faction (let's say from 1 to 2). Also change his texture (wearing faction's 2 clothes for instance). Thank you in advance.
     
  4. TonyLi

    TonyLi

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

    Mixing the AI systems is dicey. You might be better off asking Will at BHS to consider adding a wave system to Emerald.

    If you want to forge ahead with the mix, you'll need to add a script that unregisters the AI from RFPS. For example, CharacterDamage.cs does it like this:

    Code (csharp):
    1. AIComponent.NPCRegistryComponent.UnregisterNPC(AIComponent);//unregister NPC from main NPC registry
    You can hook this script up to the Emerald_AI's OnDeath() UnityEvent. I haven't tested this, so I don't know what other repercussions it might have.


    Somewhere way back in this thread I posted a general-purpose trigger event script. It looks something like this:

    TriggerEvent.cs
    Code (csharp):
    1. using UnityEngine;
    2. using UnityEngine.Events;
    3.  
    4. public class TriggerEvent : MonoBehaviour
    5. {
    6.     public string requiredTag = "Player";
    7.     public UnityEvent onTriggerEnter = new UnityEvent();
    8.  
    9.     private void OnTriggerEnter(Collider other)
    10.     {
    11.         if (other.CompareTag(requiredTag)) onTriggerEnter.Invoke();
    12.     }
    13. }

    Add a trigger collider to your NPC (or an child GameObject). Configure the OnTriggerEnter() event to set its AI component's factionNum and change its material.
     
    C_Occlusion, Weblox and Mark_01 like this.
  5. NickNovell

    NickNovell

    Joined:
    Apr 27, 2017
    Posts:
    51
    Thanks a lot!
     
  6. Weblox

    Weblox

    Joined:
    Apr 11, 2016
    Posts:
    277
    @TonyLi

    Thanks a lot for all your time and effort. Great to see you are still keeping this thread alive. :D

    Hooking into the death event with an external script to unregister the NPC was exactly what I had in mind. It's a shame I still dont have coding skill to turn your hint into a valid script. :confused:

    Going through my Assets I found the CoreGameKit in my toolbox. It might have a slight learning curve and may be overkill for this current Project, but this seems a good alternative also...
     
  7. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,692
    Is CoreGameKit integrated with Emerald? It might not matter, since I think you can do everything in the inspector with both of them, but integration would certainly make it easier.
     
  8. Weblox

    Weblox

    Joined:
    Apr 11, 2016
    Posts:
    277
    Wow @TonyLi - that was an instant reply ! :p

    Now that you mentioned I do not see Emerald AI on the CoreGameKit Integration list.
    I have not been active on their Forum yet, but I think that's a good place for requesting Emerald Integration, if needed. I suppose the RFPS Wave UI will not work with CoreGameKit, so this might be an issue. I still have alot of work to do in my RFPS Project so I am not in a great rush, but having the wave survival with Emerald Agents would be a great benefit for me.

    Thanks for all your help and keep up the good work ... ;)
     
    Last edited: Aug 31, 2018
  9. jijones

    jijones

    Joined:
    May 16, 2018
    Posts:
    4
    hey guys its me again i was looking at doing ammo penetration for different materials and bullet drop I found an asset but from what i can see in the tutorials I'm unsure how i would implement it to RFPS, I was wondering if anyone has tried it with the RFPS before i buy the asset here is the link https://www.assetstore.unity3d.com/#!/content/72755

    Also does anyone know how to make a health meter like Doomguys face something i miss and wanna try out thanks.
     
  10. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,692
    Both of those would require you to make changes to RFPS's scripts. I'd recommend doing them only if you're comfortable with scripting or can find someone to do the scripting for you (e.g., hire someone on Unity Connect).

    For the health meter, you could modify HealthText.cs.

    For the ammo penetration, you'd have to dig into the FPSPlayer.cs and CharacterDamage.cs scripts.
     
  11. GameMunchers

    GameMunchers

    Joined:
    Jul 3, 2017
    Posts:
    40
    Two things one, how can i add stamina bar to v 1.23?
    and second how do i remove the sneaking feature when you go behind an enemy and one shot it.
     
  12. GameMunchers

    GameMunchers

    Joined:
    Jul 3, 2017
    Posts:
    40
    i get an error timetemp does not exist in the current context
     
  13. NickNovell

    NickNovell

    Joined:
    Apr 27, 2017
    Posts:
    51
    @TonyLi I managed to create a trigger to change NPCs faction and FPS Player mesh material. But, when I restart the game FPS Player still wearing the changed clothes. The albedo of the FPS Player material has permanent changed.

    On TriggerEvent component I used Material.CopyPropertiesFromMaterial. Is this wrong?

    Thank you in advance.
     
  14. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,692
    Can you set the renderer's material instead?
     
  15. NickNovell

    NickNovell

    Joined:
    Apr 27, 2017
    Posts:
    51
    Sorry, what does that mean?
     
  16. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,692
    Set the SkinnedMeshRenderer's material property. For example, the event below applies the 'apple' material to Robot2's SkinnedMeshRenderer:

    material.png
     
    Weblox likes this.
  17. Mucossa

    Mucossa

    Joined:
    Feb 25, 2018
    Posts:
    34
    why is not there a multiplayer plugin? can anyone do not it? photon or unet ... nobody can do it? paid or free of charge.
     
  18. GameMunchers

    GameMunchers

    Joined:
    Jul 3, 2017
    Posts:
    40
  19. franky_li

    franky_li

    Joined:
    Aug 8, 2016
    Posts:
    163
    Stamina
     
  20. NickNovell

    NickNovell

    Joined:
    Apr 27, 2017
    Posts:
    51
    Hello, is there a way for the Thirst number to count from 100 to 0 and not from 0 to 100? I use it as an antidote.
    Sorry, I have so many questions :) Thank you.
     
  21. NickNovell

    NickNovell

    Joined:
    Apr 27, 2017
    Posts:
    51
     
  22. franky_li

    franky_li

    Joined:
    Aug 8, 2016
    Posts:
    163
    100 - thirst value
     
  23. NickNovell

    NickNovell

    Joined:
    Apr 27, 2017
    Posts:
    51
    Can you be more specific please?Thank you.
     
  24. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,692
    If your model uses multiple materials, you may need to do a little scripting. For example, the built-in soldier's SkinnedMeshRenderer uses two materials. The first material, which is what you can assign in the Trigger Event, is for the helmet. If you also need to change other materials, you'll need to assign to SkinnedMeshRenderer.materials[] in a script. Or switch to a model that uses only one material.
     
  25. NickNovell

    NickNovell

    Joined:
    Apr 27, 2017
    Posts:
    51
    I don't know how to do scripting, but thank you very much for your time to answer! I appreciate that.
     
  26. jons190

    jons190

    Joined:
    Sep 13, 2016
    Posts:
    260
    This comes up every few weeks and I think It would be an awsome update to the overall kit. I thought someone at least attempted it in this thread a few months back in Photon???? and actually thought they had it working, but I may be remembering it wrong..... Maybe Tony Li or someone else with a tad more skillz could chime in as to why this seems to be a hard problem to solve.... Seems like it should at least be doable....but what do I know....
     
  27. jons190

    jons190

    Joined:
    Sep 13, 2016
    Posts:
    260
    I have been interested in doing this exact thing with thirst. Using it as a antidote to poison. Did you figure this one out? Might be as easy as just swapping the values in the prefab from 0-100 to 100-0.... maybe.....
     
  28. jijones

    jijones

    Joined:
    May 16, 2018
    Posts:
    4
    Hey guys i recently got a bug I created my player's character on Adobe Fuse and I followed the instructions so when i go to play it and jump to the third person camera it shows both the third person model and the visible model is visible no matter which camera it jumped to both are seen.

    Wish there was a system like Invector that you drag and drop the model on it and rigs everything for you maybe something to add on the next update a rigging system for both weapons and humanoid characters.
     
  29. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,692
    Multiplayer is just significantly more complicated than single player. And it's even more complicated if you're trying to retrofit a kit that wasn't designed from the beginning for multiplayer. I can list specifics if you want (physics synchronization, server authority, client-side prediction, lobby & matchmaking, etc.), but the gist is that the work to write a multiplayer shooter is 50% shooter and 50% multiplayer. And if you start with a single player shooter kit, you're actually less than 50% of the way there because you need to undo and rewrite some of the design decisions in the shooter part to support multiplayer.
     
    jons190 and Mucossa like this.
  30. GameMunchers

    GameMunchers

    Joined:
    Jul 3, 2017
    Posts:
    40
    Really?! can you please explain or share the stamina system with me??
     
  31. GameMunchers

    GameMunchers

    Joined:
    Jul 3, 2017
    Posts:
    40
    Does the RPFS Save System Work With RFPS V. 1.23 ???
     
  32. franky_li

    franky_li

    Joined:
    Aug 8, 2016
    Posts:
    163
    This is the code if you use a slider for stamina:
    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEngine.UI;
    3. using System.Collections;
    4. public class StaminaBar : MonoBehaviour
    5. {
    6.     private Slider staminaBar;
    7.     private FPSRigidBodyWalker walker;
    8.     private float oldStaminaAmt = -1;
    9.     void Start()
    10.     {
    11.         walker = FindObjectOfType<FPSRigidBodyWalker>();
    12.         staminaBar = GetComponent<Slider>();
    13.         staminaBar.maxValue = walker.staminaForSprint;
    14.     }
    15.     void Update()
    16.     {
    17.         //only update if value to be displayed has changed
    18.         if (oldStaminaAmt != walker.staminaForSprintAmt)
    19.         {
    20.             staminaBar.value = walker.staminaForSprintAmt;
    21.             oldStaminaAmt = walker.staminaForSprintAmt;
    22.         }
    23.     }
    24. }
     
  33. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,692
    Yes.
     
  34. paulojsam

    paulojsam

    Joined:
    Jul 2, 2012
    Posts:
    575
    is there any tutorials to replace player and ai models? i want to create archers
     
  35. paulojsam

    paulojsam

    Joined:
    Jul 2, 2012
    Posts:
    575
    how can i make the ai arrows stick like the player arrows?
     
  36. Hammre

    Hammre

    Joined:
    May 23, 2016
    Posts:
    10
    Has anyone used RFPS with Cinemachine virtual cameras? I'm trying to set up an intro level with a cutscene that ends with returning control to the RFPS main camera. Most cinemachine tutorials assume you are just using their virtual cameras for your game camera as well.
     
  37. jons190

    jons190

    Joined:
    Sep 13, 2016
    Posts:
    260
    There are a bunch. I made some archers and majic bolt throwing wizards. It was fairly easy to convert the existing stuff over.
     
  38. paulojsam

    paulojsam

    Joined:
    Jul 2, 2012
    Posts:
    575
    can you please post link regarding them, i also wonder if its possible to have the ai shoot arrows that stick to the surfaces just like the player
     
    KyleFriesen likes this.
  39. hoschi3d

    hoschi3d

    Joined:
    Oct 4, 2014
    Posts:
    17
    Hello, Is it possible to release the camera from the player in the third person mode? I would like to have static cameras for my project, but unfortunately I can not solve the standard camera without the character being unable to control
     
  40. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,692
    The MovePlayerAndCamera script (on FPS Camera) has a method ReleaseMainCamera(). Call it once to release the camera from RFPS's control. Call it again to give control back to RFPS.
     
  41. jandd661

    jandd661

    Joined:
    Jun 25, 2017
    Posts:
    23
    Sorry, should be
    Code (csharp):
    1. timeTemp = 0f;"
    Better late than never I guess. Sorry for the delay.
     
  42. jandd661

    jandd661

    Joined:
    Jun 25, 2017
    Posts:
    23
    I would like to urge the dev(s) to get a proper forum. This thread has become to large and is not useful when trying to see if the question has already been asked. Also questions get buried quickly. I'm sure @TonyLi must get frustrated answering repetitive questions. A quick search found some free ones:

    https://www.proboards.com/
    https://www.createaforum.com/

    please, please, please =)
     
  43. NickNovell

    NickNovell

    Joined:
    Apr 27, 2017
    Posts:
    51
    Hello to all again. In Third person view when the camera collides on an object (clip mask=default in CameraControl.cs) it zooms to the player when rotating the camera. The result is the camera to get through the player model. How we can do so when the camera collides to an object, not to zoom to the player?

    Thank you.
    Untitled-1.jpg
     
    Weblox likes this.
  44. mshakeri226

    mshakeri226

    Joined:
    Sep 10, 2018
    Posts:
    1
    I've created a player using rfpsp and uma and now i got an issue on adding NPCs. Im trying to add a soldier but the soldier doesn't do anything and just stands there and just stares at me. I have no idea what to do.
     
  45. C_Occlusion

    C_Occlusion

    Joined:
    Jun 4, 2012
    Posts:
    44
    I have never used the UMA characters but maybe you can find something in this video...hope it helps you out...

     
  46. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    Core GameKit works with EmeraldAI as long as you make sure you call the EmeraldAI ResetAI function if you are re-using prefabs for spawns. Otherwise a spawn will be in the wrong state such as already dead from previous use.
     
    Weblox likes this.
  47. Weblox

    Weblox

    Joined:
    Apr 11, 2016
    Posts:
    277
    Can you explain how to do this plz? Also, thnx in advance! o_O
     
  48. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    I took a look at my last RFPS project with emerald and didn't see any place where I called that function, but when I look at the Emerald_AI code I see that it is doing it on the OnEnable() function as long as you have RecycleAIRef set to true. So, I think as long as you have that flag set then it should reset automatically when spawned and enabled.
     
    Weblox likes this.
  49. Weblox

    Weblox

    Joined:
    Apr 11, 2016
    Posts:
    277
    Thanks a lot! I will give it a try. :D
     
  50. petercoleman

    petercoleman

    Joined:
    Feb 21, 2016
    Posts:
    477
    I second your question?

    Tried few times to do whats needed myself but never really been able to fix it. I just find I have to change cameras all the time - back to FPS when its likely to happen to avoid getting angry about it :) You cant expect your game player to do that though and its quite off putting when playing. It is very annoying. I guess if was easy to do it would have been done by the developer or not as the case may be :)