- Joined
- Jan 3, 2021
- Messages
- 6
Hi there : )
TLDR at the end.
I'm currently trying to write a campaign AI and as you might imagine, it's not working. I have the following line at the beginning of the main function to get some semblance of feedback:
When this line shows the file works. Doesn't mean the AI does what I want it to, but at least the file has no critical errors. But the line doesn't show...
I tried removing and pasting the code back in piece by piece to find the error. As soon as the struct I wrote is in the file I no longer see the message in game. I posted the struct below and you'll see it isn't exactly complex.
Now, while there is a definite possibility that there's just an error in the struct, I went over it again and again without finding anything. So, I figured it is possible that structs aren't usable in JASS AI files. I couldn't find any structs in the common.ai. Can I not use Structs in .ai files, or more general vJASS?
TLDR; Can I not use Structs in .ai files?
TLDR at the end.
I'm currently trying to write a campaign AI and as you might imagine, it's not working. I have the following line at the beginning of the main function to get some semblance of feedback:
JASS:
call DisplayTextToPlayer(Player(22),0,0,"AI started")
When this line shows the file works. Doesn't mean the AI does what I want it to, but at least the file has no critical errors. But the line doesn't show...
I tried removing and pasting the code back in piece by piece to find the error. As soon as the struct I wrote is in the file I no longer see the message in game. I posted the struct below and you'll see it isn't exactly complex.
JASS:
struct Attackwave
integer array unittypes[ATTACKWAVEMAXUNITTYPES]
integer array unitamounts[ATTACKWAVEMAXUNITTYPES]
integer currentIndex
static method create takes nothing returns Attackwave
local Attackwave new = Attackwave.allocate()
set new.currentIndex = 0
return new
endmethod
method addUnit takes integer unitType, integer amount returns nothing
if this.currentIndex <= (ATTACKWAVEMAXUNITTYPES - 1) then
set this.unittypes[this.currentIndex] = unitType
set this.unitamounts[this.currentIndex] = amount
set this.currentIndex = this.currentIndex + 1
endif
endmethod
endstruct
Now, while there is a definite possibility that there's just an error in the struct, I went over it again and again without finding anything. So, I figured it is possible that structs aren't usable in JASS AI files. I couldn't find any structs in the common.ai. Can I not use Structs in .ai files, or more general vJASS?
TLDR; Can I not use Structs in .ai files?