HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

AOE Attack

11-19-2006, 02:53 AM#1
Anopob
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
Av3n
Well I don't really know but why not use, all units in range event?

-Av3n
11-19-2006, 03:25 AM#3
TaintedReality
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
Anopob
@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
TaintedReality
Quote:
@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?

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
Anopob
I don't get it...can you show me an example? Thanks.
11-19-2006, 08:18 PM#7
wyrmlord
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
Daxtreme
Trigger:
AoE damage init
Collapse Events
Map Initialization
Conditions
Collapse Actions
Set Leak_Group = (Units in (Entire map))
Collapse Unit Group - Pick every units in Leak_Group and do (Actions)
Collapse Loop - Actions
Trigger - Add to AoE Damage <gen> the event: ((Picked unit) comes within 300 of UNIT_VARIABLE (your hero which does the attack)
Custom script: call DestroyGroup(udg_Leak_Group)

Trigger:
AoE Damage init 2
Collapse Events
Unit - A unit enters (Entire map)
Conditions
Collapse Actions
Trigger - Add to AoE Damage <gen> the event: (Entering unit) comes within 300 of UNIT_VARIABLE

Trigger:
AoE Damage
Events
Collapse Conditions
((Triggering unit) belongs to an enemy of (Owner of (UNIT_VARIABLE))) Equal to True
Collapse Actions
- Your actions go here -

That's about it.
11-19-2006, 09:22 PM#9
Anopob
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
Relyte
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
Daxtreme
Now that you tell it... Yea I think so :P
11-20-2006, 02:18 AM#12
Anopob
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
xombie
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
[VDM]Amn
tell us about your map, game idea, teams.
it may helps us to give you different solutions.
11-20-2006, 10:52 PM#15
TaintedReality
Quote:
it may helps us to give you different solutions.

The stated solution works perfectly fine.