• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[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