Announcement

Collapse
No announcement yet.

How to keep characters state when Level streaming

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How to keep characters state when Level streaming

    I just start making a souls like ARPG game, I split my original Map into several maps using level streaming.
    I would like to make a game like Dark Souls, All enemies keep their state before I refresh them.

    Enemy characters spawn when I streaming in the new level, enemy characters destroy immediately when I leave the streaming volume.
    I want to keep the enemies state after I run away. Because I will back to beaten them again.

    I think maybe Level streaming only use for the environment, enemy characters must arrange with level blueprint script.

    Is there any good solution?

    #2
    I think you would want to add a Boolean onto each enemy and keep that as part of the saved game state. So when you load into a level, if the Boolean is false, then that specific enemy will not spawn (defeated), otherwise it will spawn. You could do this dynamically by choosing whether or not to spawn the enemy when the level starts, or even do it from the enemy's blueprint--say OnEventBeginPlay--IsEnemyDefeated (Boolean)--if yes, then destroy actor--if no, then do nothing or have it continue its normal code.

    I'm not sure how to save the variable's state...say when the player restarts the game--something to look into!

    Hope that helps!

    Comment


      #3
      Originally posted by samnater View Post
      I think you would want to add a Boolean onto each enemy and keep that as part of the saved game state. So when you load into a level, if the Boolean is false, then that specific enemy will not spawn (defeated), otherwise it will spawn. You could do this dynamically by choosing whether or not to spawn the enemy when the level starts, or even do it from the enemy's blueprint--say OnEventBeginPlay--IsEnemyDefeated (Boolean)--if yes, then destroy actor--if no, then do nothing or have it continue its normal code.

      I'm not sure how to save the variable's state...say when the player restarts the game--something to look into!

      Hope that helps!
      Thats a good solution. To go a bit further, you could create an array and save all the states of the enemies to disk. Then when you load your level, have a Spawner Blueprint go through the array and determine who should spawn based on the state.
      [WIP] Procedural City Generator | RPG AI
      [MARKETPLACE] Animal Behavior Kit | Space Shooter Template | Procedural Foliage Tool | Procedural Park
      [FREE] Modular Road Tool | Action Platformer Template | Radar BP | Free Birds | Procedural Buildings
      Join our Discord

      Comment


        #4
        If you want to fully change levels, then you want the GameInstance. It keeps data in check even when loading a new level.

        https://wiki.unrealengine.com/Game_I...t_Data_Storage
        Musical Range VR | Musical Range Trailer | Pausing Game On Steam Overlay | Aperture Tag

        Comment


          #5
          Originally posted by CoquiGames View Post
          Thats a good solution. To go a bit further, you could create an array and save all the states of the enemies to disk. Then when you load your level, have a Spawner Blueprint go through the array and determine who should spawn based on the state.
          Thank you for your solution. I need to finish Save Game so that I could dramatically spawn the enemy as the same state ( the same location, die or not, same Hp Mp, even the wooden box is broken or not) when I come back (Not exit game or refresh game state).

          Comment


            #6
            Thank you for the document. I am studying how to use it in my project.

            Comment

            Working...
            X