HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

A unit enters a region, event only fires if I enter from a particular side

09-09-2009, 05:03 AM#1
Steelbom
Hey, I've got two regions in front of two entrances, both lead to the same middle of the area.
The event for both regions only fires, when.. I enter from the bottom of the region.

It's not a problem, for the bottom part, because it's supposed to detect when it enters,
But the top region it is a problem, because it only says "Entering" when I leave.

I'll attach an image if this is not clear.

This is my code where the event is added to the trigger for entering all the regions relating to this:

Trigger:
LoadRegions
Events
Conditions
Collapse Actions
Set rRegionsStart[0] = RedStart <gen>
Set rRegionsStart[1] = BlueStart <gen>
Set rRegionsStart[2] = TealStart <gen>
Set rRegionsStart[3] = PurpleStart <gen>
Set rRegionsStart[4] = YellowStart <gen>
Set rRegionsStart[5] = OrangeStart <gen>
Set rRegionsStart[6] = GreenStart <gen>
Set rRegionsStart[7] = PinkStart <gen>
Set rRegionsStart[8] = GrayStart <gen>
Set rRegionsStart[9] = LightBlueStart <gen>
Set rRegionsStart[10] = DarkGreenStart <gen>
Set rRegionsStart[11] = DarkBrownStart <gen>
Set rRegionsStart2[0] = RedStart2 <gen>
Set rRegionsStart2[1] = BlueStart2 <gen>
Set rRegionsStart2[2] = TealStart2 <gen>
Set rRegionsStart2[3] = PurpleStart2 <gen>
Set rRegionsStart2[4] = YellowStart2 <gen>
Set rRegionsStart2[5] = OrangeStart2 <gen>
Set rRegionsStart2[6] = GreenStart2 <gen>
Set rRegionsStart2[7] = PinkStart2 <gen>
Set rRegionsStart2[8] = GrayStart2 <gen>
Set rRegionsStart2[9] = LightBlueStart2 <gen>
Set rRegionsStart2[10] = DarkGreenStart2 <gen>
Set rRegionsStart2[11] = DarkBrownStart2 <gen>
Collapse For each (Integer A) from 0 to 11, do (Actions)
Collapse Loop - Actions
Trigger - Add to UnitEntersStart <gen> the event (Unit - A unit enters rRegionsStart[(Integer A)])
Trigger - Add to UnitEntersStart <gen> the event (Unit - A unit enters rRegionsStart2[(Integer A)])

Start2 is at the top, Start is at the bottom, I also have regions that are for exiting the same area, because I encountered this problem before so I decided to have two lots of regions next to each other, one for entering and one for exiting.

This is the part of the code:
Trigger:
UnitEntersStart
Events
Conditions
Collapse Actions
Set PN = ((Player number of (Owner of (Triggering unit))) - 1)
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
((Player((PN + 1))) slot status) Not equal to Is playing
Collapse Then - Actions
Skip remaining actions
Else - Actions
-------- 0 is bottom, 1 is top --------
Collapse For each (Integer A) from 0 to 11, do (Actions)
Collapse Loop - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(rRegionsStart2[(Integer A)] contains (Triggering unit)) Equal to True
Collapse Then - Actions
Set bEnteredFromTop[PN] = True
Set iHeroInPlayerMaze[PN] = (Integer A)
Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(rRegionsStart[(Integer A)] contains (Triggering unit)) Equal to True
Collapse Then - Actions
Set bEnteredFromTop[PN] = False
Set iHeroInPlayerMaze[PN] = (Integer A)
Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
bHeroStarted[PN] Equal to False
Collapse Then - Actions
Set bHeroStarted[PN] = True
Unit - Turn collision for (Triggering unit) Off
Game - Display to (All players) the text: entering (col off)
Else - Actions

The event doesn't actually fire if I enter from the top.

Does this problem have an obvious solution? or is it weird?

I'd appreciate any help

Kind Regards
Attached Images
File type: jpgMaze1.jpg (158.4 KB)
09-12-2009, 06:21 PM#2
meOme
Regions have a strange thing about them:
At the moment you enter them from 2 sides (don't know which 2 exactly), you count as "in the region". But from the other 2 directions, you don't.
So "(rRegionsStart[(Integer A)] contains (Triggering unit)) Equal to True " probably never is true when the event triggers.
Why do you have that condition anyways? ^^
09-12-2009, 06:24 PM#3
meOme
Regions are weird. "(rRegionsStart[(Integer A)] contains (Triggering unit))" is false when you enter the region from 2 of the sides, and true from the other 2 sides.
Why do you have that condition anyways?