• 🏆 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!

[Solved] Creating units at random spots

Status
Not open for further replies.
Level 7
Joined
Feb 23, 2020
Messages
253
Hello, how do i create 3 units total, one at each of these 4 regions?

So one spot should be open only

Thanks in advance.

upload_2020-5-19_18-50-2.png
 
Level 3
Joined
Mar 15, 2018
Messages
31
Try this :)

  • MakeUnits
    • Events
    • Conditions
    • Actions
      • Set VariableSet SpawnRegions[0] = Region 000 <gen>
      • Set VariableSet SpawnRegions[1] = Region 001 <gen>
      • Set VariableSet SpawnRegions[2] = Region 002 <gen>
      • Set VariableSet SpawnRegions[3] = Region 003 <gen>
      • Set VariableSet SpawnRegionVacant = (Random integer number between 0 and 3)
      • For each (Integer A) from 0 to 3, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • SpawnRegionVacant Not equal to (Integer A)
            • Then - Actions
              • Unit - Create 1 Fußsoldat for Player 1 (Red) at (Center of SpawnRegions[(Integer A)]) facing Default building facing degrees
            • Else - Actions
 
Level 7
Joined
Feb 23, 2020
Messages
253
Try this :)

  • MakeUnits
    • Events
    • Conditions
    • Actions
      • Set VariableSet SpawnRegions[0] = Region 000 <gen>
      • Set VariableSet SpawnRegions[1] = Region 001 <gen>
      • Set VariableSet SpawnRegions[2] = Region 002 <gen>
      • Set VariableSet SpawnRegions[3] = Region 003 <gen>
      • Set VariableSet SpawnRegionVacant = (Random integer number between 0 and 3)
      • For each (Integer A) from 0 to 3, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • SpawnRegionVacant Not equal to (Integer A)
            • Then - Actions
              • Unit - Create 1 Fußsoldat for Player 1 (Red) at (Center of SpawnRegions[(Integer A)]) facing Default building facing degrees
            • Else - Actions
This is what i was looking for, thank you sir! :)

Edit: @old_edge5 , so i want these spawned unit to interact with the event "a unit comes within X range of [The spawned unit]. How do i make that work? I tried using "Move unit instantly to" instead, but that did not seem to work hm

Edit: I found a way^^
 
Last edited:
Status
Not open for further replies.
Top