| 05-29-2009, 07:35 AM | #1 |
I need to find a way to detect when a unit attacks ground. I simply need to detect when it attacks not when it is ordered to, is there a way to do this? |
| 05-29-2009, 01:15 PM | #2 |
I don't know the answer to your question, but it would be pretty quick and painless to set up a trigger -- hell, even in GUI -- that detects when your test unit does anything and spits out a debug message. |
| 05-29-2009, 02:12 PM | #3 |
Yeah im pretty much asking for a non complex system. I just need to find out when a unit iwth the "artillery" type attack attacks the ground. I dont need to find out complex stuff like when the projectile hits etc. Just simply when it attempts to attack. |
| 05-29-2009, 03:27 PM | #4 |
EVENT_UNIT_TARGET_IN_RANGE should fire whenever a unit is in range to attack a target. I just wouldn't know of a way to detect if the target is ground. GetEventTargetUnit() == null might work but that would still include destructables and items. |
| 05-29-2009, 03:58 PM | #5 |
complex. All I can think of is to have a grid of invisible units all over the map and use the damage event on them (this is as expensive as you can think of) |
| 05-29-2009, 04:03 PM | #6 |
cant you detect by order, togheter by damage detection? |
| 05-29-2009, 04:05 PM | #7 |
I dont need damage detection or any of the complexities, order doesnt work since itl fire the moemnt the unit is ordered to attack ground, regardless of whether it needs to walk closer to shoot or not. |
| 05-29-2009, 04:20 PM | #8 |
Catch the order and check if the unit is in range of the target location? |
| 05-29-2009, 04:25 PM | #9 |
Something might still stop that unit after the order. You could try to trigger all ranged attacks with some nice collinsion missiles. This way it would be easy to detec stuff like attack ground and others. ( Of course its not really easy and takes shitloads of work.. ) |
| 05-29-2009, 04:31 PM | #10 | |
Quote:
You could maybe somehow combine an order event with an EVENT_UNIT_TARGET_IN_RANGE event by setting a boolean for the unit to true when it has been ordered to a point and to false if it has been ordered to do anything else. Then on EVENT_UNIT_TARGET_IN_RANGE you check if the triggering unit's boolean is true and if it is you know that it attacks a ground point. You won't get around "complex" I guess. Maybe you should explain what you actually need this for. There might be a much easier way to do this. |
| 05-29-2009, 04:41 PM | #11 |
I tryed this: JASS:
loop
exitwhen i > 100
call TriggerRegisterPlayerUnitEvent(trig, Player(0), ConvertPlayerUnitEvent(i), null)
set i = i + 1
endloop
JASS:
loop
exitwhen i > 100
if ConvertPlayerUnitEvent(i) == GetTriggerEventId() then
call BJDebugMsg(I2S(i))
endif
set i = i + 1
endloop
everytime, the unit does anything like being (de)selected, ordered, BEING attack itself, etc it prints a number. but when attacking ground, nothing fires. strange why there is a being attacked event, but no attacking event.. the problem with check if unit is in range and has attack ground order workaround is, you dont know if the unit´s attack is on cooldown and when its acutually attacking. creating a dummyunit at the target of the order and reorder the unit to attack it. then use the unit is attacked event on the dummy would work better |
| 05-30-2009, 02:35 AM | #12 | |
Quote:
Acutally the unit im trying to attack gorund is dummy that hits only once so checking for range shoukd work. |
