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

Boss AI Problem

Status
Not open for further replies.
Level 16
Joined
Mar 27, 2011
Messages
1,349
So I'm creating a system to make the enemy boss in my map cast abilities. Boss take damage, he casts abilities if certain conditions are met. I'm using timers to act as like cooldowns. It works for the most part, except it appear that one of my timers isn't being set at all!

Here's my code:

  • Arthas Cast
    • Events
      • Game - GDD_Event becomes Equal to 0.00
    • Conditions
      • GDD_DamagedUnit Equal to Boss
      • (Remaining time for BossAbilityTimerBuffer) Equal to 0.00
    • Actions
      • -------- --------------- --------
      • -------- Boss Ultimate --------
      • -------- --------------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Life of Boss) Less than or equal to 2000.00
          • BossUltimateUsed Equal to False
        • Then - Actions
          • Trigger - Run Arthas Ultimate <gen> (ignoring conditions)
          • Countdown Timer - Start BossAbilityTimerBuffer as a One-shot timer that will expire in 9.00 seconds
          • Set BossUltimateUsed = True
        • Else - Actions
      • -------- Rechecks AbilityBuffer in case Ultimate was triggered --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Remaining time for BossAbilityTimerBuffer) Equal to 0.00
        • Then - Actions
          • -------- --------------- --------
          • -------- Holy Light --------
          • -------- --------------- --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Remaining time for BossAbilityTimer[1]) Equal to 0.00
              • BossAbilityCounter Equal to 1
            • Then - Actions
              • Game - Display to (All players) for 1.00 seconds the text: Holy Light
              • Unit - Add Holy Light (boss) to Boss
              • Unit - Order Boss to Human Paladin - Holy Light Boss
              • Set BossAbilityCounter = (BossAbilityCounter + 1)
              • Countdown Timer - Start BossAbilityTimer[1] as a One-shot timer that will expire in 30.00 seconds
              • Countdown Timer - Start BossAbilityTimerBuffer as a One-shot timer that will expire in 3.00 seconds
              • Wait 3.00 seconds
              • Unit - Remove Holy Light (boss) from Boss
            • Else - Actions
              • -------- --------------- --------
              • -------- Divine Shield --------
              • -------- --------------- --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Remaining time for BossAbilityTimer[2]) Equal to 0.00
                  • BossAbilityCounter Equal to 2
                • Then - Actions
                  • Game - Display to (All players) for 1.00 seconds the text: Divine Shield
                  • Unit - Add Divine Shield (boss) to Boss
                  • Unit - Order Boss to Human Paladin - Activate Divine Shield
                  • Set TempPoint = (Position of Boss)
                  • Unit - Create 1 Dummy Unit for Neutral Hostile at TempPoint facing Default building facing degrees
                  • Unit - Order (Last created unit) to Human Sorceress - Slow Boss
                  • Custom script: call RemoveLocation (udg_TempPoint)
                  • Set BossAbilityCounter = 1
                  • Countdown Timer - Start BossAbilityTimer[2] as a One-shot timer that will expire in 25.00 seconds
                  • Countdown Timer - Start BossAbilityTimerBuffer as a One-shot timer that will expire in 3.00 seconds
                  • Wait 6.00 seconds
                  • Unit - Remove Divine Shield (boss) from Boss
                • Else - Actions
        • Else - Actions
  • Timer Test
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Game - Display to (All players) for 1.00 seconds the text: (BossTimer1: + (String((Remaining time for BossAbilityTimer[1]))))
      • Game - Display to (All players) for 1.00 seconds the text: (BossTimer2: + (String((Remaining time for BossAbilityTimer[2]))))
      • Game - Display to (All players) for 1.00 seconds the text: (Buffer: + (String((Remaining time for BossAbilityTimerBuffer))))
BossAbilityTimer[2] continues to report 0 after the Divine Shield Ability is cast. Anyone know why?
 
Level 16
Joined
Mar 27, 2011
Messages
1,349
Ahh no it doesn't. This has fixed the problem.

This fact is exclusive to Dialogs and Timers.

I didn't realize you needed to set the array size for these variables. I use to set the array size of all variable type, but all variables appeared to work regardless of initialization size, so I stopped bothering.

Thanks.
 
Level 17
Joined
Dec 11, 2014
Messages
2,004
Ahh no it doesn't. This has fixed the problem.



I didn't realize you needed to set the array size for these variables. I use to set the array size of all variable type, but all variables appeared to work regardless of initialization size, so I stopped bothering.

Thanks.

Glad it worked ;)
Beware next time :D

EDIT: Found out the reason:

Dialogs and Timers do not have a function to initialize. They are created by the Variable manager. As the Variable manager doesn't know how many timers /Dialogs will be used in the Functions, it creates as much as the Arrays say ;)
 
Last edited:
Status
Not open for further replies.
Top