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: 178

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.
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top