| 11-19-2006, 02:53 AM | #1 |
This is NOT about an attack that does splash damage. I didn't know what else to name the topic, sorry. Please move this if it's not suppose to be in this forum. Basically, what I'm trying to do is when unit-types come in an area (say, 300 AOE) of other unit-types the unit #2 will run and attack unit #1. Now, I would use "Unit comes into range" event but I do not know how to use a variable unit to detect that. Basically, I make Unit A's with a trigger, and I'm trying to figure out how to detect any of the Unit A's getting near Unit B's which will result in the Unit B's running and stabbing Unit A's to their deaths. Thanks for any help! |
| 11-19-2006, 03:06 AM | #2 |
Well I don't really know but why not use, all units in range event? -Av3n |
| 11-19-2006, 03:25 AM | #3 |
Make other triggers using triggers. You need to make one for each Unit A, to check if any Unit B's come within 300. Or just periodically check, which would add a bit of lag but might be feasible depending on how intensive the trigger would be. |
| 11-19-2006, 05:18 PM | #4 |
@Av3n: I'm making Unit A's in a trigger, and if you set a variable to those units you can't use the variable in a "Unit comes in range" event. @TaintedReality: I think I was unclear (sorry). Unit B's will be all around the map, meaning some will be made by triggers. How can I make that ANY Unit A's come in ANY Unit B's = Unit B's running and stabbing Unit A's? |
| 11-19-2006, 07:25 PM | #5 | |
Quote:
Yes, which is exactly why you need to create triggers using triggers. This allows you to make them dynamically whenever you create new units. |
| 11-19-2006, 07:51 PM | #6 |
I don't get it...can you show me an example? Thanks. |
| 11-19-2006, 08:18 PM | #7 |
You cannot create new triggers without JASS (I think), however, there's an action that allows you to add events to a specific trigger. So make a trigger with all the actions that you want to happen when Unit A goes near Unit B, and then make another trigger that will add events to this trigger. You'll probably want the second trigger to go off whenever a unit enters the playable map area and then check the unit type. For the action, just use the Trigger - Add Event action. That should work. |
| 11-19-2006, 08:27 PM | #8 |
| 11-19-2006, 09:22 PM | #9 |
Oh yeah, I remember that now. Okay thanks everyone. EDIT: Wait, I can't do your 1st/2nd trigger. Is it the event "Unit - Unit Within Range"? Because if it is, you cannot change the first "unit". It has to be "A unit comes within (AOE) of (UNIT)". So how can I change the 1st "unit" to "picked unit"? EDIT EDIT: Nevermind, I got it (again). |
| 11-19-2006, 10:04 PM | #10 |
Couldn't you just do: unit enters within 300 of Unit A, If (entering unit) belongs to enemy of Unit A = True, and (entering unit) is unit type Unit B = True, then Order unit A to attack unit B? |
| 11-19-2006, 10:48 PM | #11 |
Now that you tell it... Yea I think so :P |
| 11-20-2006, 02:18 AM | #12 |
In your case, Unit A's = enemies and Unit B's = you. But no, because I'm making Unit A's with triggers as well. |
| 11-20-2006, 03:58 AM | #13 |
What I suggest doing is making a timer event, and every time the timer goes off, you pick every unit (in a group variable, ofcourse) and perform an event for every unit in 300 range of that unit (excluding self and other filters). This should not cause much lag, there are only two loops, and even less if you use ForGroup (which I imagine somebody who doens't use JASS would do). |
| 11-20-2006, 07:29 AM | #14 |
tell us about your map, game idea, teams. it may helps us to give you different solutions. |
| 11-20-2006, 10:52 PM | #15 | |
Quote:
The stated solution works perfectly fine. |
