| 09-19-2009, 03:45 PM | #1 |
I'm created a dungeon-crawler and I want to know how I would go about doing some AI. In my last dungeon-crawler I had an event - IsUnitAttacked then, have a chance to cast an ability. I'm pretty sure this isn't the best way to go about it. Suggestions? |
| 09-19-2009, 04:14 PM | #2 |
I would create some sort of "In Combat, Out of Combat" system from there detect all mobs in combat and then have your mob abilities setup with a % chance to proc and check that every couple seconds. Or you could do event based spells, like if the mob gets to under 10% life it casts the spell, or if the Hero gets a crit or does over a certain amount of damage. I don't know how you have your system setup so I'm just throwing out some ideas. |
| 09-19-2009, 04:40 PM | #3 |
I guess the bigger problem I'm having is how does the normal WC3 AI work anyway? With some abilities, computer-controlled units will use them by themselves, and with others they won't. How can I disable the computer's wanting to cast abilities? |
| 09-19-2009, 04:47 PM | #4 |
The best way to do it is to control everything in the combat phase, which means, even ordering the attacks and such. That'll interrupt anything the internal ai might do. I think Blade.dk made an ai tutorial a while back, it uses the old Handle Vars, but if you're familiar with vJass, it shouldn't be a problem updating it. |
| 09-19-2009, 04:48 PM | #5 |
Don't actually give them abilities, use Dummy Casting for that, just setup a list of what mobs have what abilities and their chance / event for procing. Then once it meets the requirements for cast, make an invisible dummy unit, give it the proper spell and have the dummy unit cast then remove the dummy unit. Or you can do what Mindy was suggesting as an alternative to dummy casting. |
| 09-19-2009, 05:06 PM | #6 | |
Quote:
I found that : Chain Lightning, Hurl Boulder, Finger of Pain will be automatically cast by computer players. I think they are cast when there is a unit moving away from them nearby. While spells like Slam, Thunder Clap, War Stomp are automatically cast when there is a number of enemy units around the caster. |
| 09-19-2009, 06:53 PM | #7 |
On the same note, how can you stop creeps from helping each other, or reducing the radius in which nearby creeps will come and fight. |
| 09-19-2009, 06:56 PM | #8 |
somewhere in the gameconstants under "neutral" |
