1. A slave to two rhythms, the 22nd Terraining Contest is here.
    Dismiss Notice
  2. The heavens smile on the old faithful. The 16th Techtree Contest has begun.
    Dismiss Notice
  3. The die is cast - the 6th Melee Mapping Contest results have been announced. Onward to the Hive Cup!
    Dismiss Notice
  4. The glory of the 20th Icon Contest is yours for the taking!
    Dismiss Notice
  5. Shoot to thrill, play to kill. Sate your hunger with the 33rd Modeling Contest!
    Dismiss Notice
  6. Do you hear boss music? It's the 17th Mini Mapping Contest!
    Dismiss Notice
  7. 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.

[Solved] Trigger doesn't respond to AI controllers?

Discussion in 'Triggers & Scripts' started by Drazhar, Oct 12, 2011.

  1. Drazhar

    Drazhar

    Joined:
    May 11, 2010
    Messages:
    213
    Resources:
    0
    Resources:
    0
    Hey all, I'm finally back. Need a hand with this trigger, it doesn't want to work when AI's cast the spell. If it's a player it works, no matter the slot, but if the controller is an AI then it doesn't work properly, even if I have control over the AI's units, it's supposed to spread the rejuvenation spell to all nearby allies. I don't understand why. Thanks :)

    • Dune mend lesser
      • Events
        • Unit - A unit Starts the effect of an ability
      • Conditions
        • (Ability being cast) Equal to Dune Mending
      • Actions
        • Set DunemendGroup = (Units within 300.00 of (Position of (Target unit of ability being cast)) matching (((Matching unit) belongs to an ally of (Owner of (Triggering unit))) Equal to True))
        • Unit Group - Pick every unit in DunemendGroup and do (Actions)
          • Loop - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • ((Picked unit) has buff Dune Mending ) Equal to False
              • Then - Actions
                • Set DuneMendpOs = (Position of (Picked unit))
                • Unit - Create 1 Caster for (Owner of Dunewalker) at DuneMendpOs facing Default building facing degrees
                • Unit - Add Lesser Dune Mending (Neutral Hostile) to (Last created unit)
                • Unit - Set level of Lesser Dune Mending (Neutral Hostile) for (Last created unit) to (Level of Dune Mending for Dunewalker)
                • Unit - Order (Last created unit) to Night Elf Druid Of The Claw - Rejuvenation (Picked unit)
                • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
              • Else - Actions
                • Do nothing
        • Custom script: call DestroyGroup (udg_DunemendGroup)
        • Custom script: call RemoveLocation(udg_DuneMendpOs)
     
  2. Maker

    Maker

    Joined:
    Mar 6, 2006
    Messages:
    9,174
    Resources:
    17
    Maps:
    2
    Spells:
    14
    Tutorials:
    1
    Resources:
    17
    Use Game - Display text message to debug it.

    Is the dummy created? Does it get the cast order?
     
  3. Drazhar

    Drazhar

    Joined:
    May 11, 2010
    Messages:
    213
    Resources:
    0
    Resources:
    0
    Ok so I gave the dummies a model to see if they are created. I tested it with a player being the owner of the hero and the dummies were created and casted the spell. When I made a computer in control of the hero and ordered the spell, the dummies were created but they didn't cast it. I've already set it in the ability properties tab for computers to use custom abilities, which I knew was working already because the computer casts the healing spell on it's own. :vw_wtf:
     
  4. Maker

    Maker

    Joined:
    Mar 6, 2006
    Messages:
    9,174
    Resources:
    17
    Maps:
    2
    Spells:
    14
    Tutorials:
    1
    Resources:
    17
    Try creating the dummies for neutral passive and adding neutral to targets allowed in the spell properties.
     
  5. Drazhar

    Drazhar

    Joined:
    May 11, 2010
    Messages:
    213
    Resources:
    0
    Resources:
    0
    Thank you, that worked! But why? I'm still confused as the AI's and player are all currently allied. + rep :)
     
  6. Bannar

    Bannar

    Joined:
    Mar 19, 2008
    Messages:
    3,099
    Resources:
    20
    Spells:
    5
    Tutorials:
    1
    JASS:
    14
    Resources:
    20
    Hey, Drazhar. I see that you have somewhat archieved what you wanted but I must warn you. Your trigger leaks what can lead to making your map unplayable after certain amount of time. Futhermore, script can be improved to increase it's efficiency.
    'bj_wantDestroyGroup = true' can help you especialy, making your like easier (gets rid of manual group creation/detroying).
    (Owner of (Triggering unit)) -> (Triggering player)

    One question: where do you declare Dunewalker variable?
    • Dune mend lesser
      • Events
        • Unit - A unit Starts the effect of an ability
      • Conditions
        • (Ability being cast) Equal to Dune Mending
      • Actions
        • Set p = (Position of (Target unit of ability being cast))
        • Custom script: set bj_wantDestroyGroup = true
        • Unit Group - Pick every unit in (Units within 300.00 of p matching ((((Matching unit) belongs to an ally of (Triggering player)) Equal to True) and (((Matching unit) has buff Dune Mending) Equal to False))) and do (Actions)
          • Loop - Actions
            • Set DuneMendpOs = (Position of (Picked unit))
            • Unit - Create 1 Caster for (Owner of Dunewalker) at DuneMendpOs facing Default building facing degrees
            • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
            • Unit - Add Lesser Dune Mending (Neutral Hostile) to (Last created unit)
            • Unit - Set level of Lesser Dune Mending (Neutral Hostile) for (Last created unit) to (Level of Dune Mending for Dunewalker)
            • Unit - Order (Last created unit) to Night Elf Druid Of The Claw - Rejuvenation (Picked unit)
            • Custom script: call RemoveLocation(udg_DuneMendpOs)
        • Custom script: call RemoveLocation(udg_p)
     
    Last edited: Oct 13, 2011
  7. Drazhar

    Drazhar

    Joined:
    May 11, 2010
    Messages:
    213
    Resources:
    0
    Resources:
    0
    Hey Spinnaker, I didn't actually intend on using the triggering player, I was only testing it out when trying to fix the problem that I had, I usually don't use that function. But thanks for pointing that out as I forgot to change it back, is that the only place it leaks? Thank you for the function for destroying groups.

    Not sure I understood your question completely, but the Dunewalker variable is set when the hero is picked.
     
  8. Bannar

    Bannar

    Joined:
    Mar 19, 2008
    Messages:
    3,099
    Resources:
    20
    Spells:
    5
    Tutorials:
    1
    JASS:
    14
    Resources:
    20
    I'm here to help you learn how to maximalize your efforts to make them somewhat perfect ;>

    Loop on script again; merging GroupEnum and 'if' can be an additional improvement - afterall if unit does not has that buff, no actions are performed.
     
  9. Maker

    Maker

    Joined:
    Mar 6, 2006
    Messages:
    9,174
    Resources:
    17
    Maps:
    2
    Spells:
    14
    Tutorials:
    1
    Resources:
    17
    One could also filter out structures and dead units, dummies shouldn't be created for them.

    Triggering player could be stored into a variable along with the ability level.

    I'd create the dummies for neutral passive.
     
  10. Drazhar

    Drazhar

    Joined:
    May 11, 2010
    Messages:
    213
    Resources:
    0
    Resources:
    0
    Ah I get it, thanks guys. Yeah i'll work on making my triggers more efficient, I restructured mine to be like yours Spinnaker and i'll use it as an example for the others and Maker i'll work on filtering out units that that dummies don't need to be created for, you guys have been a great help :)