Search Unity

Realistic FPS Prefab [RELEASED]

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

  1. jons190

    jons190

    Joined:
    Sep 13, 2016
    Posts:
    260
    Make sure your scenes have a Save System prefab, at least the very first scene that could load a saved game (e.g., main menu) or do anything involving the Save System.



    -------------------------------
    I've been wondering about this......
    Senario.
    Player starts up game, I have RFPS and save system in the first scene.
    Player stops at level five and save system autosaves.....
    Player comes back two days later. Loads game at level five.

    will it pick up the save system that is only loaded in the first scene via some magic of the save system? should i have the save system prefab in each level? I currently only have it loaded in the first scene and that MAY NOT be the same scene a player access after a save...




    So far it all seems to work with only having the save system in the first scene (although now that I think about it, I have never tested a double save.... maybe I haven't come across it yet! zoiks!)
     
  2. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,692
    @jons190 - It only needs to be in the first scene. It sounds like you're using AutoSaveLoad. The AutoSaveLoad component in the first scene will see that there's an existing autosave file, so it will load the saved game, which load the player into level five. The Save System GameObject is designed to survive scene changes, so the Save System from the first scene will continue to exist in level five.

    You can have a Save System in level five, too, if you want. In this case, the Save System from the first scene will survive into level five and replace the Save System in level five. In other words, the first Save System to exist in any run of the game will continue to be the Save System for the rest of that run.
     
  3. jons190

    jons190

    Joined:
    Sep 13, 2016
    Posts:
    260
    ------------------------------
    Yes this is exactly what I thought was going on, but I thought I would check. (I actually have autosave turned off at the moment and it all still seems to work...)
     
  4. petercoleman

    petercoleman

    Joined:
    Feb 21, 2016
    Posts:
    477
    Hi TonyLi,

    Just to say a big thank you for all of your help once again....

    I have all the components for the save system working correctly now as required for the moment. i.e.. Checkpoints and save system running at the same time as a my non default rfps Menu system....

    At some stage I will look at getting this updated hopefully so that the save system works and saves each scene to a different slot or just progressive saves to different slots, as well as allowing a user to select each scene individually to play if they would like to do that (this bit is easy to do of course) :)

    Thanks again for all of your support at the forum here.

    Kindest regards

    Peter
     
    TonyLi likes this.
  5. petercoleman

    petercoleman

    Joined:
    Feb 21, 2016
    Posts:
    477
    Hi all,

    I have another question which I am sure has been asked about before but would not know how to find any relevant posts.

    I have a project which is an rpg kind of game so swords and such like weapons.

    My question is : Anyone know a solution to fix the issue whereby an NPC enemy weapon (e.g. sword) passes through the player when hit. Effectively the weapon does not actually collide with the player but does impart damage of course.

    I am guessing that this is standard in such situations as I can see that actually having such a weapon physically colliding with the player might be an issue.

    Obviously in a game with gun weapons where bullets are fired and hit the player this is not an issue as one does not normally see the bullet but its somewhat off putting in an RPG when a sword hits the player and does not collide or impact with the player physically. This is especially the case say when a "Club" weilding enemy bashes the player but the "Club" passes straight through the player as opposed to a sword which in theory could potentially do so if it misses a BONE :)

    I guess one could work around with adding some sort of additional box collider to the player though I am not sure that would actually work without causing other issues and i was looking for a less crude solution if there is one :)

    Regards

    Peter
     
  6. OZAV

    OZAV

    Joined:
    Aug 9, 2013
    Posts:
    299
    ... Pete, maybe you should try setting up (in the npc attack code) the target to be player main camera instead, so you will have a nice effect as well ? (eg. target = GameObject.FindWithTag ("MainCamera"). That sort of stuff ... Besides - what's wrong with the NPC blunt weapons going through the player? It's what you will ideally desire to have, as the effect, in the such kind of duels, anyways, for the better interaction ? RDA-Deck-C.JPG
     
  7. GameMunchers

    GameMunchers

    Joined:
    Jul 3, 2017
    Posts:
    40
    Is it possible to use rucksack with RFPS? 1.23
     
  8. Takahama

    Takahama

    Joined:
    Feb 18, 2014
    Posts:
    169
    Hello and please dont ignore me!!

    I am trying to figure out terrain layers for footsteps but i do not know how does RFPSP's terrain layer detection works.
    Can anyone tell me how does player character detects and plays footstep sounds based on surface?
     
    Last edited: Jun 22, 2019
  9. jaberwocky

    jaberwocky

    Joined:
    Nov 28, 2016
    Posts:
    106
    OK, I finally got around to loading up JimBob's demo. After some configuration, I got it working in that I can now pick up items that are then placed into inventory. I get the cursor when the appropriate window is open (Hide cursor, show cursor, etc.) but when I click on any dialog, it doesn't react at all. No drag/drop, no usage a consumables, etc. What do I need to check? It seems that I am soo close to getting this to work. Frustrating. Thanks a ton for any tips!
     
  10. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,692
    Does your scene have an EventSystem? (If not: menu item GameObject > UI > Event System)
     
  11. jaberwocky

    jaberwocky

    Joined:
    Nov 28, 2016
    Posts:
    106
    I had the event system (demo from JimBob) but I didn't have the Horizontal and Vertical set up (I did, but they were called something else) Thanks! Now on to the next problem...
     
  12. jaberwocky

    jaberwocky

    Joined:
    Nov 28, 2016
    Posts:
    106
    More bugs. Some items work, some don't. If I copy the items from JimBob's Demo, they work. If I create my own, they don't. Getting a bit frustrated with Inventory Pro to say the least. Their support is limited to a Discord channel.
    Anyone have suggestions for a less-buggy inventory system? I was hoping for basic inventory, currency, placement on character, stats, and vendors. Crafting is a possibility but not absolutely necessary. The most important thing is that it is compatible with RFPSP
     
  13. F0GZ

    F0GZ

    Joined:
    Feb 22, 2018
    Posts:
    33
    Check out my game's alpha gameplay video made with RFPSP

     
  14. petercoleman

    petercoleman

    Joined:
    Feb 21, 2016
    Posts:
    477
    In RFPSP objects can be marked with Tags. E.G. dirt, wood,metal etc. The Tags should have been be added by RFPSP so you should tag objects appropriately. Box = wood and so on and the correct sounds will paths when the objects are collided with. e.g hit by bullet, walked upon, etc.

    Most objects will be on the default layer except NPC's which will be on the NPC layer. Player should already be on the correct layer by default.

    The sounds that play on Terrains or other surfaces when the Player walks on them are listed and can be changed in the Player characters settings

    For Terrains I use the "Dirt" Tag and in the player settings I use Default 1 to Default 5 for the walking sounds which work perfectly for different surfaces.

    Hope that helps.

    Peter
     
    TonyLi likes this.
  15. jons190

    jons190

    Joined:
    Sep 13, 2016
    Posts:
    260
    Anyone using hte object pool? Can you add NPCs to the pool? Right now I have a bunch of NPC loaded intomy level, but "turned off" and when they go through the monster trigger, they turn on and start doing thier thing, but I'm wondering if ther eis a more optimized way to handle my NPC's and am thinking the object pool might be a better oslution!

    cheers mates!
     
  16. jons190

    jons190

    Joined:
    Sep 13, 2016
    Posts:
    260
    Nice zombie models. where did you get those, if I may ask?
     
    JamesArndt likes this.
  17. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,692
    I don't think object pooling will help much. The vastly greater proportion of memory and CPU is consumed by the AI running its update loop.
     
  18. jons190

    jons190

    Joined:
    Sep 13, 2016
    Posts:
    260
    Ya kinda what I thought. I think I have it as optimized as I can now ...(by loading them all at level startup and then turning them off with the monster trigger script so that they only come on, when a player trips the monster trigger , trigger... Mostly I only have one or two going at a time..) But I'm always looking to eck out one more ms somewhere... cheers!
     
  19. naqi1122

    naqi1122

    Joined:
    Aug 26, 2018
    Posts:
    1
    Hi I want to know that as i put my character i fps main as playing character and change my guns the position of my guns is not accurate as in default Fps main how can i fix it please help.....i need it as soon if any one could give posiotion values too

    upload_2019-7-17_15-28-52.png
     
  20. halo_of_the_sun

    halo_of_the_sun

    Joined:
    Sep 17, 2017
    Posts:
    64
    Hey,

    Having a strange issue with the Save System, it works perfectly fine in the Editor, but when I make a Build 2 things happen:

    1. The Load Screen has disappeared
    2. Sometimes all equipment and health is reset on entering the new Scene (only on a couple Scenes that are the same as any other)

    I can't replicate it in the Editor it's just on the Builds, I'm using Unity 2017.1.1 and Save System from around the same time (updating both in the past has led to a few issues so stuck with both, updating now to see if it fixes)

    In the meantime or in case that doesn't work, any ideas on what I could look at to fix it?
     
  21. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,692
    Hi @vincent_lade - Put your customized Save System prefab in the first scene that uses anything related to the Save System, including scene changes or checking if a saved game exists. Otherwise the Save System will create a generic Save System GameObject that will replace your customized Save System prefab for the duration of the play session Usually it's best to put the Save System prefab in the first scene of your game.

    Feel free to send a copy of your project to tony (at) pixelcrushers.com if you'd like me to take a look.
     
  22. jons190

    jons190

    Joined:
    Sep 13, 2016
    Posts:
    260
    Hey anyone. There usta be a white paper ont he realistic website on how to convert the asset over to Oculus. Ikknow it was outdated, but I'm wondering if anyone has that doc, if so could you send it along?
    Cheers
     
  23. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,692
    jons190 likes this.
  24. jons190

    jons190

    Joined:
    Sep 13, 2016
    Posts:
    260
  25. jons190

    jons190

    Joined:
    Sep 13, 2016
    Posts:
    260
    Alright.... I'm using the pickupontriggerenter script to just roll over object and automatically pick them up. It works great for the weapons and ammo, but not the health pickups. Health pickups seems to fire off another set of logic, where I have to pick up an item, by hitting a button (the hand icon pops up) and it works great... But I am trying to pair my control schema down so I can get rid of gamepad controllers and go with a GO controller (which has Much less inputs) Has anyone setup an automatic pickup for health? If so I'd love to hear how you did it...

    When i put the pickuponenters script on a health pickup I get the following error....
    Failed to call function PickUpItem of class HealthPickup
    Calling function PickUpItem with no parameters but the function requires 1.


    and I'm not sure what to mod in the script to pass a parameter to it.....

    Cheers
    -------------------------------
    followup. By my lame programming knowledge... It seems I should add this line:
    if (other.CompareTag("Player")) SendMessage("PickUpItem");

    To the Pickuphealth script at this point (line 33:


    void PickUpItem (GameObject user){
    FPSPlayerComponent = user.GetComponent<FPSPlayer>();
    line33 --------------------------------
    if (FPSPlayerComponent.hitPoints < FPSPlayerComponent.maximumHitPoints){
    //heal player
    FPSPlayerComponent.HealPlayer(healthToAdd);

    if(pickupSound){PlayAudioAtPos.PlayClipAt(pickupSound, myTransform.position, 0.75f);}
     
    Last edited: Jul 19, 2019
  26. F0GZ

    F0GZ

    Joined:
    Feb 22, 2018
    Posts:
    33
    Zombies from "Studio New Punch".
    Animations from "Jason D Grace".

    Sorry for late reply :)
     
  27. jons190

    jons190

    Joined:
    Sep 13, 2016
    Posts:
    260
    Awesome! Thanks! I like the way they twitch....
     
  28. jons190

    jons190

    Joined:
    Sep 13, 2016
    Posts:
    260
    @TonyLi

    Hey, was just coming around to work on the save system. Seems I have this NOT working again. It all seems to be saving games, but when I come back and launch my app to a saved game, it loads up from the fist level and goes from there (does not load the saved game automagicaly. ) I am using the autoladlevel script. and I assume it should load the last level I played, when coming back from a quit and restart of the app.

    Should I have the save system, with the autolader script loaded on all scenes, so that when I comes back to a saved game , (say level five) it will load up from there? I swear I had this all working at one point..... I currently have the save system and autoloader loaded on the first scene , that should load on each startup. But i'm checking my logic..... I may ahve more quetiosn for you.

    Also, whats the status of the quest system? I think I want to use it in my next game.
     
    Last edited: Jul 28, 2019
  29. jons190

    jons190

    Joined:
    Sep 13, 2016
    Posts:
    260
    Powerups and RFPS?

    Has anyone implemented any type of powerups? I want to add some and even, ultimatly have a character builder, where the player can build up abilities on their character (stronger attack, fast moves etc...) as they rack up kills. I was thinking of using TonyLi's Quest system and somehow using the points generated from the Quests in this to build up the character. BUT before I get to hacking and script kidding my code, I wanted to see if anyone else has done this before . I don't want to reinvent the wheel if necessary.... and it seems like prety standard fare.. So has anyone done this beofer with RFPS? Cheers all!
     
  30. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,692
    Hi @jons190 - The AutoSaveLoad script should be on your Save System GameObject, which should be in the first scene that could possibly use the save system. Usually this is the main menu scene. This way, if there's a saved game, it automatically loads into that saved game. Otherwise it shows the main menu.

    If that doesn't fit your design, please describe how you want it to work in your game. It will probably amount to ticking or unticking one or two checkboxes.

    The Dialogue System's quest system supports RFPSP (see the example scene), and many games use it extensively. But Quest Machine will not have RFPSP since RFPSP is deprecated.

    You can use the Dialogue System to do some simple powerups such as increasing the player's max hit points or making the player invulnerable.
     
  31. jons190

    jons190

    Joined:
    Sep 13, 2016
    Posts:
    260

    Ok, I actually don't have a menu screen. The game just fires up and goes, I was hoping to use the autosave feature to just automatically loads and save games. I think I may not have the save system on a screen that loads everytime....... This must be the problem. I'll rejigger the code today and see if I can fix that.... I know at some point it was working as I could quit or take my vr headset off and it would save anywhere in my game and then it would load right up from that point after I put my VR headset on and started playing the game.... and I turned that all off to test.... I just turned it all back on and now I can't get it to work right.... I suspect this could also be the case why my scene transition manager only works on the first level....

    Dialogue System. ya thats the one. Some simple power up would be grand. I'm rereading the docs now! ;-)
     
    TonyLi likes this.
  32. jons190

    jons190

    Joined:
    Sep 13, 2016
    Posts:
    260
    Hey @TonyLi

    So, I'm still having troubles with the save system. Been working on it for a couple of days now and am just missing something. it all works great, except it's not picking up and autoloading a saved game.

    So, I have about 20 levels, 10 levels are intro screens for the next level set alternately. (So... intro level, playable level, intro level,, playable level.... ect) I only want to save on the intro screen so that when a player comes back after quitting, they get the intro scene to the level they are on and then that level loads and they start from the beginning of the playable level..

    But alas, I just can't make this work. It seems to save fine, but will not autoload on restartup. It just loads the game from the begining and goes from there.

    Hers a screen of my set up.(It's a paste job from photoshop as I didn't have enough screen space to capture it all in one go.)
    The save system is in the very first scene that loads in the game.
    I have fps player saver on each Rfps prefab in each scene.
    The player key is set to : saver on each scene.
    This is for android VR.

    Not sure where I am going wrong... Thoughts? I have a huntch it something simple.... But I've tried a bunch of different combos to get it to work and nothing seems too....

    (Screenshot of saver system setup)
    save_error.jpg


    Screen shot of rfps prefab setup:
    error_2 copy.jpg
     
  33. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,692
    Hi @jons190 - Is this correct?
    • The scenes are [Title/MainMenu] -> [Intro1] -> [Gameplay1] -> [Intro2] -> [Gameplay2] -> [Intro3] -> etc.
    • Save the game at beginning of each intro level.
    • Do not allow saving during the gameplay levels.
    • When the player starts the app, check for a saved game and immediately go there instead of [Title/MainMenu].
    If that's correct, then set it up like this:
    1. Title scene: Add an AutoSaveLoad on an empty GameObject, not the Save System GameObject or children.
      Tick Load On Start, but untick everything else.

    2. Intro# scenes: Add a GameObject with a Timed Event and Save System Methods. Configure it like below:
      upload_2019-8-3_16-16-7.png

    3. Remove all other AutoSaveLoad components from scenes.
    Whenever the player enters an Intro# scene, this GameObject will save the game to slot 1. The saved game will remember that the player is in that scene.

    Whenever the game starts, the Title scene's AutoSaveLoad will check if there's a saved game in slot 1. If so, it will load that saved game, bringing the player immediately to that intro scene. Otherwise it will allow the Title scene's main menu to appear.
     
    Franciscotx56 and jons190 like this.
  34. jons190

    jons190

    Joined:
    Sep 13, 2016
    Posts:
    260
    Will try tonight!!!!!! YOU ROCK.
     
    TonyLi likes this.
  35. unicat

    unicat

    Joined:
    Apr 8, 2012
    Posts:
    425
    Hi, can i rename the water tag in RFPS somewhere, because it conflicts with dwp 2(Dynamic Water Physics 2). I want to use the seazone from rfps which uses the water tag, but then dwp 2 doesn`t work anymore. ? Thank you .
     
    Last edited: Aug 24, 2019
  36. raptgamesstudio

    raptgamesstudio

    Joined:
    Sep 3, 2019
    Posts:
    8
    hi TonyLi,
    I have a latest version RFPS and unity version is 2018.2.17f1. My problem is that when i use bow in editor its position is same where i place it but when i run it on mobile its position is change while other weapons positions are same as i placed them.
     
  37. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,692
    Hi @raptgamesstudio - Are you using the Save System for Realistic FPS Prefab? If so, does this only occur after loading a saved game or using a scene portal?

    If not, perhaps someone in the community here can help. I don't have a lot of experience setting up different weapons in RFPSP.
     
  38. raptgamesstudio

    raptgamesstudio

    Joined:
    Sep 3, 2019
    Posts:
    8

    thanks for your quick reply.
    i dosent use save system but still i have this problem that weapons( bow ) position change on mobile whenever i go to 3rdpersion but in first persion it will ok.kindly help me.
     
  39. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,692
    Sorry, I haven't used a bow on mobile. Try using Unity Remote. This runs the game in the editor but shows it on the Android device. If the position is still wrong, look for warnings or errors in the Console.

    If Unity Remote works, then deploy a build to your mobile device and attach a debugger so you can see if it logs and warnings or errors.

    Good luck!
     
  40. raptgamesstudio

    raptgamesstudio

    Joined:
    Sep 3, 2019
    Posts:
    8

    i found solution.
    first note rotation and position of bow and then just get bow at run time and give it those position and rotation after some interval of seconds.

    Problem solved.
     
  41. raptgamesstudio

    raptgamesstudio

    Joined:
    Sep 3, 2019
    Posts:
    8


    i found solution.
    first note rotation and position of bow and then just get bow at run time and give it those position and rotation after some interval of seconds.

    Problem solved.
     
  42. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,692
    Great! Thanks for sharing the solution in case others have the same problem in the future.
     
    raptgamesstudio likes this.
  43. raptgamesstudio

    raptgamesstudio

    Joined:
    Sep 3, 2019
    Posts:
    8

    Thanks for your reply too
     
  44. jons190

    jons190

    Joined:
    Sep 13, 2016
    Posts:
    260
    Hi there. Still have this trouble? Try changing the zxy coordinates of the weapon position. Ping me if you still ahve troubles as I have been dealing with this for a few months now and know all the fixes ;-)
     
  45. jons190

    jons190

    Joined:
    Sep 13, 2016
    Posts:
    260
    So, I've finally come back around to this and alas. No love. It seems the newest version of Savesystem is not actually loading the picked up saved game. (as best I can tell) on the android system. It works great in the editor and stand alone x86 builds, but will not load a saved game on android. I'm planning g on rolling back to a earlier version of save system this weekend as I know it worked fine a few versions back. Anyway, just thought I would let ya know. In case you have an insperation on a bug fix.

    Config. Ovr utilities (this is for VR) unity 2018.4 LTS (but saw this on all version of the 2018 branch) last version of RFPS and last version of save system.... android.

    Cheers mate!
     
  46. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,692
    What saved game data storer are you using? Can you try using the PlayerPrefs Saved Game Data Storer?
     
  47. jons190

    jons190

    Joined:
    Sep 13, 2016
    Posts:
    260
    Yup

    Yup, using the built in PlayerPerfs storer. And for the record, i'm not exactly sure what it' doing ont he device. It may not be saving the games (but the scene/portal transitions seemt o be working and caring over health and ammo from one scene to the other) I just assumed it was not loading the saved data....


    Gonna load up a clean project with rfps and save system and rewired only tonight and see what that gets me.


    Screen shot of current setup/config.
    upload_2019-9-7_19-44-0.png

    Cheers mate!
     
    Last edited: Sep 8, 2019
  48. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,692
    @jons190 - You may need to tick Save On Pause and/or Save On Lose Focus. When you close an Android app by hitting the home button, it doesn't actually close. Android just pauses it.
     
  49. jons190

    jons190

    Joined:
    Sep 13, 2016
    Posts:
    260
    Shouldn't the save system save between scene changes? and then pick up that scene on reload? Anyway. i am suspicious I have a corrupt project. Actually not corrupt per say, but I've done a few upgrades through this code base. Unity 5.2 to 5.6 to 2018.16f to 2018.4.6lts and I think three version of RFPS and almost every version of save system I've upgraded the project though. i have a sneaky hutch something got lost in the translations. i loaded up a new project in 2018.lts with all the latest greatest and it's different..... I am still getting everything working at a baseline and will report back in about 48 hours....



     
  50. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,692
    When changing scenes, it saves to memory only. You actually have to tell it to save to a slot to make it save to persistent storage such as disk or PlayerPrefs.

    If it's not restoring to the scene that you saved in, make sure the Save System component's Save Current Scene checkbox is ticked.

    Okay, good luck!