System Bonus (unit state modification)

Cohadar

master of fugue
Reaction score
209
set Damage = BinaryBonus.create('A8T0', 12, 5)

(0,1,2,...11) = 12 total
 

Gwypaas

hook DoNothing MakeGUIUsersCrash
Reaction score
50
set Damage = BinaryBonus.create('A8T0', 12, 5)

(0,1,2,...11) = 12 total

I know, I forgot to edit that part, it goes to 11 or 12 in my test map :p



Solved: I did like this:
JASS:
//! external ObjectMerger w3a AItg A8T8 anam "Bonus Damage" Iatt 1 1280 ansf "(binary 8)"
//! external ObjectMerger w3a AItg A8T9 anam "Bonus Damage" Iatt 1 2560 ansf "(binary 9)"
//! external ObjectMerger w3a AItg A8T: anam &quot;Bonus Damage&quot; Iatt 1 5120 ansf &quot;(binary <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite1" alt=":)" title="Smile    :)" loading="lazy" data-shortname=":)" />&quot;
//! external ObjectMerger w3a AItg A8T; anam &quot;Bonus Damage&quot; Iatt 1 10240 ansf &quot;(binary <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite2" alt=";)" title="Wink    ;)" loading="lazy" data-shortname=";)" />&quot;
//! external ObjectMerger w3a AItg A8T&lt; anam &quot;Bonus Damage&quot; Iatt 1 20480 ansf &quot;(binary &lt;)&quot;
JASS:
set Damage = BinaryBonus.create(&#039;A8T0&#039;, 13, 5)


and now it works up to 40955 extra damage :)


I think this works because now I only continue on the Latin_1 codes instead of jumping ~40 "slots" to come to 'a'.
 

lucifekit

New Member
Reaction score
2
Maybe it's not good enough to make a increase max life aura.>.<

Can you teach me how to make a increase max life aura :)
 

Kenny

Back for now.
Reaction score
202
Maybe it's not good enough to make a increase max life aura.>.<

Can you teach me how to make a increase max life aura

I havent read through it all, but this definately seems capable of making such an aura.

Base it off an already existing aura (maybe brilliance aura), then every every X seconds check for units with that aura, or unit within X distance of the aura unit, if the units have the buff or are in range, then add the max life ability to them, else remove the ability.
 

Romek

Super Moderator
Reaction score
963
Base it off an already existing aura (maybe brilliance aura), then every every X seconds check for units with that aura, or unit within X distance of the aura unit, if the units have the buff or are in range, then add the max life ability to them, else remove the ability.
Or you could just use UAC (see my sig), and add the bonus in the UnitEnter method, and remove it in the UnitLeave method. :)
 

waaaks!

Zinctified
Reaction score
255
is there any built in function that removes bonuses?
or if there is none, then how could i remove these bonuses?
 

Romek

Super Moderator
Reaction score
963
I'd guess doing "set Bonus_Blah = 0" would remove all the bonuses from that unit.
 

Faust

You can change this now in User CP.
Reaction score
123
Hmm... Could this also be used to add attack range in-game? Just asking...

The method of that is to give your unit in the object editor some wicked long range, then in the editor or in the game, set Acquisition Range to your liking.

This is the closest you can get.

As for the system... looks badass at first sight of the comments. I'll definitely look into it deeper, later.
 

Cohadar

master of fugue
Reaction score
209
Do abilities with 100 levels really take up that much memory/cause lag/load slowly?

Yes.
Ability with 100 levels is like 100 1-level abilities.
And I mean this literally, wc3 does not do any optimization for multilevel abilities, they are basically a 1-level abilities stored in the record one after another.

TRY:
make an empty map,
put one unit in the middle,
make some 100-level ability,
give that ability to the preplaced unit,
see how long it takes for map to load.
 

TwoHeadedBoy

New Member
Reaction score
6
Well you certainly have me convinced. The map without took 5 seconds to load, the map with 4, 100 lv abilities: armor, damage, life and mana, took 20 seconds to load.

Now the problem is that I dont understand JASS :(
 

Rommel

New Member
Reaction score
13
Yes.
Ability with 100 levels is like 100 1-level abilities.
And I mean this literally, wc3 does not do any optimization for multilevel abilities, they are basically a 1-level abilities stored in the record one after another.

TRY:
make an empty map,
put one unit in the middle,
make some 100-level ability,
give that ability to the preplaced unit,
see how long it takes for map to load.

Wa...so useful information :D ...I've been working with WE over 4 years but i have just known this, How can you know so much, Cohadar ? :D
 

Steel

Software Engineer
Reaction score
109
You need to rework how your system handles Life and Mana because it shouldn't have a limitation based on the abilities you feed into the system.

There is an older system on Wc3c that I've used for a while

JASS:
constant function MaxStateModifierId takes unitstate u returns integer
    if u == UNIT_STATE_MAX_LIFE then
        return &#039;A007&#039; // Rawcode of the Max Life Modifier ability.
    elseif u == UNIT_STATE_MAX_MANA then
        return &#039;A008&#039; // Rawcode of the Max Mana Modifier ability.
    endif
    return 0
endfunction
function SetUnitMaxState takes unit whichUnit, unitstate whichUnitState, integer newVal returns boolean
    local integer c = newVal-R2I(GetUnitState(whichUnit, whichUnitState))
    local integer i = MaxStateModifierId(whichUnitState)
    if i == 0 then
        return false
    endif
    if c &gt; 0 then
        loop
            exitwhen c == 0
            call UnitAddAbility(whichUnit, i)
            if c &gt;= 100 then
                set c = c - 100
                call SetUnitAbilityLevel(whichUnit, i, 4)
            elseif c &gt;= 10 then
                set c = c - 10
                call SetUnitAbilityLevel(whichUnit, i, 3)
            else
                set c = c - 1
                call SetUnitAbilityLevel(whichUnit, i, 2)
            endif
            call UnitRemoveAbility(whichUnit, i)
        endloop
    elseif c &lt; 0 then
        set c = -c
        loop
            exitwhen c == 0
            call UnitAddAbility(whichUnit, i)
            if c &gt;= 100 then
                set c = c - 100
                call SetUnitAbilityLevel(whichUnit, i, 7)
            elseif c &gt;= 10 then
                set c = c - 10
                call SetUnitAbilityLevel(whichUnit, i, 6)
            else
                set c = c - 1
                call SetUnitAbilityLevel(whichUnit, i, 5)
            endif
            call UnitRemoveAbility(whichUnit, i)
        endloop
    endif
    return true
endfunction


With this you can have the system add 100,000 Life or Mana if you wanted to with just 1 ability and 3 levels.

Also, the simple convention of a getter function is nicer than having to use your already existing overload functions, call me old fashion, but I find it more user friendly.

Bonus_Life[<unit>] does return the value, but I like a getBonus("Life", u) better myself.

Finally, I don't like the inability to Bonus_Life[<unit>] - 40 to simply subtract 40 hitpoints. You have to do the round about way of set Bonus_Life[<unit>] = Bonus_Life[<unit>] - 40. This is annoying as hell for something so simple.
 

Cohadar

master of fugue
Reaction score
209
That Life and Mana modification depends on a blizzards bug.
I won't make my system bug dependent because you never know when it might get fixed.

Finally, I don't like the inability to Bonus_Life[<unit>] - 40 to simply subtract 40 hitpoints. You have to do the round about way of set Bonus_Life[<unit>] = Bonus_Life[<unit>] - 40. This is annoying as hell for something so simple.
Simply make some BJ function for yourself:
JASS:

public function AddLife takes unit whichUnit, real lifeDiff returns nothing
    set Bonus_Life[whichUnit] = Bonus_Life[whichUnit] + lifeDiff
endfunction
 

Steel

Software Engineer
Reaction score
109
Simply make some BJ function for yourself:
JASS:

public function AddLife takes unit whichUnit, real lifeDiff returns nothing
    set Bonus_Life[whichUnit] = Bonus_Life[whichUnit] + lifeDiff
endfunction

Don't worry I did, but I will still depend on the "bug" to function properly for Life and Mana adjustments :p
 

prismpirate

New Member
Reaction score
2
Could anyone instruct me on how to implement this in GUI?

Update: This is what I have so far. Jasshelper hangs when I save it, so I know something is wrong. Can anyone tell me where I have gone wrong?
Trigger:
  • Testing
    • Events
      • Unit - A unit Learns a skill
    • Conditions
      • (Learned Hero Skill) Equal to (==) Rock Slide (Troll)
    • Actions
      • Set TempInteger = (Learned skill level)
      • Set Temp_Unit = (Triggering unit)
      • Custom script: set Bonus_Life[GetUnitIndex(Temp_Unit)] = TempInteger
 

LilBlueSmurf

New Member
Reaction score
0
This is a great system. I have a couple questions and requests though.

1. (I didn't delve in the code) Is there a limit to 8 tiers, or can more be added?

2. Would mana regen and life regen be possible to affect with this? I have no clue if they would stack or not either.

If the answer to both of those is yes, can someone start me off on the mana and life regen skill lines needed? I can fill all the stuff in, but level 1 (or 0) for each would be appreciated.

I know some jazz, but I'm back after many many years away so I'm quite rusty. That also makes looking up specific abilities that would have the right stat a big chore, while I figure people here probably would know right off hand.

Thanks.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      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