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

[AI] Ai Pick Heroes

Status
Not open for further replies.
Level 3
Joined
Jun 18, 2016
Messages
68
Guys, i need some help here. How can i make my map's AI to pick their own heroes from tavern? example i have 5 different heroes and have 5 players, 1 is me another 4 was AI. How can i order them to pick their own hero? i dont want they has same hero in map...
 
I have no idea how to order an Bot to use Taverns/Shops, but it can be solved with Triggers.

If this is for the selection of a custom game with picking a hero at the Start, you could add all Hero-types into an unit-typ array and then create them after Human-Players picked or after a time expired.

If you want to make Heroes unique you can then use the Player - disable Training/construction action and you'll need an boolean array, to capture the allready picked Hero-types. At creation for bot hero's you need to consider the already pick situation.

Pro Hint - use the Object Editor datafield - "Pointvalue" to give any Hero-Type a Number, will allow more easy determination.

This will allow you more easily to create Random button btw.
 
  • Initialisierung
    • Ereignisse
      • Map initialization
    • Bedingungen
    • Aktionen
      • -------- They need the same numbers at point-value --------
      • Set Hero_Type[0] = Paladin
      • Set Hero_Type[1] = Erzmagier
      • Set Hero_Type[2] = Bergkönig
  • Pick
    • Ereignisse
      • Unit - A unit enters (Playable map area)
    • Bedingungen
      • ((Triggering unit) is a Hero) Gleich True
    • Aktionen
      • Spielergruppe - Pick every player in (All players) and do (Actions)
        • Schleifen - Aktionen
          • Player - Make (Unit-type of (Triggering unit)) not avaible for training/construction by (Picked player)
          • Set Hero_Type_picked[(Point-value of (Unit-type of (Triggering unit)))] = True
That way you have an easy indexing for hero-types and if they are picked.
 
Level 3
Joined
Jun 18, 2016
Messages
68
Those heroes need the same number in the point value? example all are 1?

And...What if i want to make it can have all pick and random? will it random the hero that is been picked?
 
For Random, well you need somehow to get avaible Hero Indexs.

Spontan i can think about two ways
1. loop through all Hero-Types and add all avaible to an int-array (some type of stack), remember the last number and than pick a random Index out of the stack. This is the hero.

2. Do a get Random Hero-Index. Redo that if Hero is unavaible.
 
Status
Not open for further replies.
Top