HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

This trigger not working.. Why?

03-30-2008, 01:38 AM#1
Diablo02
Trigger:
Leak Controller part 3 p2 Copy Copy
Collapse Events
Unit - A unit enters Red end <gen>
Unit - A unit enters Blue end <gen>
Unit - A unit enters Teal end <gen>
Unit - A unit enters Purple end <gen>
Conditions
Collapse Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
((Triggering unit) is A structure) Equal to False
Collapse Then - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Blue end <gen> contains (Triggering unit)) Equal to True
((Owner of (Triggering unit)) is an enemy of Player 2 (Blue)) Equal to True
Collapse Then - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
LeakCtrl[(Player number of (Triggering player))] Equal to 1
Collapse Then - Actions
Set Lives[2] = (Lives[2] - 2)
Collapse Else - Actions
Set Lives[(Player number of (Triggering player))] = (Lives[(Player number of (Triggering player))] + 1)
Set Lives[2] = (Lives[2] - 1)
Else - Actions
Collapse Else - Actions
Do nothing

Just to clarify some stuff:
Ive done and gone this through my head and all if statement's should equal to true.
The array 'LeakCtrl' (located in the final if statement) is set to 1.

problem is that for some reason its not going through the final if statement (which i need it to).

Can someone tell me whats wrong with this?
03-30-2008, 01:54 AM#2
Ammorth
The "unit is in region" condition is funny in that on 2 edges, it won't work properly and on 2 edges it does (the way the engine handles regions).

The quick fix is to make a slightly bigger region around the event region and use that region for the condition.
03-30-2008, 02:14 AM#3
Strilanc
Expanding on what Ammorth said:

What GUI calls a "region" is what Jass calls a "rect". When you create an entered region event the Gui region (Jass rect) is converted to a Jass region.

The problem is that there are positions units can be in where they are not in the gui region, but they are in the jass region. This is Blizzard's fault.
03-30-2008, 02:19 AM#4
Diablo02
K did that and still no luck... does not work
03-30-2008, 02:24 AM#5
Ammorth
Re-post the trigger. You must have something wrong.

For debug purposes, stick a game message after each condition and see which condition fails. From there, you can find out what the problem is.
03-30-2008, 02:25 AM#6
Diablo02
Trigger:
Leak Controller part 3 p2 Copy Copy
Collapse Events
Unit - A unit enters Red end <gen>
Unit - A unit enters Blue end test <gen>
Unit - A unit enters Teal end <gen>
Unit - A unit enters Purple end <gen>
Conditions
Collapse Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
((Triggering unit) is A structure) Equal to False
Collapse Then - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Blue end test <gen> contains (Triggering unit)) Equal to True
((Owner of (Triggering unit)) is an enemy of Player 2 (Blue)) Equal to True
Collapse Then - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
LeakCtrl[(Player number of (Triggering player))] Equal to 1
Collapse Then - Actions
Set Lives[2] = (Lives[2] - 2)
Collapse Else - Actions
Set Lives[(Player number of (Triggering player))] = (Lives[(Player number of (Triggering player))] + 1)
Set Lives[2] = (Lives[2] - 1)
Else - Actions
Collapse Else - Actions
Do nothing
03-30-2008, 02:30 AM#7
Ammorth
Make sure the triggering unit is an enemy and make sure the LeakCtrl is set to 1. Other than that, I see nothing wrong.
03-30-2008, 03:18 AM#8
Diablo02
hmm .. wierd
03-30-2008, 04:02 AM#9
Diablo02
k i added tests to it and it appears to be stopping at this if statement..
If - Conditions
(Blue end test <gen> contains (Triggering unit)) Equal to True
((Owner of (Triggering unit)) is an enemy of Player 2 (Blue)) Equal to True

The first one should be true when the region contains the unit (which it does) and secondly, player 1 is enemies with everyone, same with player 2 (so second if should be true)...

Further testing... and have came that:
(Blue end test <gen> contains (Triggering unit)) Equal to True
is not working and need to know how to make it work <- any other ideas since expanding the region didn't do anything ?
03-30-2008, 06:42 AM#10
Tide-Arc Ephemera
For future references...

Trigger:
Use trigger tags.

Suitable for GUI triggers.
03-30-2008, 07:51 AM#11
Deaod
you can simplify your trigger by putting all your conditions into one 'If - Conditions' part

like this:
Trigger:
Leak Controller part 3 p2 Copy Copy
Collapse Events
Unit - A unit enters Red end <gen>
Unit - A unit enters Blue end test <gen>
Unit - A unit enters Teal end <gen>
Unit - A unit enters Purple end <gen>
Conditions
Collapse Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
((Triggering unit) is A structure) Equal to False
(Blue end test <gen> contains (Triggering unit)) Equal to True
((Owner of (Triggering unit)) is an enemy of Player 2 (Blue)) Equal to True
LeakCtrl[(Player number of (Triggering player))] Equal to 1
Collapse Then - Actions
Set Lives[2] = (Lives[2] - 2)
Collapse Else - Actions
Set Lives[(Player number of (Triggering player))] = (Lives[(Player number of (Triggering player))] + 1)
Set Lives[2] = (Lives[2] - 1)

aight. after looking at it, i noticed you are using (Triggering Player). Replace that with (Owner of (Entering/Triggering Unit)).
Maybe this will help.
03-30-2008, 02:12 PM#12
Diablo02
Trigger:
Leak Controller part 3 p2 Copy Copy
Collapse Events
Unit - A unit enters Red end <gen>
Unit - A unit enters Blue end test <gen>
Unit - A unit enters Teal end <gen>
Unit - A unit enters Purple end <gen>
Conditions
Collapse Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
((Triggering unit) is A structure) Equal to False
(Blue end test <gen> contains (Entering unit)) Equal to True
((Owner of (Triggering unit)) is an enemy of Player 2 (Blue)) Equal to True
Collapse Then - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
LeakCtrl[(Player number of (Owner of (Triggering unit)))] Equal to 1
Collapse Then - Actions
Set Lives[2] = (Lives[2] - 2)
Collapse Else - Actions
Set Lives[(Player number of (Owner of (Triggering unit)))] = (Lives[(Player number of (Owner of (Triggering unit)))] + 1)
Set Lives[2] = (Lives[2] - 1)
Collapse Else - Actions
Do nothing

Alright heres the new code ... couldn't put everything into 1 if but simplified it.
But it still doesn't work...
03-30-2008, 03:42 PM#13
Ammorth
I just realized you didn't do what I said before. You need to create a NEW region and make it slightly bigger (by 1 on all sides) than the old region. The new region should be used only for the condition (Is unit in region) while the old smaller region should be used for the event.
03-30-2008, 04:43 PM#14
Diablo02
Maby... but just realized that that single condition(the one causing problems) is useless since the event is already detecting an entering unit and no need for a condition to detect entering unit.
Its fixed now.

Thx anyways guys.