Custom AI Haunted Gold Mine order issue

Rickie26k

New Member
Reaction score
0
So I've this melee map with 10 factions on it, one being Forsaken with Haunted Gold mines. Been working on human and orc AI before, not much problem but needs polish.

So, to explain the issue, the computer refuses to build Haunted Gold mines on gold mines. I've copied the original and renamed it, also copied and the Blighted Gold Mine ability for use. I have the new Haunted Gold Mine in build order and its set as the gold mine type for the AI. I did the script conversion display trick and found out the computer is indeed trying to build, however not on an existing gold mine. Does anyone know the cause of this?

Original gold mines work, so I was pondering if there's some hidden AI stuff attached to either the default Haunted Gold Mine or the default Blighted Gold Mine ability. Some expert advice would be very welcome.
 

Rushhour

New Member
Reaction score
46
I'm not familiar with AI's but there is some special thing in the BJs about haunted goldmines:

JASS:
function IssueBuildOrderByIdLocBJ takes unit whichPeon, integer unitId, location loc returns boolean
    if (unitId == 'ugol') then
        return IssueHauntOrderAtLocBJ(whichPeon, loc)
    else
        return IssueBuildOrderById(whichPeon, unitId, GetLocationX(loc), GetLocationY(loc))
    endif
endfunction

The BJ build order checks if the issued building is the haunted goldmine and then calls this function.
JASS:
function IssueHauntOrderAtLocBJ takes unit whichPeon, location loc returns boolean
    local group g = null
    local unit goldMine = null

    // Search for a gold mine within a 1-cell radius of the specified location.
    set g = CreateGroup()
    call GroupEnumUnitsInRangeOfLoc(g, loc, 2*bj_CELLWIDTH, filterIssueHauntOrderAtLocBJ)
    set goldMine = FirstOfGroup(g)
    call DestroyGroup(g)

    // If no mine was found, abort the request.
    if (goldMine == null) then
        return false
    endif

    // Issue the Haunt Gold Mine order.
    return IssueTargetOrderById(whichPeon, 'ugol', goldMine)
endfunction


Maybe the problem is that you try to "build" the mine but to create it you need to target the goldmine (the building is a spell in this case ?! ). If you did this in your AI script, I can't help you.
 

Rickie26k

New Member
Reaction score
0
Im actually just using the standard AI Editor for this, and Im not very familiar with JASS. I know basic programming syntax and thinking so I could probably inject something trigger based. Not quite sure what BJ even means -_-'

Still, custom Acolytes can work with the default Haunted Gold Mine, even build it as per build order priority from the AI Editor. I've basically only copied it and given it a copied version of the Blighted Gold Mine.

Right now the first AI acolyte just spams the command at a location, but its not a gold mine.

Edit*: Is it possible to retrieve the AI scripts from whats done in the AI editor? *Searches*
Edit**: Eyeballing JASS AI stuffs, might get an idea.

Update: I exported the AI editor file and looked over in JassCraft, the only difference there between Haunted Gold Mine and (my) Undead Haunted Gold Mine is the raw name ugol vs u00C.
One thing bugs me however, its phrased "call SetBuildAll( BUILD_UNIT, 1, 'ugol', -1 )" and I cant find anything about SetBuildAll. Dont expect to find much there but one never knows, as "call SetBuildUnit( n, UnitID )" is what I find at least in tutorial description.

Update: Using JASSCraft I inserted a SetBuildUnit with my custom unit, but yet again, the acolyte wont target a gold mine to build it on. *sad panda*
Update: Its not based on identifying its abilities, I tried with the original Blighted Gold Mine. So it seems there's something hidden about building Haunted Gold Mines. Im all out of ideas, using original with renaming for now. Still want to know what its about though :eek:

Update: Very weird revelation. I tested the order for the AI building default Haunted Gold Mine, and its *drumroll* undeadgoldmine2. What the...
Update: Tried this:

Code:
Undead Initiation
    Events
        Unit - A unit Is issued an order targeting a point
    Conditions
        ((Owner of (Triggering unit)) controller) Equal to Computer
        (Unit-type of (Triggering unit)) Equal to Undead Acolyte
        (Issued order) Equal to (Order(undeadgoldmine2))
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Number of units in (Units of type Undead Haunted Gold Mine)) Equal to (Number of units in (Units of type Undead Necropolis))
            Then - Actions
                Trigger - Turn off (This trigger)
                Skip remaining actions
            Else - Actions
                Unit - Order (Triggering unit) to build a Undead Haunted Gold Mine at (Target point of issued order)

No success. Halp!
 

DrakeMagi

New Member
Reaction score
0
what i did was made custom gold , use tigger to replace it with custom haunted gold mine.
which haunted gold mine start empty so in replace trigger add gold to it.
 

NeuroToxin

New Member
Reaction score
46
I have one answer and one question.
Question: Is there anyway I could use one or two of those races in my melee map? I'd give credits of course.
Answer: Couldn't you just preset the undead mines? And then at the beginning of the map, like map init, check if its not undead, if it is, leave it, if its not, remove the haunted. Same goes to the nelfs.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top