HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Need help with a trigger

02-06-2003, 06:10 PM#1
Guest
Ok what I need is a trigger that will move a unit to the center of a region whenever the unit enters that region.... Sure I could use
Event - unit enters Region
Move entering unit to Center of Region

But I dont feel like making 288 triggers for 288 regions...
If you can figure out any alternatives itll help.
In case you wanted to know, im making a bomberman map using real bomberman rules (power ups, grid system, etc)
02-06-2003, 06:44 PM#2
Guest
You want to have multiple triggers without making multiple triggers. No, don't think thats possible. The region is hard coded into the event.

It would be great if they made a general region trigger event like: "If unit enters any region" and then you would be able to use "Triggering Region" for your actions....but for now, no.

Break.
02-07-2003, 02:15 PM#3
rwxr-xr-x
breakscience is correct. To trigger on a unit entering a region, you have to specify the region. You could, however, create a single generic trigger, but you will need 288 events referring to all of the regions you want to trigger on.
02-07-2003, 07:16 PM#4
Guest
You could probably have 1 trigger that is constantly being called by using Unit - A Unit Enters Playable Map area then by using Arrays with regions you could use a for loop to go thru each region (which would call a single trigger that uses an If statement to compare the region the unit is in (if any))... once you determine if that unit has actually entered a specified region, call your trigger that moves the unit to the center of that region. This way you only need probably 3 tiggers... 1 to loop the regions, a second to compare if the unit is in the current region, and a 3rd to implement the unit movement to the center of that region if conditions are met.

This could be pretty CPU intensive... however, how intensive would be something you'd have to test and I can't imagine it being much more intensive than checking 200+ regions as you point out.

Maybe it's a starting point at least since I don't fully understand your intended goal other than to avoid creating some 200+ triggers. An array, for loop, and if-then-else triggers are usually a good substitution under those circumstances.
02-08-2003, 05:16 AM#5
rwxr-xr-x
That won't work, because Unit enters playable map area will only trigger once when the unit first enters the map. It won't get called repeatedly. The only true way to reduce the amount of triggers or events is to do a periodic event, and check if a unit is in a region. But in order to be accurate, it would have to be low like 2 or 3 seconds, and this will only cause major lag.
02-08-2003, 05:22 AM#6
Dinadan87
Quote:
Originally posted by rwxr-xr-x
That won't work, because Unit enters playable map area will only trigger once when the unit first enters the map. It won't get called repeatedly. The only true way to reduce the amount of triggers or events is to do a periodic event, and check if a unit is in a region. But in order to be accurate, it would have to be low like 2 or 3 seconds, and this will only cause major lag.


And it would fire whenever the unit was in the region, whether he jsut entered or not. So as soon as he walked in he would be stuck to the middle and not able to leave.
02-08-2003, 06:05 AM#7
rwxr-xr-x
Quote:
Originally posted by Dinadan87
And it would fire whenever the unit was in the region, whether he jsut entered or not. So as soon as he walked in he would be stuck to the middle and not able to leave.


Not quite sure I get what you are saying. An event for a unit entering a region only gets called when the unit enters the region. The trigger would get called once, and not again for that unit until it leaves that region and re-enters. Since it is defined as playable map area, it only gets called once (unless the unit is removed and placed again).
02-08-2003, 05:08 PM#8
Guest
Oh, I thought maybe he was spawning units in a random area on the map and wanted them to move to the center of the closest region... which is why I figured he had 288 regions :////

Still, there must be some way of iterating thru a list of defined units/regions rather than all those triggers... there is just no specifics on the units... unless he just means ANY unit... I assumed he meant monster units... when created... a one-shot deal of moving them to the center of the closest region.
02-08-2003, 05:53 PM#9
Guest
What exactly are the regions for?
If they are to mark a grid, then use X,Y coordinates to check instead of regions.
If they are around units, then use a range trigger and go through several If Than statements to check and make sure everything is in the right place.
02-08-2003, 11:50 PM#10
Guest
These regions are for detecting whenever a player 'drops' a bomb(unit), I need to move this bomb to the center of the region it was placed in because im using a point/x/y system to create the explosions around it. If you played bomberman you would know what im talking about... basically, when a bomb explodes, the explosion will go as far as a certain amount, say 2 'regions'. I got the explosion part right, but for it to work, I need the bombs in the center.
02-08-2003, 11:59 PM#11
BananaTwist
Try something like, action: .01 seconds condition: unit in (region) equal to true or unit in (another region) equal to true or...
Action: move to center of entered region. I'm pretty dure i've done somethink like this before but i havn't been on the editor forever.
02-09-2003, 12:17 AM#12
DaKaN
.01 seconds would be hell on the processor especally if we are talking maybe 50 regions or so