• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[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