• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • Vote for the theme of Hive's HD Modeling Contest #7! Click here to vote! - Please only vote if you plan on participating❗️

[AI] [solved] Condition Not Working? I swear it was working earlier

Status
Not open for further replies.
Level 20
Joined
Mar 16, 2008
Messages
824
EDIT: SOLVED SORRY I JUST DIDN'T HAVE GLOBAL VARIABLES SET CORRECTLY / OBJECT EDITOR

The script seems to get hung up on building guard towers. It was working before. IDK why it has a problem now. This player starts out with two guard towers. So the intended action is to upgrade them and not build two more base level guard towers, unless they get destroyed then build two more base level ones then upgrade them. Here are the relevant segments of the script:

JASS:
globals
    boolean                 gCond_Need_Guard_Tower     = false
    constant integer        GUARD_TOWER_1              = 'h00R'
    constant integer        GUARD_TOWER_2              = 'h00Q'
endglobals

JASS:
function UpdateConditions takes nothing returns nothing
    set gCond_Need_Guard_Tower = ( ( GetUnitCount( GUARD_TOWER_1 ) + GetUnitCount( GUARD_TOWER_2 ) ) < 2 )
endfunction

JASS:
function BuildPriorities takes nothing returns nothing
    local integer mine = TownWithMine()
    if (gCond_Need_Guard_Tower) then
        call SetBuildAll( BUILD_UNIT, 1, GUARD_TOWER_1, -1 )
        call SetBuildAll( BUILD_UNIT, 2, GUARD_TOWER_1, -1 )
    endif
    call SetBuildAll( BUILD_UNIT, 1, GUARD_TOWER_2, -1 )
    call SetBuildAll( BUILD_UNIT, 2, GUARD_TOWER_2, -1 )
endfunction

It just seems to give up on life when it gets to the point with the guard tower conditions. I swear it was working in other iterations. Any ideas?
 
Last edited:
Status
Not open for further replies.
Top