| 05-26-2005, 06:25 AM | #1 |
Im looking for a non-complicated way to basically add one unit's current hp to another units max. i.e unit 1 has 200 hp, unit 2 has 300, then the trigger changes unit 2's hp to 500. I was thinking of upgrades, although that is unreversable and also using the item hp ability. but the thing is, that i would have to make at least 50 data entries or even more for the item hp bonus ability. I.e the ability would go up by 50's per level so i would be able to work it out by dividing the unit's hp by 100 and then rounding it off to get the level of the hp, although that would tend to give either too much or too little. |
| 05-26-2005, 07:15 AM | #2 |
get bonusmod, it solves the 50 data entries problem by using powers of 2. |
| 05-26-2005, 07:33 AM | #3 |
i made something like this for that, uses a few abilities and spans up to +131071 life, though each ability more you add, it doubles that number Code:
//---------------------------------------------------------------------------
//***************************************************************************
//---------------------------------------------------------------------------
//LIFE
//---------------------------------------------------------------------------
//***************************************************************************
//---------------------------------------------------------------------------
//These are health item bonuses, 1, 2, 4, 8, 16, etc...
set udg_CONST_abilLifeArray_A[0] = 'A01I' //-131072
set udg_CONST_abilLifeArray_A[1] = 'A01H'
set udg_CONST_abilLifeArray_A[2] = 'A01G'
set udg_CONST_abilLifeArray_A[3] = 'A01F'
set udg_CONST_abilLifeArray_A[4] = 'A01E'
set udg_CONST_abilLifeArray_A[5] = 'A01D'
set udg_CONST_abilLifeArray_A[6] = 'A01C'
set udg_CONST_abilLifeArray_A[7] = 'A01B'
set udg_CONST_abilLifeArray_A[8] = 'A01A'
set udg_CONST_abilLifeArray_A[9] = 'A019'
set udg_CONST_abilLifeArray_A[10] = 'A018'
set udg_CONST_abilLifeArray_A[11] = 'A017'
set udg_CONST_abilLifeArray_A[12] = 'A016'
set udg_CONST_abilLifeArray_A[13] = 'A015'
set udg_CONST_abilLifeArray_A[14] = 'A014'
set udg_CONST_abilLifeArray_A[15] = 'A013'
set udg_CONST_abilLifeArray_A[16] = 'A012'
set udg_CONST_abilLifeArray_A[17] = 'A011'
//***************************************************************************
//Removes all life ability bonuses applied to unit 'u'
//***************************************************************************
function clearLifeBonus takes unit u returns nothing
local integer a
set a = 0
loop
exitwhen a > 17
call UnitRemoveAbilityBJ( udg_CONST_abilLifeArray_A[a], u )
set a = a + 1
endloop
endfunction
//***************************************************************************
//Sets life ability bonuses for unit 'u' to an integer
//***************************************************************************
function setLifeBonus takes unit u, integer hp returns nothing
local integer a = 1
local integer b = 65536
local boolean neg = false
call clearLifeBonus(u)
call SetHandleInt( u, "var_nCurrentHPBonus", hp )
if ( hp < 0 ) then
set neg = true
set hp = (131072 + hp)
endif
loop
exitwhen a > 17
if ( ModuloInteger(hp, b) < hp ) then
call UnitAddAbilityBJ( udg_CONST_abilLifeArray_A[a], u )
set hp = hp - b
if ( hp == 0 ) then
set a = 17
endif
else
//
endif
set b = b / 2
set a = a + 1
endloop
if ( neg ) then
call UnitAddAbilityBJ( udg_CONST_abilLifeArray_A[0], u )
endif
endfunction
//***************************************************************************
//Adds an integer life ability bonuses for unit 'u'
//***************************************************************************
function addLifeBonus takes unit u, integer hp returns nothing
local integer a
call clearLifeBonus(u)
set a = GetHandleInt( u, "var_nCurrentHPBonus" ) + hp
call setLifeBonus( u, a )
endfunction |
| 05-26-2005, 09:23 AM | #4 |
or use the item vitality booster ability. give it to the unit. |
| 05-26-2005, 09:37 PM | #5 |
Guest | Positive and negative manual of healths? |
| 05-27-2005, 09:37 AM | #6 |
not manual of health, that's a tome. the other HPboosting passive items. |
| 05-27-2005, 09:51 AM | #7 |
cant you give a unit an inventory ability, then take it away? (and use manuals of health) |
| 05-27-2005, 08:23 PM | #8 |
that thing is posted will work, and i believe its equivilent or almost equivalent to bonusmod (i haven't actually looked at that) but you just need to make a buncha copies of (item life bonus) abilities, set them to 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536 and -131072 then use custom script: call addLifeBonus( (unit), (hp to add) ) and you can add anything, or add negative value to take away max life (well, anything from -13072 to +13071) |
| 05-28-2005, 12:03 AM | #9 |
Use bonusmod, bonusmod isn't available directly, but you can find one version on InvX and another version on weaaddar's rpg system, although I think it got lost on attachments too? , wait a sec it is on wc3search now that I remember. Someone should reupload the independant version... |
