• 🏆 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 Hero Pick System

Status
Not open for further replies.
Level 6
Joined
Jul 13, 2007
Messages
173
Hello Everyone!:grin: i got a bit of trouble here. in my map i want so that you can Pick a random hero either by game mode all random, or by buying a random unit. i have been trying to make this, but yeah it didnt turn out to well. can anyone here lead me to a tutorial or system on this site or another? or post the code for such a system here. all help will be appreciated.
 
Level 5
Joined
Apr 8, 2008
Messages
88
As DarkAngelAzazel allready said, you first should create a unit variable that stores every possible hero.

  • Set the Values
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set Heroes[1] = Paladin
      • Set Heroes[2] = Archmage
      • Set Heroes[3] = Mountain King
      • Set Heroes[4] = Blood Mage
-AR command

  • With command
    • Events
      • Player - Player 1 (Red) types a chat message containing -AR as An exact match
    • Conditions
      • Has_Heroes Equal to 0
    • Actions
      • Set Has_Heroes = 1
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Unit - Create 1 Heroes[(Random integer number between 1 and 4)] for (Picked player) at ((Picked player) start location) facing Default building facing degrees
When you buy a "random unit"

Then you have to create a dummy unit that you buy, but when it enters the map it gets removed while it spawns a random hero for that player.

  • when you buy one
    • Events
      • Unit - A unit enters (Entire map)
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Footman
    • Actions
      • Unit - Remove (Triggering unit) from the game
      • Unit - Create 1 Heroes[(Random integer number between 1 and 4)] for (Owner of (Triggering unit)) at ((Owner of (Triggering unit)) start location) facing Default building facing degrees
I made so the heroes are created at the startlocation of the players, but you can change that if you'd like to :thumbs_up:
 
Status
Not open for further replies.
Top