Mình có đọc trên hiveworkshop về cách cho AI Hero sử dụng spell, có một đoạn code dưới đây mình không hiểu và muốn nhờ các bạn giúp một số chỗ:
Cho mình hỏi muốn AIHero là một hero vừa được train xong từ một Altar thì mình phải làm như thế nào vậy?
Link:http://www.hiveworkshop.com/forums/...gered-hero-artificial-intelligence-gui-33249/
Mã:
[I]Usage of Abilities[/I]
Events
Time - Every 1 seconds of the game
Conditions
(Player [#](color) controller) Equal to Computer
Actions
Set VarUnitGroup = (Units within [distance] of (Position of ([B]AIHero[Array#][/B]) matching (((Matching Unit) is Alive) Equal to True) and ((Matching Unit) belongs to an enemy of (Owner of ([B]AIHero[Array#][/B])) Equal to True) and (((Matching Unit) is A Hero) Equal to True)
Unit - Pick every unit in VarUnitGroup then do (Actions) else do (Else Actions)
Loop - Actions
If (All Condition are true) then do (Actions) Else do (Else Actions)
If - Conditions
(Integer((Life of (Picked Unit)))) Less than or Equal to [desired life]
Then - Actions
Unit - Order [Hero Picker of Player (#)] to [Ability] [to (Picked Unit)/(Position of (Picked Unit))]
Custom script: call DestroyGroup(udg_VarUnitGroup)
Else - Actions
Custom script: call DestroyGroup(udg_VarUnitGroup)
Link:http://www.hiveworkshop.com/forums/...gered-hero-artificial-intelligence-gui-33249/
Chỉnh sửa cuối: