SineCosine
I'm still looking for my Tangent
- Reaction score
- 77
JASS:
//! runtextmacro BuffType("SlowDown")
//! runtextmacro SetBuffName("Chilled")
//! runtextmacro SetBuffAlignment("NEGATIVE")
//! runtextmacro SetBuffTooltip("This unit has been chilled; it moves more slowly than it usually does.")
//! runtextmacro SetBuffIcon("ReplaceableTextures\\CommandButtons\\BTNFrost.blp")
//! runtextmacro BuffStruct()
integer Slow
effect e
string SlowE = "Abilities\\Spells\\Other\\FrostDamage\\FrostDamage.mdl"
string SlowAP = "chest"
method onApply takes nothing returns nothing
call Status[this.unit].modMoveSpeedPercentBonus(-Slow)
set this.e = AddSpecialEffectTarget(SlowE, this.unit, SlowAP)
endmethod
method onRemove takes nothing returns nothing
if GetUnitTypeId(this.unit)!=0 then // if the unit still exists.
call Status[this.unit].modMoveSpeedPercentBonus(Slow)
endif
call DestroyEffect(this.e)
set this.e = null
endmethod
static method apply takes unit target, integer Amount, real duration returns nothing
local thistype this=thistype.create(null)
set this.Slow = Amount
call this.setUnit(target)
call this.destroyTimed(duration)
endmethod
//! runtextmacro EndBuff()
scope Slower initializer OnInit
globals
private constant integer PhebeId = 039;o01G039;
private constant real Range = 600.00
private constant integer AI = 039;A029039;
endglobals
private function OnDamage takes nothing returns boolean
if Damage_IsAttack() == true and Status[GetTriggerUnit()].getMoveSpeedPercentBonus() == 0 then
if GetUnitTypeId(GetEventDamageSource()) == PhebeId then
call SlowDown.apply(GetTriggerUnit(), 30, 5.0)
endif
if GetUnitAbilityLevel(GetEventDamageSource(), AI) > 0 then
call IssueBonusOrder(GetEventDamageSource(), "Slow", Range)
endif
endif
return false
endfunction
private function OnInit takes nothing returns nothing
local trigger t = CreateTrigger()
call Damage_RegisterEvent(t)
call TriggerAddCondition(t, Condition(function OnDamage))
endfunction
endscope
I figured I'd just drop this here..
Remember when you guys told me that adding this:
JASS:
if GetUnitTypeId(this.unit)!=0 then // if the unit still exists.
//Stuff
endif
Should solve it?
Well, I thought it would, so I never tested it after that.
(I got lazy to work on the map.)
I just tried it..
And AIDS is giving me errors as soon as the affected units die ._.
[EDIT]
The error is none other than this:
Error using AIDS: Trying to get the unit of unassigned index.
I haz been cursed!
(Or something like that)
I'll gladly upload the map with the scenario on request >.>
It won't bug on the 1st level on occasion, but the 2nd level onwards bugs like mad (Well, only error messages)