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. The Lich King demands your service! We've reached the 19th edition of the Icon Contest. Come along and make some chilling servants for the one true king.
    Dismiss Notice
  4. The 4th SFX Contest has started. Be sure to participate and have a fun factor in it.
    Dismiss Notice
  5. The poll for the 21st Terraining Contest is LIVE. Be sure to check out the entries and vote for one.
    Dismiss Notice
  6. The results are out! Check them out.
    Dismiss Notice
  7. Don’t forget to sign up for the Hive Cup. There’s a 555 EUR prize pool. Sign up now!
    Dismiss Notice
  8. The Hive Workshop Cup contest results have been announced! See the maps that'll be featured in the Hive Workshop Cup tournament!
    Dismiss Notice
  9. 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.

RPG left/uncontrolled players control system

Discussion in 'World Editor Help Zone' started by Parojo, Apr 4, 2013.

  1. Parojo

    Parojo

    Joined:
    Jan 4, 2010
    Messages:
    15
    Resources:
    0
    Resources:
    0
    Hello everyone!

    I'm working on my programing skills and I can't find the solution to one of my problems. Here is what I want to do:

    The map would be a RPG. There can be 6 players (red, orange, yellow, blue, purple and green). When there is only one player, that player gets kicked (no problem until now).

    When there are two players, the system must check who are the actual players and for each of them, give control of 2 other uncontrolled players (at random I guess, but of course they must not control the same players). For example, if red and blue are playing, red gets control of green and yellow, blue gets control of orange and purple. I have no idea how I can do that, or I do but it's gonna be a huge mess of if then else if then else if then else... And I'm sure there must be a better way.

    When there are 3 players, each of them gets control of another uncontrolled player, so the system is similar to the one before.

    Nothing happens when there are 4 or more players (well... no problem with that part of course).

    If anyone has a clue about the way I must solve this... Please tell me ;)

    Thank you for your answers people! :)
     
  2. Dr Super Good

    Dr Super Good

    Spell Reviewer

    Joined:
    Jan 18, 2005
    Messages:
    25,545
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    Why? It seems a bit random that you do this yet allow 2 people to play without kicking them.

    If the game is single player custom (where you can cheat) then kick them.
    If the game is multiplayer but with only 1 player, then give him control of all other heroes. You cannot cheat in multiplayer, even if you are alone.

    Give all active players control over all players who are not playing. Let them decide who controls what hero rather than them being assigned one randomly. This also solves the 4 and 5 player problem as then there is 2 or 1 hero that is shared between all active players fairly.

    Control is an alliance setting. You do not need mutual control, only for the non-playing/left player to treat all players who are playing with control. You may even want full unit control so they can spend their resources and things.
     
  3. Parojo

    Parojo

    Joined:
    Jan 4, 2010
    Messages:
    15
    Resources:
    0
    Resources:
    0
    Good idea, but how do you check that the player is playing alone in lan and not in single player?

    About the sharing system, what's the best way to do that?

    The only way I know is by the if conditions. Something like that:

    If 2 players
    Then
    { if player 1 is real
    then
    {if player 2 isn't real, give control
    if player 3 isn't real, give control
    etc.}
    else
    { if player 2 is real...

    dafuq, I'm sure I need to find a better way :/ my programing skills aren't good enough for this yet...
     
  4. ap0calypse

    ap0calypse

    Joined:
    Jan 26, 2007
    Messages:
    4,780
    Resources:
    2
    Spells:
    1
    Tutorials:
    1
    Resources:
    2
    You can do this with game caches:
    • Custom script : set udg_SinglePlayerMode = ReloadGameCachesFromDisk()

    (I got this trigger from Almia)
    This will set the boolean variable "SinglePlayerMode" to true if the player is playing in single player, and to false if the player is playing LAN / on b.net.

    Kicking players while they cannot cheat (LAN/b.net) is indeed a bit harsh.
    Personally, I really enjoy it when a map has a single-player mode (custom game only), where you cannot save, but have extra stuff (like infinite repicks, commands to teleport anywhere you like, or get experience) as a means to test the map.
     
  5. Dr Super Good

    Dr Super Good

    Spell Reviewer

    Joined:
    Jan 18, 2005
    Messages:
    25,545
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    A player group acts as a container for many player. You can loop through all players in a player group (like you can with unit groups) and then do an action.

    You can also nest those loops (which is what you want to do here).

    For every player who is not playing then...
    For every player who is playing then...
    Get picked player who is not playing to treat picked player who is playing as shared with full control.
    Get picked player who is playing to treat picked player who is not playing as shared vision.
     
  6. Parojo

    Parojo

    Joined:
    Jan 4, 2010
    Messages:
    15
    Resources:
    0
    Resources:
    0
    Thank you both for your answers!

    I have a problem with the for loop: I can only use integers, which give "for every integer A, then..."

    How can I use something else than a simple integer? :/
     
  7. ap0calypse

    ap0calypse

    Joined:
    Jan 26, 2007
    Messages:
    4,780
    Resources:
    2
    Spells:
    1
    Tutorials:
    1
    Resources:
    2
    A player group loop can be found under the action type "Player Group".
    It is called "Pick every player in group and do multiple actions"
    • Player Group - Pick every player in (All players) and do (Actions)
      • Loop - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • ((Picked player) slot status) Equal to Is playing
          • Then - Actions
          • Else - Actions


    Though an integer-loop would also work (convert the integer to a player with "Conversion - Convert player index to player").
    • For each (Integer A) from 1 to 10, 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
          • Else - Actions