- Joined
- Dec 3, 2020
- Messages
- 962
So I have the following ai script:
Right when the AI is about to send their first attack wave, the game permanently freezes (doesn't crash but freezes).
Anyone knows why? I am pretty sure that it's not some triggers causing it and I do the following:
I activate the script for the AI when the map begins (as I always do on every other map of my campaign). The AI only rebuilds lost structures now and has campaignDefenders (works perfectly, doesn't freeze the game).
Then a few moments later I send it the command(0, 0) which gives a signal to the AI to begin attacking the player, the AI prepares its attack wave and as soon as it begins sending it to attack, the game permanently freezes.
This happens with all the other AI Scripts I use on the map too, but for testing purposes I removed them and only kept this one.
All the values are correct (player variables, attack and defend captain coordinates, the unit IDs etc...).
The AI has enough gold, lumber, food and all the necessary techtree. It is also an enemy to the player and the player's allies (and allied to the other undead bases).
I am doing this on the Frostmourne mission. I have removed 90% of the triggers though and I triple checked and didn't find any suspicious trigger that might cause it.
Furthermore, once I activated the AI and didn't send it the command(0, 0) to attack and the game never froze (I playtested it for like 25 min and had 0 issues).
PS: I can send a link to the campaign if anyone wants to waste his time to check the triggers on the final map but at least looking at the script I post here would suffice.
I simplified it as much as I could to see if it will still freeze and it does (for example I removed the looping attack waves etc...).
Basically it works perfectly up until the very first attack wave.
JASS:
//==================================================================================================
// Retribution -- dark green player (Undead Scourge - Player 11) -- AI Script
//==================================================================================================
globals
player targ1 = PlayerEx(1) // Alliance Expedition (player)
player targ2 = PlayerEx(7) // Kirin Tor
player targ = targ1
endglobals
//--------------------------------------------------------------------------------------------------
// switch_targets
//--------------------------------------------------------------------------------------------------
function switch_targets takes nothing returns nothing
loop
exitwhen CommandsWaiting() > 0
call Sleep(1)
endloop
set targ = targ2
endfunction
//--------------------------------------------------------------------------------------------------
// main
//--------------------------------------------------------------------------------------------------
function main takes nothing returns nothing
call CampaignAI(ZIGGURAT_1,null)
//call DoCampaignFarms(false)
set campaign_wood_peons = 0
call SetReplacements(3,3,3)
//call GroupTimedLife(true)
call SetCaptainHome(DEFENSE_CAPTAIN,4209,5530)
call SetCaptainHome(ATTACK_CAPTAIN,2462,204)
call SetPeonsRepair(true)
call SetBuildUnitEx( 1,1,1, NECROPOLIS_1 )
call SetBuildUnitEx( 1,1,1, ACOLYTE )
call SetBuildUnit( 1, UNDEAD_MINE )
call SetBuildUnitEx( 2,2,2, CRYPT )
call SetBuildUnitEx( 1,1,1, GRAVEYARD )
call SetBuildUnitEx( 5,5,5, ZIGGURAT_1 )
call SetBuildUnitEx( 1,1,1, NECROPOLIS_2 )
call SetBuildUnitEx( 5,5,5, ACOLYTE )
call SetBuildUnitEx( 5,5,5, ZIGGURAT_2 )
call SetBuildUnitEx( 1,1,1, DAMNED_TEMPLE )
call SetBuildUnitEx( 1,1,1, SLAUGHTERHOUSE )
call SetBuildUnitEx( 1,1,1, 'usap' )
call SetBuildUnitEx( 1,1,1, 'ubon' )
call SetBuildUnitEx( 1,1,1, NECROPOLIS_3 )
call CampaignDefenderEx( 6, 6, 6, GHOUL )
call CampaignDefenderEx( 3, 3, 3, NECRO )
call WaitForSignal()
call StartThread(function switch_targets)
//*** WAVE 1 ***
call InitAssaultGroup()
call CampaignAttackerEx( 5,5,5, GHOUL )
call CampaignAttackerEx( 1,1,1, ABOMINATION )
call CampaignAttackerEx( 4,4,4, 'nska' )
call SuicideOnPlayerEx(M1,M1,M1,targ)
//*** WAVE 2 ***
call InitAssaultGroup()
call CampaignAttackerEx( 10,10,10, GHOUL )
call CampaignAttackerEx( 2,2,2, ABOMINATION )
call CampaignAttackerEx( 4,4,4, 'unec' )
call SuicideOnPlayerEx(M4,M4,M4,targ)
//*** WAVE 3 ***
call InitAssaultGroup()
call CampaignAttackerEx( 12,12,12, GHOUL )
call CampaignAttackerEx( 4,4,4, 'unec' )
call CampaignAttackerEx( 1,1,1, 'umtw' )
call CampaignAttackerEx( 4,4,4, 'ugar' )
call SuicideOnPlayerEx(M4,M4,M4,targ)
//*** WAVE 4 ***
call InitAssaultGroup()
call CampaignAttackerEx( 10,10,10, GHOUL )
call CampaignAttackerEx( 3,3,3, ABOMINATION )
call CampaignAttackerEx( 6,6,6, 'nska' )
call CampaignAttackerEx( 2,2,2, 'ufro' )
call SuicideOnPlayerEx(M4,M4,M4,targ)
endfunction
Right when the AI is about to send their first attack wave, the game permanently freezes (doesn't crash but freezes).
Anyone knows why? I am pretty sure that it's not some triggers causing it and I do the following:
I activate the script for the AI when the map begins (as I always do on every other map of my campaign). The AI only rebuilds lost structures now and has campaignDefenders (works perfectly, doesn't freeze the game).
Then a few moments later I send it the command(0, 0) which gives a signal to the AI to begin attacking the player, the AI prepares its attack wave and as soon as it begins sending it to attack, the game permanently freezes.
This happens with all the other AI Scripts I use on the map too, but for testing purposes I removed them and only kept this one.
All the values are correct (player variables, attack and defend captain coordinates, the unit IDs etc...).
The AI has enough gold, lumber, food and all the necessary techtree. It is also an enemy to the player and the player's allies (and allied to the other undead bases).
I am doing this on the Frostmourne mission. I have removed 90% of the triggers though and I triple checked and didn't find any suspicious trigger that might cause it.
Furthermore, once I activated the AI and didn't send it the command(0, 0) to attack and the game never froze (I playtested it for like 25 min and had 0 issues).
PS: I can send a link to the campaign if anyone wants to waste his time to check the triggers on the final map but at least looking at the script I post here would suffice.
I simplified it as much as I could to see if it will still freeze and it does (for example I removed the looping attack waves etc...).
Basically it works perfectly up until the very first attack wave.
Last edited: