• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Randomizing player spawns with regions

Status
Not open for further replies.
Level 6
Joined
Apr 5, 2013
Messages
154
  • 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?
 
Level 15
Joined
Jul 9, 2008
Messages
1,552
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>)
 
Status
Not open for further replies.
Top