Can someone make me few attachments for model

Status
Not open for further replies.
Here's the code for attaching...

JASS:
library Attachments 

struct AT
    private static hashtable h = InitHashtable()
    
    static method removeAttachment takes item it returns nothing
        if HaveSavedHandle(h,GetHandleId(it),0) then
            call DestroyEffect(LoadEffectHandle(h,GetHandleId(it),0))
            call RemoveSavedHandle(h, GetHandleId(it), 0)
        endif
    endmethod

    static method addAttachment takes item it, unit u, string sfx ,string where returns nothing
        call SaveEffectHandle(h,GetHandleId(it), 0, AddSpecialEffectTarget(sfx,u,where))
    endmethod

endstruct

endlibrary

HOW TO USE?
  • AddIt
    • Events
      • Unit - A unit Acquires an item
    • Conditions
    • Actions
      • Custom script: local string s = "war3mapImported\\Master Sword.mdl"
      • Custom script: call AT.addAttachment(GetManipulatedItem(),GetTriggerUnit(), s, "hand")
  • RemoveIt
    • Events
      • Unit - A unit Loses an item
    • Conditions
    • Actions
      • Custom script: call AT.removeAttachment(GetManipulatedItem())

if you want a moving model, use the Sphere ability of the Blood Mage...
 
I dont think he needs to destroy an Item after a unit dies - maybe he could set like ---Unit---Dies---Drop---Item---On POINT---of---Dead Unit--- :)
if you dont want to remove it, simply remove and add it again, no harm done...and you can remove your attachment if item is dropped just like in the sample trigger...
in other words you can customize the removal...
 
Status
Not open for further replies.
Back
Top