• 🏆 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!

Change Unit Attack-Type, Damage and Range in-game

Status
Not open for further replies.
So, I was trying to remove locust in-game seamlessly (click and drag select) for my RP map, so I decided to play around with Crow Form.

I thought I had everything figured out, but then my units started getting the attack type of the crow form unit, instead of their own attack type. Apparently, this is caused by the removal of the Crow Form ability in the function "Detect Morph".

JASS:
function DetectMorph takes nothing returns nothing
        local unit whichUnit = GetTriggerUnit()
        call SetUnitPosition(whichUnit, GetUnitX(whichUnit), GetUnitY(whichUnit)) //Allows order to be issued below
        call IssueImmediateOrder(whichUnit, "unravenform") //Only works after moving the unit
        call UnitRemoveAbility(whichUnit, 'Amrf') //This causes the bug
        call DestroyTrigger(GetTriggeringTrigger())
endfunction

function MakeUnitSelectable takes unit whichUnit returns nothing
    local integer unitId = GetHandleId(whichUnit)
    local integer selectionType = 0
    local trigger morphDetect
 
    if selectionType == 0 then

        set morphDetect = CreateTrigger()
        call TriggerRegisterUnitLifeEvent( morphDetect, whichUnit, LESS_THAN, GetUnitState(whichUnit, UNIT_STATE_LIFE))
        call TriggerAddAction(morphDetect, function DetectMorph)
    
        call UnitAddAbility(whichUnit, 'Amrf')
        call UnitMakeAbilityPermanent(whichUnit, true,  'Amrf')
        call IssueImmediateOrder(whichUnit, "ravenform")
    endif
endfunction

Basically, the unit will inherit the following 3 stats from the crow form alternate unit:
-Damage and Attack-Type and Range (not missle art, but weapon type is inherited)
-Movement Speed (not type, unfortunately)
-Flying Height
-The unit facing angle also changes, and orders are interrupted.

You have to remove the Crow Form ability in the same thread as the one in which the "unravenform" order was issued. Otherwise, the unit will not inherit the stats.

This bug is not very useful to me, so I don't intend on checking it out any further. But I couldn't find anything about it on the internet, thus I decided to post it here, to see if anyone knew about it. Hopefully it can be useful to anyone who stumbles upon this, even though the trick is pretty limited.

Just type "fix" on the chat in map I've attached while selecting a unit(s) to use the trick on it. Sorry about the map being a mess, I was testing out other stuff in it.

EDIT: Actually, this also has something to do with DetectMorph running twice (once for the first transformation and a second time for the second one)
 

Attachments

  • anas.w3x
    934.1 KB · Views: 130
Last edited:
Status
Not open for further replies.
Top