Problem with eachloops/multiple players (4P Game)

Welcome to our brand new Clickteam Community Hub! We hope you will enjoy using the new features, which we will be further expanding in the coming months.

A few features including Passport are unavailable initially whilst we monitor stability of the new platform, we hope to bring these online very soon. Small issues will crop up following the import from our old system, including some message formatting, translation accuracy and other things.

Thank you for your patience whilst we've worked on this and we look forward to more exciting community developments soon!

Clickteam.
  • Hello. I'm trying to to do game with 4 players. There would be many different playable characters in the game (with own hitboxes/controls/abilities/events... basically everything...), but many players are able to have a same character. I'm working with "foreach" event and I was able to do something with multiple players all of which are identical (it was different project, not this). The problem here is that I can't make my foreach events work. I want to differentiate my events with "CHAR" & "ID" alternate values:

    "CHAR = (Different Playable Character)"
    "ID = (Character variation... Something that tells if there are many of the same characters)"

    For example:

    Player 1:
    CHAR = Mario
    ID = 1

    Player 2:
    CHAR = Luigi
    ID = 1

    Player 3:
    CHAR = Mario
    ID = 2 (Id 2, because it's second Mario)

    I got that part to work, BUT the problem is not being able to move the character individually (check attached file..).
    It's something to do with "foreach loops", because only Player 1 can move every single character with the same "CHAR" Player 1 has.
    I already have "foreach loop" for one thing so it's impossible to make multiple "foreach loops" for the same events...
    (I'm bad to explain, but look at yourself from a file)...
    At this point, we should figure out how to get the two red players to move separately. "CHAR" and "ID" must be included.
    Controls: (P1 Moves = A,Z), (P2 Moves = S,X )

  • You appear to be over-complicating things - unless each player has multiple characters, you could simply cut out all the loops and put the commands (like line 10) in a start of frame event.

    What you're missing is that you need to allocate each player to each platform movement object: Set object to (whatever your main player is for each PMO).

    It seems to me it would be far simpler just to setup the movement once for each platform movement object and player without using loops - but if you're determined to use loops then you need to start with - if a key is pressed i.e. if user presses a left arrow key - then determine who the user is - and then tell that specific platform movement object that the user has pressed the left arrow key.

    Casual games: Please login to see this link.

  • "Character Creation" works fine like that. It checks what characters players have and adds them to the level. "start of frame", doesn't just work, if the game needs to add a calculated number of things.

    Different character uses different PMO. Every player is connected to every platform movement object. They can't be controlled by:

    * On each one of Group.Buttons, loop name "PLAYER_Move"
    + ID( "Group.Buttons" ) = 1
    + Repeat while "1" is pressed
    Group.Buttons : User is holding left input key

    However, (* On each one of Group.Perspective, loop name "PLAYER_Controls") must be on event too.
    The problem here is that I don't know how to have two "foreach loops" on the same event.

    "It seems to me it would be far simpler just to setup the movement once for each platform movement object and player without using loops"
    If I just setup the movement once for each platform movement object, there would be too many similar events. Some character doesn't even differ that much, some does alot... I... I can't fully understand that part...
    "then determine who the user is" As I told, it can be controlled with (* On each one of Group.Buttons, loop name "PLAYER_Move"). You can control each player (with same character), BUT (* On each one of Group.Perspective, loop name "PLAYER_Controls") must be included to separate players and controls.

    I may not have fully understood your message, but if you had an example or if you were able to edit my file, I might understand better.

  • I got the impression you were often running loops for a single command instead of just typing the event with the single command but if what you're doing works for you - then just ignore that part of what I'm writing.

    Unless you inserted it into the bit that is password protected you're missing the command in bold that tells the PMO who it is controlling - in this case I assume hitbox - because I don't know if it's your skin or hitbox.

    * On loop "Skin1"[INDENT] New Objects : Create Player Skin 1 at (69,160) layer 1[/INDENT]
    [INDENT] New Objects : Create PMO_1 at (90,189) layer 1[/INDENT]
    [INDENT] New Objects : Create Player Hitbox 1 at (80,196) layer 1[/INDENT]
    [INDENT] PMO_1 : Set object to Player Hitbox 1[/INDENT]


    To run two loops you'd embed them - something like this:

    * Upon pressing any key[INDENT] Start loop for each one of Group.Perspective, loop name "PLAYER_Controls"[/INDENT]


    * On each one of Group.Perspective, loop name "PLAYER_Controls"
    [INDENT] Start loop for each one of Group.Buttons, loop name "PLAYER_Moves"[/INDENT]
    [INDENT]
    [/INDENT]

    Casual games: Please login to see this link.

  • There is nothing important in password protected place (nothing that affects anything. It's just used for showing values/testing).

    Well I tried that "Set object to Player Hitbox" on the loops, it didn't changed anything. It worked in exactly the same way as before. (Line 27 already did that job).

    But how can I set that last part to lines 42-44 correctly?

  • I don't think your problem is with the for each loops - but rather how to create 4-user movement using the platform movement object and that's a question I can't answer.

    As far as I can see the PMO doesn't have the ability to allocate controls to player1, player2 etc. like the platform object does. Fusion would not be able to know when a keyboard is being pressed from which player it originates unless you have a way to connect them first and without that connection Fusion will do nothing. The only suggestion would be to to run it in tandem with a movement that does have those built-in features, like the platform object.

    Hopefully someone else can help you better.

    (I didn't see line 27 because it uses qualifiers and I was looking under the PMO objects - sorry, my mistake.)

    Casual games: Please login to see this link.

  • My player movement is too complicated to "platform object". I have done successfully events with over 10 players, who uses a similar MPO (Every single objects/parts has been cloned and everyone has one counter in common so they are connected), so it's indeed possible. I can make events with different characters, and I can make events where all the characters are similar, but I can't make events with different characters where other players could choose the same character. I think problem is still with foreachloops.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!