• 🏆 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!

Zerg thing trigger.

Status
Not open for further replies.
Level 23
Joined
Oct 20, 2012
Messages
3,075
Ei guys, I need a bit of help here. You see today I've been creating an altered melee just for fun and the race I'm building is somewhat similar to the Zerg. Now the problem is with this set of triggers:

  • Events
    • Map initialization
  • Conditions
  • Actions
    • For each (Integer TempInteger) from 1 to 12, do (Actions)
      • Loop - Actions
        • Trigger - Add to SelectLarvae <gen> the event (Player - (Player(TempInteger)) Selects a unit)
        • Trigger - Add to DeselectLarvae <gen> the event (Player - (Player(TempInteger)) Deselects a unit)
  • Events
    • Map initialization
  • Conditions
  • Actions
    • Set TempGroup = (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to Forgotten One))
    • Unit Group - Pick every unit in TempGroup and do (Actions)
      • Loop - Actions
        • Set TO_MaxInteger = (TO_MaxInteger + 1)
        • Set TO_Halls[TO_MaxInteger] = (Picked unit)
        • For each (Integer TempInteger) from 1 to 5, do (Actions)
          • Loop - Actions
            • Set TempPoint1 = (Position of TO_Halls[TO_MaxInteger])
            • Set TempPoint2 = (TempPoint1 offset by (Random real number between 100.00 and 200.00) towards (Random angle) degrees)
            • Unit - Create 1 Larvae for (Owner of TO_Halls[TO_MaxInteger]) at TempPoint2 facing (Random angle) degrees
            • Unit Group - Add (Last created unit) to TO_LarvaeGroup[TO_MaxInteger]
            • Custom script: call RemoveLocation(udg_TempPoint1)
            • Custom script: call RemoveLocation(udg_TempPoint2)
    • Custom script: call DestroyGroup(udg_TempGroup)
  • Events
    • Unit - A unit Finishes construction
  • Conditions
    • (Unit-type of (Triggering unit)) Equal to Forgotten One
  • Actions
    • Set TO_MaxInteger = (TO_MaxInteger + 1)
    • Set TO_Halls[TO_MaxInteger] = (Triggering unit)
    • For each (Integer TempInteger) from 1 to 5, do (Actions)
      • Loop - Actions
        • Set TempPoint1 = (Position of TO_Halls[TO_MaxInteger])
        • Set TempPoint2 = (TempPoint1 offset by (Random real number between 100.00 and 200.00) towards (Random angle) degrees)
        • Unit - Create 1 Larvae for (Owner of TO_Halls[TO_MaxInteger]) at TempPoint2 facing (Random angle) degrees
        • Unit Group - Add (Last created unit) to TO_LarvaeGroup[TO_MaxInteger]
        • Custom script: call RemoveLocation(udg_TempPoint1)
        • Custom script: call RemoveLocation(udg_TempPoint2)
  • Events
    • Time - Every 0.20 seconds of game time
  • Conditions
  • Actions
    • For each (Integer TempInteger) from 1 to TO_MaxInteger, do (Actions)
      • Loop - Actions
        • Unit Group - Pick every unit in TO_LarvaeGroup[TempInteger] and do (Actions)
          • Loop - Actions
            • Set TempPoint1 = (Position of (Picked unit))
            • Set TempPoint2 = (Position of TO_Halls[TempInteger])
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • (Distance between TempPoint1 and TempPoint2) Greater than or equal to 300.00
                • ((Picked unit) is in TO_SelectedLarvae) Not equal to True
              • Then - Actions
                • Set TempPoint3 = (TempPoint2 offset by (Random real number between 100.00 and 250.00) towards (Angle from TempPoint2 to TempPoint1) degrees)
                • Unit - Order (Picked unit) to Move To TempPoint3
                • Custom script: call RemoveLocation(udg_TempPoint3)
              • Else - Actions
            • Custom script: call RemoveLocation(udg_TempPoint1)
            • Custom script: call RemoveLocation(udg_TempPoint2)
  • Events
  • Conditions
    • (Unit-type of (Triggering unit)) Equal to Larvae
    • (Owner of (Triggering unit)) Equal to (Triggering player)
  • Actions
    • Unit Group - Add (Triggering unit) to TO_SelectedLarvae
  • Events
  • Conditions
    • (Unit-type of (Triggering unit)) Equal to Larvae
    • (Owner of (Triggering unit)) Equal to (Triggering player)
  • Actions
    • Unit Group - Remove (Triggering unit) from TO_SelectedLarvae

For now, what all of these does is to create the Larvae (Larvae is already the plural, right?) and restrict them from going too far from their respective building.

Yes, everything works but only on the first building and its larvae. I have no idea why it only works with one since, no matter how much I look at it, it should work for multiple units. So any of you peepz have an idea?
 
Status
Not open for further replies.
Top