- Joined
- Oct 7, 2024
- Messages
- 25
Hiya again,
I recently made an AI script for a mission but it isn't working. I will provide as much detail as I can, and I think I know where the issue is, but who knows.
This is what I have for my program. The enemy I am making is an Orange Orc and the player is Red. I am currently only making 1 "difficulty". Everything is using standard melee calls except for 'OGut' which is a modified version of a far seer saved as a custom unit in the mission with that tag. I have a screenshot below showing how it is saved.
====
This is the object editor. From my understanding, you can't directly place any campaign versions, so I saved a copy into the mission.
I didn't do any kinds of importing for the heroes since I reasoned that the script would just read it off the mission.
For actually saving, I made the script above in Jasscraft (.j file), then copied into Notepad ++ and saved as a .ai file, which I imported into the mission.
As for actually calling it, here is what I did. The action in the 2nd image is to send something so WaitforSignal actually works, but I'm not sure how to actually write it. This could also be something that is causing the issue.
That's pretty much anything I could think of that would be helpful for troubleshooting. I tested in both the map-editor and saved as a campaign and tested directly inside the game, but neither worked (I also ran into other a few other bugs like the UI showing as undead instead of human when launched from in the game but that's another unrelated problem).
Hopefully y'all can help me out, as all the other resources that y'all provided have been really helpful, so thanks
Edit: I also want to clarify that nothing is happening. Peons don't go to harvest gold, no troops are trained. I think I see an issue with there not being anything calling new units to be trained (everything in the build order section is already placed and units are assigned to be defenders, working on it).
I recently made an AI script for a mission but it isn't working. I will provide as much detail as I can, and I think I know where the issue is, but who knows.
This is what I have for my program. The enemy I am making is an Orange Orc and the player is Red. I am currently only making 1 "difficulty". Everything is using standard melee calls except for 'OGut' which is a modified version of a far seer saved as a custom unit in the mission with that tag. I have a screenshot below showing how it is saved.
JASS:
globals
player user = PlayerEx(0)
endglobals
function main takes nothing returns nothing
call CampaignAI(otrb, null)
call DoCampaignFarms(false)
call SetPeonsRepair(true)
call SetHeroesFlee(false)
call SetGroupsFlee(false)
//Accounts all preplaced units
call SetBuildUnit(1, ogre)
call SetBuildUnit(4, opeo)
call SetBuildUnit(1, obar)
call SetBuildUnit(1, ostr)
call SetBuildUnit(1, oalt)
call SetBuildUnit(1, osld)
call SetBuildUnit(1, ofor)
call SetBuildUnit(4, otrb)
call SetBuildUnit(5, ogru)
call SetBuildUnit(4, ohun)
call SetBuildUnit(3, oshm)
//Defenders
call CampaignDefenderEx(5, 5, 5, ogru)
call CampaignDefenderEx(4, 4, 4, ohun)
call CampaignDefenderEx(3, 3, 3, oshm)
//Wave system
call WaitForSignal()
//*** WAVE 1: 7 minutes ***
call Sleep(M4)
call InitAssaultGroup()
call CampaignAttackerEx(3, 3, 3, ogru)
call CampaignAttackerEx(2, 2, 2, ohun)
call CampaignAttackerEx(1, 1, 1, oshm)
call SuicideOnPlayer(M4, user)
//*** WAVE 2: 11 minutes ***
call Sleep(M4)
call InitAssaultGroup()
call CampaignAttackerEx(1, 1, 1, OGut)
call CampaignAttackerEx(2, 2, 2, ogru)
call CampaignAttackerEx(2, 2, 2, ohun)
call SuicideOnPlayer(M4, user)
//*** WAVE 3: 15 minutes ***
call Sleep(M4)
call InitAssaultGroup()
call CampaignAttackerEx(3, 3, 3, ogru)
call CampaignAttackerEx(5, 5, 5, ohun)
call SuicideOnPlayer(M4, user)
//*** WAVE 4: 19 minutes ***
call Sleep(M4)
call InitAssaultGroup()
call CampaignAttackerEx(1, 1, 1, OGut)
call CampaignAttackerEx(3, 3, 3, ogru)
call CampaignAttackerEx(1, 1, 1, oshm)
call SuicideOnPlayer(M4, user)
loop
//*** WAVE 5+: repeating ***
call Sleep(M4)
call InitAssaultGroup()
call CampaignAttackerEx(3, 3, 3, ogru)
call CampaignAttackerEx(3, 3, 3, ohun)
call CampaignAttackerEx(2, 2, 2, oshm)
call SuicideOnPlayer(M4, user)
endloop
endfunction
====
This is the object editor. From my understanding, you can't directly place any campaign versions, so I saved a copy into the mission.
I didn't do any kinds of importing for the heroes since I reasoned that the script would just read it off the mission.
For actually saving, I made the script above in Jasscraft (.j file), then copied into Notepad ++ and saved as a .ai file, which I imported into the mission.
As for actually calling it, here is what I did. The action in the 2nd image is to send something so WaitforSignal actually works, but I'm not sure how to actually write it. This could also be something that is causing the issue.
That's pretty much anything I could think of that would be helpful for troubleshooting. I tested in both the map-editor and saved as a campaign and tested directly inside the game, but neither worked (I also ran into other a few other bugs like the UI showing as undead instead of human when launched from in the game but that's another unrelated problem).
Hopefully y'all can help me out, as all the other resources that y'all provided have been really helpful, so thanks
Edit: I also want to clarify that nothing is happening. Peons don't go to harvest gold, no troops are trained. I think I see an issue with there not being anything calling new units to be trained (everything in the build order section is already placed and units are assigned to be defenders, working on it).
Last edited:
