- Joined
- Aug 28, 2019
- Messages
- 84
Hi everyone, I have known the Hive for a long time but only recently signed on. I noticed that there were discussions years ago asking about modifying melee AI with triggers, and from what I can tell the code was not shared. So here it is. This is part of a simple tutorial I made many years ago, with significant help from my friend CHUNK whose knowledge of JASS is that of legend. Without further ado, here it is.
********
TUTORIAL
********
This simple command will allow you to check all the "Fixed Player Settings" boxes in Player Properties but still control the level of Melee AI in the game (Easy/Normal/Insane) by modifying this trigger. (To be totally clear, this is not about custom AI, it's about changing difficulty of the game's inborn AI).
Make this trigger:
Events
Map Initialization
Conditions
(nothing)
Actions
Player Group - Pick Every Player in (All players controlled by a Computer player) and do (Custom script: call ConvertAIDifficulty(2))
Custom Script: call DestroyTrigger( GetTriggeringTrigger() )
NOTE: As this is, it will make the computer AIs Insane. See that number "2" in there? That means "insane" melee AI. 1 is normal, 0 is easy.
Thus, in the custom script, the NUMBER in the () corresponds to difficulty.
0 = Easy
1 = Normal
2 = Insane
There you go, let me know what you think. I have not tried executing these actions in any other way, but I imagine you could have some kind of event within your map that would be able to modify the AI of computer players.
You could probably also modify the actions to target specific computer players, and with tweaking of upgrades and unit availability use this to change the strategy of the computer AI without having to ever mess with AI in the first place. Just a theory.
Best regards,
ThomasEddington
********
TUTORIAL
********
This simple command will allow you to check all the "Fixed Player Settings" boxes in Player Properties but still control the level of Melee AI in the game (Easy/Normal/Insane) by modifying this trigger. (To be totally clear, this is not about custom AI, it's about changing difficulty of the game's inborn AI).
Make this trigger:
Events
Map Initialization
Conditions
(nothing)
Actions
Player Group - Pick Every Player in (All players controlled by a Computer player) and do (Custom script: call ConvertAIDifficulty(2))
Custom Script: call DestroyTrigger( GetTriggeringTrigger() )
NOTE: As this is, it will make the computer AIs Insane. See that number "2" in there? That means "insane" melee AI. 1 is normal, 0 is easy.
Thus, in the custom script, the NUMBER in the () corresponds to difficulty.
0 = Easy
1 = Normal
2 = Insane
There you go, let me know what you think. I have not tried executing these actions in any other way, but I imagine you could have some kind of event within your map that would be able to modify the AI of computer players.
You could probably also modify the actions to target specific computer players, and with tweaking of upgrades and unit availability use this to change the strategy of the computer AI without having to ever mess with AI in the first place. Just a theory.
Best regards,
ThomasEddington