1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. Don’t forget to sign up for the Hive Cup. There’s a 555 EUR prize pool. Sign up now!
    Dismiss Notice
  4. The Hive Workshop Cup contest results have been announced! See the maps that'll be featured in the Hive Workshop Cup tournament!
    Dismiss Notice
  5. The results are out! Check them out.
    Dismiss Notice
  6. The poll for Hive's 12th Concept Art Contest is up! Go cast your vote for your favourite genie!
    Dismiss Notice
  7. The raddest synthwave tracks were chosen - Check out our Music Contest #12 - Results and congratulate the winners!
    Dismiss Notice
  8. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

[Trigger] Need help with fixing boss' AI

Discussion in 'Triggers & Scripts' started by MatiS, Feb 4, 2016.

  1. MatiS

    MatiS

    Joined:
    Feb 23, 2015
    Messages:
    208
    Resources:
    29
    Models:
    27
    Packs:
    2
    Resources:
    29
    Hi guys,

    I've made an AI for boss, but as soon as he get's damaged first time he freezes in place and turns invulnerable. I gave him a spell (or rather fully triggered it) that gives boss 'invulnerable' buff, but it shouldn't work this way :-(.

    Here are triggers:
    Basic AOE attack

    • UseCleave
      • Events
        • Time - Every 0.50 seconds of game time
      • Conditions
      • Actions
        • Set BossLocation = (Position of Boss)
        • Set CleaveCounter = 0
        • Unit Group - Pick every unit in (Units within 150.00 of BossLocation matching ((Owner of (Matching unit)) Equals to Player 9 (Grey))) and do (Actions)
          • Loop - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • (Picked unit) Equals to Aphophis
              • Then - Actions
                • Set CleaveCounter = (CleaveCounter + 3)
              • Else - Actions
                • Set CleaveCounter = (CleaveCounter + 1)
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • CleaveCounter Greater or equal 3
          • Then - Actions
            • Unit - Order Boss to Special-Channel‚
          • Else - Actions
        • Custom script: call RemoveLocation(udg_BossLocation)

    • Cleave
      • Events
        • Units - A unit Starts an effect of an ability
      • Conditions
        • (Ability being cast) Equals to Cleave
      • Actions
        • Set BossLocation = (Position of Boss)
        • Units group - Pick every unit in (Units within 150.00 of BossLocation matching ((Owner of (Matching unit)) Equals to Player 9 (Grey))) and do (Actions)
          • Loop - Actions
            • Unit - Cause Boss to damage (Picked unit), dealing 100.00 damage of attack type Normal and damage type Cold
        • Custom script: call RemoveLocation(udg_BossLocation)


    AOE stun

    • FreezingForceUse
      • Events
      • Conditions
      • Actions
        • Set BossLocation = (Position of Boss)
        • Set FreezingForceCounter = 0
        • Units Group - Pick every unit in (Units within 150.00 of BossLocation matching ((Owner of (Matching unit)) Equal to Player 9 (Grey))) and do (Actions)
          • Loop - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • (Picked unit) RĂłwna siÄ™ Aphophis
              • Then - Actions
                • Set FreezingForceCounter = (FreezingForceCounter + 3)
              • Else - Actions
                • Set FreezingForceCounter = (FreezingForceCounter + 1)
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • FreezingForceCounter Greater or equal 3
          • Then - Actions
            • Unit - Order Boss to Human - Paladin: Activate Divine Shield
          • Else - Actions
        • Custom script: call RemoveLocation(udg_BossLocation)

    • FreezingForce
      • Events
        • Unit - A unit Starts an effect of an ability
      • Conditions
        • (Ability being cast) Equals to Freezing Force
      • Actions
        • Trigger - Turn off FreezingForceUse <gen>
        • Trigger - Turn off UseCleave <gen>
        • Set BossLocation = (Position of Boss)
        • Animation - Play Boss's spell animation
        • Unit - Pause Boss
        • Wait 2.50 seconds
        • Set FreezingForceCounter = 0
        • Units group - Pick every unit in (Units within 200.00 of BossLocation matching ((Owner of (Matching unit)) Equals to Player 9 (Grey))) and do (Actions)
          • Loop - Actions
            • Set FreezingForceCounter = (FreezingForceCounter + 1)
            • Units group - Add (Picked unit) to FreezingForceGroup
            • Unit - Pauza (Picked unit)
            • Unit - Order DummyUnit 0065 <gen> to Human - Sorceress: Slow Boss
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • FreezingForceCounter RĂłwna siÄ™ 0
          • Then - Actions
            • Units group - Add Boss to FreezingForceGroup
            • Unit - Pause Boss
            • Unit - Order DummyUnit 0065 <gen> to Human - Sorceress: Slow Boss
          • Else - Actions
        • Wait 4.00 seconds
        • Units group - Pick every unit in FreezingForceGroup and do (Actions)
          • Loop - Actions
            • Unit - Unpause (Picked unit)
        • Custom script: call RemoveLocation(udg_BossLocation)
        • Trigger - Turn on FreezingForceUse <gen>
        • Trigger - Turn on UseCleave <gen>


    Summon Spell

    Initiate Ability:
    • IceInitiate
      • Events
        • Unit - Frozen One 0064 <gen>'s life becomes Lesser than 1600.00
      • Conditions
      • Actions
        • Trigger - Turn off (This trigger)
        • Trigger - Turn off UseCleave <gen>
        • Trigger - Turn off FreezingForceUse <gen>
        • Trigger - Make Boss Invulnerable
        • Set BossFrostAbilityPoint = (Center of BossAppear <gen>)
        • Unit - Order Boss to Move BossFrostAbilityPoint
        • Trigger - Turn on IceFreeze <gen>

    Ability Trigger:
    • IceFreeze
      • Events
        • Unit - A unit enters BossAppear <gen>
      • Conditions
        • (Triggering unit) Equals to Boss
      • Actions
        • Trigger - Turn off (This trigger)
        • Trigger - Turn off FreezingForceUse <gen>
        • Unit - Pause Boss
        • Animation - Play Boss's Stand Channel animation
        • Special Effect - Create a special effect at BossFrostAbilityPoint using Abilities\Spells\Undead\ReplenishMana\ReplenishManaCasterOverhead.mdl
        • Set FreezeEffect = (Last created special effect)
        • Set GhostCounter = 5
        • For each (Integer A) from 1 to 5, do (Actions)
          • Loop - Actions
            • Unit - Create 1 Wandering Soul for Gracz 3 (Seledynowy) at BossFrostAbilityPoint facing 170 degrees


    Counter
    • GhostDeath
      • Events
        • Unit - A unit dies
      • Conditions
        • (Unit-type of (Triggering unit)) Equals to Wandering Soul
      • Actions
        • Set GhostCounter = (GhostCounter - 1)
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • GhostCounter Equals to 0
          • Then - Actions
            • Special Effect - Destroy FreezeEffect
            • Animation - Reset Boss's animation
            • Unit - Make Boss Vulnerable
            • Unit - Unpause Boss
            • Trigger - Turn on UseCleave <gen>
            • Trigger - Turn on FreezingForceUse <gen>
          • Else - Actions



    As for variables, Aphophis is player's hero. I hope I translated all triggers correctly. I would be grateful for help :)
     
  2. PurgeandFire

    PurgeandFire

    Code Moderator

    Joined:
    Nov 11, 2006
    Messages:
    7,427
    Resources:
    18
    Icons:
    1
    Spells:
    4
    Tutorials:
    9
    JASS:
    4
    Resources:
    18
    Add this action:
    • Game - Display message to (All Players): "Testing"


    To your "IceInitiate" trigger. It looks like it might be firing prematurely. You should check to make sure that '1600' is the value you want.

    If that isn't the problem, add a message (like the one above) to the other triggers and try to find out which one is being executed at the wrong time. It'll help us help you. :)
     
  3. MatiS

    MatiS

    Joined:
    Feb 23, 2015
    Messages:
    208
    Resources:
    29
    Models:
    27
    Packs:
    2
    Resources:
    29
    I made some test and a few fixes. Something is bugged with stunning ability, it doesn't count units correctly (it shouldn't even run in the first phase). Also, 'cleave' ability is not used. 'Summon' ability works correctly. I'm gonna make some tests with other abilities and then I'll update the post :-D.