HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

If/Then/Else question i think

02-12-2005, 09:53 PM#1
GellingFellan
Sorry for asking this probably simple question, but im a noob with triggers.

I think I need to make a trigger like this...

When units owned by Player 1 Red enter Region 000, -IF- Player 6 Green owns Unit A, -THEN- make Player 1 Red's units attack move to Region 001, -ELSE- make Player 1 Red's units attack move to Region 002.

If you know how I could make a trigger like this, please help :)

Thanks
02-12-2005, 10:21 PM#2
ThyFlame
Quote:
Originally Posted by GellingFellan
Sorry for asking this probably simple question, but im a noob with triggers.

I think I need to make a trigger like this...

When units owned by Player 1 Red enter Region 000, -IF- Player 6 Green owns Unit A, -THEN- make Player 1 Red's units attack move to Region 001, -ELSE- make Player 1 Red's units attack move to Region 002.

If you know how I could make a trigger like this, please help :)

Thanks

E:
A unit enters region
C:
Player(owner of (entering unit)) == player 1 (red)
(entering unit) is in Region 000
E:
IF
Player(owner of (Unit A)) == Player 6
THEN
Pick all units in unit group (whatever you want to move) and order (picked unit) to attack-move to Region 001
ELSE
Pick all units in unit group (whatever you want to move) and order (picked unit) to attack-move to Region 002
02-15-2005, 11:29 PM#3
GellingFellan
Awesome! It works ThyFlame, THANKS!
02-16-2005, 05:11 PM#4
ThyFlame
Quote:
Originally Posted by GellingFellan
Awesome! It works ThyFlame, THANKS!

You had any doubt? ;)
02-16-2005, 11:32 PM#5
GellingFellan
Oh crap, after further testing, its actually not working like I need it to.

I couldn't copy your trigger exactly but i got pretty close, heres what I have.

Code:
Events
      Unit - A unit enters Region 009 <gen>

Conditions
      (Owner of (Entering Unit)) Equal to Player 1 (Red)

Actions
      If ((Owner of Outpost 1 0024 <gen>) Equal to Player 7 (Green))
         then do 
      (Unit Group - Pick every unit in (Units in Region 009 <gen>) and do (Unit - Order (Picked unit) to Attack-Move To (Center of Region 004 <gen>))) 
         else do 
      (Unit Group - Pick every unit in (Units in Region 009 <gen>) and do (Unit - Order (Picked unit) to Attack-Move To (Center of Region 008 <gen>)))



Here is a picture of the way the Regions are set up (Sorry for using dashes, but if I used spaces the picture would mess up).

_________________
|------Reg009----------|
|--------_______-------|------------------------Reg004---------------Reg008
|--------|----------|------|
|--------|Reg000|------|
|--------|______|------|
|--------------------------|
|________________|




______
|---------|
|Reg001|
|______|



I have a trigger that makes Player 1 (Red) units Attack-Move from Reg001 to Reg000, and that trigger combined with the trigger above should make Player 1 (Red) units Attack-Move to either Reg004 or Reg008, once they enter Reg009, depending on whether or not Player 7 (Green) owns the unit "Outpost 1".

The current problems are:

-Other units besides Player 1 (Red) units will be given the order to Attack-Move to either Reg004 or Reg008. For example, a if Player 2 (Blue) has a hero inside Reg009 when a Player 1 (Red) unit enters Reg009, then they will both be ordered to Attack-Move to Reg004 or Reg008. I need it so that only Player 1 (Red) units will be given the order.

-For some reason, when units attack-move from Reg001 to Reg000 and step into Reg009, and set off the trigger, atleast 1 of the units will turn around and go back to Reg001 rather than go to Reg004 or Reg008 like it should.



Any help fixing these problems would be greatly appreciated
02-17-2005, 01:04 AM#6
Guest
Code:
Events
      Unit - A unit enters Region 009 <gen>

Conditions
      (Owner of (Entering Unit)) Equal to Player 1 (Red)

Actions
      If ((Owner of Outpost 1 0024 <gen>) Equal to Player 7 (Green))
         then do 
      Unit - Order (Entering unit) to Attack-Move To (Center of Region 004 <gen>))
         else do 
      Unit - Order (Entering unit) to Attack-Move To (Center of Region 008 <gen>))


Your code picked every unit in the region, whoever it belonged to, and made it move.
Simply replacing the group unit by entering unit should fix this
02-17-2005, 07:49 PM#7
GellingFellan
OMG, this fixed BOTH of the problems. THANKS BadFurDay!
02-18-2005, 07:15 PM#8
ThyFlame
Note that you may experience problems with the use of entering object, since if any units that match those conditions try to pass through those regions that aren't supposed to be moved by those triggers, it will still be issued the order.

This isn't a problem if that doesn't occur, but you may need to accomidate for it.
02-18-2005, 07:32 PM#9
Guest
ThyFlame: That's why Blizzard created conditions ;)
If/Then/Else question i think - Wc3C.net