Some tips on functions

roXplosive

New Member
Reaction score
15
I wonder if is there any way to detect how much armor and spell resistance a unit has . And if so how would you do it ? (i have thought of some functions to do so but IDK if there aren't any already implemented)

How do you toss units in the air ? You make them flying and then set the altitude ? If so what impact has the "rate" variable in SetUnitFlyHeight(unit,height,rate)

Thanks for your time
 

warden13

New Member
Reaction score
32
Rate sets the speed of change of height. If you set 1 it will slowly rise your height. If you make 0 it will instantly set your flying height.
 

roXplosive

New Member
Reaction score
15
Say if I implement this will the regeneration kick in before the code finishes execution ?

JASS:

function TargetMagicResistance takes unit target returns real 
local real initialHP
local real endHP
local real cmpHP

  set initialHP=GetWidgetLife(target)
  set cmpHP=initialHP
  if (initialHP<100) then
    call SetWidgetLife(target,initialHP+100)
    set cmpHP=cmpHP+100
  endif
  call UnitDamageTarget(target,target,100.00,false,false,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_COLD,WEAPON_TYPE_WHOKNOWS)
  set endHP=GetWidgetLife(target)
  call SetWidgetLife(target , initialHP)
  return 100.00-cmpHP+endHP
  
endfunction


And for armor count :

JASS:

function TargetArmor takes unit target returns real 
local real initialHP
local real endHP
local real cmpHP
local real armor         


//I know each point of armor increases virtual HP vs phisical by 6% so dmg taken to HP 1/(1+0.06*armor)*damage done
  set initialHP=GetWidgetLife(target)
  set cmpHP=initialHP
  if (initialHP<100) then
    call SetWidgetLife(target,initialHP+100)
    set cmpHP=cmpHP+100
  endif
  call UnitDamageTarget(target,target,100.00,true,false,ATTACK_TYPE_CHAOS,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
  set endHP=GetWidgetLife(target)
  call SetWidgetLife(target,initialHP)
  set armor=(cmpHP-endHP)/100  //calculating proportional damage taken by the unit to the damage dealt by the attack
  set armor= 1/armor-1              //armor contribution to EHP
  set armor = armor*100/6         //finally obtaining armor value
  
  return armor

endfunction



I have found the GetDamageFactor function but I think it's using too many instructions .
 

roXplosive

New Member
Reaction score
15
If somebody noticed any misuses in WeaponType and DamageType that alter the results please notice me .
 

Viikuna

No Marlo no game.
Reaction score
265
There is a cool system called UnitProperties in wc3c.net script section, which can be used to control units bonus attributes, such as armor and spell resistance. Then you just need some Table where you store unit types base armor and if it is a Hero you better take agility in account too.


For toss type spells you should use a fast periodic timer and constantly calculate and set new height with rate 0.0 ( instant )

Good timer period for moving units is somewhere around .03 , because thats the speed human eye works. I usually use .025.

You better just look some spells in spell section to see how people do their jump and toss spells.
 
General chit-chat
Help Users

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top