• 🏆 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] Extreme Lag Because of Function/Conditions?

Status
Not open for further replies.
Level 18
Joined
Mar 16, 2008
Messages
721
When I add these conditions to this AI script, it seems to cause extreme lag to the point of freezing the game completely. When I disable them, the script seems to run fine. Any ideas why? I would say some king of leak but it doesn't seem to crash the game??? Thank you.

Here is the disabled version of the script. So when the /// is removed, it causes extreme lag about 5 mins in or so.
JASS:
function UpdateConditions takes nothing returns nothing
/// set gCond_Need_Exp1 = ( ( GetMinesOwned(  ) < 2 ) and ( GetTownUnitCount( 'htow', 1, false ) == 0 ) )
/// set gCond_Need_Exp2 = ( ( GetMinesOwned(  ) < 3 ) and ( GetTownUnitCount( 'htow', 2, false ) == 0 ) )
/// set gCond_Need_Exp3 = ( ( GetMinesOwned(  ) < 4 ) and ( GetTownUnitCount( 'htow', 3, false ) == 0 ) )
/// set gCond_Need_Exp4 = ( ( GetMinesOwned(  ) < 5 ) and ( GetTownUnitCount( 'htow', 4, false ) == 0 ) )
/// set gCond_Need_Exp5 = ( ( GetMinesOwned(  ) < 6 ) and ( GetTownUnitCount( 'htow', 5, false ) == 0 ) )
/// set gCond_Need_Exp6 = ( ( GetMinesOwned(  ) < 7 ) and ( GetTownUnitCount( 'htow', 6, false ) == 0 ) )
endfunction

JASS:
function BuildPriorities takes nothing returns nothing
    ...
/// if (gCond_Need_Exp1) then
        call BuildExpansion( 'htow', 'htow' )
/// endif
    ...
/// if (gCond_Need_Exp2) then
        call BuildExpansion( 'htow', 'htow' )
/// endif
    ...
    ...
/// if (gCond_Need_Exp3) then
        call BuildExpansion( 'htow', 'htow' )
/// endif
/// if (gCond_Need_Exp4) then
        call BuildExpansion( 'htow', 'htow' )
/// endif
/// if (gCond_Need_Exp5) then
        call BuildExpansion( 'htow', 'htow' )
/// endif
/// if (gCond_Need_Exp6) then
        call BuildExpansion( 'htow', 'htow' )
/// endif
endfunction
 
Status
Not open for further replies.
Top