• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

About Unit Group

Status
Not open for further replies.
Level 3
Joined
Mar 29, 2011
Messages
38
A unit learn skill, create a bear, add bear to a unit group. Every second, order unit group to follow owner.
When i learn that skill, the bear spawned but don't follow me? I don't know what's wrong with these trigger

  • Call of the Wind learn
    • Events
      • Unit - A unit Learns a skill
    • Conditions
      • (Learned Hero Skill) Equal to Call of the Wild
    • Actions
      • Set CotW_Owner = (Triggering unit)
      • Set CotW_Point = (Position of (Triggering unit))
      • Set CotW_Level = (Level of Call of the Wild for (Triggering unit))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • CotW_Level Equal to 1
        • Then - Actions
          • Unit - Create 1 Baby Te'dy Bear lv1 for (Owner of CotW_Owner) at CotW_Point facing Default building facing degrees
          • Unit Group - Add (Last created unit) to CotW_Pet_Group
        • Else - Actions
  • Pet follow
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in CotW_Pet_Group and do (Actions)
        • Loop - Actions
          • Unit Group - Order CotW_Pet_Group to Right-Click CotW_Owner
 
You don't need a periodic loop for that. Order the bear once to right click the caster and then a trigger with the 3 order events:
  • Events
    • Unit - A unit Is issued an order targeting an object
    • Unit - A unit Is issued an order targeting a point
    • Unit - A unit Is issued an order with no target
via a hashtable save the caster to the bear and use the actions:
  • Set Caster = (Load 0 of (Key(Triggering unit)) from Hashtable)
  • Unit - Order (Triggering unit) to Right-Click Caster
As for the problem itself, although I haven't tested it, you either have a not-initially enabled trigger, which you forgot to turn on or you should be using the method I described.

Take care of leaks and prefer Triggering player instead of (Owner of (Triggering unit)).
 
Level 8
Joined
Jan 8, 2010
Messages
493
if the bear cannot be selected (locust) you can add the order after creating the unit and then follow Pharaoh's suggestion. hmm. or just add it even when it can be selected, realized it makes no difference XD

anyway, maybe the reason why the bear doesn't follow you is because you pick every units in a group and make it follow the caster. it will look like Picked Unit = Unit Group. just place the ordering action outside "Pick Every Unit" loop.

or use:
Unit Group - Pick every unit in CotW_Pet_Group and do (Actions)
Loop - Actions
Unit - Order Picked Unit to Right Click CotW_Caster
 
Status
Not open for further replies.
Top