|
|
#1 |
|
User
Join Date: Jan 2007
Posts: 167
![]()
|
My goal is to create a function that prevents aggro from 0 damage events.
The problem with it is, that units can attack nearby enemies without having the "attack", "smart" or "patrol" order. The following code is what I got so far. JASS:Therefore my question: Is there anyway to check what a unit is currently doing, especially if it is attacking anything? If you have any other suggestions to improve my code please post them aswell. |
|
|
|
| Sponsored Links - Login to hide this ad! |
|
|
|
|
#2 |
|
User
Join Date: Mar 2008
Posts: 205
![]()
|
When units start to attack nearby enemies by themselves they trigger the EVENT_UNIT_ACQUIRED_TARGET event. When they disengage because they're lured too far away from their idle spot then they get a move order.
You can use these two events to determine if a unit is in combat. Sometimes a unit also disengages without using the move order... then you'd have to check periodically if its current order is "idle". I wrote a little script that stores information like this and also adds interface functions for several important events that have to do with combat behavior but I haven't really tested it enough to recommend it yet. If you're interested I can pm you my current results though. |
|
|
|
|
|
#3 |
|
User
Join Date: Jan 2007
Posts: 167
![]()
|
Sounds definitely interesting, I'd love to get that PM.
Already tried to use the approach you suggested. JASS:Works, looks nice, but has a flaw I'd like to get rid off. I currently use a TriggerSleepAction within the onAcquire method to allow the user to force disengage the unit before the unit is detected as engaging. So I'm still hoping for suggestions on code improvement. Last edited by tamisrah : 04-26-2009 at 08:33 PM. |
|
|
|
![]() |
| Thread Tools | Search this Thread |
|
|
|
Donate |