• 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.

Give AI heroes

Status
Not open for further replies.
Level 15
Joined
Aug 11, 2009
Messages
1,606
How about using something like this?
  • About AI
  • Events
    • Map initialization
  • Conditions
  • Actions
    • Set Hero_Number = (Random integer number between 1 and 6)
    • Player Group - Pick every player in (All players matching (((Picked player) controller) Equal to Computer)) and do (Actions)
      • Loop - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Picked player) Equal to Player 1 (Red)
          • Then - Actions
            • Set Point = (Center of Team 1 Start <gen>)
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • Hero_Number Equal to 1
              • Then - Actions
                • Unit - Create 1 Paladin for Player 1 (Red) at Point facing Default building facing degrees
              • Else - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • Hero_Number Equal to 2
              • Then - Actions
                • Unit - Create 1 Archmage for Player 1 (Red) at Point facing Default building facing degrees
              • Else - Actions
          • Else - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Picked player) Equal to Player 2 (Blue)
          • Then - Actions
            • Set Point = (Center of Team 2 Start <gen>)
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • Hero_Number Equal to 1
              • Then - Actions
                • Unit - Create 1 Paladin for Player 2 (Blue) at Point facing Default building facing degrees
              • Else - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • Hero_Number Equal to 2
              • Then - Actions
                • Unit - Create 1 Archmage for Player 2 (Blue) at Point facing Default building facing degrees
              • Else - Actions
          • Else - Actions
        • Custom script: call RemoveLocation(udg_Point)
 
hmm.. but I would need to set them already at map init or something... but useful anyways... I was just thinking of different game modes but anyways I won't be placing all random I think so this will do it. I found a way on how to use your trigger to fit my needs because I'm planning of about 40+ heroes....

but can you make something that can run after the players picked their heroes so that players can pick first before the AI get heroes because the AI might get the hero that a player wants to use.....
 
Then this has to do with the Hero Selection system you use...I remove the picked heroes from my map using the 2 below triggers.
  • Player - Make (Unit-type of (Sold unit)) Unavailable for training/construction by (Picked player)
  • Unit - Remove (Sold unit) from the game

I did that already, It is removed from the taverns but how to use it in your trigger?

For example since I have about 40 heroes then I might do this:
  • Set Hero[1] = blah
  • //do this up to how many heroes you have
  • Player Group - Pick Every Player matching PlayerIsControlledbyComputer then do actions
  • Set number = Math Random Integer between 0 and 40
  • Create 1 Hero[number] for picked player
  • Neutral Building - Remove Hero[number] from all marketplaces
then how will I remove that hero from the list of possible outcomes? If I remove him from the array then the next player might get the same number and will get a null unit-type
 
My suggestion would be use...SetHero[1]= XXX,SetHero[2]= XXX etc
Do this for all your heroes.Then add all these heroes to a Unit Group.
Then you something like player picks hero...remove hero from unit group.
This way the Computer won't be able to pick the same hero again.

But a unit group needs the units to be in-game right but I'm using taverns..

I can set the variable to null after that variable is picked but still the random number can be equal to that value then it will not create a hero because I nulled it...

EDIT: ahh. okay I can just create all the heroes at some place when there is an AI player then remove them when a hero of that kind is picked from the tavern or by the AI trigger then remove the remaining ones after the selection ends right? figured it out just haven't tested yet... thanks!
 
Level 15
Joined
Aug 11, 2009
Messages
1,606
hmm,you are right.That leaves us with 2 options then.Maybe try this?
  • Unit Group - Add Hero[1] to HeroPickGroup
or the other option is to create a region,outside map boundaries and place all the heroes there.This way you will be able to pick and add them to a Group.

EDIT:if you found the solution then no problem :)
 
hmm,you are right.That leaves us with 2 options then.Maybe try this?
  • Unit Group - Add Hero[1] to HeroPickGroup
or the other option is to create a region,outside map boundaries and place all the heroes there.This way you will be able to pick and add them to a Group.

I'll just create them at some point when there is an AI player.. but you cannot add a Unit-type to a group right?
 
Status
Not open for further replies.
Top