How do I use families correctly

0 favourites
  • Nice control scheme RageByte with clever use of families.

    Thank you

  • It works peeeerfectly !

    Now I can destroy my project and start again on solid bases. I already tested with platform behavior, and now all I have to do is add a real selection menu with nice portraits

    Thx x 1000.

  • It works peeeerfectly !

    Now I can destroy my project and start again on solid bases. I already tested with platform behavior, and now all I have to do is add a real selection menu with nice portraits

    Thx x 1000.

    You're welcome, I'm glad you can use it.

  • Just a question : when you write

    Pick Player where Player.UID != Player2[/code:2cnjsnz6] (on mouse click), it prevents player1 to attribute his controls to a character already selected by player 2. But shouldn't it also prevent from attribute several times the same controls to differents characters ? To make it clear, make this event possible only if Player.UID hasn't been set yet.
    I tried Pick Player where Player.UID != Player2 [b]&[/b] Player1, but it doesn't work.
  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Just a question : when you write

    Pick Player where Player.UID != Player2[/code:2pasakqv] (on mouse click), it prevents player1 to attribute his controls to a character already selected by player 2. But shouldn't it also prevent from attribute several times the same controls to differents characters ? To make it clear, make this event possible only if Player.UID hasn't been set yet.
    I tried Pick Player where Player.UID != Player2 [b]&[/b] Player1, but it doesn't work.
    

    You could simply add "if Player1 = -1" on the first Mouse Left Click event and "if Player2 = -1" on the Mouse Right Click event and that way you can't choose 2 classes for the same player. But that's a very rudimentary selection process and I didn't pay much attention to it. Here is a better way to do the whole thing, though it uses Arrays and separate layouts - one for Player selection and one for the game it's self , like in plinkie's example. This way you can also have 2 or more players with the same class. Press a button and select the class. Then press Start to go to the Game layout or Reset to start the selection again.

    https://www.dropbox.com/s/6vyx7bt45op0z ... .capx?dl=0

    I still haven't added controls for players 3 and 4 so selecting them will spawn players but they don't do anything. Just add the token strings with the key-codes in the Controls variable of the Blue and Yellow buttons using this format "Left | Right | Up | Down | Something". You can find a list of keys and their respective codes on the web but if you're looking to assign game-pad controls to it I have no idea how because I never used that feature.

  • Wow, better and better...

    Now I need the entire week to understand all, and apply it to my project. Or should I start again from beginning ? I have succeeded in doing interesting things, like adding operational live bars for each active character, behaviors and animations not repeated, etc.

    Anyway, thanks again for all your work, I'm pretty sure it will be usefull not only for me but for anyone.

  • Wow, better and better...

    Now I need the entire week to understand all, and apply it to my project. Or should I start again from beginning ? I have succeeded in doing interesting things, like adding operational live bars for each active character, behaviors and animations not repeated, etc.

    Anyway, thanks again for all your work, I'm pretty sure it will be usefull not only for me but for anyone.

    The more the merrier. I figured you might have to restart your project but if you've already restarted once know that you can copy paste chunks of script form one project to another if you open them both. The key is to first copy the Variables, Families and Objects the chunks of script use, otherwise it won't work. Functions, token strings and arrays may be a bit difficult at first but believe me they are worth learning as soon as possible.

  • While I am at it, what would be the best solution to select from alernative images (like portraits) in the menu page, and not directly the characters ? Share some variables between chars and portraits ? Give a new animation for chars (a static one with a portrait) ? Someting else ?

  • Yes, something like that. Basically either make the portraits new objects but add them to the player family and name their Class variable the same as their corresponding actual players, or simply add new animations to each player to use only in the selection menu. The most correct way to do it would be to make a new portrait object that doesn't share the Player family and give it multiple animations for each class portrait. An object that really doesn't function at all like the Players but with the same variables and family may cause some head aches further on.

    Then you can give it a text variable that stores the class just like the Player objects have. It can even be named Class as well. Then you replace the references to Player in this here segment with references to the new object like, instead of "On Click on Player", "On Click on Portrait" and then setting the second Array value to Portrait.Class instead of Player.Class.

  • HI again,

    I'm stuck at this point :

    If I add quotes to remove the error, of course it doesn't work :/

  • Sorry, was away for a few days. This seems strange. You could do this:

    tokencount(str(Player.PressedKeys), " | ") - 1[/code:k7jq0g9z] The "str" turns whatever is in brackets into a text string but it's weird to have to use it because Player.PressedKeys is already a text string. Make sure you didn't accidentally set Player.PressedKeys to a number type variable but I think that's impossible. The problem may be that I set the default values of Player.PressedKeys to "-1", so maybe the event sees it as a number. You can also try changing that value to "a" or "start" by selecting the Player family and editing the variable. That way it starts with text.
  • You don't have to be sorry, you were already so helpfull.

    I'll try this tonight.

  • Make sure you didn't accidentally set Player.PressedKeys to a number type variable

    I did :/

    Feel so stupid

  • > Make sure you didn't accidentally set Player.PressedKeys to a number type variable

    >

    I did :/

    Feel so stupid

    Hehehe coding can do that to you. I was thinking it's impossible within my script because the variable was already assigned some text values and that makes Construct forbid you to change it's type but I forgot you were replicating a custom version of my script.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)