| 01-03-2003, 01:27 AM | #1 |
Here is exactly what im trying to do: I'm using the event that follows: Unit - Unit comes within 600.0 of <custom variable here> My only problem is im not able to enter a custom variable into that event. The reason i must use a variable is because it doesn't know which unit to put into the event until later on in the game. When a player selects a 'hero' in the game, that hero is set to a variable... then this variable will be used later on in the event i have listed to you above. Have i given enough information this time? Perhaps someone can find me a more efficient way of achieving what i am trying to do. Thanks for everyone's time! |
| 01-03-2003, 03:39 AM | #2 |
I can think of a few ways. None are perfect, but they might suffice. Method 1: A region around the hero - Draw a region that's 1200*1200 units. - Have an event that detects when the '<custom variable here>' moves (i.e. attack move, move, etc, you'll need a few events). Use a Player-Owned Unit event, then a condition that checks that the unit is infact your <custom variable here>. If this is too complex or too much work, a periodic event would work too. - Move the 1200*1200 region onto the position of the hero. - When a unit enters the region, activate your trigger. Problem: Obviously that it's a square, where you want a circle. Method 2: A region around the hero - Draw several regions that form a circular shape, then basically use the above triggers. You'd need more events on your actual trigger though. Method 3: An invisible, preplaced unit - Have an invisible unit with no collision and no selection scale. I.e. give it the ghost ability. Preplace this unit. Then using the above movement events, constantly move the invisible unit to the position of the <custom variable here>. Then you can use the event 'Unit - Unit comes within range' using the preplaced invisible unit. Gl hf~, hope that helps. |
| 01-03-2003, 09:29 AM | #3 |
Method 1 & 2 wont work because moving region dont fire an entering region trigger. |
| 01-03-2003, 10:31 AM | #4 |
Do a periodic trigger that checks the units in a radius from the hero. |
| 01-03-2003, 01:23 PM | #5 |
Sounds like you are trying to do collision detection between units. The best solution I have come up with is SuperIKI suggested, and have a periodic event checking to see if the distance between units is within a range, if so do what you want. Its not a great method, if you want to do it for multiplayer, if you are trying to use it for collision detection but its the best I have come up with. |
| 01-03-2003, 02:32 PM | #6 | |
Quote:
I realize that a region moving over a unit wont activate the 'unit enters region' event. That wasn't the idea. |
