• 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!

[Trigger] AI Scripts not starting after intro cinematic

Level 3
Joined
Jan 12, 2010
Messages
35
I'm working on a campaign-style map using custom AI scripts, but they stopped working after I implemented a cinematic at the start of the map.

I have verified that the AI scripts work fine if I run my "start ai" trigger on map initialization, but only if I disable the opening cinematic. So, the cinematic trigger seems to be introducing the problem, not the AI script itself. If anyone can help me figure out what I'm doing wrong here, it would be much appreciated.

The main cinematic trigger is as follows:
(this is run by a Run Trigger action on map initialization, so it has no event nor conditions)
  • Actions
    • Hero - Disable experience gain for HERO_JAINA.
    • Game - Turn the day/night cycle Off
    • -------- TURN ON CINEMATIC MODE --------
    • Cinematic - Turn cinematic mode On for Pg_aaaPlayerGroup
    • Cinematic - Disable user control for Pg_aaaPlayerGroup.
    • Cinematic - Fade out over 0.00 seconds using texture White Mask and color (0.00%, 0.00%, 0.00%) with 0.00% transparency
    • -------- PAUSE / HIDE UNITS --------
    • Set VariableSet ug_hidden_units = (Units in (Playable map area))
    • Unit Group - Remove all units of (Units owned by P_aaaPlayer.) from ug_hidden_units.
    • Unit Group - Remove all units of (Units owned by P_nightbladeMain.) from ug_hidden_units.
    • Unit Group - Remove all units of (Units owned by Neutral Passive.) from ug_hidden_units.
    • Unit Group - Pick every unit in ug_hidden_units and do (Actions)
      • Loop - Actions
        • Set VariableSet u_temp_unit = (Picked unit)
        • Unit - Pause u_temp_unit
        • Unit - Hide u_temp_unit
    • -------- START MUSIC --------
    • Sound - Set Combat Sounds to 0.00%
    • Sound - Set Animation and Spell Sounds to 0.00%
    • Trigger - Run intro music <gen> (checking conditions)
    • -------- XXXXX CINEMATIC IS NOW SKIPPABLE XXXXX --------
    • Set VariableSet is_in_cinematic = True
    • Trigger - Turn on intro skip <gen>
    • If (intro_skipped Equal to True) then do (Skip remaining actions) else do (Do nothing)
    • -------- Jaina & Shamans move --------
    • Set VariableSet u_intro_shaman_speaker = (Random unit from ug_intro_shamans)
    • Set VariableSet temp_point = (Center of cine01 shaman move01 <gen>)
    • Unit Group - Order ug_intro_party to Move To temp_point
    • Custom script: call RemoveLocation(udg_temp_point)
    • Set VariableSet temp_point = (Center of cine01 Jaina move01 <gen>)
    • Unit - Order HERO_JAINA to Move To temp_point
    • Custom script: call RemoveLocation(udg_temp_point)
    • Trigger - Turn on intro Jaina face shaman <gen>
    • -------- FADE IN --------
    • Camera - Apply intro01 gate1 <gen> for P_aaaPlayer over 0.00 seconds
    • Camera - Apply intro02 gate2 <gen> for P_aaaPlayer over 18.00 seconds
    • Cinematic - Fade in over 2.00 seconds using texture White Mask and color (0.00%, 0.00%, 0.00%) with 0.00% transparency
    • Wait 3.00 seconds
    • If (intro_skipped Equal to True) then do (Skip remaining actions) else do (Do nothing)
    • -------- Time: 3s --------
    • Cinematic - Send transmission to Pg_aaaPlayerGroup from u_intro_shaman_speaker named Shaman: Play No sound and display On behalf of Durota.... Modify duration: Set to 6.00 seconds and Don't wait
    • Wait 6.00 seconds
    • If (intro_skipped Equal to True) then do (Skip remaining actions) else do (Do nothing)
    • -------- Time: 9s --------
    • Cinematic - Send transmission to Pg_aaaPlayerGroup from HERO_JAINA named Jaina Proudmoore: Play No sound and display Any time, gentlemen.... Modify duration: Set to 12.00 seconds and Don't wait
    • Wait 12.00 seconds
    • If (intro_skipped Equal to True) then do (Skip remaining actions) else do (Do nothing)
    • -------- Time: 21s --------
    • -------- party moves on; fade to the battle --------
    • Set VariableSet temp_point = (Center of cine01 shaman move02 <gen>)
    • Unit Group - Order ug_intro_party to Move To temp_point
    • Custom script: call RemoveLocation(udg_temp_point)
    • Wait 2.00 seconds
    • If (intro_skipped Equal to True) then do (Skip remaining actions) else do (Do nothing)
    • -------- Time: 23s --------
    • Cinematic - Fade out over 1.00 seconds using texture White Mask and color (0.00%, 0.00%, 0.00%) with 0.00% transparency
    • Wait 1.00 seconds
    • If (intro_skipped Equal to True) then do (Skip remaining actions) else do (Do nothing)
    • -------- Time: 24s --------
    • Camera - Apply intro03 town1 <gen> for P_aaaPlayer over 0.00 seconds
    • Camera - Apply intro04 town2 <gen> for P_aaaPlayer over 6.00 seconds
    • -------- THE FIGHT BEGINS --------
    • Trigger - Turn on intro heals <gen>
    • Unit - Order u_intro_archer01 to Attack u_intro_footman03
    • Unit - Order u_intro_archer02 to Attack u_intro_footman02
    • Unit - Order u_intro_archer03 to Attack u_intro_footman01
    • Unit - Order u_intro_footman01 to Attack u_intro_archer03
    • Unit - Order u_intro_footman02 to Attack u_intro_huntress
    • Unit - Order u_intro_footman03 to Attack u_intro_archer01
    • Unit - Order u_intro_huntress to Attack u_intro_footman02
    • Sound - Set Combat Sounds to 80.00%
    • Sound - Set Animation and Spell Sounds to 80.00%
    • -------- fade back in --------
    • Cinematic - Fade in over 1.00 seconds using texture White Mask and color (0.00%, 0.00%, 0.00%) with 0.00% transparency
    • Wait 1.00 seconds
    • If (intro_skipped Equal to True) then do (Skip remaining actions) else do (Do nothing)
    • Sound - Play HumanCallToArmsWhat1 <gen> at 100.00% volume, attached to Town Hall 0003 <gen>
    • Wait 2.00 seconds
    • If (intro_skipped Equal to True) then do (Skip remaining actions) else do (Do nothing)
    • Sound - Play FootmanYesAttack3 <gen> at 100.00% volume, attached to u_intro_footman01
    • Wait 2.00 seconds
    • If (intro_skipped Equal to True) then do (Skip remaining actions) else do (Do nothing)
    • Sound - Play ShandrisYesAttack3 <gen> at 100.00% volume, attached to u_intro_huntress
    • Wait 2.00 seconds
    • If (intro_skipped Equal to True) then do (Skip remaining actions) else do (Do nothing)
    • Unit - Order HERO_JAINA to Attack u_intro_archer02
    • Wait 1.00 seconds
    • If (intro_skipped Equal to True) then do (Skip remaining actions) else do (Do nothing)
    • Cinematic - Send transmission to Pg_aaaPlayerGroup from HERO_JAINA named Jaina Proudmoore: Play No sound and display We're being attacke.... Modify duration: Set to 8.00 seconds and Don't wait
    • Wait 8.00 seconds
    • If (intro_skipped Equal to True) then do (Skip remaining actions) else do (Do nothing)
    • -------- elves can now be killed --------
    • Trigger - Turn off intro heals <gen>
    • Unit Group - Pick every unit in ug_intro_elf_group and do (Actions)
      • Loop - Actions
        • Set VariableSet u_temp_unit = (Picked unit)
        • Unit - Set life of u_temp_unit to 1.00%
    • Set VariableSet temp_point = (Center of intro archer retreat <gen>)
    • Unit - Order u_intro_archer02 to Move To temp_point
    • Unit - Order u_intro_archer01 to Move To temp_point
    • Custom script: call RemoveLocation(udg_temp_point)
    • Wait 3.00 seconds
    • If (intro_skipped Equal to True) then do (Skip remaining actions) else do (Do nothing)
    • Cinematic - Fade out over 1.00 seconds using texture White Mask and color (0.00%, 0.00%, 0.00%) with 0.00% transparency
    • Wait 1.00 seconds
    • If (intro_skipped Equal to True) then do (Skip remaining actions) else do (Do nothing)
    • -------- Fight ends; move to conversation with Footman --------
    • Unit - Remove u_intro_archer01 from the game
    • Unit - Remove u_intro_archer02 from the game
    • Unit - Remove u_intro_archer03 from the game
    • Unit - Remove u_intro_huntress from the game
    • Set VariableSet temp_point = (Center of cine01 Jaina move02 <gen>)
    • Unit - Move HERO_JAINA instantly to temp_point, facing 90.00 degrees
    • Custom script: call RemoveLocation(udg_temp_point)
    • Set VariableSet temp_point = (Center of cine01 Footman move <gen>)
    • Unit - Move u_intro_footman01 instantly to temp_point, facing 270.00 degrees
    • Custom script: call RemoveLocation(udg_temp_point)
    • Unit Group - Pick every unit in ug_intro_shamans and do (Actions)
      • Loop - Actions
        • Set VariableSet u_temp_unit = (Picked unit)
        • Unit - Make u_temp_unit face u_intro_footman01 over 0.00 seconds
    • Camera - Apply intro05 footman talk <gen> for P_aaaPlayer over 0.00 seconds
    • Cinematic - Fade in over 1.00 seconds using texture White Mask and color (0.00%, 0.00%, 0.00%) with 0.00% transparency
    • Wait 1.00 seconds
    • If (intro_skipped Equal to True) then do (Skip remaining actions) else do (Do nothing)
    • Cinematic - Send transmission to Pg_aaaPlayerGroup from HERO_JAINA named Jaina Proudmoore: Play No sound and display What's going on her.... Modify duration: Set to 8.00 seconds and Don't wait
    • Wait 8.00 seconds
    • If (intro_skipped Equal to True) then do (Skip remaining actions) else do (Do nothing)
    • Cinematic - Send transmission to Pg_aaaPlayerGroup from u_intro_footman01 named Footman: Play No sound and display I've no idea, milad.... Modify duration: Set to 10.00 seconds and Don't wait
    • Wait 10.00 seconds
    • If (intro_skipped Equal to True) then do (Skip remaining actions) else do (Do nothing)
    • Cinematic - Fade out over 1.00 seconds using texture White Mask and color (0.00%, 0.00%, 0.00%) with 0.00% transparency
    • Wait 1.00 seconds
    • If (intro_skipped Equal to True) then do (Skip remaining actions) else do (Do nothing)
    • Camera - Apply intro06 elf base <gen> for P_aaaPlayer over 0.00 seconds
    • Camera - Apply intro07 elf base <gen> for P_aaaPlayer over 10.00 seconds
    • Cinematic - Fade in over 1.00 seconds using texture White Mask and color (0.00%, 0.00%, 0.00%) with 0.00% transparency
    • Wait 1.00 seconds
    • If (intro_skipped Equal to True) then do (Skip remaining actions) else do (Do nothing)
    • Cinematic - Send transmission to Pg_aaaPlayerGroup from HERO_JAINA named Jaina Proudmoore: Play No sound and display We'll have to break.... Modify duration: Set to 10.00 seconds and Don't wait
    • Wait 12.00 seconds
    • Cinematic - Fade out over 1.00 seconds using texture White Mask and color (0.00%, 0.00%, 0.00%) with 0.00% transparency
    • Wait 1.00 seconds
    • If (intro_skipped Equal to True) then do (Skip remaining actions) else do (Do nothing)
    • Camera - Apply intro05 footman talk <gen> for P_aaaPlayer over 0.00 seconds
    • Cinematic - Fade in over 1.00 seconds using texture White Mask and color (0.00%, 0.00%, 0.00%) with 0.00% transparency
    • Wait 1.00 seconds
    • If (intro_skipped Equal to True) then do (Skip remaining actions) else do (Do nothing)
    • Unit - Make HERO_JAINA face u_intro_shaman_speaker over 1.00 seconds
    • Wait 1.00 seconds
    • If (intro_skipped Equal to True) then do (Skip remaining actions) else do (Do nothing)
    • Cinematic - Send transmission to Pg_aaaPlayerGroup from HERO_JAINA named Jaina Proudmoore: Play No sound and display You should get to s.... Modify duration: Set to 8.00 seconds and Don't wait
    • Wait 8.00 seconds
    • If (intro_skipped Equal to True) then do (Skip remaining actions) else do (Do nothing)
    • Cinematic - Send transmission to Pg_aaaPlayerGroup from u_intro_shaman_speaker named Shaman: Play No sound and display We orcs do not run .... Modify duration: Set to 14.00 seconds and Don't wait
    • Wait 14.00 seconds
    • If (intro_skipped Equal to True) then do (Skip remaining actions) else do (Do nothing)
    • Cinematic - Send transmission to Pg_aaaPlayerGroup from HERO_JAINA named Jaina Proudmoore: Play No sound and display Well, then, gentlem.... Modify duration: Set to 5.00 seconds and Don't wait
    • Wait 5.00 seconds
    • If (intro_skipped Equal to True) then do (Skip remaining actions) else do (Do nothing)
    • -------- Time: 111s --------
    • -------- CINEMATIC ENDS --------
    • Trigger - Turn off intro skip <gen>
    • Trigger - Run start ai scripts <gen> (checking conditions)
    • Cinematic - Fade out over 2.00 seconds using texture White Mask and color (0.00%, 0.00%, 0.00%) with 0.00% transparency
    • Wait 2.00 seconds
    • Trigger - Run intro cleanup <gen> (checking conditions)

The other triggers used/referenced by the intro cinematic trigger are:
(this trigger is run by the above trigger, so, again, it has no events nor conditions)
  • Actions
    • Sound - Clear the music list
    • Wait 0.01 seconds
    • Sound - Play Orc Theme.
    • Sound - Set the music list to Music, starting with a random song

(this is for the fighting archers/huntress/footmen units in intro cinematic, all of whom are owned by Neutral Passive)
  • Events
    • Unit - A unit Takes damage
  • Conditions
    • (Owner of (Triggering unit)) Equal to Neutral Passive
  • Actions
    • Set VariableSet u_intro_heal_target = (Triggering unit)
    • Unit - Set life of u_intro_heal_target to 100.00%

(this is to make Jaina turn to face the shaman group after the first Move command)
  • Events
    • Unit - A unit enters cine01 Jaina move01 <gen>
  • Conditions
    • (Entering unit) Equal to HERO_JAINA
  • Actions
    • Trigger - Turn off (This trigger)
    • Wait 0.50 seconds
    • Unit - Make HERO_JAINA face u_intro_shaman_speaker over 1.50 seconds

(this is the trigger to transition from cinematic to gameplay, and is run at the end of the intro cinematic trigger as well as by the intro skip trigger)
  • intro cleanup
    • Actions
      • Set VariableSet is_in_cinematic = False
      • -------- remove intro elves --------
      • Unit - Remove u_intro_archer01 from the game
      • Unit - Remove u_intro_archer02 from the game
      • Unit - Remove u_intro_archer03 from the game
      • Unit - Remove u_intro_huntress from the game
      • -------- give footmen to player --------
      • Unit - Change ownership of u_intro_footman01 to P_aaaPlayer and Change color
      • Unit - Change ownership of u_intro_footman02 to P_aaaPlayer and Change color
      • Unit - Change ownership of u_intro_footman03 to P_aaaPlayer and Change color
      • -------- set footman hp --------
      • Unit - Set life of u_intro_footman01 to 90.00%
      • Unit - Set life of u_intro_footman02 to 60.00%
      • Unit - Set life of u_intro_footman03 to 85.00%
      • -------- move units into position --------
      • Set VariableSet temp_point = (Center of start footman01 <gen>)
      • Unit - Move u_intro_footman01 instantly to temp_point, facing 125.00 degrees
      • Custom script: call RemoveLocation(udg_temp_point)
      • Set VariableSet temp_point = (Center of start footman02 <gen>)
      • Unit - Move u_intro_footman02 instantly to temp_point, facing 125.00 degrees
      • Custom script: call RemoveLocation(udg_temp_point)
      • Set VariableSet temp_point = (Center of start footman03 <gen>)
      • Unit - Move u_intro_footman03 instantly to temp_point, facing 125.00 degrees
      • Custom script: call RemoveLocation(udg_temp_point)
      • Set VariableSet temp_point = (Center of start shaman01 <gen>)
      • Unit - Move Shaman 0002 <gen> instantly to temp_point, facing 90.00 degrees
      • Custom script: call RemoveLocation(udg_temp_point)
      • Set VariableSet temp_point = (Center of start shaman02 <gen>)
      • Unit - Move Shaman 0025 <gen> instantly to temp_point, facing 90.00 degrees
      • Custom script: call RemoveLocation(udg_temp_point)
      • Set VariableSet temp_point = (Center of start shaman03 <gen>)
      • Unit - Move Shaman 0026 <gen> instantly to temp_point, facing 90.00 degrees
      • Custom script: call RemoveLocation(udg_temp_point)
      • Set VariableSet temp_point = (Center of start shaman04 <gen>)
      • Unit - Move Shaman 0027 <gen> instantly to temp_point, facing 90.00 degrees
      • Custom script: call RemoveLocation(udg_temp_point)
      • Set VariableSet temp_point = (Center of start Jana <gen>)
      • Unit - Move HERO_JAINA instantly to temp_point, facing 90.00 degrees
      • Custom script: call RemoveLocation(udg_temp_point)
      • -------- reset gold mine --------
      • Neutral Building - Set Gold Mine 0000 <gen> to 15000 gold
      • -------- reset trees --------
      • Destructible - Pick every destructible in start wood target <gen> and do (Actions)
        • Loop - Actions
          • Set VariableSet temp_destructable = (Picked destructible)
          • Destructible - Set life of temp_destructable to 100.00%
      • -------- resume XP gain --------
      • Hero - Enable experience gain for HERO_JAINA.
      • -------- resume day/night cycle --------
      • Game - Turn the day/night cycle On
      • -------- reset resources --------
      • Player - Set P_aaaPlayer.Current gold to 375
      • Player - Set P_aaaPlayer.Current lumber to 125
      • -------- restore game camera --------
      • Camera - Apply start cam <gen> for P_aaaPlayer over 0.00 seconds
      • -------- reset sound channels --------
      • Sound - Reset all volume channels to 100%
      • -------- cinematic mode off --------
      • Cinematic - Turn cinematic mode Off for (All players)
      • Cinematic - Enable user control for (All players).
      • -------- stop music --------
      • Sound - Stop the currently playing music theme
      • -------- unhide units --------
      • Unit Group - Pick every unit in ug_hidden_units and do (Actions)
        • Loop - Actions
          • Set VariableSet u_temp_unit = (Picked unit)
          • Unit - Unhide u_temp_unit
      • Unit - Unpause all units
      • -------- fade in --------
      • Cinematic - Fade in over 1.00 seconds using texture White Mask and color (0.00%, 0.00%, 0.00%) with 0.00% transparency
      • -------- queue quest messages --------
      • Wait Campaign hint delay seconds
      • Trigger - Add quest message main q <gen> to the trigger queue (Checking conditions)
      • Trigger - Add hint ships q <gen> to the trigger queue (Checking conditions)

  • intro skip
    • Events
      • Player - Player 10 (Light Blue) skips a cinematic sequence
    • Conditions
      • intro_skipped Equal to False
    • Actions
      • Trigger - Turn off (This trigger)
      • Set VariableSet intro_skipped = True
      • Trigger - Turn off intro Jaina face shaman <gen>
      • Trigger - Turn off intro heals <gen>
      • Trigger - Run start ai scripts <gen> (checking conditions)
      • Cinematic - Fade out over 1.00 seconds using texture White Mask and color (0.00%, 0.00%, 0.00%) with 0.00% transparency
      • Wait 1.00 seconds
      • Trigger - Run intro cleanup <gen> (checking conditions)
And then, the trigger to run the AI scripts, which itself is ran by a Run Trigger action in either intro cinematic or intro skip, is simply:
  • Actions
    • AI - Start campaign AI script for P_moonhunter: 01teal.ai
    • AI - Start campaign AI script for P_nightbladeMain: 01darkgreen.ai
I've read through all these triggers multiple times, but can't for the life of me find the problem. As-is, the AI doesn't run -- their wisps start harvesting lumber, but then they just sit there. If I move the action to run the start ai trigger to map initialization, same issue. But, if I move it to map initialization, and disable the map initialization action to run intro cinematic, it suddenly works fine. And, either both ai scripts run fine, or neither of them do. So the problem is almost certainly with the intro cinematic; I just can't see it. Am I missing something obvious?

I'm like, 99% sure the ai scripts themselves aren't the problem, but I'll put them here, just in case I'm wrong about that.
JASS:
//========================================================
//    AI script for the Moonhunters in Map01
//     Mass huntress + PotM; aggressive, but low-tech
//========================================================
globals
    player user = Player(9)
endglobals
//========================================================
//    BUILD PRIORITIES    
//========================================================
function BuildOrder takes nothing returns nothing

    call SetBuildUnitEx( 1, 1, 1, 'ewsp' )
    call SetBuildUnitEx( 1, 1, 1, 'etol' ) 
    call SetBuildUnitEx( 6, 6, 6, 'emow' )
    call SetBuildUnitEx( 2, 3, 3, 'eaom' )
    call SetBuildUnitEx( 1, 1, 1, 'eate' )
    call SetBuildUnitEx(12,12,12, 'ewsp' )
    call SetBuildUnitEx( 1, 1, 1, 'edob' )
    call SetBuildUnitEx( 1, 1, 1, 'etoa' )
endfunction

//========================================================
//    BASE DEFENSE
//========================================================

function CampaignDefenses takes nothing returns nothing
    call CampaignDefenderEx(2, 2, 4, 'earc' ) 
    call CampaignDefenderEx(0, 2, 4, 'esen' )
    call CampaignDefenderEx(1, 1, 1, 'Emoo' )
endfunction

//========================================================
//    ATTACK WAVES    
//========================================================

function AttackWaves takes nothing returns nothing

    //***  WAVE 1  ***
    call InitAssaultGroup()
    call CampaignAttackerEx( 2, 2, 4, 'esen' )
    call CampaignAttackerEx( 0, 2, 2, 'earc' )
    call SuicideOnPlayerEx(60,60,60, user)

    //***  WAVE 2  ***
    call InitAssaultGroup()
    call CampaignAttackerEx( 2, 4, 4, 'esen' )
    call CampaignAttackerEx( 0, 2, 2, 'earc' )
    call SuicideOnPlayerEx(120, 120, 90, user)

    call SetBuildUpgrEx(1, 1, 1, 'Reuv' )

    //***  WAVE 3  ***
    call InitAssaultGroup()
    call CampaignAttackerEx( 2, 2, 4, 'esen' )
    call CampaignAttackerEx( 0, 3, 3, 'earc' )
    call CampaignAttackerEx( 0, 1, 1, 'Emoo' )
    call SuicideOnPlayerEx(150, 150, 150, user)
    
    call SetBuildUpgrEx(0, 1, 1, 'Resm' )
    call SetBuildUpgrEx(0, 1, 1, 'Rema' )
    call SetBuildUpgrEx(1, 1, 1, 'Remg' )

    loop
        //***  WAVE 4  ***
        call InitAssaultGroup()
        call CampaignAttackerEx( 3, 3, 4, 'esen' )
        call CampaignAttackerEx( 0, 2, 3, 'earc' )
        call SuicideOnPlayerEx(180, 150, 150, user)

        //***  WAVE 5  ***
        call InitAssaultGroup()
        call CampaignAttackerEx( 3, 3, 3, 'esen' )
        call CampaignAttackerEx( 0, 2, 2, 'earc' )
        call SuicideOnPlayerEx(120, 120, 90, user)

        //***  WAVE 6  ***
        call InitAssaultGroup()
        call CampaignAttackerEx( 2, 4, 6, 'esen' )
        call CampaignAttackerEx( 0, 2, 3, 'earc' )
        call SuicideOnPlayerEx(90, 90, 90, user)
    
        //***  WAVE 6  ***
        call InitAssaultGroup()
        call CampaignAttackerEx( 2, 3, 4, 'esen')
        call CampaignAttackerEx( 2, 3, 4, 'earc' )
        call SuicideOnPlayerEx(75, 75, 75, user)


        //***  WAVE 7  ***
        call InitAssaultGroup()
        call CampaignAttackerEx( 2, 3, 3, 'esen' )
        call CampaignAttackerEx( 2, 3, 3, 'earc' )
        call CampaignAttackerEx( 1, 1, 1, 'Emoo' )
        call SuicideOnPlayerEx(115, 90, 60, user)

        //***  WAVE 8  ***
        call InitAssaultGroup()
        call CampaignAttackerEx( 2, 4, 6, 'esen' )
        call CampaignAttackerEx( 2, 4, 4, 'earc' )
        call SuicideOnPlayerEx(180, 180, 150, user)
    endloop
endfunction

//========================================================
//    MAIN FUNCTION
//========================================================
function main takes nothing returns nothing
    call CampaignAI('emow', null)
    call SetSlowChopping( true )
    call SetPeonsRepair( true )
    call SetRandomPaths( true )

    call BuildOrder()
    call CampaignDefenses()


    call AttackWaves()
endfunction

JASS:
//========================================================
//    AI script for the Nightblades in Map01
//     Mostly defensive; occasional air attacks.
//========================================================
globals
    player user = Player(9)
    integer TechUp = 1
endglobals
//========================================================
//    BUILD PRIORITIES
//========================================================
function BuildOrder takes nothing returns nothing

    call SetBuildUnitEx( 1, 1, 1, 'ewsp' )
    call SetBuildUnitEx( 1, 1, 1, 'etol' )
    call SetBuildUnitEx( 6, 6, 6, 'emow' )
    call SetBuildUnitEx(12,12,12, 'ewsp' )
    call SetBuildUnitEx( 1, 2, 2, 'eaom' )
    call SetBuildUnitEx( 1, 1, 1, 'edob' )
    call SetBuildUnitEx( 1, 1, 1, 'eate' )
    call SetBuildUnitEx( 1, 1, 1, 'etoa' )
    call SetBuildUnitEx( 1, 2, 2, 'eaow' )
    call SetBuildUnitEx( 1, 1, 1, 'eden' )
    if TechUp > 1 then
        call SetBuildUnitEx( 1, 1, 1, 'etoe' )
        call SetBuildUnitEx( 1, 1, 1, 'edos' )
        call SetBuildUnitEx( 8, 8, 8, 'emow' )
    endif
endfunction
//========================================================
//    BASE DEFENSE
//========================================================
function CampaignDefenses takes nothing returns nothing
    call CampaignDefenderEx ( 2, 2, 4, 'earc' )
    call CampaignDefenderEx ( 0, 2, 2, 'efdr' )
    call CampaignDefenderEx ( 1, 1, 1, 'Ewar' )
endfunction
//========================================================
//    ATTACK WAVES
//========================================================
function AttackWaves takes nothing returns nothing
    local integer AttackTier = TechUp

    loop        
        //***  WAVE 1  ***
        call InitAssaultGroup()
        call CampaignAttackerEx( 2, 2, 4, 'earc' )
        call CampaignAttackerEx( 1, 2, 2, 'ebal' )
        call SuicideOnPlayerEx(180, 180, 180, user)

        call SetBuildUpgrEx(1, 1, 1, 'Reuv' )
        call SetBuildUpgrEx(1, 1, 1, 'Reib' )
        call SetBuildUpgrEx(1, 1, 1, 'Redc' )
        exitwhen AttackTier != TechUp

        //***  WAVE 2  ***
        call InitAssaultGroup()
        call CampaignAttackerEx( 2, 4, 4, 'earc' )
        call CampaignAttackerEx( 1, 1, 2, 'ebal' )
        call CampaignAttackerEx( 2, 2, 4, 'edot' )
        call SuicideOnPlayerEx(150, 150, 150, user)

        call SetBuildUpgrEx(0, 1, 1, 'Resm' )
        call SetBuildUpgrEx(0, 1, 1, 'Rema' )
        call SetBuildUpgrEx(1, 1, 1, 'Reec' )
        exitwhen AttackTier != TechUp

        loop
            //***  WAVE 3  ***
            call InitAssaultGroup()
            call CampaignAttackerEx( 2, 4, 4, 'ehpr' )
            call CampaignAttackerEx( 2, 2, 2, 'efdr' )
            call SuicideOnPlayerEx(150, 150, 120, user)
            exitwhen AttackTier != TechUp

            //***  WAVE 4  ***
            call InitAssaultGroup()
            call CampaignAttackerEx( 2, 2, 4, 'earc' )
            call CampaignAttackerEx( 2, 2, 2, 'ebal' )
            call CampaignAttackerEx( 0, 2, 2, 'edot' )
            call SuicideOnPlayerEx(240, 240, 240, user)
            exitwhen AttackTier != TechUp
        endloop
        exitwhen AttackTier != TechUp
    endloop
endfunction

function AngyAttackWaves takes nothing returns nothing
    local integer AttackTier = TechUp

    //make sure lower tier upgrades are researched
    call SetBuildUpgrEx(1, 1, 1, 'Reuv' )
    call SetBuildUpgrEx(1, 1, 1, 'Reib' )
    call SetBuildUpgrEx(1, 1, 1, 'Redc' )
    call SetBuildUpgrEx(0, 1, 1, 'Resm' )
    call SetBuildUpgrEx(0, 1, 1, 'Rema' )
    call SetBuildUpgrEx(1, 1, 1, 'Reec' )

    loop
        call SetBuildUpgrEx(0, 1, 1, 'Remk' )
        call SetBuildUpgrEx(1, 1, 1, 'Recb' )

        //***  WAVE 1 ***
        call InitAssaultGroup()
        call CampaignAttackerEx( 2, 4, 4, 'earc' )
        call CampaignAttackerEx( 1, 1, 2, 'ebal' )
        call CampaignAttackerEx( 2, 2, 4, 'edot' )
        call CampaignAttackerEx( 1, 1, 1, 'Ewar' )
        call SuicideOnPlayerEx(240, 240, 240, user)
        //exitwhen AttackTier != TechUp

        loop
            //***  WAVE 2 ***
            call InitAssaultGroup()
            call CampaignAttackerEx( 4, 6, 6, 'ehpr' )
            call CampaignAttackerEx( 2, 2, 2, 'efdr' )
            call CampaignAttackerEx( 1, 1, 2, 'echm' )
            call SuicideOnPlayerEx(150, 150, 150, user)
            //exitwhen AttackTier != TechUp

            //***  WAVE 3 ***
            call InitAssaultGroup()
            call CampaignAttackerEx( 2, 4, 4, 'earc' )
            call CampaignAttackerEx(0, 2, 2, 'edot' )
            call CampaignAttackerEx( 1, 1, 2, 'ebal' )
            call SuicideOnPlayerEx(180, 180, 180, user)
            //exitwhen AttackTier != TechUp

            //***  WAVE 4 ***
            call InitAssaultGroup()
            call CampaignAttackerEx(6, 6, 6, 'ehpr' )
            call CampaignAttackerEx(2, 2, 3, 'echm' )
            call SuicideOnPlayerEx(180, 180, 180, user)
            //exitwhen AttackTier != TechUp

            //***  WAVE 5 ***
            call InitAssaultGroup()
            call CampaignAttackerEx(2, 2, 4, 'ehpr' )
            call CampaignAttackerEx(2, 2, 2, 'efdr' )
            call SuicideOnPlayerEx(90, 60, 60, user)
            //exitwhen AttackTier != TechUp

            //*** Wave 6 ***
            call CampaignAttackerEx( 4, 6, 6, 'earc' )
            call CampaignAttackerEx( 2, 2, 4, 'ebal' )
            call CampaignAttackerEx( 1, 1, 1, 'Ewar' )
            call CampaignAttackerEx( 0, 0, 2, 'edot' )
            call SuicideOnPlayerEx(240, 240, 240, user)
            //exitwhen AttackTier != TechUp
        endloop
        //exitwhen AttackTier != TechUp
    endloop
endfunction

function AttackLoop takes nothing returns nothing
    loop
        if TechUp == 1 then
            call AttackWaves()
        elseif TechUp == 2 then
            call AngyAttackWaves()
        else
            call DisplayTextToPlayer(user, 0, 0, "Something's broken")
        endif
    endloop
endfunction
        
//========================================================
//    COMMAND FUNCTIONS
//========================================================
function TechCondition takes nothing returns nothing
    if CommandsWaiting() > 0 then
        //call DisplayTextToPlayer(user, 0, 0, "signal recieved")
        set TechUp = GetLastCommand()
        call PopLastCommand()
        call InitBuildArray()
        call BuildOrder()
    endif
endfunction

function ConditionLoop takes nothing returns nothing
    call TechCondition()
    call StaggerSleep(1,5)
    loop
        call TechCondition()
        call Sleep(5)
    endloop
endfunction
//========================================================
//    MAIN FUNCTION
//========================================================
function main takes nothing returns nothing
    call CampaignAI('emow', null)
    call SetSlowChopping( true )
    call SetPeonsRepair( true )
    call SetRandomPaths( true )

    call BuildOrder()
    call CampaignDefenses()

    call StartThread(function ConditionLoop)

    call AttackLoop()
endfunction
 
I'd say it's here:

1783994450462.webp


In the past I've had issues with AIs 100% because of the "pause all units" function, even though "pick all units > pause picked unit" works fine for reasons only know to Worldedit

So try replacing unpause all units by "unpause picked unit" inside your Loop - Actions
 
Dug into Blizzard.j and found the implementation of the GUI Action:

  • Unit - Pause all units
JASS:
function PauseAllUnitsBJ takes boolean pause returns nothing
    local integer index
    local player  indexPlayer
    local group   g

    set bj_pauseAllUnitsFlag = pause
    set g = CreateGroup()
    set index = 0
    loop
        set indexPlayer = Player( index )

        // If this is a computer slot, pause/resume the AI.
        if (GetPlayerController( indexPlayer ) == MAP_CONTROL_COMPUTER) then
            call PauseCompAI( indexPlayer, pause )
        endif

        // Enumerate and unpause every unit owned by the player.
        call GroupEnumUnitsOfPlayer( g, indexPlayer, null )
        call ForGroup( g, function PauseAllUnitsBJEnum )
        call GroupClear( g )

        set index = index + 1
        exitwhen index == bj_MAX_PLAYER_SLOTS
    endloop
    call DestroyGroup(g)
endfunction

In that function, PauseCompAI is silently called (not mentioned in the GUI description), which may be why the computer players end up being paused for the rest of the session.
 
Dug into Blizzard.j and found the implementation of the GUI Action:

  • Unit - Pause all units
JASS:
function PauseAllUnitsBJ takes boolean pause returns nothing
    local integer index
    local player  indexPlayer
    local group   g

    set bj_pauseAllUnitsFlag = pause
    set g = CreateGroup()
    set index = 0
    loop
        set indexPlayer = Player( index )

        // If this is a computer slot, pause/resume the AI.
        if (GetPlayerController( indexPlayer ) == MAP_CONTROL_COMPUTER) then
            call PauseCompAI( indexPlayer, pause )
        endif

        // Enumerate and unpause every unit owned by the player.
        call GroupEnumUnitsOfPlayer( g, indexPlayer, null )
        call ForGroup( g, function PauseAllUnitsBJEnum )
        call GroupClear( g )

        set index = index + 1
        exitwhen index == bj_MAX_PLAYER_SLOTS
    endloop
    call DestroyGroup(g)
endfunction

In that function, PauseCompAI is silently called (not mentioned in the GUI description), which may be why the computer players end up being paused for the rest of the session.
of course Blizzard doing hidden things like this...
 
Back
Top