• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Problem Shortening Triggers

Status
Not open for further replies.
Level 21
Joined
Jan 5, 2005
Messages
3,515
is there a way i can shorten this trigger? with a loop command or something?

[trigger:1:6bfb7c2b02]
Attack Move1
Events
Unit - A unit enters Attack1 <gen>
Unit - A unit enters Attack2 <gen>
Unit - A unit enters Attack3 <gen>
Conditions
((Owner of (Triggering unit)) Equal to Player 11 (Dark Green)) or ((Owner of (Triggering unit)) Equal to Player 12 (Brown))
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Owner of (Triggering unit)) Equal to Player 11 (Dark Green)
Then - Actions
Unit Group - Order AttackerGroups[1] to Attack-Move To (Position of HQ[1])
Unit Group - Order AttackerGroups[2] to Attack-Move To (Position of HQ[1])
Unit Group - Order AttackerGroups[3] to Attack-Move To (Position of HQ[1])
Else - Actions
Unit Group - Order AttackerGroups[4] to Attack-Move To (Position of HQ[2])
Unit Group - Order AttackerGroups[5] to Attack-Move To (Position of HQ[2])
Unit Group - Order AttackerGroups[6] to Attack-Move To (Position of HQ[2])
[/trigger:1:6bfb7c2b02]
 
Level 21
Joined
Jan 5, 2005
Messages
3,515
oh no it does not matter i fixed my problem i think like this

[trigger:1:4333fae346]Attack Move1
Events
Unit - A unit enters Attack1 <gen>
Unit - A unit enters Attack2 <gen>
Unit - A unit enters Attack3 <gen>
Conditions
((Owner of (Triggering unit)) Equal to Player 11 (Dark Green)) or ((Owner of (Triggering unit)) Equal to Player 12 (Brown))
Actions
For each (Integer A) from 1 to 6, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Triggering unit) is in AttackerGroups[(Integer A)]) Equal to True
Then - Actions
If (((Integer A) Less than or equal to 3) and ((Owner of (Triggering unit)) Equal to Player 11 (Dark Green))) then do (Unit Group - Order AttackerGroups[(Integer A)] to Attack-Move To (Position of HQ[1]))
else do (Unit Group - Order AttackerGroups[(Integer A)] to Attack-Move To (Position of HQ[2]))
Unit Group - Remove all units of AttackerGroups[(Integer A)] from AttackerGroups[(Integer A)]
Else - Actions
Do nothing

[/trigger:1:4333fae346]
 
Level 21
Joined
Jan 5, 2005
Messages
3,515
EDIT: i had a big long post with all my triggers here explaining my problem (which i have fixed). here is as section of that post summing it up:

my problem lies in that the last trigger does not add all the units i spawn the the unit group, it only adds one of each unit to the unit group, so i get one attaker type 1, one attacker type 2 and one attacker type 3 instead of one attacker type 1, two attacker type 2 and so on...i cant actually understand why there is this problem. can you only add one unit at a time to a aunit group or something?

it turns out if you use the trigger

[trigger:1:a9e5be3de0]
Unit - Create 2 AttackerTypes[2] for Player 11 (Dark Green) at (Center of Spawn2 <gen>) facing Default building facing degrees
Unit Group - Add (Last created unit) to AttackerGroups[X]
[/trigger:1:a9e5be3de0]

it will only add 1 of the last created units to the group instead of both of them. to fix this you must change the trigger to

[trigger:1:a9e5be3de0]
Unit - Create 2 AttackerTypes[2] for Player 11 (Dark Green) at (Center of Spawn2 <gen>) facing Default building facing degrees
Unit Group - Add all units of (Last created unit group) to AttackerGroups[X]
[/trigger:1:a9e5be3de0]

a noobish mistake i know, but still i fixed it. sorry for all these stupid problems i cause, i have a tendancy to be stuck on something for ages, then work it out very quickly the next day.
 
Level 21
Joined
Jan 5, 2005
Messages
3,515
hey what would be a reasonable periodic time for a trigger like this?

[trigger:1:2c22489380]
Attack Move 2
Events
Time - Every 2.00 seconds of game time
Conditions
Actions
Unit Group - Pick every unit in AttackerGroups[7] and do (Unit - Order (Picked unit) to Attack-Move To (Position of HQ[2]))
Unit Group - Pick every unit in AttackerGroups[8] and do (Unit - Order (Picked unit) to Attack-Move To (Position of HQ[1]))

[/trigger:1:2c22489380]

is 2 seconds gunna be too laggy?
 
Level 21
Joined
Jan 5, 2005
Messages
3,515
ok cool. lol and get this, i have changed my trigger AGAIN! this must be the 7/8th time now :p i change it for stability and lag. i have made a comprimise on this trigger

[trigger:1:a48674523f]
Attack Move1 Copy
Events
Unit - A unit enters Attack1 <gen>
Unit - A unit enters Attack2 <gen>
Unit - A unit enters Attack3 <gen>
Conditions
((Owner of (Triggering unit)) Equal to Player 11 (Dark Green)) or ((Owner of (Triggering unit)) Equal to Player 12 (Brown))
Actions
For each (Integer A) from 1 to 3, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Triggering unit) is in AttackerGroups[(Integer A)]) Equal to True
Then - Actions
Unit Group - Order AttackerGroups[(Integer A)] to Attack-Move To (Position of HQ[2])
Wait 0.10 seconds
Unit Group - Add all units of AttackerGroups[(Integer A)] to AttackerGroups[7]
Unit Group - Remove all units of AttackerGroups[(Integer A)] from AttackerGroups[(Integer A)]
Else - Actions
For each (Integer B) from 3 to 6, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Triggering unit) is in AttackerGroups[(Integer A)]) Equal to True
Then - Actions
Unit Group - Order AttackerGroups[(Integer A)] to Attack-Move To (Position of HQ[1])
Wait 0.10 seconds
Unit Group - Add all units of AttackerGroups[(Integer A)] to AttackerGroups[8]
Unit Group - Remove all units of AttackerGroups[(Integer A)] from AttackerGroups[(Integer A)]
Else - Actions
[/trigger:1:a48674523f]

it works and it uses less conditions but it has a few additions and changes. really it just a comprimise because it works exactly how i would expect. only problem is that its longer than the trigger i had in the first place!

for some reason, when i try this trigger it doesnt work. any ideas why?

[trigger:1:a48674523f]
Attack Move1 Copy Copy
Events
Unit - A unit enters Attack1 <gen>
Unit - A unit enters Attack2 <gen>
Unit - A unit enters Attack3 <gen>
Conditions
((Owner of (Triggering unit)) Equal to Player 11 (Dark Green)) or ((Owner of (Triggering unit)) Equal to Player 12 (Brown))
Actions
For each (Integer A) from 1 to 6, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Triggering unit) is in AttackerGroups[(Integer A)]) Equal to True
(Integer A) Less than or equal to 3
Then - Actions
Unit Group - Order AttackerGroups[(Integer A)] to Attack-Move To (Position of HQ[2])
Wait 0.10 seconds
Unit Group - Add all units of AttackerGroups[(Integer A)] to AttackerGroups[7]
Unit Group - Remove all units of AttackerGroups[(Integer A)] from AttackerGroups[(Integer A)]
Else - Actions
Unit Group - Order AttackerGroups[(Integer A)] to Attack-Move To (Position of HQ[1])
Wait 0.10 seconds
Unit Group - Add all units of AttackerGroups[(Integer A)] to AttackerGroups[8]
Unit Group - Remove all units of AttackerGroups[(Integer A)] from AttackerGroups[(Integer A)]

[/trigger:1:a48674523f]
 
Level 2
Joined
Apr 19, 2006
Messages
28
This is what you have for your FIRST trigger:

if
Triggering unit is in AttackerGroups(A) = true
Then
((int A, int A, int A, etc.))
if
Triggering unit is in AttackerGroups(B) = true
Then
((int A, int A, int A, etc.))

For your 2nd 'if' command, you use integer B in the the 'For' loop but not in the actions.

If you still have trouble, just post again and I'll post the complete corrected trigger. Good luck.

-Miz
 
Level 21
Joined
Jan 5, 2005
Messages
3,515
yes that would work, but it would still use two loops and only cut out condition. anyways now i am happy with the trigger i have its not to long and hopefully will reduce some lag (which is partly my reason for shortening), the only thing i want to know is why will the
(Integer A) Less than or equal to 3
trigger not work? i dont understand it, it should work.
 
Level 2
Joined
Apr 19, 2006
Messages
28
Your triggers have errors in them. That is what my last post was about.

Look at your loop integers in your 1st trigger. They don't match the actions!!!!! Even it it works like you want it, it is not doing what you think it is doing. Your first trigger says this:

"if you are in Attackergroups 1, go here1 do this1
if you are in Attackergroups 2, go here1 do this1
if you are in Attackergroups 3, go here1 do this1

if you are in Attackergroups 3, go here2 do this2
if you are in Attackergroups 3, go here2 do this2
if you are in Attackergroups 3, go here2 do this2"

In your 2nd trigger, use (or multiple conditions) or (and all conditions). For instance

[trigger:1:c718c030b9]Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
And - All (Conditions) are true
Conditions
a Equal to 0
b Equal to 1
c Equal to 2
Then - Actions
Do nothing
Else - Actions
Do nothing[/trigger:1:c718c030b9]
This says: If this is true and this is true and this is also true... do this.


[trigger:1:c718c030b9]If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Or - Any (Conditions) are true
Conditions
a Equal to 0
b Equal to 1
c Equal to 2
Then - Actions
Do nothing
Else - Actions
Do nothing[/trigger:1:c718c030b9]
This says: If this is true do this or if this is true do this or if this is true do this.

This helps me keep it straight. It may fix your problem :)

Good Luck.

-Miz
 
Level 21
Joined
Jan 5, 2005
Messages
3,515
no it is right, the trigger that i am using, the working one says

enter region

if dark green

unit group 1 go to hq 2
unit group 2 go to hq 2
unit group 3 go to hq 2

if brown

unit group4 go hq 1
unit group 5 go hq 1
unit group 6 go hq 1

you see i dont actually have problem any more. i just dont udnerstand why the second trigger didnt work. even with your description i still dont. it doesnt matter though.
 
Status
Not open for further replies.
Top