• 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.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

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

Status
Not open for further replies.
Level 22
Joined
Mar 16, 2008
Messages
1,032
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.
Back
Top