Help with my system bonus item attribute

Dark gamer

New Member
Reaction score
0
I don't know why my system error. If i pick item in the first time, it will bonus attribute normal but when i loss it or pick the second or third time, the bonus will false ( maybe add 3xx 4xx attribute ) . :( help me :-s pls <3
my demo map :
 

Attachments

  • Bonus Ability Item.w3x
    527.2 KB · Views: 179

Dark gamer

New Member
Reaction score
0
OK !
Here is my trigger to set ability bonus of item :

JASS:

function BaoItem takes integer id,integer str,integer agi,integer int,integer dam,integer arm,integer ias,integer ims,integer rel,integer rem returns nothing
    set ItemID[ItemCount] = id
    set ItemStr[ItemCount] = str
    set ItemAgi[ItemCount] = agi
    set ItemInt[ItemCount] = int
    set ItemDam[ItemCount] = dam
    set ItemArm[ItemCount] = arm
    set ItemCount = ItemCount + 1
endfunction

function ItemLM takes integer id,integer life,integer mana returns nothing    
endfunction

function Trig_Init_Item_Actions takes nothing returns nothing
    call BaoItem(&#039;I00O&#039;,0,0,0,24,0,0,0,0,0)
    call BaoItem(&#039;I00P&#039;,0,0,0,15,0,10,0,0,0)
    call BaoItem(&#039;I00D&#039;,6,0,0,0,0,0,0,0,0)
    call BaoItem(&#039;I00C&#039;,0,6,0,0,0,0,0,0,0)
    call BaoItem(&#039;I000&#039;,0,0,0,0,0,0,50,0,0)
    call BaoItem(&#039;I00V&#039;,0,0,0,18,3,0,0,0,0)
    call BaoItem(&#039;I00M&#039;,0,0,0,12,0,0,0,0,0)
    call BaoItem(&#039;I00J&#039;,0,0,9,0,0,0,0,0,0)
    call BaoItem(&#039;I017&#039;,24,0,0,0,0,0,0,0,0)
    call BaoItem(&#039;I00K&#039;,9,0,0,0,0,0,0,0,0)
    call BaoItem(&#039;I01A&#039;,0,0,0,48,0,0,0,0,0)
    call BaoItem(&#039;I00Q&#039;,0,0,0,6,0,0,0,0,0)
    call BaoItem(&#039;I00S&#039;,0,0,0,21,0,5,0,0,0)
    call BaoItem(&#039;I00E&#039;,3,0,0,0,0,0,0,0,0)
    call BaoItem(&#039;I002&#039;,0,0,0,0,0,0,0,0,0)
    call BaoItem(&#039;I001&#039;,0,0,0,0,0,15,0,0,0)
    call BaoItem(&#039;I00L&#039;,0,9,0,0,0,0,0,0,0)
    call BaoItem(&#039;I00H&#039;,9,9,9,0,0,0,0,0,0)
    call BaoItem(&#039;I00I&#039;,3,3,3,0,0,0,0,0,0)
    call BaoItem(&#039;I00N&#039;,0,0,0,18,0,0,0,0,0)
    call BaoItem(&#039;I00G&#039;,0,0,3,0,0,0,0,0,0)
    call BaoItem(&#039;I00W&#039;,0,0,0,0,0,0,0,0,0)
    call BaoItem(&#039;I01G&#039;,0,0,0,0,0,0,0,0,0) 
    call BaoItem(&#039;I00T&#039;,0,0,0,0,6,0,0,0,0)
    call BaoItem(&#039;I01F&#039;,0,0,0,0,0,0,0,0,0) 
    call BaoItem(&#039;I01C&#039;,0,0,0,24,0,0,0,0,0)
    call BaoItem(&#039;I01D&#039;,0,0,0,21,0,0,0,0,0)
    call BaoItem(&#039;I01E&#039;,0,0,0,0,0,0,0,0,0) 
    call BaoItem(&#039;I00R&#039;,0,0,0,30,0,0,0,0,0)
    call BaoItem(&#039;I007&#039;,0,0,0,0,0,0,0,2,0)
    call BaoItem(&#039;I00F&#039;,0,0,6,0,0,0,0,0,0)
    call BaoItem(&#039;I003&#039;,0,0,0,0,0,0,0,0,0)
    call BaoItem(&#039;I00B&#039;,0,3,0,0,0,0,0,0,0)
    call BaoItem(&#039;I008&#039;,0,0,0,0,0,0,0,0,2)
    call BaoItem(&#039;I018&#039;,0,0,24,0,0,0,0,0,0)
    call BaoItem(&#039;I004&#039;,0,0,0,0,0,0,0,4,0)
    call BaoItem(&#039;I005&#039;,0,0,0,0,0,0,0,0,4)
    call BaoItem(&#039;I019&#039;,0,24,0,0,0,0,0,0,0)
    
    call BaoItem(&#039;I01J&#039;,0,0,0,0,0,0,0,0,0)
    call BaoItem(&#039;I023&#039;,0,9,0,18,0,0,30,0,0)
    call BaoItem(&#039;I03A&#039;,0,0,0,0,15,0,0,0,0)
    call BaoItem(&#039;I01Q&#039;,0,0,0,9,0,0,0,0,0)
    call BaoItem(&#039;I031&#039;,0,0,0,30,0,35,0,0,0)
    call BaoItem(&#039;I02H&#039;,9,6,12,0,0,0,0,0,0)
    call BaoItem(&#039;I02X&#039;,0,0,12,21,0,0,0,0,0)
    call BaoItem(&#039;I036&#039;,0,0,0,54,0,0,0,0,0)
    call BaoItem(&#039;I02J&#039;,6,12,9,0,0,0,0,0,0)
    call BaoItem(&#039;I03C&#039;,0,0,0,54,0,0,0,0,0)
    call BaoItem(&#039;I02Q&#039;,0,0,15,21,0,0,0,0,0)
    call BaoItem(&#039;I02P&#039;,0,0,12,18,0,0,0,0,1)
    call BaoItem(&#039;I02R&#039;,0,0,18,24,0,0,0,0,3)
    call BaoItem(&#039;I02T&#039;,0,0,0,21,0,0,0,0,0)
    call BaoItem(&#039;I01H&#039;,0,0,0,0,0,0,0,5,5)
    call BaoItem(&#039;I01S&#039;,0,0,0,33,0,0,0,0,0)
    call BaoItem(&#039;I02B&#039;,0,0,0,33,0,0,0,0,0)
    call BaoItem(&#039;I02L&#039;,12,9,6,0,0,0,0,0,0)
    call BaoItem(&#039;I02D&#039;,0,0,0,30,0,45,0,0,0)
    call BaoItem(&#039;I02Z&#039;,18,0,0,30,0,0,0,0,0)
    call BaoItem(&#039;I020&#039;,15,6,6,0,0,0,0,0,0)
    call BaoItem(&#039;I021&#039;,6,6,15,0,0,0,0,0,0)
    call BaoItem(&#039;I01Z&#039;,6,15,6,0,0,0,0,0,0)
    call BaoItem(&#039;I02F&#039;,0,0,0,18,0,0,100,0,0)
    call BaoItem(&#039;I014&#039;,0,0,0,9,0,25,65,0,0)
    call BaoItem(&#039;I01Y&#039;,6,3,3,0,0,0,0,0,0)
    call BaoItem(&#039;I02U&#039;,0,12,0,18,0,0,0,0,0)
    call BaoItem(&#039;I03E&#039;,18,0,0,30,0,0,80,0,0)
    call BaoItem(&#039;I027&#039;,6,0,0,34,0,0,0,0,0)
    call BaoItem(&#039;I045&#039;,0,0,0,0,5,0,0,0,0)
    call BaoItem(&#039;I038&#039;,0,0,0,33,0,0,0,7,6)
    call BaoItem(&#039;I025&#039;,0,0,0,0,0,0,0,0,3 ) 
    call BaoItem(&#039;I01W&#039;,3,3,6,0,0,0,0,0,0)
    call BaoItem(&#039;I029&#039;,0,0,3,18,0,3,0,0,0)
    call BaoItem(&#039;I01L&#039;,0,0,7,12,0,0,0,0,0)
    call BaoItem(&#039;I01X&#039;,3,6,3,0,0,0,0,0,0)
    call BaoItem(&#039;I02N&#039;,0,0,0,0,5,0,0,0,0)
    call BaoItem(&#039;I016&#039;,0,0,0,30,0,15,22,0,0)
    call BaoItem(&#039;I040&#039;,0,0,39,39,0,0,0,0,0)
    call BaoItem(&#039;I03W&#039;,0,27,0,33,30,33,0,0,0)
    call BaoItem(&#039;I03G&#039;,10,0,0,60,0,0,0,0,0)
    call BaoItem(&#039;I03S&#039;,0,36,0,24,0,0,0,0,0)
    call BaoItem(&#039;I03I&#039;,27,0,0,36,0,0,0,0,0)
    call BaoItem(&#039;I03O&#039;,0,0,0,80,0,0,0,9,0)
    call BaoItem(&#039;I03Q&#039;,24,24,24,24,0,0,0,0,0)
    call BaoItem(&#039;I03K&#039;,0,0,0,60,0,0,0,0,0)
    call BaoItem(&#039;I03M&#039;,0,0,0,85,6,25,0,0,0)
    call BaoItem(&#039;I03U&#039;,0,0,30,0,0,0,0,0,8) 
    call BaoItem(&#039;I03Y&#039;,33,0,0,0,0,0,0,11,0)    
endfunction


I use function HeroStatus to increases or reduce hero attribute

JASS:
function HeroStatus takes unit u,real str,real agi,real int,real dam,real armor returns nothing
    local integer t
    local integer a
    local integer b
    local integer c
    local integer dvi
    local integer chuc
    local integer tram
    local integer array abi1
    local integer array abi2
    local integer array abi3
    local integer array at
    local integer i 
    local boolean tru 
    set at[1] = R2I(str)
    set at[2] = R2I(agi)
    set at[3] = R2I(int)
    set at[4] = R2I(dam)
    set at[5] = R2I(armor)
    set abi1[1] = &#039;SJ01&#039;    // str 1
    set abi1[2] = &#039;SJ04&#039;    // agi 1
    set abi1[3] = &#039;SJ07&#039;    // int 1
    set abi1[4] = &#039;AItg&#039;    // dam 1
    set abi1[5] = &#039;AId1&#039;    // arm 1
    set abi2[1] = &#039;SJ02&#039;    // str 10
    set abi2[2] = &#039;SJ05&#039;    // agi 10
    set abi2[3] = &#039;SJ08&#039;    // int 10
    set abi2[4] = &#039;AItn&#039;    // dam 10
    set abi2[5] = &#039;AId2&#039;    // arm 10
    set abi3[1] = &#039;SJ03&#039;    // str 100
    set abi3[2] = &#039;SJ09&#039;    // agi 100
    set abi3[3] = &#039;SJ09&#039;    // int 100
    set abi3[4] = &#039;AItc&#039;    // dam 100
    set abi3[5] = &#039;AId3&#039;    // arm 100
    set i = 1
    loop
        exitwhen i &gt; 5
        set tru = false
        if at<i> &lt; 0 then
            set at<i> = - at<i>
            set tru = true
        endif
        if at<i> != 0 then
            set t    = at<i>
            set dvi  = GetUnitAbilityLevel(u,abi1<i>) - 1
            set chuc = GetUnitAbilityLevel(u,abi2<i>) - 1
            set tram = GetUnitAbilityLevel(u,abi3<i>) - 1
            set a    = (t - ModuloInteger(t,100))/100
            set t    = t - a * 100
            set b    = (t - ModuloInteger(t,10))/10
            set t    = t - b * 10
            set c    = t
            
            if tru == false then                
                    if c + dvi &gt;= 10 then
                        set b = b + 1
                        set c = c + dvi - 10
                    else
                        set c = c + dvi
                    endif
                    if b + chuc &gt;= 10 then
                        set a = a + 1
                        set b = b + chuc - 10
                    else
                        set b = b + chuc
                    endif
                    set a = a + tram
                else
                    if dvi - c &lt; 0 then
                        set b = b - 1
                        set c = 10 + dvi - c
                    else
                        set c = dvi - c
                    endif
                    if chuc - b &lt; 0 then
                        set a = a - 1
                        set b = 10 + chuc - b
                    else
                        set b = chuc - b
                    endif
                    if tram - a &lt; 0 then
                        set a = 0
                    else
                        set a = tram - a
                    endif
            endif
            call SetUnitAbilityLevel(u,abi1<i>,c + 1)
            call SetUnitAbilityLevel(u,abi2<i>,b + 1)
            call SetUnitAbilityLevel(u,abi3<i>,a + 1)
        endif
        set i = i + 1
    endloop
endfunction
</i></i></i></i></i></i></i></i></i></i></i>


And event pick or loss item :

JASS:
//Event pick item 

function Trig_Pick_Up_Item_Actions takes nothing returns nothing
    local integer a = 1
    local unit u = GetTriggerUnit()
    local item i = GetManipulatedItem()
    local integer id = GetItemTypeId(i)
    
    
    set a = 1
    loop
        exitwhen a &gt; ItemCount
        if id == ItemID[a] then
            exitwhen true
        endif
        set a = a + 1
    endloop
       call HeroStatus(u,ItemStr[a],ItemAgi[a],ItemInt[a],ItemDam[a],ItemArm[a])
    set i = null
    set u = null
endfunction

//Loss Item - ability

function Trig_Loss_An_Item_Actions takes nothing returns nothing
    local integer a = 1
    local unit u = GetTriggerUnit()
    local item i = GetManipulatedItem()
    local integer id = GetItemTypeId(i)
    
   
    
    set a = 1
        loop
            exitwhen a &gt; ItemCount
            if id == ItemID[a] then
                exitwhen true
            endif
            set a = a + 1
        endloop
        call HeroStatus(u,-ItemStr[a],-ItemAgi[a],-ItemInt[a],-ItemDam[a],-ItemArm[a])
    set i = null
    set u = null
endfunction

//===========================================================================
function Init takes nothing returns nothing
    local trigger t = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_DROP_ITEM )
    call TriggerAddAction( t, function Trig_Loss_An_Item_Actions )
    set t = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_PICKUP_ITEM )
    call TriggerAddAction( t, function Trig_Pick_Up_Item_Actions )
    set t = CreateTrigger(  )
    call TriggerRegisterTimerEventSingle( t, 0.10 )
    call TriggerAddAction( t, function Trig_Init_Item_Actions )
    set t = null
endfunction
endscope


it is all trigger i used in that system . but it only do correct in the first time :banghead:
Help me pls :eek:
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top