• Check out the results of the Techtree Contest #19!
  • 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.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

Need help at hero triggering

Status
Not open for further replies.
to make a random selection use an array of unit-types
make a variable called HeroTypes with size 1 and type "unit-type"
then make a trigger that will load it and create the heroes, shud look something like this:
Code:
event- player 1 types "-random"
condition- none
action-
set HeroTypes[0] = Hero1
set HeroTypes[1] = Hero2
set HeroTypes[2] = Hero3
...
For each player do
  -Create 1 HeroTypes[Random number between 0 and <how many hero types> for (Picked Player) at Center of (Spawn Location) facing 0 angle

for the second question use action "Player - limit Training of Heroes"
 
oh i though u meant all random, nvm then heres one for all players
Code:
event- player 1 types "-random" 
player 2 types "-random" 
player 3 types "-random" 
player 4 types "-random" 
player 5 types "-random" 
... copy that event for every player
condition- none 
action- 
set HeroTypes[0] = Hero1 
set HeroTypes[1] = Hero2 
set HeroTypes[2] = Hero3 
... 
  -Create 1 HeroTypes[Random number between 0 and <how many hero types> for (Triggering Player) at Center of (Spawn Location) facing 0 angle
 
heres this might be a little easier to understand
Code:
First Trigger:
Map Initialization:
(Create a variable of type "Unit" as an array. Set the arry up to however many heros there are going to be in the map.)
Set "Your variable"(1) to Paladin
Set "Your variable"(2) to Archmage
Set "Your variable"(3) to Bloodmage
and so on and so forth. Of course set the heros as listed above to whatever heros you want the player to be able to choose from. You can set the array however large u want it. Now for the next trigger:

Player 1 Red types "-random".
Unit: 1 "Your Variable"(Random number between 1 and <how many heros their are> for (Triggering Player) at center of (whatever region you want) facing (Default building degrees(270)).

I hope that clears it up a little bit more.
 
heres this might be a little easier to understand
Code:
First Trigger:
Map Initialization:
(Create a variable of type "Unit" as an array. Set the arry up to however many heros there are going to be in the map.)
Set "Your variable"(1) to Paladin
Set "Your variable"(2) to Archmage
Set "Your variable"(3) to Bloodmage
and so on and so forth. Of course set the heros as listed above to whatever heros you want the player to be able to choose from. You can set the array however large u want it. Now for the next trigger:

Player 1 Red types "-random".
Unit: 1 "Your Variable"(Random number between 1 and <how many heros their are> for (Triggering Player) at center of (whatever region you want) facing (Default building degrees(270)).

I hope that clears it up a little bit more.
 
Status
Not open for further replies.
Back
Top