HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Damage and Invulnerability skills.

11-22-2006, 02:31 PM#1
BertTheJasser
Some time ago, I noticed that when I use <DamageUnitByOptions> on a paladin with a low hp percentage, he uses his invulnerability skill, before the damage as done (In fact, he starts when he gets the 0.01 damagepoints by a caster to check for dmgT and attT).

So this really nerves.

To fix this, just use a diffrent method of "detecting", if the unit was damageable by that types.

Collapse JASS:
function DamageUnitByOptions takes unit hurter, unit target, real dmg, integer DamageOptions returns boolean
 local real f
    if(IsDamageOptionIncluded(DamageOptions,DamageTypes(cs_dopt_Atype,cs_dopt_Dtype)))then
          set DamageOptions=DamageOptions-1
    endif
// or
// local string s=I2S(DamageOptions)
// local integer i=StringLength(s)
// set i=S2I(SubString(s,i-1,i))
// set i=ModuloInteger(i,2)
// if (i==1) then
//      set DamageOptions=DamageOptions-1
// endif
    set f=GetDamageFactorByOptions(hurter,target,DamageOptions)
    if (f==0) then
        return false
    endif
 return UnitDamageTarget(hurter,target,dmg*f,true,false,cs_dopt_Atype,cs_dopt_Dtype,null)
endfunction


Maybe it requires a little update for the standard attType/dmgType, .. all in all it should work well.
11-27-2006, 07:35 PM#2
BertTheJasser
Hmm.. not one reply. What's up?
11-27-2006, 09:27 PM#3
Vexorian
If I do that I wouldn't be able to get DamageFactor I would rather trash devine shield, besides UnitDamageTarget does not return true or false depending on the success of the damage.
11-27-2006, 09:49 PM#4
Vexorian
I tried to make the AI cast it but it does seem to notice that 0.01 from neutral soruces are not reason for devine shield, I even set hitpoints to the minimum.

Are you sure a trigger that gives too much importance to any kind of damage (even if it is less than 1) is not involved?
11-28-2006, 09:53 AM#5
BertTheJasser
Quote:
Originally Posted by Vexorian
I tried to make the AI cast it but it does seem to notice that 0.01 from neutral soruces are not reason for devine shield, I even set hitpoints to the minimum.

Just use a simple creep and give it divineshield, set damage between 20%-40% (don't know the exact value). And periodically get the damage factor (every 1 second) and decrease the life (in case hp was to high) and keep looping till the unit dies/uses divine shield.

Quote:
Originally Posted by Vexorian
Are you sure a trigger that gives too much importance to any kind of damage (even if it is less than 1) is not involved?

No, I always check ignore dmage done by casters which is below 1.

Btw. what does UnitDamageTarget return?