• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

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

Status
Not open for further replies.
Level 6
Joined
May 11, 2010
Messages
236
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)
 
Level 6
Joined
May 11, 2010
Messages
236
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:
 
Level 6
Joined
May 11, 2010
Messages
236
Thank you, that worked! But why? I'm still confused as the AI's and player are all currently allied. + rep :)
 

Bannar

Code Reviewer
Level 26
Joined
Mar 19, 2008
Messages
3,140
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:
Level 6
Joined
May 11, 2010
Messages
236
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.
 
Level 6
Joined
May 11, 2010
Messages
236
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 :)
 
Status
Not open for further replies.
Top