неполучаетса добавить уловия в етот код кто владеет jass`ом помогите вставить условия
как добавить в код типо юнит приминяет способность если у него есть целительное зелья(заряды больше 1) то летит снаряд тд...и делаетса -1 заряд лечебному зелью но если заряд лечебного зелья равен 0 то предмет лечебное зелья удаляетса у приминяющего юнита http://mega-disk.ucoz.ru/fails/snarads.jpg -вот ето мой тригер
к вот етому коду
Code
function Rocket_Conditions takes nothing returns boolean return GetSpellAbilityId() == 'A000' endfunction //=========================================================================== function Remove2 takes nothing returns nothing local timer t=GetExpiredTimer() local integer h = GetHandleId(t) local unit d=LoadUnitHandle(udg_Hash,h,1) local destructable de=LoadDestructableHandle(udg_Hash,h,2) call RemoveDestructable(de) call RemoveUnit(d) set t = null set d = null set de = null endfunction //=========================================================================== function Remove takes nothing returns nothing local timer t=GetExpiredTimer() local integer h = GetHandleId(t) local unit d=LoadUnitHandle(udg_Hash,h,1) call RemoveUnit(d) set t = null set d = null endfunction //=========================================================================== function dest takes nothing returns nothing local timer t=GetExpiredTimer() local integer h = GetHandleId(t) local timer t2 = CreateTimer() local integer h2 = GetHandleId(t2) local integer i=LoadInteger(udg_Hash,h,3) local unit d=LoadUnitHandle(udg_Hash,h,2) local destructable de = GetEnumDestructable() // call KillDestructable( de ) call SaveInteger(udg_Hash,h,3,i) call KillUnit(d) call PauseTimer(t) call FlushChildHashtable(udg_Hash,h) call DestroyTimer(t) // call SaveUnitHandle(udg_Hash,h2,1,d) call SaveDestructableHandle(udg_Hash,h2,2,de) call TimerStart(t2,1,false,function Remove2) // set t2 = null set t = null set d = null set de = null endfunction //=========================================================================== function ROMove takes nothing returns nothing local timer t=GetExpiredTimer() local integer h = GetHandleId(t) local unit u=LoadUnitHandle(udg_Hash,h,1) local unit d=LoadUnitHandle(udg_Hash,h,2) local integer i=LoadInteger(udg_Hash,h,3)-1 local real a=LoadReal(udg_Hash,h,4) local real x = GetUnitX(d) local real y = GetUnitY(d) local real x2 = GetUnitX(d)+35.*Cos(a) local real y2 = GetUnitY(d)+35.*Sin(a) local location l = Location(0,0) local location l2 = Location(0,0) local integer fl local integer fl2 local group g = CreateGroup() local unit f local integer max = 0 local rect r = Rect(x - 70, y - 70, x + 70, y + 70) local timer t2 local integer h2 // call MoveLocation(l,x,y) call MoveLocation(l2,x2,y2) set fl = R2I(GetLocationZ(l))+9 set fl2 = R2I(GetLocationZ(l2)) // if fl < fl2 then set i = 0 else call SetUnitX(d,x2) call SetUnitY(d,y2) endif // call GroupEnumUnitsInRange(g,GetWidgetX(d),GetWidgetY(d),50,null) loop set f=FirstOfGroup(g) exitwhen f==null // if GetWidgetLife(f)>.0 and max < 1 and f != u and f != d then set max = max + 1 call UnitDamageTarget(u,f,200,true,false,ATTACK_TYPE_CHAOS,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS) set i = 0 endif call GroupRemoveUnit(g,f) endloop // set bj_enumDestructableCenter = l set bj_enumDestructableRadius = 70 call EnumDestructablesInRect(r, filterEnumDestructablesInCircleBJ, function dest) // if i == 0 then set t2 = CreateTimer() set h2 = GetHandleId(t2) call KillUnit(d) call PauseTimer(t) call FlushChildHashtable(udg_Hash,h) call DestroyTimer(t) call SaveUnitHandle(udg_Hash,h2,1,d) call TimerStart(t2,1,false,function Remove)
else call SaveInteger(udg_Hash,h,3,i) endif // call RemoveLocation(l) call RemoveLocation(l2) call RemoveRect(r) set t = null set u = null set d = null set f = null set l = null set l2 = null set r = null set t2 = null endfunction
//=========================================================================== function Trig_Rocket_Actions takes nothing returns nothing local timer t = CreateTimer() local integer h = GetHandleId(t) local unit u = GetSpellAbilityUnit() local real x = GetUnitX(u) local real y = GetUnitY(u) local real x2 = GetSpellTargetX() local real y2 = GetSpellTargetY() local real dis = SquareRoot((x-x2)*(x-x2)+(y-y2)*(y-y2)) local real a = Atan2(y2-y,x2-x) local player p = GetOwningPlayer(u) local unit d = CreateUnit(p,'e000',x,y,a*bj_RADTODEG) // if dis < 100 then set dis = dis + 100 endif // call SaveUnitHandle(udg_Hash,h,1,u) call SaveUnitHandle(udg_Hash,h,2,d) call SaveInteger(udg_Hash,h,3,R2I(dis)/35) call SaveReal(udg_Hash,h,4,a) call TimerStart(t,0.05,true,function ROMove) // set t = null set d = null set p = null set u = null endfunction
//=========================================================================== function InitTrig_Rocket takes nothing returns nothing local integer i=0 set gg_trg_Rocket=CreateTrigger() loop call TriggerRegisterPlayerUnitEvent(gg_trg_Rocket, Player(i),EVENT_PLAYER_UNIT_SPELL_EFFECT,null) exitwhen i==11 set i=i+1 endloop call TriggerAddCondition(gg_trg_Rocket,Condition(function Rocket_Conditions)) call TriggerAddAction(gg_trg_Rocket,function Trig_Rocket_Actions) set gg_trg_Rocket = null endfunction