Moderator
M
Moderator
Reviewed by Maker, AI System v2.2.4, 5th May 2012
Approved
The system works, but it could be a lot more efficient and could provide more intelligent heroes.
Reviewed by Maker, AI System v2.1.2, 8th Apr 2012
Required changes
Suggested changes
- Add importing instructions into the map file including how to customize the skill build for heroes
You also must mention that the initial size of the arrays must be 12
- Instead of picking all items in the map, pick items inside a custom region. Center the region on the hero
- The system causes FPS drop in the test map, but not as much as before.
The every 2 seconds trigger is quite heavy still- Rename Initialization to AI Initilaization
- Remove the vision and shared units actions from the initialization trigger
Use different init trigger for that, one that doesn't belong to the system- Save picke unit into a variable in AI Every 2 sec to avoid repeated function calls
- Remove unneeded variables
- AI taget unit might be null when you order units to attack move to a position of that unit
The units won't move anywhere, you could skip giving the order altogether- Use a variable for injured state value, set it at map initilaization
You could also use variables for other values like item pick range- AI hero cast doesn't need Starts the effect of an ability event
Reviewed by Maker, [GUI] AI System v1.2.5, 2nd Apr 2012
Required changes
- Don't set map spesific actions in your system's triggers
- AI hero ability learn initialization is not done correctly
Don't use BJ functions
Save things for unit type id's
It also leaks unit groups- The system causes FPS drop every 3 seconds in the test map
- Don't pick all units in the map for every player every 3 seconds
->
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- And - All (Conditions) are true
- Conditions
- (Owner of (Picked unit)) Equal to (Player((Integer A)))
- ((Triggering unit) is A structure) Equal to False
- ...
- Then - Actions
- Else - Actions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- (Owner of (Picked unit)) Equal to (Player((Integer A)))
- ((Triggering unit) is A structure) Equal to False
- ...
- Then - Actions
- Else - Actions
- Learn to use player number to avoid integer loops.
AI Remove Dead Unit trigger for example is very unefficient- AI Change Target trigger signals to me that the system is not MUI
- In AI Attack you should check that the random unit is not null
- AI Hero Learn Skill test trigger is very unefficient. I recommend using a hashtable and saving stuff with unit type id
- I think AI Hero Cast trigger should have Begins casting an ability event
- AI AI Pick Item trigger could use a group that has heroes only so you don't have to
filter through tons on non hero units
Bribe: Please seperate map-specific things into another section, for example you mingled the game message with your actual code, which is not a great idea.
I recommend instead of using "pick units matching conditions", to pick the units overall and then use an if/then/else (multiple actions) block to filter them out. For example, you could change the group actions in "AI Set Units" to this:
- Set TempGroup = (Units owned by (Player((Integer A))))
-
Unit Group - Pick every unit in TempGroup and do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- ((Picked unit) is A structure) Equal to false
- ((Picked unit) is dead) Equal to false
- ((Picked unit) is in AIInjuredHeroes[(Integer A)]) Equal to false
- ((Picked unit) is in AIUnits[(Integer A)]) Equal to false
- ((Picked unit) is in CastingAIUnits) Equal to false
-
Then - Actions
- Unit Group - Add (Picked unit) to AIUnits[(Integer A)]
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Loop - Actions