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
    No worries! If I had time, I'd be happy to write the script. I posted the tips above in case maybe another programmer could use them.
     
  2. TheChairMaster64

    TheChairMaster64

    Joined:
    Aug 9, 2016
    Posts:
    59
    It's alright Tony do what ever you need to do thanks again tho. If you do plan to make the script some time later when your free I'd like to know but if not it's completely fine and id understand. Now I'll stop bothering you about it and let you get back to your stuff.
     
  3. Weblox

    Weblox

    Joined:
    Apr 11, 2016
    Posts:
    277
    Hi, did you already follow @TonyLi 's Post from here ? It will greatly help to integrate Game Mechanics, if you don't know how to Code (like myself). You can apply those tipps to most Scripts in RFPS to trigger actions in various states.

    I got the exploding enemies done also, using the above mentioned Events () and the GrenadeObject.cs script, that has a good example of how to use the timer. Maybe you can copy/paste the timer event to get the weapon removed with an according event ().
     
  4. arnesso

    arnesso

    Joined:
    Mar 3, 2015
    Posts:
    96
    Hi,

    I would like to spawn my FPS Main prefab. Well , the spawning happens after the camera cannot move ,or player cannot move, I 'm sure in on of scripts cannot deteche data or something like this.
    Has anyone made a succesful spawning without the FPS Main prefab would be in hierachy ? ( I think about Instantiate)
    I have tried a loot of version, even tried disabling the "prefabroot" , but no succes.
    Thank you for any help ;)
     
  5. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    This seems to work:
    1. Remove the player prefab from the scene.

    2. Create an empty GameObject at (0,0,0) named "Other". Make all GameObjects that use RFPS scripts children of Other. Deactivate Other. Leave the other GameObjects, such as the Terrain, outside of Other.

    3. Create an empty GameObject at (0,0,0) named "Instantiate Player". Add the script below:
    Code (csharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class InstantiatePlayer : MonoBehaviour {
    5.  
    6.     public Vector3 playerPosition = new Vector3(-3, 17, 6);
    7.     public GameObject player;
    8.     public GameObject other;
    9.  
    10.     void Awake() {
    11.         Instantiate(player, playerPosition, Quaternion.identity);
    12.     }
    13.  
    14.     IEnumerator Start() {
    15.         yield return null;
    16.         if (other != null && !other.activeInHierarchy) other.SetActive(true);
    17.     }
    18. }
    Assign the player prefab to the Player field. Assign the Other GameObject to the Other field.

    The script instantiates the player. Then after one frame (to let the player finish its setup), it activates all the GameObjects in Other. (Since they have RFPS scripts, they depend on the player prefab to the set up.)

    (Sorry TheChairMaster64 - This was a quick one to check. For your more complex weapon behavior, Weblox's suggestions are good to use UnityEvents. After fairly minor script modifications, you'll be able to hook up lots of behavior in the editor. Joe Strout did a UnityEvent tutorial here.)
     
    arnesso likes this.
  6. arnesso

    arnesso

    Joined:
    Mar 3, 2015
    Posts:
    96
    Thank you for your help, it should work in theory, but I have tried different way, but it did not work for me :\
    So I drag the FPS's gamobjects onto "Other" and deactivate "Other", I assigned the correct stuffs, but I experienced this
    - There are gamobjects in duplicated form ( 2 fps player) and
    -On Instantiante script i see the other place -> missing Gamobject; but i have assigned it... -.-

    Other people does it work ?
    thanks
     
  7. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Here's an example scene: RFPS_InstantiatePlayer.unitypackage

    It's set up like this:
     
    Weblox and arnesso like this.
  8. arnesso

    arnesso

    Joined:
    Mar 3, 2015
    Posts:
    96
    Thank you :) It worked ! I do not know why did not work my version, I did the same thing.
    Now I am working on spawn Player ( but FPS Camera object is not active and FPSRigidbodyWalker is disabled) -> for Photon spawning, the players will be controlled separetly.
    I can do it, and activate the FPS cam is good, but I cannot move after spawned. I figured out the CameraControl can cause this problem(each components are enabled) . I tried to drag CameraControl script onto other RFPS object, but that was totally chaos.
    ANy idea how could i avoid this problem what causes CameraControl ( probably it has to be enabled at Start, but i do not know how to solve this yet :\ ) ?
     
  9. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Sorry, no ideas.
     
  10. Hormic

    Hormic

    Joined:
    Aug 12, 2014
    Posts:
    251
    I integrated this example but i have a very strange behavior which i can't explain.
    It only works when i have two colliders on the player.
    With the standard capsule collider the trigger will not get activated, but when i add another capsule collider to the player, even a exact duplicate then it works Unity_2017-02-21_21-33-54.png .
    But it gets even more wired, when i deactivate the capsule Collider above(the original one) and activate the new one it works, Unity_2017-02-21_21-29-22.png when i remove the deactivated collider it don't works Unity_2017-02-21_21-34-12.png and when i deactive the duplicate and active the original it also don't works Unity_2017-02-21_21-33-28.png o_O ???
    So is mercury currently in reverse or what is going on here?
     
  11. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    @Hormic - Did you add PickupOnTriggerEnter to the pickup or the player? It should be on the pickup.

    If that doesn't help, set up just a single collider like the original example. Play the scene and pause. Then check the collider to make sure it and the rigidbody are active.
     
    Hormic likes this.
  12. Hormic

    Hormic

    Joined:
    Aug 12, 2014
    Posts:
    251
    Hey TonyLi, Thank you, yes i have the PickUpTriggerEnter on Pickup items - bow and arrows.
    and yes i investigated the collider in the scene view and the it is active but it doesn't trigger the event in the circumstances i described above. The rigidbody is als there, so it should also be active. But anyway i found a solution for now, maybe my player prefab is screwed somehow (you remember the problem with the multiple "disable gameplay.." assignment.) But its ok for now, but...

    another question: :p
    In the meantime i have imported your Pick up with explosive arrow example.
    But i don't want explosive arrows and therefore i renamed the explosive arrows to arrowexplosive.prefab and imported the original arrow.prefab again, but in game still the explosive arrows are in use.
    How can i change it so, that the original arrow.prefab is used again?
     
    Last edited: Feb 21, 2017
  13. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Inspect the player's Bow (FPS Weapons > Deadzone ... > Weapon Pivot V Bob > Bow). Under the Damage and Firing section, look up Projectile Pool Index (e.g., 17). Then inspect Object Pooling Manager and check what's assigned to that pool index.
     
    Weblox and Hormic like this.
  14. Hormic

    Hormic

    Joined:
    Aug 12, 2014
    Posts:
    251
    Yes perfect, big thanks again, your help is highly appreciated, you are the perfect teacher. :)

    another question:
    What you think is the best way to make cutscenes with DS and RFPS?
     
  15. Hormic

    Hormic

    Joined:
    Aug 12, 2014
    Posts:
    251
    I use Map Magic for the Terrain and at some point i always lose the footstep sounds.
    All Layers and Tags are assigned properly, same as in the RFPS demo, but the map magic terrain is much bigger with the possibilty for invinite terrain, so i guess this is the reason for the problem.

    I would like to have a fallback to the dirt sound when no specific terrain is located, but its a bit to complicated for me:
    This is the error:
    and this the line 290:
    Code (CSharp):
    1. float[,,] splatmapData = terrainData.GetAlphamaps( mapX, mapZ, 1, 1 );
     
  16. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Happy to help!

    For cutscenes, it depends on the complexity of your cutscenes. It's easy to make simple in-game cutscenes using sequencer commands in a Sequence Trigger. If you want to freeze the player during a cutscene, copy FPS Player's Set Active On Dialogue Event and Set Enabled On Dialogue Event components. (Click each component's gear menu and select Copy. Then click the gear menu again and click Paste as New.) Then in these new copies change the Trigger to OnSequence. Finally, set the Sequence Trigger's Speaker or Listener to FPS Player.

    Some devs have even used sequencer commands to script very elaborate cutscenes, such as in Shadows Peak (which also uses RFPS, BTW). But for complicated cutscenes I prefer to use a dedicated visual cutscene editor such as SLATE or Cinema Director. You can still kick them off in a Sequence Trigger using a single sequencer command (e.g., SLATE() or Cinema()). This gives you a consistent way to set them up, and you can also freeze the player if you want to.
     
    Hormic likes this.
  17. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Try adding this line above it:
    Code (csharp):
    1. if (!(0 <= mapX && mapX < terrainData.alphamapWidth && 0 <= mapZ && mapZ < terrainData.alphamapHeight)) return new float[0];
    If the current position is out of bounds, it should handle it more gracefully. I haven't actually tested it, though, so it may need some tweaking.
     
    Hormic likes this.
  18. Hormic

    Hormic

    Joined:
    Aug 12, 2014
    Posts:
    251
    Thank you very much, yes your line works perfectly and fixed it! :)

    I will look into the sequenzer commands for the cutscenes and see what fits my needs best way.
    There is also the MovePlayerandCamera.cs script from RFPS which allows to release the player and camera, but i guess using this is manouvering out DS or i'm wrong?
    I already have Cinema Director so maybe its the best way to use this for the cutscenes.
    But when i have a Dialog in the Cinema Director Cutscene is this Dialog then powered by Dialog System or not?
    Because if not, it needs custom UIs and also translating will be much more complicated.
     
  19. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    MovePlayerAndCamera is useful if you just want to move the player and camera. But if you want to do a more complex cutscene use the Dialogue System, or Cinema Director, or both. I prefer both; you can use the Cinema() sequencer command to kick off a Cinema Director cutscene from a Dialogue System Sequence Trigger. This way you can let the Dialogue System take care of pausing the player during the cutscene.
     
    Hormic likes this.
  20. zero_null

    zero_null

    Joined:
    Mar 11, 2014
    Posts:
    159
    Hello for me the fire button isn't working in the latest version. which means I can't pickup weapons and stuff . Please can anybody help ? I have read it and can't find. I am so desperate checking this out.
     
  21. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Any errors in the console? Maybe your "Fire1" input was deleted or redefined.
     
  22. zero_null

    zero_null

    Joined:
    Mar 11, 2014
    Posts:
    159
    no errors at all. I need to add it from Editor>Input ???
    If I change Fire to Fire1 then it shows error that Fire Input needs to setup.
     
  23. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Change it back so the error disappears. Then select Edit > Project Settings > Input, and check the values assigned to Fire1.
     
  24. zero_null

    zero_null

    Joined:
    Mar 11, 2014
    Posts:
    159
    Yeah, I reverted it back but there is no Fire1 Button. Could that be an issue with Unity version ??? I am on latest Unity 5.5.1

    Sorry sorted it out. My bad. There wasn't an issue lol
     
    Last edited: Feb 24, 2017
  25. Weblox

    Weblox

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

    didn't get any alerts over the last few days...
    That is some helpful information. I have been playing with the pool manager too, but haven't got it to work previously. I got it now to spawn different Projectiles for my weapons. Can we also add NPC AI to the pool to get around the Frame Drops when spawning AI in Wave Mode? I have about 7 NPCs spawning in at the same time and my fames drop badly for a
    second... ;)
     
  26. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Not without scripting. The NPCSpawner script's Spawn() method instantiates from a prefab, not from a pool. You'd have to change that in the code.
     
  27. Weblox

    Weblox

    Joined:
    Apr 11, 2016
    Posts:
    277
    I see. I will have to put that on the queue for now and start optimizing my game levels. Maybe that'll do it for my performance issue. Thnks for clearing. ;)
     
  28. jons190

    jons190

    Joined:
    Sep 13, 2016
    Posts:
    260

    Hey Tony. So I'm just now circling back on this , after finishing my level design,I tried the "create a empty game object, name it and then add the spawn point name at the loadlevel" option. And alas, it did not work.

    So, I have scene "1" and "2" In the end of level "1" I set up an arch that the player has to walk through and set up the trigger events and on the Sequence trigger (script) I added the command : Loadlevel(2, Spawn2) Where Spawn2 is the name of my empty game object at the start of scene 2 (see attached screenshot)

    So it does work, in the fact that it loads up the new scene (scene "2")... but does not put the player at the spot of the empty game object called "Spawn2".

    Any thoughts on what I may have missed?
     

    Attached Files:

  29. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Hi @jons190 - The instructions are tucked away in the Multiple Scene Example section of the docs. Sorry about the confusing docs. They will be fixed in the next release (see below). Here are some things to check:
    • Dialogue Manager GameObject has a Level Manager component. (This is probably the issue.)
    • FPS Player has a Persistent Position Data component.
    • If the spawnpoint is an inactive GameObject, it must be a child of an active GameObject. If it's active, it can be a root object.
    Better yet, use the updated RFPS Support package on the Dialogue System Extras page. The online docs are for the current release version, not this updated support package. But the support package adds a "Save Position" checkbox to the FPS Lua Bridge component. If you tick this checkbox, you no longer need a Persistent Position Data component, nor do you need a Persistent Smooth Mouse Look component on your FPS Camera. The Dialogue Manager still needs a Level Manager component, though. Here's an example: RFPS_Spawnpoint_Example_2017-02-27.unitypackage. You'll need to add both scenes to your build settings so Unity can load them at runtime.
     
  30. TheChairMaster64

    TheChairMaster64

    Joined:
    Aug 9, 2016
    Posts:
    59
    So I have a question. It's not entirely about rfps. I plan on buying another package for my project. This package will be the multiplayer side of my game. Id like to know how I would merge the two projects and not have settings over written and have both rfps and the multiplayer package to work fine together. I plan on having a menu that would take you to singleplayer, multiplayer (the other package), and survival. If you'd like to know the package I wanna get it is called ez fps (I wouldn't recommend it at the moment because the creator is busy at school and needs to update the package because I see a lot of comments on his forum that it has some bugs.) By the way this is my game so far. It has been improved since this video went up a month ago but I havent had Internet to post another video. Oh and one last question. Is there a way to have different grenade and arrow types because if I make a 2nd grenade weapon it uses the same grenade as the first grenade weapon same for the arrow unless I didn't try the arrow yet.
     
    Last edited: Mar 1, 2017
  31. Weblox

    Weblox

    Joined:
    Apr 11, 2016
    Posts:
    277
    Nice game. I see you have put some work inside. ;)

    I know the EZFPS Package too and have PlayTested the Demo, but didn't find the time yet to work with it. It has been around a while before it went live on the Asset Store and the Developer has added many features. I have red the comments about bugs too, but the Asset has been working as I loaded it into Unity. You will have to signup for a free Photon Account and put your Photon ID into EZFPS on import to make it work tho. Also you need full privileges on your internet connection (not a guest login) to even work with EZFPS, if I remember it right. Using EZPS I would strongly suggest to start a fresh Project and use this a multiplayer game. I would NOT recommend to combine it with RFPS.

    Multiplayer and RFPS has been disussed in the thread before. RFPS in itself is not very modular and Scripts highly depend on each others. To make it work with EZFPS one would need to write advanced Scripts and bridges I suppose. RFPS is a great Single-Player framework, well suited for beginners and EZFPS seems to be a fun multiplayer with player classes, nme, bots, etc. but one might be better off to treat both as seperate Projects. However, I am not a Programmer in any way and this is just from my point of view.

    You can setup new Grenades and Arrows through the PoolManager. You need to set the corresponding object pool index in the Projectile Prefab and also the Projectile Pool Index in the FPS Weapon.
     
    Last edited: Mar 1, 2017
  32. TheChairMaster64

    TheChairMaster64

    Joined:
    Aug 9, 2016
    Posts:
    59
    Thanks for the help. So I don't really wanna combine them. I mean like I'll have a main menu and at that main menu if you pick singleplayer or survival it would load up rfps levels and stuff and if you choose multiplayer it would load up ez fps stuff. The multiplayer wouldn't be using rfps in anyway it would only use ez fps. The only things that would carry over to the multiplayer from single player would be models and textures no scripts which means the multiplayer would be a totally separate project and everything would be made off ez fps stuff. So what I'm trying to say is i am building two separate projects with different templates one for singleplayer(rfps) and one for multiplayer (ez fps) so I was just wondering if it was possible to have them as one big project. I'm sorry if I read your comment wrong weblox and this is what you already explained to me I'm just bit slow at this game dev stuff lol.
     
    Weblox likes this.
  33. Weblox

    Weblox

    Joined:
    Apr 11, 2016
    Posts:
    277
    Actually I have been giving this a thought too. I have not been able to try this setup, but it might actually work. You would have to avoid any "namespace errors" (double scripts with the same name) and/or import conflicts with the standart assets folder. If EZFPS comes with a demo it might be better to strip that out in the import manager and only import the core asset. Maybe someone else has some more tipps.

    If you give it a try don't forget to backup your Project! :)
     
  34. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Weblox's advice to back up your project is definitely step #1.

    EZFPS and RFPS are both Complete Projects. This means they ship with customized versions of the files in the ProjectSettings folder, such as InputManager, TagManager, etc. If you import RFPS and then import EZFPS into the same project, EZFPS's ProjectSettings files will overwrite RFPS's. The solution is to import EZFPS into a new, empty project. Then go through each section of Edit > Project Settings in both projects and manually copy the differences into your original project without overwriting any existing settings. For example, if EZFPS defines an input named "Chat", define the same input in your original project.

    The tricky part will be layers. Internally, Unity and RFPS reference layers by their element number as shown in the Layer Manager inspector. I don't know if EZFPS also goes by number or by layer name. If it goes by number, then just make a note of which RFPS layer name corresponds to the same EZFPS layer. If the EZFPS manual says to set an object to layer XYZ, set it to the corresponding RFPS-named layer.

    Then import EZFPS into your original project, but untick the ProjectSettings folder before importing.


    RFPS's scripts are not in a namespace. (More accurately, since they don't specify a namespace, they fall into the default "global" namespace.) As Weblox mentioned, if EZFPS also doesn't use namespaces, it's likely that there might be conflicts. In this case, choose which package you're going to freeze and not import updates from the Asset Store for the duration of your project. RFPS is pretty stable, so it's probably a good choice. Then edit all the RFPS scripts and wrap the classes in a namespace. For example:
    Code (csharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. namespace RealisticFPSPrefab { //<--ADD THIS LINE...
    5.  
    6.     public class CharacterDamage : MonoBehaviour {
    7.     ...
    8.     }
    9.  
    10. } //<--...AND THIS LINE.
    If you go down this road, your project won't compile until you've wrapped every single RFPS script in the same namespace.
     
    Weblox likes this.
  35. TheChairMaster64

    TheChairMaster64

    Joined:
    Aug 9, 2016
    Posts:
    59
    So this is quite confusing at first site but I think I understand a bit. I think the part that's confusing me the most is the layers and input number stuff. Lol but then again nobody said making a game by yourself is easy. As always thanks for the help very useful info.
     
  36. Weblox

    Weblox

    Joined:
    Apr 11, 2016
    Posts:
    277
    Hi @TonyLi ! Thanks for the helpful input. I also have multiplayer on my Wishlist. I don't know how stable EZFPS is but it sure looks fun to play. There is also EBS that has photon functionality. The Author stated he doesnt know EZFPS but there shouldn't be reasons they wouldn't integrate.

    Thanks for sharing some insights on the namespace part. I just checked the EZFPS Scripts and they indeed use public classes without making use of a namespace, just as in your Code example (before adding the extra line).

    Btw, I just got Dialogue System on Sale and can't wait to integrate it into my RFPS Project.

    And while being at it, has any buddy integrated Fracturing & Destruction into RFPS ? The Script reference is here . Unfortunately this Asset seems to get little support on the forums.

    Thanks in Advance,
    Weblox
     
    Last edited: Mar 2, 2017
  37. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Thanks @Weblox! I appreciate the support!
     
    Weblox likes this.
  38. Weblox

    Weblox

    Joined:
    Apr 11, 2016
    Posts:
    277
    Thanks. I have been looking for a clever way to get Quests and Missions into my Game and besides being a Dialogue Editor it really seems perfectly tailored for the task. Also the huge Integration list is a big bonus as I plan to use some of the Assets mentioned on the Page. Besides I have not yet encountered a better support as we have received on here, not as customers but as a simple User Community. That made the decision easy. ;)
     
    TonyLi likes this.
  39. petercoleman

    petercoleman

    Joined:
    Feb 21, 2016
    Posts:
    475
    I am thinking of getting the Dialogue System too at some time as it seems to be very well received and of course supported by Tony and his team as has been mentioned here which is great to see. The wide integration range too is very helpful.

    At the moment I am waiting to see what the next major RFPS Prefab update brings that I am looking for in possible additions to it before Updating RFPSP, Unity and hopefully getting those working with the game levels I have developed so far without breaking them too much before I add any large new assets like the Dialogue System.

    My Game is on stop at the moment waiting for the RFPSP update as I am prepared to wait otherwise I might have bought the Dialogues System now while on Sale. No worries...I will get it later if all goes well :)
     
    TonyLi likes this.
  40. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    What do I need to modify if I want my arrows to fly farther?
     
  41. canaljuegos32

    canaljuegos32

    Joined:
    Jun 29, 2015
    Posts:
    63
    Anyone knows, when player dies, how to load last save game with game jam menu instead of start the scene again?
     
  42. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    In the player prefab, inspect the Bow. Under Damage and Firing, increase Projectile Force.
    Are you only using the game jam menu, or are you using the Dialogue System's old extension for the game jam menu?
     
    magique likes this.
  43. canaljuegos32

    canaljuegos32

    Joined:
    Jun 29, 2015
    Posts:
    63
    The Dialogue System's old extension. I saw the code used by continue button but no idea where to put since im not a coder.
     
  44. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    In RFPS's LevelLoadFade.cs's DoFadeOut method, change this:
    Code (csharp):
    1. #if UNITY_5_3_OR_NEWER
    2. SceneManager.LoadScene(SceneManager.GetActiveScene().name);
    3. #else
    4. Application.LoadLevel(Application.loadedLevel);
    5. #endif
    to this:
    Code (csharp):
    1. var saveHelper = FindObjectOfType<SaveHelper>();
    2. if (saveHelper != null && saveHelper.HasLastSavedGame()) {
    3.     saveHelper.LoadLastSavedGame();
    4. } else {
    5.     #if UNITY_5_3_OR_NEWER
    6.     SceneManager.LoadScene(SceneManager.GetActiveScene().name);
    7.     #else
    8.     Application.LoadLevel(Application.loadedLevel);
    9.     #endif
    10. }
     
  45. Hormic

    Hormic

    Joined:
    Aug 12, 2014
    Posts:
    251
    I have a question/problem with a mecanim NPC.
    All works fine with the standard ThirdPersonAnimatorController, beside the death of the NPC.
    I want to add a normal die animation to the AnimationController instead of the ragdoll model which RFPS uses in all cases. Cause it would be much easier to use a normal die animation as to build a ragdoll model for every NPC.
    So is this possibe and where i have to adress this in the RFPS code?
    Thanks for helping me out.
     
  46. Weblox

    Weblox

    Joined:
    Apr 11, 2016
    Posts:
    277
    I can't help with modifying the Animator, but you can set the ragdoll mode in the CharacterDamage.cs Component on your NPC and untick Radoll Active. Then assign a Dead Replacement Prefab. This is another instance of your Npc Model with only an animation Component .There you can assign a die animation. You can also add a RemoveBody.cs . You still have to make a dead replacement Prefab for every NPC.

    For changing animators and code someone else would need to help. ;)
     
    Last edited: Mar 6, 2017
    TonyLi and Hormic like this.
  47. Hormic

    Hormic

    Joined:
    Aug 12, 2014
    Posts:
    251
    Hi Weblox, Thank you for your suggestion, i was playing already a little bit with these, but without success.
    Maybe i have to convert the model into Legacy mode for the dying animation?
    Lets see, i will give it another go tomorrow.
     
  48. Weblox

    Weblox

    Joined:
    Apr 11, 2016
    Posts:
    277
    Dead Replacements should work with either mecanim or legacy setup. For mecanim just make an animator and put one die animation inside and remember to set their layer to NPCs and the tag to flesh. :)
     
    Last edited: Sep 17, 2017
    Hormic likes this.
  49. Hormic

    Hormic

    Joined:
    Aug 12, 2014
    Posts:
    251
    Yess thank you very much, its working. :)))
     
    Weblox likes this.
  50. Weblox

    Weblox

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

    I have integrated Emerald AI with RFPS and can confirm it's working well, also side by side with default RFPS AI.

    @TonyLi I have again tried to integrate UnityEngine.Events to the Emerald AI Script. Since Emerald AI mainly is split up in a AI Script and an Editor Script I could not apply it the regular way , supposedly because of Serialization and the according Editor Script, that seems to read all the Serialized Properties. I have tried to add following lines to the Emerald_Animal_AI.cs , but they dont show in the Editor.

    Code (CSharp):
    1.  
    2.  
    3.     //ADDED THESE LINES TO THE TOP UNDER MONOBEHAVIOR AROUND LINE 17
    4.  
    5.         public UnityEngine.Events.UnityEvent onFlee;            // <---ADDED THIS LINE FOR ONFLEE EVENT AROUND LINE 2227
    6.         public UnityEngine.Events.UnityEvent onFleeStop;        // <---ADDED THIS LINE FOR ONFLEESTOP EVENT AROUND LINE 1426 & 1461 & 1498
    7.         public UnityEngine.Events.UnityEvent onBreed;           // <---ADDED THIS LINE FOR ONBREED EVENT AROUND LINE 1134
    8.         public UnityEngine.Events.UnityEvent onHuntMode;        // <---ADDED THIS LINE FOR ONHUNTMODE EVENT AROUND LINE 2329
    9.         public UnityEngine.Events.UnityEvent onHuntModeStop;    // <---ADDED THIS LINE FOR ONHUNTMODESTOP EVENT AROUND LINE 2329
    10.         public UnityEngine.Events.UnityEvent onHurt;            // <---ADDED THIS LINE FOR ONHURT EVENT AROUND LINE 2227
    11.         public UnityEngine.Events.UnityEvent onAttack;          // <---ADDED THIS LINE FOR ONATTACK EVENT AROUND LINE 3003 AND 3011
    12.         public UnityEngine.Events.UnityEvent onGraze;           // <---ADDED THIS LINE FOR ONGRAZE EVENT AROUND LINE 3686
    13.         public UnityEngine.Events.UnityEvent onDead;            // <---ADDED THIS LINE FOR ONDEAD EVENT AROUND LINE 3847
    14.  
    15.  
    16.  
    17.     //ALSO I ADDED THE LINES INSIDE THE AI STATES
    18.  
    19.  
    20.     onFlee.Invoke();                   //ADDED THIS TO LINE 898 FOR ONFLEE EVENT!
    21.  
    22.     onFleeStop.Invoke();              //ADDED THIS TO LINES 1426 & 1461 & 1498  FOR ONFLEE EVENT!
    23.  
    24.     onBreed.Invoke();                 //ADDED THIS AROUND LINE 1133 FOR ONBREED EVENT!
    25.  
    26.     onHuntMode.Invoke();          //ADDED THIS AROUND LINE 2335 FOR ONHURT EVENT!
    27.  
    28.     onHuntModeStop.Invoke();        //ADDED THIS AROUND LINE 1646 FOR ONHUNTMODESTOP EVENT!
    29.  
    30.     onHurt.Invoke();                 //ADDED THIS AROUND LINE 2235 FOR ONHURT EVENT!
    31.  
    32.     onAttack.Invoke();              //ADDED THIS AROUND LINE 3021 FOR ONATTACK EVENT!
    33.  
    34.     onGraze.Invoke();              //ADDED THIS AROUND LINE 3698 FOR ONGRAZE EVENT!
    35.  
    36.     onDead.Invoke();               //ADDED THIS AROUND LINE 3861 FOR ONDEAD EVENT!
    37.  
    38.  

    I have already tried to contact Black Horizon Studios for help on this topic, but didn't hear back through the last couple of days. Any help on adding the Events to Emerald AI would be much appreciated.

    Thanks in advance,
    Weblox
     
    Last edited: Mar 8, 2017
    Hormic likes this.