• 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.

Random spawn event

Status
Not open for further replies.
Level 2
Joined
Aug 15, 2013
Messages
7
Does anyone know how to do folowing, any help is welcome.

Selected units: a(footman) and b(knight) (units are not important just example)
Event condition - Map started
Action 1
- Create random number z (where z is any number in scale from x to y -lets say x is 0 and y is 5).
Action 2
- In selected region, spawn unit (random a or b) is set value rolled in Action 1.
 

Chaosy

Tutorial Reviewer
Level 40
Joined
Jun 9, 2011
Messages
13,219
something like this?
  • Melee Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set loc = (Center of Region 000 <gen>)
      • Set roll = (Random integer number between 1 and 10)
      • For each (Integer A) from 1 to roll, do (Actions)
        • Loop - Actions
          • Unit - Create 1 Footman for Player 1 (Red) at loc facing Default building facing degrees
          • Unit - Set the custom value of (Last created unit) to roll
      • Custom script: call RemoveLocation(udg_loc)
 
Level 2
Joined
Aug 15, 2013
Messages
7
Basicly what i need - when map start, in region 1 random number (set betwen 2 values) of random unit(set between few different units) spawn
 

Chaosy

Tutorial Reviewer
Level 40
Joined
Jun 9, 2011
Messages
13,219
Oh right.

This trigger creates 5 units of one randomly selected of the specified unit types.
  • Untitled Trigger 001
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set units[1] = Knight
      • Set units[2] = Sorceress
      • Set units[3] = Grunt
      • Set units[4] = Archer
      • Set amount_of_unit_types = 4
      • Unit - Create 5 units[(Random integer number between 1 and amount_of_unit_types)] for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing degrees
 
Status
Not open for further replies.
Top