Announcement

Collapse
No announcement yet.

Respawning Actor on Player Death

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

    #16
    Oh you still need to keep the cast. The screenshot above was only supposed to highlight the self node in case it wasn't clear.
    The guy that makes the wheels turn..

    Comment


      #17
      Ah, ok thank you. Now after connecting it all, the actor still stays invisible, but now I also get a error message after ending the game. It seems to be referencing the visibility nodes in the gamemode blueprints.

      GameMode Blueprints

      Click image for larger version

Name:	GameMode.png
Views:	1
Size:	278.3 KB
ID:	1122831

      Actor Blueprints

      Click image for larger version

Name:	Actor.png
Views:	1
Size:	358.2 KB
ID:	1122830


      Error

      Click image for larger version

Name:	error.png
Views:	1
Size:	94.9 KB
ID:	1122838
      Attached Files
      Last edited by ChrisFiasco; 02-09-2017, 02:25 PM.

      Comment


        #18
        A couple things to try:

        1) Try setting the visibility of your array variable to 'public'.

        In other words, make it so the eye is green:
        Click image for larger version

Name:	a8f8cf96b1eec9ac5e2e4cebd42ea0c9.png
Views:	1
Size:	1.2 KB
ID:	1122837

        2) Try testing different scenarios. Try one where the player immediately dies prior to killing any enemies. Try one where the player kills several enemies before dying. Does anything change?

        3) Add an 'isValid' node after the cast node in the for loop area. If this doesn't work, try moving the isValid node before the cast node.

        Accessed none typically means it's trying to run an operation on an input which is 'null'. In simpler terms it means its trying to 'Set Visibility' on nothing. It does specifically mention trying to run it on something 'pending kill' which might mean somewhere else in your blueprints you're attempting to destroy some of the actors in the array.

        Just double checking, the player which you control isn't also an actor of type 'flat' is it? If it is, then this is the root cause of the error.
        The guy that makes the wheels turn..

        Comment


          #19
          No, the player has its default name of SideScrollerCharacter. I think that pending kill error had to do with the destroy actor in the player dies comment. The error did go away when setting up IsValid after the 'Cast To flat' though, but I received a new error when putting it before 'Cast To'. This error would occur if I died and respawn, but if I just exited the game without dying, no error. Other than that it's all still the same.

          After Cast to

          Click image for larger version

Name:	GameMode.png
Views:	1
Size:	291.2 KB
ID:	1122841

          Before Cast to

          Click image for larger version

Name:	GameMode2.png
Views:	1
Size:	292.0 KB
ID:	1122842


          Error

          Click image for larger version

Name:	error.png
Views:	1
Size:	94.6 KB
ID:	1122843

          Comment


            #20
            In the case where you put the isValid before the cast node, the 'Array Element' output on the foreach loop is what should be connected to the input on the 'isValid' node.

            When you had the isValid node after the cast, were any of the actors reappearing?

            This thread might give you some help:
            https://forums.unrealengine.com/show...-Read-Property

            This thread may be a simpler way to do what I described... This method would negate any need for the array. You would still turn off collisions and make them invisible in the same way, but this method would replace the way your 'Reset Map' event is setup:
            https://answers.unrealengine.com/que...acter-blu.html
            The guy that makes the wheels turn..

            Comment


              #21
              No, unfortunately they were not reappearing. I messed around in the Level Blueprints and got kind of close. The way it's setup is when the player dies, the actor is spawned at a certain spot marked by a target actor. This isn't optimal at all and the previous actor is still there after you spawn, it's just spawning in a duplicate. The collision boxes are also gone. This is the level blueprints for it if it makes it easier to understand.

              Click image for larger version

Name:	Level.png
Views:	1
Size:	291.2 KB
ID:	1122844

              Comment


                #22
                Also thank you for the links. For the second link it would be 'ResetMap' -> 'Get All ACtors Of Class' -> 'For Each Loop' -> 'Cast to Flat' - > 'Set Visibility' -> 'Set Actor Enable Collision', with the static mesh components as targets? I imagine I would keep the IsValid as well? Would anything change within the Actor and Character blueprints?

                Comment

                Working...
                X