No announcement yet.

Calling a function on disconnect [solved]

  • Filter
  • Time
  • Show
Clear All
new posts

    Calling a function on disconnect [solved]

    Does anyone know how to call a function when the user Forfeits/Disconnects (preferably in the mutator class)? Destroyed() is not called. I'm out of ideas.

    NotifyLogout() ?


      Nope. Tried it.

      It may not be possible, looks like objects aren't destroyed, but the whole level and everything is thrown away natively. Or something.


        It's all garbage collected.

        What I really want to do is have this function (I can put it anywhere) call:

        when the level is exited


        When the next level loads, but it needs to be able to be called without a mutator.

        I'm thinking that this could be done by having the mutator spawn a class that won't be garbage-collected and have the function in that class. Make the class figure out when the level is destroyed, call the function, then destroy itself.


          Well, I figured out a way to do it, thanks to UnrealWiki. In case anyone's wondering, I now have it set up like so:

          When the mutator spawns, it spawns a dummy playercontroller. The playercontroller class has the native GetEntryLevel() function. The dummy playercontroller then spawns an actor in the Entry level so it isn't garbage-collected, then destroys itself. That actor doesn't do anything until the user returns to the menu, when it calls the function and then destroys itself.


          Seems like a lot of work to do something relatively simple...