• 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

Status
Not open for further replies.
Level 20
Joined
Oct 21, 2006
Messages
3,230
  • Unit - Create 1 (Random level 1 creep unit-type) for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing degrees
This creates only random creep...

I tried to change
call CreateNUnitsAtLoc( 1, ChooseRandomCreepBJ(1)
to
call CreateNUnitsAtLoc( 1, ChooseRandomUnitBJ(1)
but it didnt work. :l


EDIT
yeah I can put every unit into an array and pick a random unit from there, but any less-time-consuming ideas?

EDIT
Random creep action creates only creeps that are in that tileset...
 
Last edited:

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,287
yeah I can put every unit into an array and pick a random unit from there, but any less-time-consuming ideas?

Sadly no, as I am sure as hell you do not want a fully random unit. It would be stupid as hell to see frostmourn pedistle, mediev or a town hall (all are units and all would be inluded in a random selection) spawn randomly.

Thus you will have to make an integer array, store all the unit types you want to spawn in it with no gaps in indexes and then choosing the type of the unit to make via a random index of that array (only from indexes which have types in them).
 
Status
Not open for further replies.
Top