Announcement

Collapse
No announcement yet.

Inventory & Interaction == error after dying

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

    Inventory & Interaction == error after dying

    I searched already for solution, but no luck.

    Here is what I have so far and my problem. Please correct me if Im doing anything wrong. Im new to this.

    I have a mutator. It modifies the pawn by adding an inventory. This inventory will always be with the pawn until it dies (just like the sheild gun).

    The inventory adds an interaction that is attached to the player controller. And the interation is used to get input.

    Here is the problem:
    Once the pawn dies and respawns, I get General Fault error saying something wrong with the InteractionMaster. I do have stuff in the Tick function of the inventory to call a cleanup that will remove the interaction if the pawn dies. But those logs never show up, so its not being called.

    So the problem now is how to clean up the interaction? (note that a new interaction and inventory are spawned once the player respawns).

    Also, am I doing this right? Would it make more sense (and more efficient) if I have the interaction spawned only once in the Mutator class and then not have to worry about removing it? My main problem lies in that fact that I cant seem to able to clean up once the pawn dies.

    #2
    I've been messing around with Interactions for the last few days (finally got them working!) but I'm far from an expert, so take what I say with a grain of salt.

    From your description I think your problem may be that you're creating & destroying interactions. As I understand them, you should only have to create your Interaction once -- when the player joins. The interaction should NOT be tied to the Pawn itself, and should remain intact until the players leaves the game.

    That said, you may be using the inventory in a different way then I think you are. If you're trying to add a key binding to work with your inventory, or a HUD to describe your inventory though, I think you should just be creating it once per player. If that's what you want, I can point to you my source as a working example of how to get an Interaction up and running (and working in a network environment -- that's the kicker!) if you'd like.

    Comment


      #3
      Thanks for the reply.

      I think you may be right, and all along I felt that is the most efficent way to do it.

      Well I am using the interaction just to get input and also display on the HUD.

      So you are saying that I should have a reference to a interaction in my Mutator class, and create that in the initialize function? I would still need to attach the interaction to the player controller. And when the pawn dies, the interaction stays, so I can keep using that same interaction.

      Is that right? I would like to see your code to get the overall idea, at least. Thanks again.

      Comment


        #4
        Not quite I think. I believe what the code I've got does is simply make sure it's executes on each client once. But I can't be 100% sure because I garnered the technique from the TeamRadar 3.0 mutator (which is really quite spiffy) -- they'll definately be mentioned in my acknowledgements when I'm done!

        You can find my code here. The only two files I think you'll really care about are MutVehicleDetonator.uc & VehicleDetonatorInteraction.uc.

        I think you'll be only really looking at VehicleDetonatorInteraction::KeyEvent for that class. I'm assuming you know already about adding the key bindings themselves.

        As for the mutator, I believe 80% of the code in that class deals exclusivly with getting the Interaction up and running so it should be mostly a straight copy with some class name changes.

        [edit]
        Acutally, I think you are right now that I look back at my code -- the mutator does have an Interaction and update that. I'm not really sure about it frankly; it seems unncessary to me but since I took me a long time to get the Interaction up and running properly across a network, I was sort of afraid to remove anything. When I have the **** thing finished I'll go back over stuff like that and try removing pieces to see what's truly necessary and what isn't.

        Comment


          #5
          Awesome. Just spent 2 minutes looking thruough the mutator and interaction code and I can say it will definetly be helpful. Your mutator is kind of similar to mine, so I understand just by glancing what you are doing. I will reply back to this thread once I look in depth. Thanks again.

          Comment


            #6
            I implemented moving interaction from the inventory into the mutator class.

            Now what I do is in the modify player function, I attach the interaction's reference to the inventory I create.

            Problem now is the same as before. When the pawn dies, its inventory dies too, I guess. But the interaction is still trying to use inventory. How can I set the interaction's reference to the inventory to none once the pawn dies?

            Comment


              #7
              That should happen automatically. Any references to an object should be set to None as soon as it's destroyed. So you should have to check the reference, and if it's None, re-create the inventory. No dangling pointers in UnrealScript

              Comment


                #8
                Ya you are right.

                But I still get the error.

                Here it is:

                History: UObject::ProcessEvent <- (InteractionMaster
                Package.InteractionMaster, Function
                Engine.InteractionMaster.Process_PostRender) <-
                UInteractionMaster::MasterProcessPostRender <-
                FPlayerSceneNode::Render <- UGameEngine:raw <-
                UWindowsViewport::Repaint <- UWindowsClient::Tick <- ClientTick <-
                UGameEngine::Tick <- Level Torlan <- UpdateWorld <- MainLoop <-
                FMallocWindows::Free <- FMallocWindows::Realloc <- 676F4C57 0
                FArray <- FArray::Realloc <- 0*2 <- FMallocWindows::Free

                Comment


                  #9
                  Hmmm. Definately the interaction (duh), but that error doesn't say much beyond that. I'd stick a whole whack load of Log() calls all over the place to try to figure out what action seems to be causing the InteractionMaster to barf.

                  Double hmmmm. From that error it might have something to do with your PostRender (if you're using one). Try disabling the HUD for a build just to see if this goes away.

                  Comment


                    #10
                    Found the problem.

                    I had my interaction class have a reference to the inventory, and if that reference is none, then no function in the inventory does anything.

                    Problem was that once the pawn dies, his inventory is destroyed, and the reference in the interaction to the inventory is set to none. But NOT immediately, which was causing general faults to occur. So I made the reference = none explicitly in the Destroyed function of the inventory class. So far, with exhaustive testing, no faults. Ill test in dedicated server mode soon though.

                    Thanks for the help, YusakuGodai.

                    Comment

                    Working...
                    X