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.

Hero Selection

Discussion in 'Triggers & Scripts' started by Faith, Feb 13, 2015.

  1. Faith

    Faith

    Joined:
    Dec 29, 2009
    Messages:
    883
    Resources:
    3
    Spells:
    1
    Tutorials:
    2
    Resources:
    3
    I'm using a system I just came up with and I want to fine-tune it.
    Also there seems to be a problem I couldn't find where only the first hero is selectable.

    Map Initialization
    • Main
      • Events
        • Map initialization
      • Conditions
      • Actions
        • Trigger - Run Game <gen> (ignoring conditions)
        • Trigger - Run Regions <gen> (ignoring conditions)
        • Trigger - Run Players <gen> (ignoring conditions)
        • For each (Integer tempInt) from 1 to 12, do (Actions)
          • Loop - Actions
            • Trigger - Add to Clear <gen> the event (Player - player[tempInt] types a chat message containing -clear as An exact match)
            • -------- --------------------------------------------- --------
            • Trigger - Add to HS Selection <gen> the event (Player - player[tempInt] Selects a unit)
            • Trigger - Add to HS Finalization <gen> the event (Player - player[tempInt] types a chat message containing -c as An exact match)
        • Trigger - Run HS Init <gen> (ignoring conditions)
        • Trigger - Run HS Generation <gen> (ignoring conditions)
    Player Initialization
    • Players
      • Events
      • Conditions
      • Actions
        • Set tempLoc = (Center of heroSelection region00 <gen>)
        • For each (Integer tempInt) from 1 to 12, do (Actions)
          • Loop - Actions
            • Set playerHero[tempInt] = No unit
            • Set player[tempInt] = (Player(tempInt))
            • Set playerName[tempInt] = (Name of player[tempInt])
            • Set playerNameOriginal[tempInt] = playerName[tempInt]
            • Player - Make Neutral Passive treat player[tempInt] as an Ally with shared vision
            • Unit - Create 1 Dummy (Camera Locking) for player[tempInt] at tempLoc facing Default building facing degrees
            • Set playerCameraLock[tempInt] = (Last created unit)
            • Camera - Lock camera target for player[tempInt] to playerCameraLock[tempInt], offset by (0.00, 0.00) using Default rotation
            • Camera - Set player[tempInt]'s camera Distance to target to 3000.00 over 0.00 seconds
            • Custom script: call RemoveLocation(udg_tempLoc)
    Hero Selection
    HS Init
    • HS Init
      • Events
      • Conditions
      • Actions
        • Set HS_heroType[1] = Soul Reaper
        • Set HS_heroType[2] = Haunted Spirit
        • Set HS_heroType[3] = No unit-type
        • Set HS_heroType[4] = No unit-type
        • Set HS_heroType[5] = No unit-type
        • Set HS_heroType[6] = No unit-type
        • Set HS_heroType[7] = No unit-type
        • Set HS_heroType[8] = No unit-type
        • Set HS_heroType[9] = No unit-type
        • Set HS_heroType[10] = No unit-type
        • Set HS_heroType[11] = No unit-type
        • Set HS_heroType[12] = No unit-type
        • Set HS_heroType[13] = No unit-type
        • Set HS_heroType[14] = No unit-type
        • Set HS_heroType[15] = No unit-type
        • Set HS_heroType[16] = No unit-type
        • Set HS_heroType[17] = No unit-type
        • Set HS_heroType[18] = No unit-type
        • Set HS_heroType[19] = No unit-type
        • Set HS_heroType[20] = No unit-type
        • Set HS_heroType[21] = No unit-type
        • Set HS_heroType[22] = No unit-type
        • Set HS_heroType[23] = No unit-type
        • Set HS_heroType[24] = No unit-type
        • Set HS_heroType[25] = No unit-type
        • Set HS_heroType[26] = No unit-type
        • Set HS_heroType[27] = No unit-type
        • Set HS_heroType[28] = No unit-type
        • Set HS_heroType[29] = No unit-type
        • Set HS_heroType[30] = No unit-type
        • Set HS_heroType[31] = No unit-type
        • Set HS_heroType[32] = No unit-type
        • Set HS_heroType[33] = No unit-type
        • Set HS_heroType[34] = No unit-type
        • Set HS_heroType[35] = No unit-type
        • Set HS_heroType[36] = No unit-type
    HS Generation
    • HS Generation
      • Events
      • Conditions
      • Actions
        • For each (Integer tempInt) from 1 to 36, do (Actions)
          • Loop - Actions
            • Set tempLoc = (Center of HS_region[tempInt])
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • HS_heroType[tempInt] Not equal to No unit-type
              • Then - Actions
                • Unit - Create 1 HS_heroType[tempInt] for Neutral Passive at tempLoc facing 0.00 degrees
              • Else - Actions
                • Unit - Create 1 Dummy (Development) for Neutral Passive at tempLoc facing 0.00 degrees
                • Set HS_heroTaken[tempInt] = True
            • Custom script: call RemoveLocation(udg_tempLoc)
            • Set tempLoc = (Center of HS_region[0])
            • Set HS_hero[tempInt] = (Last created unit)
            • Unit - Make HS_hero[tempInt] face tempLoc over 0.00 seconds
            • Custom script: call RemoveLocation(udg_tempLoc)
    HS Selection
    • HS Selection
      • Events
      • Conditions
      • Actions
        • Set HS_selectionValue = 0
        • Set tempPlayer = (Triggering player)
        • Set tempInt = (Player number of tempPlayer)
        • Set HS_selectionType[tempInt] = No unit-type
        • For each (Integer tempInt) from 1 to 36, do (Actions)
          • Loop - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • (Triggering unit) Equal to HS_hero[tempInt]
                • HS_heroTaken[tempInt] Not equal to True
              • Then - Actions
                • Set HS_selectionValue = tempInt
              • Else - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • HS_selectionValue Not equal to 0
          • Then - Actions
            • Set tempInt = (Player number of tempPlayer)
            • Set playerSelectionId[tempInt] = HS_selectionValue
            • Set HS_selectionType[tempInt] = HS_heroType[playerSelectionId[tempInt]]
          • Else - Actions
        • Custom script: set udg_tempPlayer = null
    HS Finalization
    • HS Finalization
      • Events
      • Conditions
        • HS_selectionType[(Player number of (Triggering player))] Not equal to No unit-type
      • Actions
        • Set tempPlayer = (Triggering player)
        • Set tempInt = (Player number of tempPlayer)
        • Unit - Kill HS_hero[playerSelectionId[tempInt]]
        • Unit - Remove HS_hero[playerSelectionId[tempInt]] from the game
        • Custom script: set udg_HS_hero[udg_playerSelectionId[udg_tempInt]] = null
        • Set HS_heroTaken[playerSelectionId[tempInt]] = True
        • Set playerHeroType[tempInt] = HS_selectionType[tempInt]
        • Set HS_heroType[playerSelectionId[tempInt]] = No unit-type
        • Set HS_selectionType[tempInt] = No unit-type
        • Set tempLoc = (Random point in HR_region[0])
        • Unit - Create 1 playerHeroType[tempInt] for tempPlayer at tempLoc facing 270.00 degrees
        • Set playerHero[tempInt] = (Last created unit)
        • Selection - Select playerHero[tempInt] for tempPlayer
        • Unit - Kill playerCameraLock[tempInt]
        • Unit - Remove playerCameraLock[tempInt] from the game
        • Camera - Reset camera for tempPlayer to standard game-view over 0.00 seconds
        • Camera - Pan camera for tempPlayer to tempLoc over 0.00 seconds
        • Player - Make Neutral Passive treat tempPlayer as an Ally
        • Custom script: call RemoveLocation(udg_tempLoc)
     
    Last edited: Feb 13, 2015
  2. Faith

    Faith

    Joined:
    Dec 29, 2009
    Messages:
    883
    Resources:
    3
    Spells:
    1
    Tutorials:
    2
    Resources:
    3
    Fixed the problem where you couldn't choose anything except the first hero.

    I'm also curious to know if there is a way to disable the ability to reset the camera distance to target using a mouse wheel while they're selecting their hero.
    Basically if they zoom back in using the mouse wheel they won't be able to view every hero.
     
  3. Wietlol

    Wietlol

    Joined:
    Aug 1, 2013
    Messages:
    4,653
    Resources:
    3
    Spells:
    3
    Resources:
    3
    Every 0.03 seconds of gametime -> set camera distance = ... set camera attack angle = -90
     
  4. Dat-C3

    Dat-C3

    Joined:
    Mar 15, 2012
    Messages:
    2,470
    Resources:
    10
    Models:
    1
    Maps:
    5
    Spells:
    3
    Tutorials:
    1
    Resources:
    10
    Should put neutral passive into a player variable as well otherwise cool system. Maybe if you plan to upload it, make a double-click feature for selection though I would prefer triple-click myself since sometimes mice can double-click with just one click... Especially if its old or damaged.

    Don't forget to edit another field in the camera stuff if you give the players more "height" to their camera.
     
  5. Faith

    Faith

    Joined:
    Dec 29, 2009
    Messages:
    883
    Resources:
    3
    Spells:
    1
    Tutorials:
    2
    Resources:
    3
    @Wietlol

    Thanks lol I was wondering if there was a way of doing it without a loop though. Like just disabling it. It's not the angle that's the problem honestly, it's the fact that they can zoom in by doing it.

    @Dat-C3

    You would only put it into a variable when it's used more than once, I typically use loops for player number values and neutral passive is never used due to the nature of the map. You yourself also dislike to use variables apparently, so I'm not sure where this is coming from. But thanks.

    There are countless better hero selection systems out there, I wouldn't bother uploading this. And this has nothing to do with double clicking or triple clicking, it's a chat message. It's a lot easier to handle.

    What do you mean?
     
  6. Dat-C3

    Dat-C3

    Joined:
    Mar 15, 2012
    Messages:
    2,470
    Resources:
    10
    Models:
    1
    Maps:
    5
    Spells:
    3
    Tutorials:
    1
    Resources:
    10
    It was a joke you didn't get. :thumbs_up:

    Yeah there is, well if you let players zoom out at the start then they'll mess up their camera height.
     
  7. Faith

    Faith

    Joined:
    Dec 29, 2009
    Messages:
    883
    Resources:
    3
    Spells:
    1
    Tutorials:
    2
    Resources:
    3
    Players aren't allowed to zoom out, what do you mean by that?