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

[Trigger] Random Unit

Status
Not open for further replies.
Level 20
Joined
Oct 21, 2006
Messages
3,231
  • 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,201
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