HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Cordinating Attacks

09-02-2003, 10:41 PM#1
D40-88
Hello, after a day of messing with this hard editor, I've finally found out how to train units and make them attack! :)

But my problem lies in the fact that I want let's say 2 ghouls to be trained one after the other in the same building, while 2 fiends to be trained in another building. After ALL 2 of each kind have been trained, I want them to attack as a GROUP, and hopefully a group of 4 (2 ghouls + 2 fiends). When I play the game, this does not happen. Instead, when the ghoul is out, it starts moving to my base and the fiend does the same thing. It does not wait for the second ghoul or second fiend to pop out before it starts its attack.
Worst, the ghoul attacks my base before the fiend (since ghouls move faster).
Can someone please tell me how to fix this glitch?
I really apprecaite any help!

Here's what I have so far.

1st trigger
(event)
elapse time is 0s
(action)
order building1 to train ghoul
order building1 to train ghoul
order building2 to train fiend
order building2 to train fiend
set wave1=true (wave1 boolean)

2nd trigger
(event)
building1 finishes training a unit
building2 finishes training a unit
(condition)
wave1=true
(action)
order units in buildarea1 owned by player 1 to attack player 2
order units in buildarea2 owned by player 1 to attack player 2 (buildarea1, buildarea2 are both regions around the buildings)
09-02-2003, 10:49 PM#2
Oinkerwinkle
Next time, assuming you have TFT, use the 'Copy as Text' option to copy your triggers morea accuractely.

Add two conditions, both integer comparisons.
(Number of units in (build area one) matching condition (Unit type of (matching unit) is equal to Ghoul) is greater than or equal to 2
(Number of units in (build area two) matching condition (Unit type of (matching unit) is equal to Crypt Fiend) is greater than or equal to 2
09-02-2003, 10:54 PM#3
desty
make a variable called N, for example, then add these triggers:

make a variable called N and set it to 0.
trigger 1
-----------

event)
building1 finishes training a unit
building2 finishes training a unit
(condition)
(action)
N = N + 1
if N = 4 then:
order units in buildarea1 owned by player 1 to attack player 2
order units in buildarea2 owned by player 1 to attack player 2 (buildarea1, buildarea2 are both regions around the buildings)


this should work, if you understand it. the other way would simply be doing:

if [units in buildarea1] + [units in buildarea2] = 4
then
attack

desty
09-03-2003, 03:09 AM#4
Hivemind
If you have TFT you want to use the AI editor for that instead of triggers. You can set it to train and attack however you want. Since everyone around here is used to solving problems via triggers a lot of ppl will know how to use triggers to do that. What a lot of ppl dont know is how to use the AI editor.

We have only looked at briefly but is seems fairly simple. If you can get it working then you could help others with custom AI stuff. We need experts on everything here.

To answer you questing using triggers, first find every event response you can. Look at each of them and try to figure out how they can be used. Ppl look at the trigger functions and then jump right in. Thats only half of what you need. Event responses are what ties the trigger functions to whats actualy going on in your game. Learn them and not only will it solve your current problem but it will also solve most of the ones you run into latter.
09-03-2003, 03:10 AM#5
Thunder-Hunter
Well I know how to use the AI Editor alittle if that helps.
09-03-2003, 03:11 AM#6
desty
nice idea hivermind, but I though the AI editor could only be used in melee... well it would work with that, if you make attack waves, and tell it what to produce.

desty
09-03-2003, 04:26 AM#7
D40-88
Can you tell me how to use the AI editor for my specific AI mentioned above?

With respect to the N+1 method shown above, I got everything to work except now certain waves seem to attack before the one before. For example, wave1 consists of 2 ghouls and 2 fiends. The attacking trigger checks if N=4 in the building1 and building2 areas, then it attacks.
As for wave2, which is suppose start AFTER the first wave. I have only 1 abom + 1 destroyer = 2 units. The attacking trigger checks if N=2.
Here's where the problem lies. Wave2 has lesser units to attack than wave1; thus, after 1 ghoul and 1 fiend has been produced (from wave1), they are sent to attack. This is obviously due to the wave2 attacking trigger since it fulfilled its requirement.

Does anyone here know how to solve this annoying problem?
BTW, thanks for the N+1 method. Really appreciate it!:D
09-03-2003, 10:01 AM#8
Krakou
Create 2 unit groups called Wave1 and Wave2 and change your trigger like this:

Event
building1 finishes training a unit
building2 finishes training a unit
Cond
Action
If (trained unit = 'ghouls' OR trained unit = 'fiend') then do Add Trained unit to group Wave1
If (trained unit = 'abom' OR trained unit = 'destroyer') then do Add Trained unit to group Wave2
If number of units in group Wave1 = 4 then do Order group Wave1 to Attack move
If number of units in group Wave2 = 2 then do Order group Wave2 to Attack move
09-03-2003, 11:03 AM#9
wcil
You could use the AI editor. Though one could write a tutorial about the AI editor, you should look at it. And AI works in custom maps as well (See the map in your \maps\FT\scenario\ )

There's a tab called attack groups which does exactly that - forms attack groups. So you can have wave 1 with 2 ghouls+2 fiends, and wave 2 with whatever. The first tab is where you time your waves, and there's also a build tree tab.

However, if you're gonna use triggers, try this-

1st trigger

(event)
elapse time is 0s
(action)
order building1 to train ghoul
order building1 to train ghoul
order building2 to train fiend
order building2 to train fiend
set wave1=true (wave1 boolean)

2nd trigger
(event)
building1 finishes training a unit
building2 finishes training a unit
(condition)
wave1=true
Number of units in build area one matching condition Unit type of matching unit is equal to Ghoul is greater than or equal to 2
Number of units in build area two matching condition Unit type of matching unit is equal to Crypt Fiend is greater than or equal to 2
(action)
order units in buildarea1 owned by player 1 to attack player 2
order units in buildarea2 owned by player 1 to attack player 2 (buildarea1, buildarea2 are both regions around the buildings)
set wave1=false
set wave2=true

3rd trigger
(event)
wave2 is true
(action)
order building3 to train abomination
order building3 to train abomination
order building4 to train statue
order building4 to train statue

4nd trigger
(event)
building3 finishes training a unit
building4 finishes training a unit
(condition)
wave2=true
Number of units in build area one matching condition Unit type of matching unit is equal to Abomination is greater than or equal to 2
Number of units in build area two matching condition Unit type of matching unit is equal to Statue is greater than or equal to 2
(action)
order units in buildarea1 owned by player 1 to attack player 2
order units in buildarea2 owned by player 1 to attack player 2 (buildarea1, buildarea2 are both regions around the buildings)
set wave2=false
set wave3=true
...........
I'll look at the AI editor in detail when I return home. (I'm currently AFK from Wc3)