• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

More than one item abilites

Status
Not open for further replies.
Level 7
Joined
Aug 19, 2009
Messages
278
If 2 "same" item abilities are added to the same unit, will they stack with each other.

Like I have an ability that increases the attack speed of an unit by 5. If I add the same ability 2 times, will they stack?

Can I remove just one of them? Or if I remove one, the other would be removed?
 
Level 21
Joined
Mar 27, 2012
Messages
3,232
If 2 "same" item abilities are added to the same unit, will they stack with each other.

Like I have an ability that increases the attack speed of an unit by 5. If I add the same ability 2 times, will they stack?

Can I remove just one of them? Or if I remove one, the other would be removed?

The rule on items is that passives stack, actives do not. This doesn't mean that a previously unstackable ability would definitely stack on items though.
 
Level 7
Joined
Aug 19, 2009
Messages
278
The rule on items is that passives stack, actives do not. This doesn't mean that a previously unstackable ability would definitely stack on items though.

But I am making a system that gives attack speed to units. It works great in one instance. But when I add the second instance it doesn't work.

The same abilities are added in each instance.
 
Level 21
Joined
Mar 27, 2012
Messages
3,232
I was exactly making a similar system.. -_-

I guess my system is pointless now..

You can still make it. It's not like I'm using his version, I use my own. If not for else, then to have a clear understanding of how the system works.

JASS:
//
//          BonusMod by Xonok
//
//      This library is a replica of weaaddar's
//      BonusMod libary. The reason why I am
//      not using his is that I do not like
//      systems that I don't fully understand
//      and thus, I must create it myself. 
//
//

globals
    integer array AddDamageAbil
    integer AddDamageAbils
    integer array AddHealthAbil
    integer AddHealthAbils
    integer array AddArmorAbil
    integer AddArmorAbils
    integer array AddManaAbil
    integer AddManaAbils
endglobals

library BonusMod requires ExtraFunctions
    function AddDamage takes unit u,integer DamageToAdd returns nothing
        local integer i = 0
        loop
            exitwhen i > AddDamageAbils
            if GetUnitAbilityLevel(u,AddDamageAbil[i]) > 0 then
                set DamageToAdd = DamageToAdd + IntPower(2,i)
                call UnitRemoveAbility(u,AddDamageAbil[i])
            endif
            set i = i + 1
        endloop
        set i = AddDamageAbils
        loop
            exitwhen i < 0
            if DamageToAdd >= IntPower(2,i) then
                call UnitAddAbility(u,AddDamageAbil[i])
                set DamageToAdd = DamageToAdd - IntPower(2,i)
            endif
            set i = i - 1
        endloop
    endfunction
    function AddHealth takes unit u,integer HealthToAdd returns nothing
        local integer i = 0
        loop
            exitwhen i > AddHealthAbils
            if GetUnitAbilityLevel(u,AddHealthAbil[i]) > 0 then
                set HealthToAdd = HealthToAdd + IntPower(2,i)
                call UnitRemoveAbility(u,AddHealthAbil[i])
            endif
            set i = i + 1
        endloop
        set i = AddHealthAbils
        loop
            exitwhen i < 0
            if HealthToAdd >= IntPower(2,i) then
                call UnitAddAbility(u,AddHealthAbil[i])
                set HealthToAdd = HealthToAdd - IntPower(2,i)
            endif
            set i = i - 1
        endloop
    endfunction
    function AddArmor takes unit u,integer ArmorToAdd returns nothing
        local integer i = 0
        loop
            exitwhen i > AddArmorAbils
            if GetUnitAbilityLevel(u,AddArmorAbil[i]) > 0 then
                set ArmorToAdd = ArmorToAdd + IntPower(2,i)
                call UnitRemoveAbility(u,AddArmorAbil[i])
            endif
            set i = i + 1
        endloop
        set i = AddArmorAbils
        loop
            exitwhen i < 0
            if ArmorToAdd >= IntPower(2,i) then
                call UnitAddAbility(u,AddArmorAbil[i])
                set ArmorToAdd = ArmorToAdd - IntPower(2,i)
            endif
            set i = i - 1
        endloop
    endfunction
    function AddMana takes unit u,integer ManaToAdd returns nothing
        local integer i = 0
        loop
            exitwhen i > AddManaAbils
            if GetUnitAbilityLevel(u,AddManaAbil[i]) > 0 then
                set ManaToAdd = ManaToAdd + IntPower(2,i)
                call UnitRemoveAbility(u,AddManaAbil[i])
            endif
            set i = i + 1
        endloop
        set i = AddManaAbils
        loop
            exitwhen i < 0
            if ManaToAdd >= IntPower(2,i) then
                call UnitAddAbility(u,AddManaAbil[i])
                set ManaToAdd = ManaToAdd - IntPower(2,i)
            endif
            set i = i - 1
        endloop
    endfunction
endlibrary

//===========================================================================
function InitTrig_BonusMod takes nothing returns nothing
    //Damage
    set AddDamageAbil[0] = 'A000' //+1
    set AddDamageAbil[1] = 'A001' //+2
    set AddDamageAbil[2] = 'A002' //+4
    set AddDamageAbil[3] = 'A003' //+8
    set AddDamageAbil[4] = 'A004' //+16
    set AddDamageAbil[5] = 'A005' //+32
    set AddDamageAbil[6] = 'A006' //+64
    set AddDamageAbil[7] = 'A007' //+128
    set AddDamageAbil[8] = 'A008' //+256
    set AddDamageAbil[9] = 'A009' //+512
    set AddDamageAbil[10] = 'A00A' //+1024
    set AddDamageAbils = 10
    //Health
    set AddHealthAbil[0] = 'A00B' //+1
    set AddHealthAbil[1] = 'A00C' //+2
    set AddHealthAbil[2] = 'A00D' //+4
    set AddHealthAbil[3] = 'A00E' //+8
    set AddHealthAbil[4] = 'A00F' //+16
    set AddHealthAbil[5] = 'A00G' //+32
    set AddHealthAbil[6] = 'A00H' //+64
    set AddHealthAbil[7] = 'A00I' //+128
    set AddHealthAbil[8] = 'A00J' //+256
    set AddHealthAbil[9] = 'A00K' //+512
    set AddHealthAbil[10] = 'A00L' //+1024
    set AddHealthAbil[11] = 'A00M' //+2048
    set AddHealthAbil[12] = 'A00N' //+4096
    set AddHealthAbil[13] = 'A00O' //+8192
    set AddHealthAbils = 13
    //Armor(whatever it does)
    set AddArmorAbil[0] = 'A013' //+1
    set AddArmorAbil[1] = 'A016' //+2
    set AddArmorAbil[2] = 'A017' //+4
    set AddArmorAbil[3] = 'A018' //+8
    set AddArmorAbil[4] = 'A019' //+16
    set AddArmorAbil[5] = 'A01A' //+32
    set AddArmorAbil[6] = 'A01B' //+64
    set AddArmorAbil[7] = 'A01C' //+128
    set AddArmorAbil[8] = 'A01D' //+256
    set AddArmorAbil[9] = 'A01E' //+512
    set AddArmorAbil[10] = 'A01F' //+1024
    set AddArmorAbils = 10
    //Mana
    set AddManaAbil[0] = 'A01G' //+1
    set AddManaAbil[1] = 'A01H' //+2
    set AddManaAbil[2] = 'A01I' //+4
    set AddManaAbil[3] = 'A01J' //+8
    set AddManaAbil[4] = 'A01K' //+16
    set AddManaAbil[5] = 'A01L' //+32
    set AddManaAbil[6] = 'A01M' //+64
    set AddManaAbil[7] = 'A01N' //+128
    set AddManaAbil[8] = 'A01O' //+256
    set AddManaAbil[9] = 'A01P' //+512
    set AddManaAbil[10] = 'A01Q' //+1024
    set AddManaAbil[11] = 'A01R' //+2048
    set AddManaAbil[12] = 'A01S' //+4096
    set AddManaAbil[13] = 'A01T' //+8192
    set AddManaAbils = 13
endfunction
Note that ExtraFunctions is also my own and in this case I use it for a power function. IntPower(2,i) means 2 raised to i.
 
Level 7
Joined
Aug 19, 2009
Messages
278
You can still make it. It's not like I'm using his version, I use my own. If not for else, then to have a clear understanding of how the system works.

I downloaded that map but my map is not saving. I am getting a error while compiling. This happens with nearly all map that use vjass if I try to save it.


" //! runtextmacro optional RunStatusEvent("Resurrect")"

syntax error. Unable to find text macro optional
 
Level 21
Joined
Mar 27, 2012
Messages
3,232
I downloaded that map but my map is not saving. I am getting a error while compiling. This happens with nearly all map that use vjass if I try to save it.


" //! runtextmacro optional RunStatusEvent("Resurrect")"

syntax error. Unable to find text macro optional

Oh, I bet you're using a newer windows than XP. A patch for windows 7 broke the lua scripts that the original Bonusmod depends on.
 
Level 7
Joined
Aug 19, 2009
Messages
278
Oh, I bet you're using a newer windows than XP. A patch for windows 7 broke the lua scripts that the original Bonusmod depends on.

This is LUA too..

Then its good for me. I can carry on with my system. Is there any bonusmod which doesn't need LUA?
 
Level 7
Joined
Aug 19, 2009
Messages
278
Well, the one I attached to my post a few posts back is one. It isn't complete, but it's bugless so far.
If you want I can give you the ExtraFunctions and it will work(although you'll still need to create the abilities)

Any other that doesn't use Lua but is complete?
 
Level 21
Joined
Mar 27, 2012
Messages
3,232
Any other that doesn't use Lua but is complete?

In pretty much any implementation you will have to create the abilities yourself, as that's what the lua scripts were originally meant for.
My system only requires you to add a function and some abilities when you make it work on new stats. Nothing complicated imo.

However, if you want, then I can update my Bonusmod to modify more stats. What do you think?
 
Level 7
Joined
Aug 19, 2009
Messages
278
In pretty much any implementation you will have to create the abilities yourself, as that's what the lua scripts were originally meant for.
My system only requires you to add a function and some abilities when you make it work on new stats. Nothing complicated imo.

However, if you want, then I can update my Bonusmod to modify more stats. What do you think?

I can add the abilites of that bonus mod. But I don't know which are lua scripts and how to remove them.

I just need attackspeed and armour. If you can do it then it will be helpful.

The problem with my system is if I have already given a unit 100% attack speed bonus for 10 seconds. If i give another 100% attack speed bonus for more 20 seconds. If the first gets removed, both of them get removed. I am tired to edit the full system again.
 
Level 7
Joined
Aug 19, 2009
Messages
278
Textmacros. They call upon lua scripts to alter the mapfile after saving. So if you remove then it should work.

Where are the text macros present?

I just need attackspeed and armour. If you can do it then it will be helpful.

The problem with my system is if I have already given a unit 100% attack speed bonus for 10 seconds. If i give another 100% attack speed bonus for more 20 seconds. If the first gets removed, both of them get removed. I am tired to edit the full system again.

----edit----

If some one has windows xp can they take my map and the bonusmod map. Upload the bonusmod into it. Remove the text macros and give it back to me?
 
Level 21
Joined
Mar 27, 2012
Messages
3,232
Where are the text macros present?

I just need attackspeed and armour. If you can do it then it will be helpful.

The problem with my system is if I have already given a unit 100% attack speed bonus for 10 seconds. If i give another 100% attack speed bonus for more 20 seconds. If the first gets removed, both of them get removed. I am tired to edit the full system again.

They even have textmacro in their name.
//! runtextmacro optional RunStatusEvent("Resurrect")"

To control stats like that you need to make another system. To do it in an organized way I mean.
Basically you add an amount and write the amount down somewhere. Then you start a timer for how long the bonus will last and when the timer runs out you remove the bonus.
Might sound simple, but it isn't for me.
Basically it's a custom buff system.
 
Level 7
Joined
Aug 19, 2009
Messages
278
They even have textmacro in their name.
//! runtextmacro optional RunStatusEvent("Resurrect")"

To control stats like that you need to make another system. To do it in an organized way I mean.
Basically you add an amount and write the amount down somewhere. Then you start a timer for how long the bonus will last and when the timer runs out you remove the bonus.
Might sound simple, but it isn't for me.
Basically it's a custom buff system.

I have done that exactly. My error is

If the bonus is 100 then it adds like 64 + 32 + 4

But the next time I add 100 adds 64 + 32 + 4(but it doesn't increase the attackspeed)

And when I remove the abilites that give 64+43+4, everything gets removed.

--edit----

I can use windows xp operating system so that lua scripts work on my map?
 
Last edited:
Level 21
Joined
Mar 27, 2012
Messages
3,232
I have done that exactly. My error is

If the bonus is 100 then it adds like 64 + 32 + 4

But the next time I add 100 adds 64 + 32 + 4(but it doesn't increase the attackspeed)

And when I remove the abilites that give 64+43+4, everything gets removed.

--edit----

I can use windows xp operating system so that lua scripts work on my map?

Yes. Windows XP did not get that patch that broke lua.
And what you are missing with your system is this:
JASS:
        local integer i = 0
        loop
            exitwhen i > AddDamageAbils
            if GetUnitAbilityLevel(u,AddDamageAbil[i]) > 0 then
                set DamageToAdd = DamageToAdd + IntPower(2,i)
                call UnitRemoveAbility(u,AddDamageAbil[i])
            endif
            set i = i + 1
        endloop
This is specifically to make sure the the bonus is added on top of the previous bonuses.
If you want you can send me your map and I'll add weeaddars bonusmod to it. Or whichever you want.
But note that they probably also use textmacros for creating the triggers, so it's just better to use mine or make your own.
If mine, then just tell me what stats to make it work on and I'll make it work and put it in your map(and create the abilities for it while I'm at it)
 
Level 7
Joined
Aug 19, 2009
Messages
278
Yes. Windows XP did not get that patch that broke lua.
And what you are missing with your system is this:
JASS:
        local integer i = 0
        loop
            exitwhen i > AddDamageAbils
            if GetUnitAbilityLevel(u,AddDamageAbil[i]) > 0 then
                set DamageToAdd = DamageToAdd + IntPower(2,i)
                call UnitRemoveAbility(u,AddDamageAbil[i])
            endif
            set i = i + 1
        endloop
This is specifically to make sure the the bonus is added on top of the previous bonuses.
If you want you can send me your map and I'll add weeaddars bonusmod to it. Or whichever you want.
But note that they probably also use textmacros for creating the triggers, so it's just better to use mine or make your own.
If mine, then just tell me what stats to make it work on and I'll make it work and put it in your map(and create the abilities for it while I'm at it)

well i am attaching my map. You can see it. I need attack speed and armor. See if you can make it through your system.
 

Attachments

  • attackspeed.w3x
    19.7 KB · Views: 38
Level 21
Joined
Mar 27, 2012
Messages
3,232
well i am attaching my map. You can see it. I need attack speed and armor. See if you can make it through your system.

I did it. Note that I did not touch your own triggers, as they are written in a messy way compared to how I write.
My bonusmod system tells how to use it in the trigger comment section.
Note that I did not make all abilities for the system in your map, as it's simply lots of blunt, but easy work.
I only made sure that attackspeed and armor work, as that's what you asked.
However, to make other attributes in the system work you only need to fix the list at the bottom of the BonusMod trigger. By that I mean putting the right ability rawcodes in there.

*Use tabs in your triggers. You can see from my systems what I mean.
*Make all things, such as ability rawcodes as easy to change as possible. Never use direct values in your system unless it's the configuration part(look at my bonusmod for example)
*If you use something more than once, then make it a variable.
*If you have lots of similar values, then use an array.
You pretty much did lots of blunt work that the computer can do for you. You don't need to do anything I suggest, but it will make your life easier if you do.

EDIT: File attached.
 

Attachments

  • attackspeedX.w3x
    25.5 KB · Views: 33
Status
Not open for further replies.
Top