• 💀 Happy Halloween! 💀 It's time to vote for the best terrain! Check out the entries to Hive's HD Terrain Contest #2 - Vampire Folklore.❗️Poll closes on November 14, 2023. 🔗Click here to cast your vote!
  • 🏆 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!
  • 🏆 HD Level Design Contest #1 is OPEN! Contestants must create a maze with at least one entry point, and at least one exit point. The map should be made in HD mode, and should not be openable in SD. Only custom models from Hive's HD model and texture sections are allowed. The only exceptions are DNC models and omnilights. This is mainly a visual and design oriented contest, not technical. The UI and video walkthrough rules are there to give everyone an equal shot at victory by standardizing how viewers see the terrain. 🔗Click here to enter!

[Trigger] Random unit creation Help!

Status
Not open for further replies.
Level 2
Joined
Jan 20, 2008
Messages
7
I've been trying to make a trigger that randomly chooses a group of units and then from that unit group, randomly chooses 1 of those units and creates it inside a region for the player "Neutral Hostile".
E.g The trigger chooses between a tauren, archer, priest, footman etc and comes up with archer. The trigger then creates an archer for Neutral Hostile in region 001. Tauren, region 002, Footman, region 003 and so on.

The problem is I'm stuck.

I tried putting units on the map, adding them to a unit group and then from this unit group tried to get a trigger to randomly choose one then place it in a region but this doesn't work with the "create unit" action fullstop.

I was thinking of assigning each unit a custom value and then having it come up with random values and using them to create the units but its the same deal, doesn't work with the "create unit" action.

I decided to convert each unit to a string and somehow randomize that, but its simply beyond my comprehension. I'd really appreciate any help you guys can offer.

Cheers.
 
Level 21
Joined
Aug 21, 2005
Messages
3,699
Put some units for neutral passive on the map. Then do:
  • Map Initialization
  • Events
    • Map Initialization
  • Conditions
  • Actions
    • Unit group - add (preset unit) to MyUnitGroup[0]
    • Unit group - add (preset unit 2) to MyUnitGroup[0]
    • Unit group - add (preset unit 3) to MyUnitGroup[1]
    • Unit group - add (preset unit 4) to MyUnitGroup[1]
  • Spawn
  • Events
    • // An event
  • Conditions
    • // A condition
  • Actions
    • Unit - Create a unit of unit type (Random unit from MyUnitGroup[random number between 1 and 2]) at region 001
 
Level 2
Joined
Jan 20, 2008
Messages
7
Thank you, Eleandor. You filled in the missing piece of the puzzle for me otherwise i was going to have to fill in ~450 values for ~25 different triggers.

Cheers mate
 
Status
Not open for further replies.
Top