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

Multiple local attachment on single unit

Status
Not open for further replies.
Level 17
Joined
Nov 13, 2006
Messages
1,814
[SOLVED] Multiple local attachment on single unit

i tryed make attachment show to every player on single dummy villager but the problem to player 2 dont work.

how supposed to work?
every time when the function is called i remove every attachment from dummy villager and recreate it (if the origianl hero got items, items stored to ilv, if not 0 then unit have item) but the model path is "" if u arent the right player.

the problem if i have 2 user in game, only for player 1 work the attaching special effect, if player 2 call this function then he dont see his own special effect on dummy villager
JASS:
    local integer pl = 1
    local integer  p = GetPlayerId(GetLocalPlayer()) + 1
    local integer i
    local integer p = 1
    local integer ilv
    local unit u = LoadUnitHandle(udg_Inv_Slots, 550, 0)
    local integer alpha = 0
    local integer glp
    local real y1 = 350
    local real y2 = 400
    local real y = LoadReal(udg_Inv_Slots, 0, 2)
    local string path
    local string QuiverPath = ""
    local real UScale = 1.2
    local integer BearForm = 'A00A'//dummy bear form ability id

    if udg_Camera_Lock then
        set alpha = 255
        set QuiverPath = "Quiver.mdx"
    endif

    call SetUnitVertexColor(u, 255, 255, 255, alpha)
    call UnitAddAbility( u, BearForm )
    call IssueImmediateOrder( u, "bearform" )
    call UnitRemoveAbility( u, BearForm )
    call SetUnitFacing(u, 90)
    if LoadInteger(udg_Stat_Table, 10000 * p + 9, 99) == 0 then
        set UScale = 2
        set y = y + y1
    else
        set UScale = 1.2
        set y = y + y2
    endif
    call SetUnitY(u, y)
    call SetUnitScale(u, UScale, UScale, UScale)
   //looping+attachment part
   //udg_Hero is the original hero, [; = player number [we loop 1-10]
   //i = equipment slot, if 1=helm, 2=armor,3=weapon,4=boots,5=shield,9=wing
    loop
        exitwhen pl > 10
        if udg_Hero[pl] != null and udg_Camera_Lock[pl] then
            set i = 1
            loop
                exitwhen i == 10
                if i == 1 or i == 2 or i == 5 or i == 9 then
                    call DestroyEffect(LoadEffectHandle(udg_Inv_Slots, 650 + pl, i))
                elseif i == 3 or i == 4 then
                    call DestroyEffect(LoadEffectHandle(udg_Inv_Slots, 650 + pl, i))
                    call DestroyEffect(LoadEffectHandle(udg_Inv_Slots, 650 + pl, i + 100))
                endif
                set ilv = LoadInteger(udg_Stat_Table, 10000 * pl + i, 99)
                if ilv > 0 then
                    set path = ""
                    if GetLocalPlayer() == Player(p-1) then
                        set path = LoadStr(udg_Item_Table, ilv, 98)
                    endif
                    if path != null then
                        if i == 1 then
                            call SaveEffectHandle(udg_Inv_Slots, 650 + pl, i, AddSpecialEffectTarget(path, u, "head"))
                        elseif i == 2 or i == 9 then
                            call SaveEffectHandle(udg_Inv_Slots, 650 + pl, i, AddSpecialEffectTarget(path, u, "chest"))
                        elseif i == 3 then
                            if ilv < 800 then
                                call SaveEffectHandle(udg_Inv_Slots, 650 + pl, i, AddSpecialEffectTarget(path, u, "hand left"))
                            elseif ilv >= 900 and ilv < 950 then
                                call SaveEffectHandle(udg_Inv_Slots, 650 + pl, i, AddSpecialEffectTarget(path, u, "hand left"))
                                call SaveEffectHandle(udg_Inv_Slots, 650 + pl, i + 100, AddSpecialEffectTarget(QuiverPath, u, "chest"))
                            elseif ilv >= 950 and ilv < 1000 then
                                call SaveEffectHandle(udg_Inv_Slots, 650 + pl, i, AddSpecialEffectTarget(path, u, "hand left"))
                                call SaveEffectHandle(udg_Inv_Slots, 650 + pl, i + 100, AddSpecialEffectTarget(path, u, "hand right"))
                            else
                                call SaveEffectHandle(udg_Inv_Slots, 650 + pl, i, AddSpecialEffectTarget(path, u, "hand right"))
                            endif
                        elseif i == 4 then
                            call SaveEffectHandle(udg_Inv_Slots, 650 + pl, i, AddSpecialEffectTarget(path, u, "foot left"))
                            call SaveEffectHandle(udg_Inv_Slots, 650 + pl, i + 100, AddSpecialEffectTarget(path, u, "foot right"))
                        elseif i == 5 then
                            call SaveEffectHandle(udg_Inv_Slots, 650 + pl, i, AddSpecialEffectTarget(path, u, "hand right"))
                        endif
                    endif
                endif
                if i == 5 then
                    set i = 8
                endif
                set i = i + 1
            endloop
        endif
        set pl = pl + 1
        set path = null
        set QuiverPath = null
        set u = null
    endloop
 
Last edited:
Status
Not open for further replies.
Top