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

[Trigger] Trigger Unit Problem

Status
Not open for further replies.
Level 12
Joined
Mar 30, 2013
Messages
664
Greetings,

I've made trigger/s on a attack random in the map.
The units spawns and will therefor attack random.

But when i tested it out, all the other units owned by the players also attacked.
Which is not the point, only the spawned should do.
Iv'e made this triggering before, but its over 2 years ago, and i have forgotten it.
So here's the triggers:

  • DemonSpawn Regions
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set SpawnRegions2[1] = DemonSpawnMain <gen>
      • Set SpawnRegions2[2] = DemonSpawnMain2 <gen>
  • Demon Attack
    • Events
      • Time - Every 0.50 seconds of game time
    • Conditions
    • Actions
      • Set DoingNothingGroup = (Units in (Playable map area) matching (((Owner of (Matching unit)) Equal to Player 12 (Brown)) or ((Owner of (Matching unit)) Equal to Player 12 (Brown))))
      • Set TempGroup2 = (Units in (Playable map area) matching ((((Matching unit) belongs to an enemy of Player 12 (Brown)) Equal to True) and ((Unit-type of (Matching unit)) Not equal to dummy missile)))
      • Set Unitposition = (Position of (Random unit from TempGroup2))
      • Unit Group - Pick every unit in DoingNothingGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Current order of (Picked unit)) Equal to (Order(<Empty String>))
            • Then - Actions
              • Unit - Order (Picked unit) to Attack-Move To Unitposition
            • Else - Actions
      • Custom script: call DestroyGroup(udg_DoingNothingGroup)
      • Custom script: call DestroyGroup(udg_TempGroup2)
      • Custom script: call RemoveLocation(udg_Unitposition)
  • Demon Wave
    • Events
      • Time - Every 4.00 seconds of game time
    • Conditions
    • Actions
      • Set TempGroup = (Units in (Playable map area) matching (((Owner of (Matching unit)) Equal to Player 12 (Brown)) or ((Owner of (Matching unit)) Equal to Player 12 (Brown))))
      • Set TempGroup2 = (Units in (Playable map area) matching ((((Matching unit) belongs to an enemy of Player 12 (Brown)) Equal to True) and ((Unit-type of (Matching unit)) Not equal to dummy missile)))
      • Set Unitposition = (Position of (Random unit from TempGroup2))
      • For each (Integer A) from 1 to 2, do (Actions)
        • Loop - Actions
          • Set Spawn_Point2[1] = (Random point in SpawnRegions2[(Random integer number between 1 and 2)])
          • Unit - Create 1 Demon Heakon for Player 12 (Brown) at Spawn_Point2[1] facing Default building facing degrees
          • Unit - Order (Last created unit) to Attack-Move To Unitposition
          • Unit - Create 1 Demon Siliniar for Player 12 (Brown) at Spawn_Point2[1] facing Default building facing degrees
          • Unit - Order (Last created unit) to Attack-Move To Unitposition
          • Custom script: call RemoveLocation (udg_Spawn_Point2[1])
          • Custom script: call RemoveLocation (udg_Spawn_Point2[bj_forLoopAIndex])
          • Wait 0.00 seconds
      • Custom script: call DestroyGroup(udg_TempGroup)
      • Custom script: call DestroyGroup(udg_TempGroup2)
      • Custom script: call RemoveLocation(udg_Unitposition)
Hope some one can help.
 
Level 12
Joined
Mar 30, 2013
Messages
664
Please i need somebody's help! It would mean so much for me!
If you didnt understand the written things above here's a more detailed;

- There are 2 spawn locations.
- Those spawn locations will there be spawning units.
- Those units will attack randomly around the map.

The problem.

- The trigger that spawn and do such things also got a "wrong- in the triggering."
- The units that are already placed in the map does also attack.
- Thats not the point, they should stay where they are. (placed.)

So when the trigger funcion have reached XX seconds, the units will spawn, and the units already placed in the map follows the attack.

Hope this is more understandable.
Sorry for any grammar.
 
Level 4
Joined
Jul 25, 2014
Messages
57
Trigger

Pick all of thoose units in a unit group, then every time remove them from those unit groups like this:
  • Untitled Trigger 001
    • Events
    • Conditions
    • Actions
      • Unit Group - Remove all units of unitsyoudontwant2move from tempgroup2
      • Unit Group - Remove all units of unitsyoudontwant2move from tempgroup
Try adding this to both of your triggers. ( make sure that your units which you don´t want to move are picked in a unit group which is unitsyoudontwant2move in this cause. This should work, but if doesn´t I´ll try to figure it out.
 
Level 12
Joined
Mar 30, 2013
Messages
664
  • Demon Wave
    • Events
      • Time - Every 4.00 seconds of game time
    • Conditions
    • Actions
      • Set TempGroup = (Units in (Playable map area) matching (((Owner of (Matching unit)) Equal to Player 12 (Brown)) or ((Owner of (Matching unit)) Equal to Player 12 (Brown))))
      • Set TempGroup2 = (Units in (Playable map area) matching ((((Matching unit) belongs to an enemy of Player 12 (Brown)) Equal to True) and ((Unit-type of (Matching unit)) Not equal to dummy missile)))
      • Set Unitposition = (Position of (Random unit from TempGroup2))
      • For each (Integer A) from 1 to 2, do (Actions)
        • Loop - Actions
          • Set Spawn_Point2[1] = (Random point in SpawnRegions2[(Random integer number between 1 and 2)])
          • Unit - Create 1 Demon Heakon for Player 12 (Brown) at Spawn_Point2[1] facing Default building facing degrees
          • Unit - Order (Last created unit) to Attack-Move To Unitposition
          • Unit - Create 1 Demon Siliniar for Player 12 (Brown) at Spawn_Point2[1] facing Default building facing degrees
          • Unit - Order (Last created unit) to Attack-Move To Unitposition
          • Custom script: call RemoveLocation (udg_Spawn_Point2[1])
          • Custom script: call RemoveLocation (udg_Spawn_Point2[bj_forLoopAIndex])
          • Wait 0.00 seconds
      • Custom script: call DestroyGroup(udg_TempGroup)
      • Custom script: call DestroyGroup(udg_TempGroup2)
      • Custom script: call RemoveLocation(udg_Unitposition)
      • Unit Group - Remove all units of (Units owned by Player 12 (Brown)) from TempGroup
This is wrong. It didnt work. If i did it wrong, tell me. And if i did wrong, be more specifict on the details.

My suggestion is that it aint something that needs to be added. I think its something that needs to be undo. (changed.)
 
Level 4
Joined
Jul 25, 2014
Messages
57
Firstly create this new trigger, it picks the units which are already placed in a unit group.
  • Trigger 1
    • Events
      • Time - Elapsed game time is 0.30 seconds
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • Set unitsyoudontwant2move = (Last created unit group)
Now there is your trigger named Demon Attack, after the : set Doing Nothing Group ... trigger line place this action:
  • Actions
    • Unit Group - Remove all units of unitsyoudontwant2move from DoingNothingGroup
If there are still problems pm me , because I don´t often read the forums.
 
Status
Not open for further replies.
Top