Hello all!
So the go is that I'm working on custom AI for another project that has a custom Night Elf techtree.
I've got AI to work for the most part doing everything I need but the Night Elves won't harvest gold from the custom Entangled Mine I have.
This is for AI made in JASS set up as Campaign AI.
I've considered doing something like ordering the wisps to harvest/entangle the mine but that feels like a sloppy band-aid patch.
Something else to note, when playing the custom techtree, trying to harvest from the gold mine works however you get hit with a "Gold Mine is already entangled" message.
Besides that, it works as it should.
Any tips or work arounds anyone can share?
I'm working on a small test map to send for anyone needing to look into a map themselves.
EDIT: Here is the JASS function I have working to get the custom wisps into the custom Entangled Mine.
It could probably be better but it works at the moment and I'm too busy trying to perfect getting the correct town's mine.
So the go is that I'm working on custom AI for another project that has a custom Night Elf techtree.
I've got AI to work for the most part doing everything I need but the Night Elves won't harvest gold from the custom Entangled Mine I have.
This is for AI made in JASS set up as Campaign AI.
I've considered doing something like ordering the wisps to harvest/entangle the mine but that feels like a sloppy band-aid patch.
Something else to note, when playing the custom techtree, trying to harvest from the gold mine works however you get hit with a "Gold Mine is already entangled" message.
Besides that, it works as it should.
Any tips or work arounds anyone can share?
I'm working on a small test map to send for anyone needing to look into a map themselves.
EDIT: Here is the JASS function I have working to get the custom wisps into the custom Entangled Mine.
JASS:
//============================================================================
// NightElfHarvestGold
//============================================================================
function NightElfHarvestGold takes integer town, integer wisps, integer maxPer returns nothing
local unit wisp
local unit mine
local group wispsGroup = CreateGroup() // Get only owned Wisps
local group minesGroup = GetPlayerUnitsOfType(legend_mine,ai_player) // Get only owned Entangled Mines
local integer count = 0
local group mineWisps = CreateGroup()
// Find an entangled mine we own that has room
loop
set mine = FirstOfGroup(minesGroup)
if mine == null then
endif
exitwhen mine == null
if IsMineAvailable(mine, maxPer) then
exitwhen true
endif
endloop
if mine == null then
call DestroyGroup(wispsGroup)
call DestroyGroup(minesGroup)
call DestroyGroup(mineWisps)
return // No mine available
endif
set wispsGroup = GetPlayerUnitsOfType(legend_worker,ai_player)
// Filter for idle Wisps
loop
set wisp = FirstOfGroup(wispsGroup)
exitwhen wisp == null
if IsUnitIdle(wisp) then
call GroupAddUnit(mineWisps, wisp) // Add unit
endif
call GroupRemoveUnit(wispsGroup, wisp) // Remove unit
endloop
call DestroyGroup(wispsGroup)
// Assign Wisps to the mine
set count = 0
loop
set wisp = FirstOfGroup(mineWisps)
exitwhen wisp == null or count >= wisps
if mine != null and wisp != null then
endif
call IssueTargetOrder(mine, "load", wisp)
call GroupRemoveUnit(mineWisps, wisp)
set count = count + 1
call Sleep(.1)
endloop
call DestroyGroup(minesGroup)
call DestroyGroup(mineWisps)
endfunction
Last edited: