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

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,183
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,183
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