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

(x)===ARTIFICCIAL__INTELIGENCE==(x)

Status
Not open for further replies.
Level 9
Joined
Dec 15, 2009
Messages
523
wew does the title looks cool?xD hehehe

anyway back to topic

can anyone teach me how to make a simple AI?umm for my upcoming Aos
i need an AI that can go to mid,top,or btm lane and cast spell and when reach 30% health it will auto return to base and refill

simple AI anyone who does know about AI's?
please

no jass please i dont know jass
 

Vunjo

Hosted Project: SC
Level 14
Joined
Jul 1, 2010
Messages
1,340
You know that it's all in triggers. You can make at map int all heroes to a variable with numbers. Like, variable called RandomHero 1 is ranger, RandomHero 2 is priest...
Then, on map int again, wait few seconds, then for each computer, give him RandomHero "random number between 1 and X", where X is maximum number of heroes. That way, a bot has selected a random Hero, then you can easly make action "Game - Display to all players the text: Bot picked (last created unit)". For going down, mid, and top, make like, Bots 2.,3. go down, 3.,4. go top and 5.,go mid. Simply, pick every unit owned by the player, and move him to desired spot whenever you want it. It would be best if you make it on "sound" similar to dota. Then, Hero will freely move. For low health to go back, when unit is attacked, simply detect his health, like if it is less than or equal to 25%, then order him to move back to fountain. Learning spells and such are a bit complicated. When the hero levels up, learn him spell. And then, if it's attacked, or if it attacks is better, simply order unit to cast the spell. Note, to cast a spell by triggers, you must cast a spell MADE from the one you are using. For example, you have a spell called Raise Dead, and you rename it to Summon Skeletons, you will have to cast a spell called Raise Dead, because there will be no such spell to cast as Summon Skeletons. You will have to do it for every Hero, I think that there's no other way. Buying items is similar, if player has X gold, and if the hero is near the shop, reduce the amount of gold for the player, and create new item for the Hero.
 
Level 9
Joined
Oct 11, 2009
Messages
477
For example, like 'Vunjo' said, creating AI triggers require some Wait actions(if not MUI/MPI), some variables, conditions, and order for Unit Groups. You need to construct proper trigger(s) which includes these for an automated player to work. Anyway there are AI tutorials in the hive, try reading them.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
You use the AI built into the game for most abilities (even custom ones get cast reasonably). You have a perodic timer with a decision tree in its actions.

Every 5 seconds is all it needs to be.
If health is low (below 25%), order hero back to main base and set recovering = true
If recovering, order back to main base.
If recovering and health is high ( above 90% ), order back into combat and set recovering = false.
If recovering = false, order into combat.

That is a very simple AI and prety much the principles behind it as far as I have seen. Want more complex behaviours? Then program them in!
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
Their movement should be based off of from your creep movement (well, in AoS game, there WILL be creeps, using a pre-defined place/route)
Use the creep route as same as the AI Heroes
Now, that's one step closer of creating an Artificial Intelligence (your spelling, wrong =D)
 
Level 12
Joined
Jan 30, 2009
Messages
1,067
OT:
"Hmmmm..... A.I.... What's the A stand for?"

"Artificial."

"What's the I--"

"Intelligence."

"...
...
What's the A stand for again?"

"Moving on."

I freaking love Caboose, <3
 

Vunjo

Hosted Project: SC
Level 14
Joined
Jul 1, 2010
Messages
1,340
Ok now, I will post as much triggers as I can. Here is the first one:
[trigger=Random Hero]Random Hero ^^
Events
Map initialization
Conditions
Actions
Set RandomHero[1] = Paladin
Set RandomHero[2] = Archmage
Set RandomHero[3] = Mountain King
Set RandomHero[4] = Blood Mage[/trigger]

This trigger will set heroes to variables, so the bot can pick a random one.
To make a Hero for a bot, use this:
[trigger=Pick a Hero]Pick a Hero FFS
Events
Map initialization
Conditions
Actions
Wait 10.00 seconds
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Player 1 (Red) controller) Equal to Computer
Then - Actions
Unit - Create 1 RandomHero[(Random integer number between 1 and 4)] for Player 1 (Red) at (Center of Sentinel Fountain <gen>) facing Default building facing degrees
Else - Actions[/trigger]

Now, the bot will get 1 Random hero. This works only for player 1 red bot, you can either spam it for all other players, or use For each integer A from 1 to 12 do actions. Sorry, but I cannot explain you how that works. Just please, ignore the fact that player 1 red is actually "Sentinels" ^^

For moving them to "down, top or mid", use something like this:
[trigger=Move Hero]Move Hero FFS
Events
Time - Every 2.00 seconds of game time
Conditions
Actions
Unit Group - Pick every unit in (Units in Sentinel Fountain <gen>) and do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Owner of (Picked unit)) controller) Equal to Computer
(Percentage life of (Picked unit)) Greater than or equal to 90.00
Then - Actions
Unit - Order (Picked unit) to Attack-Move To (Center of AI Bottom <gen>)
Else - Actions[/trigger]

So, this will move the Hero to the bottom. You can also order him to Move to that region, but if a player wants to "ambush" him, then he would ignore all attacks while moving.
For low health Hero to go back to base:
[trigger=Move N00B]Move N00B
Events
Unit - A unit Is attacked
Conditions
((Owner of (Triggering unit)) controller) Equal to Computer
((Triggering unit) is A Hero) Equal to True
(Percentage life of (Triggering unit)) Less than or equal to 25.00
Actions
Unit - Order (Triggering unit) to Move To (Center of Sentinel Fountain <gen>)[/trigger]

This will make the hero that has life less than, or equal to 25% to go back to fountain. The Hero will go back, and fight when is almost full health, because of the previous trigger.
Learning Spells, and casting them:
[trigger=Learning Spells]Paladin Spells
Events
Unit - A unit Gains a level
Conditions
((Owner of (Triggering unit)) controller) Equal to Computer
(Unit-type of (Triggering unit)) Equal to Paladin
(Hero level of (Triggering unit)) Equal to 2
Actions
Hero - Learn skill for (Triggering unit): Human Paladin - Holy Light[/trigger]

[trigger=Casting Spells]Paladin Spells
Events
Unit - A unit Is attacked
Conditions
((Owner of (Triggering unit)) controller) Equal to Computer
(Unit-type of (Triggering unit)) Equal to Paladin
Actions
Unit - Order (Attacked unit) to Human Paladin - Holy Light (Attacking unit)[/trigger]

So, when the Hero levels up, if he is paladin, and is a bot, then he will learn Holy Light, and when gets hit, will cast it on enemy unit.
For buying items, it should be similar to this:
[trigger=Buying Items]Paladin Items
Events
Unit - A unit enters Sentinel Fountain <gen>
Conditions
((Owner of (Triggering unit)) controller) Equal to Computer
(Unit-type of (Triggering unit)) Equal to Paladin
((Owner of (Triggering unit)) Current gold) Equal to 500
((Triggering unit) has an item of type Boots of Speed) Equal to False
Actions
Hero - Create Boots of Speed and give it to (Triggering unit)
Player - Add -500 to (Owner of (Triggering unit)) Current gold[/trigger]

When the Hero goes "back", if the player has 500 gold, it will buy him boots of speed. Of course, if hero allready have it, he won't buy it again =)

That is all I think. You can make all of these triggers different, it is a fact, but this is the easiest way I think.
Good luck with your project.
 
Status
Not open for further replies.
Top