• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Way to detect artillery attacks?

Status
Not open for further replies.
Level 31
Joined
Jul 10, 2007
Messages
6,306
Yea, trying to detect artillery attacks, pretty simple.

Essentially, I'm trying to check whether or not to explode a unit. I'm preventing the unit from dying and then reapplying the damage, meaning that canon towers no longer explode units, so I must check to see if I should explode the unit or not.

Tx.



And no, attackground is not an ability ; (, so I can't check to see if the unit has it or not because it's an order /sad face. Not all orders are abilities, only attack and move are.
 
Level 10
Joined
Jul 12, 2009
Messages
318
[edit] Possibly best, see if attempting to order the unit to attack-ground returns true?

Catalogue which unit-types have artillery attacks (or give them all Freezing Breath or whichever ability is the AOE-capable buff placer, and check for that buff), or maybe position a vulnerable dummy to be hit by each tower and see if it remains after taking damage (ie. whether it exploded). That's all I can think of.

I can't try at the moment, but if Barrage works with artillery attacks and if it'll then explode units, that'd be a a way to test on a dummy before the main attack hits (Barrage missile speed can be instant and can have unique allowed targets).

Or, to your end, trigger the towers' attacks so it's not actually an artillery attack dealing any damage...?
 
Just a random guess, although it probably wouldn't work in all situations:
JASS:
function IsArtillery takes unit u returns boolean
    if IssueImmediateOrder(u,"attackground") then
        call IssueImmediateOrder(u,"stop")
        return true
    endif
    return false
endfunction

It is a very sloppy function that might not even work, but it is worth a shot. It should work for most artillery, but I am not sure.
 
Level 31
Joined
Jul 10, 2007
Messages
6,306
That won't work as I've already tried that ;). You can issue any unit to attack ground so long as it can attack. If a unit can't actually attack ground but is ordered to do so, it'll just sit there, but its current order id will be 851984 (attack ground).

Catalogue which unit-types have artillery attacks (or give them all Freezing Breath or whichever ability is the AOE-capable buff placer, and check for that buff), or maybe position a vulnerable dummy to be hit by each tower and see if it remains after taking damage (ie. whether it exploded). That's all I can think of.

Catalog is out of the question ;P.

What I really need to see if a unit is marked to explode or not.

maybe position a vulnerable dummy to be hit by each tower and see if it remains after taking damage (ie. whether it exploded). That's all I can think of.

No good.

Catalogs are bad as units have multiple attacks and there are upgrades/techs, meaning 2 units may be of the same type, but only one may have artillery for one attack.
 
Level 31
Joined
Jul 10, 2007
Messages
6,306
My last idea is just to block and re-issue all damage, regardless. There's no way that I know of to tell whether a unit will explode (if a unit-type even can explode, eg. a Voidwalker just dies normally anyway.)

That's what this thing currently does, which is why I need to know whether the previous damage would have exploded the unit or not. Currently, no units explode ;|.
 
Level 31
Joined
Jul 10, 2007
Messages
6,306
Me n Bribe figured out a way, but the prob is again with techs and items and abilities ;|.

This returns true..

JASS:
if IssueTargetOrder(CreateUnit(Player(0), 'hrif', -200, -1700, 0), "attack", CreateDestructable('ATtr', -400, -1700, 60, 1, 1)) then
    call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, 60, "attacked")
endif

next?

edit
Hold it!

JASS:
    private static method display takes nothing returns boolean
        if (GetOrderTarget() != null) then
            call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, 60, "ordered")
        else
            call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, 60, "not ordered")
        endif
        return false
    endmethod

JASS:
        local trigger t = CreateTrigger()
        set u = CreateUnit(Player(0), 'hrif', -200, -1700, 0)
        call TriggerRegisterPlayerUnitEvent(t, Player(0), EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER, null)
        call TriggerRegisterPlayerUnitEvent(t, Player(0), EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER, null)
        call TriggerAddCondition(t, Condition(function thistype.display))
        if IssueTargetOrder(u, "attack", CreateDestructable('ATtr', -400, -1700, 60, 1, 1)) then
            call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, 60, "attacked")
        endif

That returns not ordered!

On canon it returns ordered!

Problem solved!!!

Now the only prob is the fact that each unit has 2 attacks, and there are techs... plus the memory leaks incurred with cataloging units as they are indexed

So, anyone wanna try and expand on this?
 
Status
Not open for further replies.
Top