• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

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

Status
Not open for further replies.
Level 18
Joined
Mar 16, 2008
Messages
721
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