• 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 Hero Trigger

Status
Not open for further replies.
Level 1
Joined
Apr 22, 2006
Messages
3
i have been trying to do this trigger for the longest and i just can't seem to get it right :cry:

does anyone know how to make a random hero trigger by making a random hero seletion from the tavern much like the one from hato's footman frenzy? if you can help me id really appricate it
 

Rui

Rui

Level 41
Joined
Jan 7, 2005
Messages
7,550
First off, you have to create two variables and a dummy unit.

Hero = Unit-Type Variable (select array and put 20)
HeroNumbers = Integer (set initial value to 20)
Dummy = Nothing special. Just create a wisp (for example) with no shadow and incredibly small, so that it's undetectable. It doesn't play much in these triggers anyway.

Now, let's make the triggers. You require two triggers in the next step.

Events:
Map Initializion

Conditions:
(None or you'll have to choose)

Actions:
Set Variable: Set Hero(1) to Archmage
Set Variable: Set Hero(2) to Paladin
Set Variable: Set Hero(3) to Mountain King


Trigger 2:
Events:
Generic Unit Event: A unit Sells a unit

Conditions:
Unit-Type Comparison: (Unit-Type of (Sold Unit)) Equal to Random Hero

Actions:
Create Units Facing Angle: Create 1 Hero[(Random integer between 1 and HeroNumbers)] for (Owner of (Sold Unit)) at Location
Unit - Remove: Remove (Sold Unit) from the game.


Etc. If you need more or less than 20 heroes, you can always change the array of Hero and the initial value of HeroNumbers to other value.
Good luck and have fun :wink:
 
Level 1
Joined
Apr 22, 2006
Messages
3
Rui said:
Actions:
Set Variable: Set Hero(1) to Archmage
Set Variable: Set Hero(2) to Paladin
Set Variable: Set Hero(3) to Mountain King

How do you set a variable to the hero?
it only lets me pick a hero if its on the map
and i dont want that
 
Level 5
Joined
Nov 14, 2004
Messages
159
No, when you get a variable set up with "Unit-Type" and set it up with array checked. Name it "hero".. the variable name is hero.

Then in trigger, you set up in Initalization event.

Action:

Set Variable = Value

On Variable, click that, you will have "hero" in it, pick it, then it has number in bracket, start off with 0 as first in list.

on Value, it give you unit-type list, you know screen with peasant, footman, knight, etc... thats where you choose hero into variable's array.
 
Status
Not open for further replies.
Top