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

[AI] Changing the AI of a player?

Status
Not open for further replies.
Level 14
Joined
Nov 13, 2017
Messages
733
Hello guys, another help askin' thread and might help some if it gets resolved. I would like to ask all of ya if there is a way we could change the AI or the brain flow of the player?

SCENARIO:
* I have Player 2 (Blue) and they usually train 5 gold peasants and 3 lumber peasants, and has only attack waves having only 5 footboys and 2 priests. That only occurs unless TRIGGER A is used up.

* TRIGGER A is only run when you, Player 1 (Red) reaches 10,000 gold then I kinda want this trigger to change the behavior of Player 2 (Blue) and make it more aggressive to train:
  • 5 gold peasants, 5 lumberjacks.
  • Send waves of 10 footies, 5 riflemen, and 3 priests. And sometimes with 2 siege golems.
Basically, how would we able to gradually or occassionally change the bahavior of a computer AI? :)
 
Level 12
Joined
Jun 15, 2016
Messages
472
Depends on the tool you're using. If you're using JASS AI then this is a simple case of changing behavior by commands: set up a function to listen to incoming commands, and once a command is received run whatever function you want. You can find more information about that Moyackx's tutorial or mine. You can update the number of wood peasants using this function native HarvestWood takes integer town, integer peons returns nothing, if you want 5 lumber gatherers you should probably call it like this HarvestWood(0, 5).

Alternatively, if you're using the AI editor, then you should first of all set up a command trigger. Once some event happens, this trigger will send a command with two numbers to the AI (command number, and data number). If this is the only trigger changing the behavior, just use 0 for both numbers.
Then, go to the AI editor and do the following:

1. In the [general] tab click add condition and create an integer comparison condition which goes like this (number of commands waiting) Greater than or equal to 1, and call it "has command" or something. Create another condition like this (number of commands waiting) Equal to 0 called "no command".

2. In the [building] tab, add two peasents to your build priorities and give them both the "has command condition". Also, change the the harvesting priorities like this:
upload_2018-9-13_18-35-1.png


3. In the [Attacking] tab... I can't actually see a way to change attack waves by condition, only how to change targets. Sorry, I tried, the AI editor sucks.
 
Status
Not open for further replies.
Top