[Solved] Assistance with AI Jass code troubleshooting

Level 7
Joined
Oct 19, 2024
Messages
55
Hello. I have been working on a campaign, as of late. However, it is my first project, and I tend to make mistakes I do not notice. In particular, two of my latest scripts are giving me a considerable amount of issues (mainly, not working), and I was wondering if anyone here would be as kind as to take a look at my maps and see where the error might be.

So, first of all, one of the latest maps (chapter 4 in the attached campaign) I have made does not run any kind of AI script properly. I have made sure several times that the Forces and Player configurations are properly set and that the triggers run correctly, and yet, nothing.

The second issue is that several AI scripts will not run on any maps, not only the faulty one. I have been using chapter 3 in order to test the AIs.

Conlusion:
-Working.ai runs properly on most chapters; while Not_Working.ai does not run on any chapter; despite the only difference between them being attack waves. As such, there must be some mistake in Not_Working.
-Chapter 4 does not run Working.ai; nor any other normally-working script. As such, there must be a mistake in the configuration of the map, which I am not able to find.

I've attached the campaign, as well as the two mentioned AIs. I've also attached the modified common.ai I'm using, so that the non-natives constants I'm using can be parsed.

(P.D: I'm not sure if this is the right forum to ask for this, or if the formatting is correct. If anything else is needed, please, let me know.)
 

Attachments

I believe there's an error in your globals, in the common.ai file you reference units that don't exist in the Object Editor as far as I an tell such as Hatch 'n00V' which I can't find. If any of those are incorrect it'll cause the script to fail.

Also I think there's a syntax error in the attack waves somewhere as when I deleted all of them the slow chopping activated. Tbh for these kinds of things I think you're better putting the globals in the AI script itself rather than editing common.ai, personally.
 
I believe there's an error in your globals, in the common.ai file you reference units that don't exist in the Object Editor as far as I an tell such as Hatch 'n00V' which I can't find. If any of those are incorrect it'll cause the script to fail.
Well, it did not solve the issue at hand, but it did solve another, different issue, so thanks!

Also I think there's a syntax error in the attack waves somewhere as when I deleted all of them the slow chopping activated. Tbh for these kinds of things I think you're better putting the globals in the AI script itself rather than editing common.ai, personally.
Hmm, something that I've noticed is that with Working.ai the SlowChopping does work, but does not attack in any form, shape, or manner, nor train garrison units. With Not_Working not even SlowChopping seems to work. I've tried adding the constants in the individual script, but it doesn't work regardless.

I've also tried it with different (working) scripts, and all have the same problem in chapter 4: The SlowChopping works, but everything else doesn't.
 
Sure but if there's an issue in common.ai and that script isn't working then it'll cause a whole host of issues hence why it's safer to put the globals in the script.

In fact I think that's the source of your issues, if there's an issue in common.ai then things like Slow Chopping can still work, but any function in common.ai such as BuildUnit or SuicideOnPlayer etc all won't.
 
I've removed the common.ai and restored the imports, as well as defining the constants individually in each script. It still doesn't work.

Working.ai does apply SlowChopping correctly in chapter 4, but does not attack nor train garrisons. Not_Working.ai still doesn't work, not in chapter 4 nor in any other chapter. So, there's still a syntax issue somewhere in Not_Working.ai, and chapter 4 must have something wrong in the AI setup. I just have no clue of what could it be.
 
I've doubled checked now, and everything seems to be in order. Besides, scripts that do work on other maps do not work on chapter 4; so it is not only that Not_Working has at least one syntax issue, but chapter 4 must have something wrong in the configuration to make perfectly fine scripts not work.

Which is weird, because the setup in chapter 4 is exactly the same as in other chapters; and yet working scripts won't harvest lumber, nor produce garrisons or attack waves.
 
Update: I've noticed that a bunch of CampaignAttackerEx where Defender instead. I've corrected it now, and attached the correct version to this comment (as well as replace it in the original). However, it didn't fix the issues. However:

Also I think there's a syntax error in the attack waves somewhere as when I deleted all of them the slow chopping activated.
I tried this, and found out that one of the constants was being referenced erroneously in the code (it was called flamecaller and I was calling it as firecaller), and hence, it wasn't working. So now, Not_Working.ai works properly, and is no longer an issue. Thanks, I'll keep this method in mind for the next time.

However, chapter 4 still refuses to work in any shape, form, or manner. SlowChopping does work now, true, but the enemy AI won't train nor garrisons nor units, nor does it react to being attacked. So, I still don't know what's wrong there.

EDIT: Solved. Today I discovered that if you unpause units without pausing them first the AI bricks itself.
 
Last edited:
Back
Top