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

Status
Not open for further replies.
Level 3
Joined
Aug 15, 2007
Messages
67
I have searched google and this site for the past couple of days with no luck so I hope this is not covered yet.

I am trying to configure an AI for a random hero in a DOTA type game. I have set the heroes to attack and retreat the way I like but I can't figure out how to make them use spells without manually triggering 30+ heroes and spells individually.

The PC players are given a random hero so I won't know which spells each one has. I am hoping there is another way rather than to set a variable array for each and every hero spell available.
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,196
Ultimately you will have to manually trigger the tactical AI for every ability if you want the AI to cast them properly. If you want them to be cast like they are in Melee then simply making the player a computer and possibly turning on AI should suffice.

Since several abilities will likely share similar cast conditions you can consider creating a library to manage that sort of ability in order to reduce code duplication.
 
Level 14
Joined
Jul 1, 2008
Messages
1,314
you could try to have arrays of abilities for your heroes, where you just save the IDs e.g.
[1] = aggressive spell
[2] = support
etc.

If you did this for every hero, then you could just handle all heroes generally. Like, if a unit enters a range of 300 of your hero, and this unit is low HP, use aggressive spell, if this would result in death or something like this.

What do you think?
 
Status
Not open for further replies.
Top