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

Trigger stops working

Status
Not open for further replies.
Level 14
Joined
Jul 12, 2011
Messages
1,370
Hello again Everyone!!!
It's the second time I spam this forum today.
I have created this trigger:
  • Space Orcs Spawn
    • Events
      • Time - Every 10.00 seconds of game time
    • Conditions
    • Actions
      • Unit - Create 1 (Unit-type of (Random unit from SpaceOrcsLivingUnitGroup)) for Player 2 (Blue) at (Center of Region 001 <gen>) facing 270.00 degrees
      • Wait 2.00 seconds
      • Unit - Create 1 (Unit-type of (Random unit from SpaceOrcsLivingUnitGroup)) for Player 2 (Blue) at (Center of Region 001 <gen>) facing 270.00 degrees
and it works perfect.
However after sometime of gameplay (about 2-3 minutes) it stops working.
Why??
 
Level 14
Joined
Jul 12, 2011
Messages
1,370
XD you found it out!!
  • Space Orcs Living Unit Group
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in Region 005 <gen>) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of (Picked unit)) Equal to Player 2 (Blue)
            • Then - Actions
              • Unit Group - Add (Picked unit) to SpaceOrcsLivingUnitGroup
            • Else - Actions
Is the problem with this trigger???

PS!!!
There is and another one trigger that kills all units in region 005 after they have been picked.
 
Level 25
Joined
Jul 10, 2006
Messages
3,315
There isn't a problem with the trigger, but you haven't explained how you use the unit group further.

When all the units that you add to the group at the start die, it is empty and your other trigger stops working.

I'm really annoyed that you aren't being clear (which would help me help you), but the fix will probably be this:

  • Space Orcs Spawn
  • Events
    • Time - Every 10.00 seconds of game time
  • Conditions
  • Actions
    • Unit - Create 1 (Unit-type of (Random unit from SpaceOrcsLivingUnitGroup)) for Player 2 (Blue) at (Center of Region 001 <gen>) facing 270.00 degrees
    • Unit Group - Add (Last created unit) to SpaceOrcsLivingUnitGroup
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
Instead of doing that, you can store all those unit-types at map init.
After that, they can die or whatever. Doesn't really matter :p.

In that unit-group trigger you have there ("Space Orcs Living Unit Group"), you can do this:
  • Unit Group - Pick every unit in (Units in Region 005 <gen> owned by Player 2 (Blue)) and do (Actions)
    • Loop - Actions
      • Set Count = (Count + 1)
      • Set UnitType[Count] = (Unit-type of (Picked unit))
To create a unit, you then do this:
  • Set TempLoc1 = (Center of Region 001 <gen>)
  • Unit - Create 1 UnitType[(Random integer number between 1 and Count)] for Player 2 (Blue) at TempLoc1 facing Default building facing degrees
  • Custom script: call RemoveLocation( udg_TempLoc1 )
(since this trigger is periodic, it's highly recommended to remove those location leaks!)
 
Level 14
Joined
Jul 12, 2011
Messages
1,370
Hey rulerofiron99!!!
That worked perfect!!
+rep:goblin_yeah:

But I also have another problem.
If they are at a disadvantage, the units retreat back to the base.
How can I prevent that???
I have unchecked some boxes in the Ai editor but nothing happened.
 
Level 14
Joined
Jul 12, 2011
Messages
1,370
I'll use ap0calypse soloution then (+rep:goblin_yeah: ap0calypse).
What I meant was that those spawned units are ordered to attack-move at a specific location.
However when they reach this area, they are attacked by enemies.
Then istead of attacking them they retreat and form a group witch acts strange.
What I want is a way to stop units from dissobeying my orders and fight to the death.

PS: Ordered units are owned by Player 2 not Neutral Hostile or something like that.
 
Status
Not open for further replies.
Top