HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

mischevious little trigger

08-08-2005, 03:23 PM#1
Skwee
I have two little baby triggers, that are simple just for testing out something, but it doesn't seem to work...

Quote:
Events
Time - Every 0.01 seconds of game time

Conditions
none

Actions
Region - Center Region 001 <gen> on ((Position of Footman 0000 <gen>) offset by 250.00 towards (Facing of Footman 0000 <gen>) degrees)

Quote:
Events
Unit - A unit enters Region 001 <gen>

Conditions
none

Actions
Game - Display to (All players) the text: I see you!




Now that is supposed to center the region a little off center so that it looks sorta like:

0 =====

With '0' being the footman and '====' representing the region, which is also supposed to change based on the direction he's facing.

Right now, when I test it the region just doesn't move along with him for some reason...

Any help?
08-08-2005, 09:36 PM#2
Vexorian
First of all there is a name issue with World Editor, what it calls regions are actually rects, and regions exist but can only be used with UMSWE/WEU or JASS, rects are rectangles and regions can have any shape.

Now, when you register an enter/leave rect event, it creates a region that contains the rect and registers the event FOR THE REGION.

So when you move the rect , the region of the event is unchanged.

There are workarounds like using the Unit comes within range of unit event or using JASS to manipulate the regions themselves but they depend on what you are doing, I would say that the Comes within range event is much better for you.
08-09-2005, 02:36 PM#3
Skwee
the problem is, I just want it for the facing direction of the unit not all the way around him....
08-09-2005, 04:00 PM#4
Anitarf
You can use a periodic trigger that's dynamically creating (and destroying) regions or that's simply doing some distance and angle comparisons to determine if the player is within sight of an enemy unit.
08-09-2005, 04:52 PM#5
Dremora
You could make a trigger that first checks if a unit is within range of the detecting unit, then checks the detecting units facing angle to see if it matches the triggering units position (could be offset like 30 degrees to either side to create a cone with the detecting units line of sight). (Not 100% sure it works tho, i hav'nt tried it out for myself at the moment, but it should work).

EDIT: didnt notice the previous post, im basicly suggesting the same thing i belive.
08-09-2005, 05:45 PM#6
Skwee
what condition would i use to see if he is facing the unit though?
08-09-2005, 08:35 PM#7
Anitarf
Quote:
Originally Posted by Skwee
what condition would i use to see if he is facing the unit though?
A real comparison. You would compare the facing angle of the detecting unit with the angle between the position of the detecting unit and the player's unit.

There are some things to watch out for when doing this. First, one of these two functions returns a value between 0 and 360, the other between -180 and 180. You need to check if the second number is negative and if it is, add 360 to it, that way you get both numbers in 0 - 360 range.

After that, you would compare if the two numbers (angles) are close enough to each other. In this case, you must also take into account that while the difference between, for example, 10 and 350 is 340, the angles are in fact only 20 degrees apart in a circle, so you need another check to take that into account.
08-09-2005, 08:37 PM#8
Skwee
ok thanks