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

Need help at hero triggering

Status
Not open for further replies.
Level 8
Joined
Jul 28, 2004
Messages
258
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"
 
Level 8
Joined
Jul 28, 2004
Messages
258
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
 
Level 7
Joined
Oct 8, 2005
Messages
298
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.
 
Level 7
Joined
Oct 8, 2005
Messages
298
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.
Top