Gather Spawned Troops and Move Out

Archideas

Active Member
Reaction score
32
Alright, yet another problem I've stumbled upon that I just can't seem to fix and thus turn to the people of this lovely forum.

What I'm trying to do is to every 30 second spawn 3 melee units and 1 ranged, add them to a unit group and then order that group to attack move to a destinated point.

Now, as far as the spawning goes, it's all fine. BUT, the problem is, after about the 3rd to 5th time the desired units are spawned, there's a chance the created units will either move out or stay dumbfolded where they're created. This is what my triggers look like so far.

Trigger:
  • Events
    • Time - Every 30.00 seconds of game time
    • Conditions
    • Actions
      • Unit - Create 3 Soldier for Player 11 (Dark Green) at (Center of Zandar Force Spawn <gen>) facing 90.00 degrees
      • Unit - Create 1 Wizard for Player 11 (Dark Green) at (Center of Zandar Force Spawn <gen>) facing 90.00 degrees
      • Unit Group - Pick every unit in (Units in Zandar Force Spawn <gen>) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • ((Picked unit) belongs to an ally of Player 11 (Dark Green)) Equal to True
                • (Unit-type of (Picked unit)) Equal to Soldier
                • (Unit-type of (Picked unit)) Equal to Wizard
              • Then - Actions
                • Unit Group - Add (Picked unit) to ZandarForces
                • Unit Group - Order ZandarForces to Attack-Move To (Center of Azrethak Boss <gen>)
              • Else - Actions


Thanks in advance for answers!
 

Avaleirra

Is back. Probably.
Reaction score
128
You forgot to add them to the unit group :p


EDIT:nvm

EDIT2: does dark green have any allies?
 

Archideas

Active Member
Reaction score
32
Dark Green has allies, yes. They're Red, Blue, Teal, Purple and Yellow just FYI. :p

*EDIT*

Also, Dark Green is the CPU and the allies are players. I'll change the first condition to Belongs to Dark Green instead of Belongs to an ally.
 

Avaleirra

Is back. Probably.
Reaction score
128
Ya I was gonna say that cuz I was having problems on my map with the ally of (player) thing :)
 

Archideas

Active Member
Reaction score
32
Somehow I doubt it's that that's causing the problem, or am I wrong? It just seems weird that after 3-5 times some units just stand still while others do what they're supposed to. :S
 

Avaleirra

Is back. Probably.
Reaction score
128
Hmmmm, random guess but could it be that your condition has 2 "picked unit" functions and picked unit can only be used for one? (totally random guess)
 

Archideas

Active Member
Reaction score
32
I have completely no idea. I'm not really that set in to it, thus I've turned to the forum for help. I'd like to avoid having too many triggers for such a simple task so I'd rather not make two different triggers for each unit type if it's avoidable.
 

Bloodydood

New Member
Reaction score
14
Trigger:
  • Untitled Trigger 001
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Wait 30.00 seconds
      • Unit - Create 3 Soldier for Player 11 (Dark Green) at (Center of Zandar Force Spawn <gen>) facing 90.00 degrees
      • Unit - Create 1 Wizard for Player 11 (Dark Green) at (Center of Zandar Force Spawn <gen>) facing 90.00 degrees
      • Set Temp_Group = (Units in Zandar Force Spawn <gen> matching (((Owner of (Matching unit)) Equal to Player 11 (Dark Green)) and (((Unit-type of (Matching unit)) Equal to Soldier) or ((Unit-type of (Matching unit)) Equal to Wizard))))
      • Unit Group - Pick every unit in Temp_Group and do (Actions)
        • Loop - Actions
          • Unit - Order (Picked unit) to Attack-Move To (Center of Azrethak Boss <gen>)
      • Custom script: call DestroyGroup (udg_Temp_Group)
      • Trigger - Run (This trigger) (ignoring conditions)


I think this should do it.
 

Avaleirra

Is back. Probably.
Reaction score
128
Ya I can't see the problem... Maybe upload your map so that people can see? (I can't because I'm on my iPod)

EDIT: what bloodydood did looks right
 

Bloodydood

New Member
Reaction score
14
You can ignore the "Wait 30 seconds" and "Run This Trigger (Ignoring Conditions)" and keep the Periodic Event. I don't think there's a problem with either.
 

Archideas

Active Member
Reaction score
32
I'll try it out right away, Bloody. I'll let you know if it works or not.

*EDIT*

Works perfectly now! Thanks Bloody and Avaleirrra for your support. + rep to you both.

**EDIT**

Instead of making a new thread, I figured I'd put another question here.

I basically want to create a spell that makes the hero with a certain ability to gain Invisibility if an enemy hero casts a spell within 800 range of said hero. How do I most efficiently work this out? I'm stuck at the part where I can efficiently add and remove units from a Unit Group that I've made for this specific spell in question.

After hero1 learns the skill it runs a trigger that checks ever 0.5 second for enemy heroes within 800 range of hero1 and if it finds one, it'll be added to the Unit Group.

I have no idea now how to remove the unit if it goes outside of range of hero1. If there's a better way to do this, please share cuz I'm stumped. :(
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top