ThePlague
New Member
- Reaction score
- 14
Why in the world is this causing a crash? when I test map Wc3 gives an error message and crashes as soon as the projectile impacts the unit
erm also I think i got all the leaks but if there are any i missed please point those out too
JASS:
function Trig_Damage takes unit Ranger, unit Target, location RangerLoc returns nothing
local location TargetLoc=GetUnitLoc(Target)
local unit Source=GetEventDamageSource()
local real AtkDmg=GetEventDamage()
local real Damage
if (Source!=Ranger)then
return
endif
if (GetUnitAbilityLevel(Ranger, 039;A021039;)==0) then
set Damage= (900-DistanceBetweenPoints(RangerLoc, TargetLoc))/8500
if (Damage<.1)then
set Damage=.05
endif
endif
if (GetUnitAbilityLevel(Ranger, 039;A021039;)==1) then
set Damage= (1250-DistanceBetweenPoints(RangerLoc, TargetLoc))/6000
if (Damage<.05)then
set Damage=.1
endif
endif
if (GetUnitAbilityLevel(Ranger, 039;A021039;)==2) then
set Damage= (1600-DistanceBetweenPoints(RangerLoc, TargetLoc))/3875
if (Damage<.05)then
set Damage=.2
endif
endif
if (GetUnitAbilityLevel(Ranger, 039;A021039;)==3) then
set Damage= (1950-DistanceBetweenPoints(RangerLoc, TargetLoc))*3/9500
if (Damage<.05)then
set Damage=.3
endif
endif
call UnitDamageTarget( Ranger, Target, Damage ,false,false , ATTACK_TYPE_HERO, DAMAGE_TYPE_NORMAL,null )
set Damage=AtkDmg + Damage
set udg_String=R2S(Damage)
call CreateTextTagUnitBJ( udg_String, Target, 100.00, 15, 100, 0.00, 0.00, 0 )
call DestroyTrigger (GetTriggeringTrigger())
call RemoveLocation (RangerLoc)
call RemoveLocation (TargetLoc)
set Ranger=null
set Target=null
set Source=null
endfunction
function Trig_R_Actions takes nothing returns nothing
local trigger Damage=CreateTrigger()
local unit Ranger=GetAttacker()
local unit Target=GetTriggerUnit()
local location RangerLoc=GetUnitLoc(Ranger)
if (GetUnitTypeId(Ranger) == 039;E006039;) then
call TriggerRegisterUnitEvent( Damage, Target, EVENT_UNIT_DAMAGED )
call TriggerAddAction( Damage, function Trig_Damage )
endif
call TriggerSleepAction (3.0)
call DestroyTrigger (Damage)
call RemoveLocation (RangerLoc)
set Ranger=null
set Target=null
endfunction
//===========================================================================
function InitTrig_R takes nothing returns nothing
set gg_trg_R = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_R, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddAction( gg_trg_R, function Trig_R_Actions )
endfunction
erm also I think i got all the leaks but if there are any i missed please point those out too