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

[General] Random Unit Spawn

Status
Not open for further replies.
Level 7
Joined
May 30, 2018
Messages
290
Hey guys :)

So, is there a way to make a random unit out of a pool of 3 units spawn in an area.
I know how normal spawn in an area works, but the random select of the spawning unit is something I would like to get advice on :)
Thanks
 
Make a unity type variable that has a array size of 3
  • Untitled Trigger 001
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set RandomUnitArray[0] = SomeUnitType
      • Set RandomUnitArray[1] = SomeOtherUnitType
      • Set RandomUnitArray[2] = AWholeOtherKindOfUnit
  • Untitled Trigger 001
    • Events
    • Conditions
    • Actions
      • Unit - Create 1 RandomUnitArray[(Random integer number between 0 and 2)] for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing degrees
 
Level 7
Joined
Dec 17, 2017
Messages
134
Just one thing, The_Silent's trigger will leak. I hope you know how to solve that.
  • Settings
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set RandomUnitArray[0] = Footman (Say)
      • Set RandomUnitArray[1] = Rifleman (Say)
      • Set RandomUnitArray[2] = Knight (Say)
  • Troop Spawn
    • Events
    • Time - Every 2.00 seconds of game time (Or your event)
    • Conditions
      • (Conditions if any)
    • Actions
      • Set Spawn_Region = (Center of (Region 1))
      • Unit - Create 1 RandomUnitArray[(Random integer number between 0 and 2)] for Player 1 (Red) at Spawn_Region facing Default building facing degrees
      • Custom Script - Remove Location(udg_Spawn_Region)
[/QUOTE]
 
Status
Not open for further replies.
Top