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. Choose your ride to damnation in the 5th Special Effect Contest Poll.
    Dismiss Notice
  5. The winners of the 13th Techtree Contest have been announced!
    Dismiss Notice
  6. The 13th Music Contest Poll has begun! Vote for the best tracks in this symphony of frost and flame.
    Dismiss Notice
  7. 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.

Randomizing player spawns with regions

Discussion in 'World Editor Help Zone' started by Qrom Bellascream, Oct 28, 2017.

  1. Qrom Bellascream

    Qrom Bellascream

    Joined:
    Apr 5, 2013
    Messages:
    150
    Resources:
    0
    Resources:
    0
    • DialogSelectOrc
      • Events
        • Dialog - A dialog button is clicked for RaceSelect
      • Conditions
        • (Clicked dialog button) Equal to RaceSelectOrc
      • Actions
        • Set RandomNumberGenerator = (Random integer number between 1 and 13)
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • ((Units within 600.00 of RegionSpawn[RandomNumberGenerator]) is empty) Equal to True
          • Then - Actions
            • Camera - Pan camera for (Triggering player) to (RegionSpawn[RandomNumberGenerator] offset by (0.00, 0.00)) over 1.00 seconds
            • Unit - Create 1 Orcish Command Center Tier 1 for (Triggering player) at RegionSpawn[RandomNumberGenerator] facing Default building facing degrees
            • Unit - Create 1 Orcish Commander for (Triggering player) at RegionSpawn[RandomNumberGenerator] facing Default building facing degrees
          • Else - Actions
            • Set RandomNumberGenerator = (RandomNumberGenerator + 1)
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • Or - Any (Conditions) are true
                  • Conditions
                    • RandomNumberGenerator Greater than 13
              • Then - Actions
                • Trigger - Run DialogSelectOrc <gen> (ignoring conditions)
              • Else - Actions

    • Set Sjot
      • Events
        • Map initialization
      • Conditions
      • Actions
        • AI - Ignore the guard positions of all Player 2 (Blue) units
        • AI - Ignore the guard positions of all Player 4 (Purple) units
        • AI - Ignore the guard positions of all Player 6 (Orange) units
        • AI - Ignore the guard positions of all Player 8 (Pink) units
        • AI - Ignore the guard positions of all Player 10 (Light Blue) units
        • AI - Ignore the guard positions of all Player 12 (Brown) units
        • Set RegionSpawn[1] = (Center of Spawn 1 <gen>)
        • Set RegionSpawn[2] = (Center of Spawn 2 <gen>)
        • Set RegionSpawn[3] = (Center of Spawn 3 <gen>)
        • Set RegionSpawn[4] = (Center of Spawn 4 <gen>)
        • Set RegionSpawn[5] = (Center of Spawn 5 <gen>)
        • Set RegionSpawn[6] = (Center of Spawn 6 <gen>)
        • Set RegionSpawn[7] = (Center of Spawn 7 <gen>)
        • Set RegionSpawn[9] = (Center of Spawn 9 <gen>)
        • Set RegionSpawn[10] = (Center of Spawn 10 <gen>)
        • Set RegionSpawn[11] = (Center of Spawn 11 <gen>)
        • Set RegionSpawn[12] = (Center of Spawn 12 <gen>)
        • Set RegionSpawn[13] = (Center of Spawn 13 <gen>)


    So here's what i'm working with. Tried making it so that when a player is assigned a spawn that is already in use, he gets a new, unused spawn assigned to him. Would be easy to do with multiple if/then/elses, but that would be extremely messy and I would need to do that for each race, so 6 times the same litany. Is there any practical way of making it work?
     
  2. UreDe4D

    UreDe4D

    Joined:
    Nov 4, 2006
    Messages:
    1,195
    Resources:
    2
    Maps:
    2
    Resources:
    2
  3. millzy

    millzy

    Joined:
    Jul 9, 2008
    Messages:
    1,540
    Resources:
    6
    Maps:
    5
    Spells:
    1
    Resources:
    6
    alright so when a player spawns you want to remove it from the list of locations available by setting it the the max number of spawns and setting the integer to 1 less so it will not longer be available

    • DialogSelectOrc
      • Events
        • Dialog - A dialog button is clicked for RaceSelect
      • Conditions
        • (Clicked dialog button) Equal to RaceSelectOrc
      • Actions
        • Set RandomNumberGenerator = (Random integer number between 1 and SpawnCount)
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • ((Units within 600.00 of RegionSpawn[RandomNumberGenerator]) is empty) Equal to True
          • Then - Actions
            • Camera - Pan camera for (Triggering player) to (RegionSpawn[RandomNumberGenerator] offset by (0.00, 0.00)) over 1.00 seconds
            • Unit - Create 1 Orcish Command Center Tier 1 for (Triggering player) at RegionSpawn[RandomNumberGenerator] facing Default building facing degrees
            • Unit - Create 1 Orcish Commander for (Triggering player) at RegionSpawn[RandomNumberGenerator] facing Default building facing degrees
            • Set RegionSpawn[RandomNumberGenerator] = RegionSpawn[SpawnCount]
            • Set SpawnCount = SpawnCount - 1
          • Else - Actions
            • Set RandomNumberGenerator = (RandomNumberGenerator + 1)
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • Or - Any (Conditions) are true
                  • Conditions
                    • RandomNumberGenerator Greater than SpawnCount
              • Then - Actions
                • Trigger - Run DialogSelectOrc <gen> (ignoring conditions)
              • Else - Actions

    • Set Sjot
      • Events
        • Map initialization
      • Conditions
      • Actions
        • Set - SpawnCount = 13
        • AI - Ignore the guard positions of all Player 2 (Blue) units
        • AI - Ignore the guard positions of all Player 4 (Purple) units
        • AI - Ignore the guard positions of all Player 6 (Orange) units
        • AI - Ignore the guard positions of all Player 8 (Pink) units
        • AI - Ignore the guard positions of all Player 10 (Light Blue) units
        • AI - Ignore the guard positions of all Player 12 (Brown) units
        • Set RegionSpawn[1] = (Center of Spawn 1 <gen>)
        • Set RegionSpawn[2] = (Center of Spawn 2 <gen>)
        • Set RegionSpawn[3] = (Center of Spawn 3 <gen>)
        • Set RegionSpawn[4] = (Center of Spawn 4 <gen>)
        • Set RegionSpawn[5] = (Center of Spawn 5 <gen>)
        • Set RegionSpawn[6] = (Center of Spawn 6 <gen>)
        • Set RegionSpawn[7] = (Center of Spawn 7 <gen>)
        • Set RegionSpawn[9] = (Center of Spawn 9 <gen>)
        • Set RegionSpawn[10] = (Center of Spawn 10 <gen>)
        • Set RegionSpawn[11] = (Center of Spawn 11 <gen>)
        • Set RegionSpawn[12] = (Center of Spawn 12 <gen>)
        • Set RegionSpawn[13] = (Center of Spawn 13 <gen>)