1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. We have recently started the 16th edition of the Mini Mapping Contest. The theme is mini RPG. Do check it out and have fun.
    Dismiss Notice
  4. Dismiss Notice
  5. The Highway to Hell has been laid open. Come along and participate in the 5th Special Effect Contest.
    Dismiss Notice
  6. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Player online detection

Discussion in 'World Editor Help Zone' started by Recklessness, Mar 18, 2019.

  1. Recklessness

    Recklessness

    Joined:
    Aug 17, 2014
    Messages:
    81
    Resources:
    0
    Resources:
    0
    Essentially what I've been trying to figure out to do is a trigger that would enable my RPG to detect which of the three players are online so they can all get the game started at once. Let me specify a bit more. In my rpg you start at a race selection screen then a class selection screen following that and obviously some people will get done quicker than others. The way I have it set-up right now your hero will be instantly created in a region in a room. Can someone make me a gui trigger so your hero is paused until every online player finishes their character creation and enters that region or at least help me figure it out.
     
  2. SoooK

    SoooK

    Joined:
    Nov 12, 2018
    Messages:
    43
    Resources:
    0
    Resources:
    0
    I guess you already triggered the hero and class selection. In that case, all you have to do, is adding a variable that holds the information that player x has finished hero selection. I recommend a boolean or an integer for that. If one player is done, you set the corresponding variable: (just an example)
    • Set boolean[1-3] = True
    • or
    • Set integer[1-3] = 1

    And you add this at the end of the trigger, that is responsible for the selection process:
    • Trigger - Run Game Start

    "Game Start" should look like this:
    • Events:
    • Conditions:
      • boolean[1] = True //or integers
      • boolean[2] = True
      • boolean[3] = True
    • Actions:
      • Do what ever should happen...

    The problem with this is, that your game will NEVER start, in case someone lefts the game early, or desyncs. I recommend adding a timer that starts your game without conditions, in case the selection process takes too long.
     
  3. Recklessness

    Recklessness

    Joined:
    Aug 17, 2014
    Messages:
    81
    Resources:
    0
    Resources:
    0
    I'll try this out and let you know if it works for me, I appreciate the help!
     
  4. Dr Super Good

    Dr Super Good

    Spell Reviewer

    Joined:
    Jan 18, 2005
    Messages:
    25,805
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    Or track when a player leaves and correct appropriately.
     
  5. Recklessness

    Recklessness

    Joined:
    Aug 17, 2014
    Messages:
    81
    Resources:
    0
    Resources:
    0
    Well I am a bit confused i'm not exactly sure if this works for me. When your hero selection is done its instantly created in some far off region, I want your hero to be paused until all player heroes land in that area. Essentially, I want the game to understand which of the three player slots are being used and if x number is being used then you would need to wait for x heroes to land in that area. Once they do they're all unpaused. Would this work??
    [​IMG]
    [​IMG] [​IMG] [​IMG]
    [​IMG]
     
  6. Sabe

    Sabe

    Joined:
    Jul 30, 2018
    Messages:
    431
    Resources:
    1
    Spells:
    1
    Resources:
    1
    Heh, that's a bit complicated. Just use loops and an integer variable.

    Here. Make a trigger to check how many players are online:
    • Check Player Status
      • Events
        • Time - Elapsed game time is 1.00 seconds
      • Conditions
      • Actions
        • For each (Integer A) from 1 to [max amount of players], do (Actions)
          • Loop - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • ((Player((Integer A))) slot status) Equal to Is playing
              • Then - Actions
                • Set PlayerCount = (PlayerCount + 1)
              • Else - Actions

    Then increase that variable every time a player chooses his/her hero:
    • Check Player Ready
      • Events
        • [Whatever your event is when a hero is chosen]
      • Conditions
      • Actions
        • Unit - Pause [Chosen hero]
        • Set PlayerReady = (PlayerReady + 1)
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • PlayerReady Equal to PlayerCount
          • Then - Actions
            • Custom script: set bj_wantDestroyGroup = true
            • Unit Group - Pick every unit in (Units in HeroArea) and do (Actions)
              • Loop - Actions
                • Unit - Unpause (Picked unit)
          • Else - Actions

    Then, a failsafe for if a player leaves, it then lowers the PlayerCount and also checks if the other two players are now ready, so they don't get stuck if they have already chosen their hero and the last one leaves before choosing his/hers:
    • Player Leave
      • Events
        • Player - Player 1 (Red) leaves the game
        • Player - Player 2 (Blue) leaves the game
        • Player - Player 3 (Teal) leaves the game
        • [...]
        • [Amount of players]
      • Conditions
      • Actions
        • Set PlayerCount = (PlayerCount - 1)
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • PlayerReady Equal to PlayerCount
          • Then - Actions
            • Custom script: set bj_wantDestroyGroup = true
            • Unit Group - Pick every unit in (Units in HeroArea) and do (Actions)
              • Loop - Actions
                • Unit - Unpause (Picked unit)
          • Else - Actions
     
    Last edited: Mar 20, 2019