| 07-12-2005, 09:42 AM | #1 |
I'm working on a map which has a pattern to it, think checkerboard. I'm trying to create a few general triggers which can be used for any of these "squares," and reduce the total amount of triggering. Here I will post questions about triggers that I'm having difficulty with, for those kind enough to help me. First question: Is there any way to generalize a region so that the region is around a unit of a specific type? It seems like you always have to name a specific region for a trigger. This trigger that I'm working on would be much easier to make with more generalized regions, as there are going to be around 50 generators around the map, if not more. I want something like: Events Unit - A unit enters (Region centered at (Unit of type (Power Generator)) Second question: I know that you can use custom script to delete temporary regions and prevent memory leaks, but is it preventing all of the leak or only most of it? What if the trigger is fired very very often during the game? After these questions are are answered, I may have other questions about the rest of this trigger. Thanks for your help. |
| 07-12-2005, 04:16 PM | #2 |
Maybe you can create a trigger with every 1 sec event that check all your units? |
| 07-13-2005, 05:50 AM | #3 |
What would that trigger look like? |
| 07-13-2005, 07:54 AM | #4 |
Here you go: Code:
Trigger
Events
The event you want
Conditions
Actions
Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Unit-type of (Picked unit)) Equal to Power Generator
Then - Actions
Unit Group - Pick every unit in (Units within 512.00 of (Position of (Picked unit))) and do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Unit-type of (Picked unit)) Not Equal to Power Generator
Then - Actions
// Do whatever you want for the units ::: If you don't want its to happen twice with a unit, set its custom value to 1 and do it only for those who whave not 1 in custom value.
Else - Actions
Else - Actions
|
| 07-13-2005, 12:32 PM | #5 |
i think theres a unti comes inrange event, so you could use that and check if one of the units was the generator, or whatever |
| 07-14-2005, 02:48 AM | #6 |
Zoxc, alright, I'll consider that trigger when I decide. Perhaps I can use that trigger format for other triggers as well. Mogmiester, unfortunately that is also like the enters region event and requires a specific unit. I have a new question. Is there any way to figure out the exact distance on the map? Like say I wanted to offset a region by exactly that region's width or wanted to know the distance between two units. |
| 07-14-2005, 09:48 AM | #7 |
Sure you can, there's a real math function distance between points. Make sure to remove the point leaks if you are going to be using this a lot, though... |
