Announcement

Collapse
No announcement yet.

Random pawn possession at startup

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

    Random pawn possession at startup

    Hi there

    I am trying to make a multiplayer game. It includes 5 different characters that are already placed on the map.

    What I want to do is when the game starts, each player must possess a random one of those characters to play with.

    I also want to sort the pawns into a few groups, where each character may be in more than one group, but each group can only contain 3 characters. So that if only 3 players join the game, then it should fill a random group first. The groups I can probably make with arrays, right? But the array that should be filled should still be selected at random on start game. And in that array the characters should still be chosen randomly.

    How do I pull of the random assignment of characters on startup?

    I have no knowledge of C++, so it would be awesome if this could be done with blueprints!

    I am very new to this, and I am probably biting off more than I can chew, but the community here seems extremely helpful.

    Thanks in advance!

    #2
    Sounds completely doable just in blueprints. For random assignment, you can use a "Random int in range" node and then use a switch on int, or a get index from array so that it's always random.

    Just begin with that concept in mind and I'll try to help you sort things out if you are confused.

    Since this is a learning project for you I'll try not to do things for you. Good luck!

    Comment


      #3
      Finally managed to figure it out! At least, the most important part. Possessing a random character, and ensuring that that character cannot be possessed again.

      But this only works when I play with one player. If I test play with two players, they can still possess each others characters, and the client seems like it's bugging out. I use the third person models, and as soon as the client possesses a character, it just sorta floats mid fall animation.

      All my variables are replicated.

      Click image for larger version

Name:	RandomCharBP.JPG
Views:	1
Size:	44.4 KB
ID:	1057352

      If anyone knows of a better way, I would appreciate the advice!
      Last edited by PSyCHoHaMSTeRza; 10-02-2014, 11:13 AM.

      Comment


        #4
        check the blueprint respawn wiki that I wrote, try avoid player index as much as you can in a multiplayer environment.
        Unreal Engine 4 Game Framework diagram for relation of all major base object types
        Unreal Engine 4 Input Event diagram, scroll down to section Input Processing Procedural
        Resident Evil Classic Camera
        RPCs official document, Must Read
        Everything you should know about replication

        Comment


          #5
          Originally posted by PenguinTD View Post
          check the blueprint respawn wiki that I wrote, try avoid player index as much as you can in a multiplayer environment.
          I looked at the wiki, and I am still a little bit confused. Trying to sort it out to what I need for my project.

          But the way I understand, is that the problem lies with the player controller, and the fact that it looks at index 0, right? So how can I make it look at whatever the player controller is that pressed the button?

          The Blueprint that I attached is on the Level Blueprint, is that a problem?

          Comment


            #6
            yes, pretty much. But from your description you still need to read more about the networking part of thing and the framework.
            Read the links in my signatures and then do it slowly from a player controller BP.
            Unreal Engine 4 Game Framework diagram for relation of all major base object types
            Unreal Engine 4 Input Event diagram, scroll down to section Input Processing Procedural
            Resident Evil Classic Camera
            RPCs official document, Must Read
            Everything you should know about replication

            Comment

            Working...
            X