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

My AI script does not work

Status
Not open for further replies.
Level 6
Joined
Sep 10, 2022
Messages
81
Hello again. I am working with the AI editor, and I am making simple AI for not melee map. I have watched some videos (pretty old) before and I have a basic understanding how to do it. But every time I launch my map, the AI does nothing... I posted successive screenshots to show exactly what was done.

1. General tab
1670776607819.png


2. Heroes tab
1670776647405.png


3. Building tab. The base building is Town Hall (AI). (AI) is editor suffix. The workers, barracks - they also have (AI) suffix. I build some workers, then swordmen, the farm and some swordmen.
1670776696951.png


Note that my custom race workers do not take up a supply. Also note that then in the triggers before I run the "campaign script" for player 3, I make him an ally for player 1 (i.e. real man)

4. Asset manager

1670777086685.png


I figured that I can't edit the full path of .ai file. I don't know if this is a problem. But in older versions (maybe before Reforged) I remember that I can edit the full paths.

5. At last I use these triggers:

1670777280496.png


1670777319503.png


Do you have any idea what I did wrong? The AI doesn't want to work. I haven't touched the Attacking tab but it doesn't even execute the build...
 
Level 3
Joined
Dec 11, 2022
Messages
20
I had my share of sleepless nights fighting AI scripts. I wrote them without the help of the editor however.

Sadly I don't remember most of the pitfalls. The largest issue is that the editor does not report the errors that it encounters in the script and silently fails. If I had to guess it probably either can't find the script, can't find the definition for a unit type by it's code, syntax error or typo (unlikely with the editor's help). That's all the concrete issues I can think of as of present. Again, there might be runtime exclusive issues but I no longer remember any of the details.

I suggest to study the AI scripts for the original campaign. Then write your own in a text editor. Prior to 1.31 the original scripts were stored in War3x.mpq/Scripts. Of particular interest to you are common.ai which declares all the AI specific natives.
 

Check your script with this tool. An error should be reported if the script has something missing.

Since you use the AI editor, make sure the AI has gold and lumber as well as the town hall to start the whole script.
 
Level 3
Joined
Dec 11, 2022
Messages
20
For this kind of check pjass should work too. Recent versions of the game package this tool with the game itself.
 
Level 6
Joined
Sep 10, 2022
Messages
81

Check your script with this tool. An error should be reported if the script has something missing.

Since you use the AI editor, make sure the AI has gold and lumber as well as the town hall to start the whole script.
Well, I checked my script. No errors. I also have starting position for AI with gold mine and lumber.
1671265888324.png

Then, I figured out something. I always ran the map using "Test Map" in Map Editor. But I decided to run through Warcraft 3 directly. I add 2nd and 3rd players, making both of them standard computers. And all worked. That is, everything worked out as soon as I entered the game and filled the slots...
Then why didn't ai work through "Test Map"?
 
Status
Not open for further replies.
Top