Такая проблема, пару лет не занимался редактором а щас не могу сообразить как сделать:
Первый вариант цель использует спел и от неё ко всем врагам летят даммики которые при подлетании к врагу наносят урон и исчезают (надо именно так ибо в дальнейшем дамаг наносится в зависимости от бафов наложеных на врага до этого момента)
вот собственно сам спел: даммики появляются и смотрят в нужную сторону но более ничего не происходит : function Shout_banshee_Dmg_Conditions takes nothing returns boolean
return( GetSpellAbilityId() == 'A006' )
endfunction
function Shout_banshee_Dmg_Filter1 takes nothing returns boolean
local unit f=GetFilterUnit()
if IsPlayerEnemy(GetOwningPlayer(GetTriggerUnit()),GetOwningPlayer(f)) and GetWidgetLife(f)>=0.405 and IsUnitType(f,UNIT_TYPE_STRUCTURE)==false then
set f=null
return true
else
set f=null
return false
endif
endfunction
function Shout_banshee_Dmg_Main takes nothing returns nothing
local timer Timer=GetExpiredTimer()
local group Group=LoadGroupHandle(udg_h,GetHandleId(Timer),2)
local unit Caster = LoadUnitHandle(udg_h,GetHandleId(Timer),1)
local integer Level = GetUnitAbilityLevel(Caster,'A006')
local real Angle = 0
local unit Dummy = null
local unit f = null
loop
set f = FirstOfGroup(Group)
exitwhen f == null
if GetUnitAbilityLevel(f, 'B000') == 0 and GetUnitAbilityLevel(f, 'B002') == 0 and GetUnitAbilityLevel(f, 'B003') == 0 then
set Angle = Atan2(GetUnitY(f)-GetUnitY(Dummy),GetUnitX(f)-GetUnitX(Dummy))
set Dummy = CreateUnit(GetOwningPlayer(Caster),'h000',GetUnitX(Caster),GetUnitY(Caster),AngleBetweenPoints(GetUnitLoc(Caster),GetUnitLoc(f)))
call SetUnitPosition(Dummy,GetUnitX(Dummy)+40*Cos(Angle),GetUnitY(Dummy)+40*Sin(Angle))
if DistanceBetweenPoints(GetUnitLoc(Dummy),GetUnitLoc(f)) <= 90 then
call RemoveUnit(Dummy)
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Orc\\LightningBolt\\LightningBoltMissile.mdl",f,"origin"))
call UnitDamageTarget(Caster,f, 30*Level, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_MAGIC, null)
if GetRandomInt(1,100) <= 15+(10*Level) and GetWidgetLife(f) > 0.405 then
set Dummy = CreateUnit(GetOwningPlayer(Caster),'h000',GetUnitX(Caster),GetUnitY(Caster),AngleBetweenPoints(GetUnitLoc(Caster),GetUnitLoc(f)))
call SaveUnitHandle(udg_h,GetHandleId(Timer),4,Dummy)
else
call DestroyTimer(Timer)
call FlushChildHashtable(udg_h,GetHandleId(Timer))
endif
endif
else
endif
call GroupRemoveUnit(Group, f)
endloop
set Timer = null
set Caster = null
set Group = null
endfunction
function Shout_banshee_Dmg_Actions takes nothing returns nothing
local unit Caster=GetSpellAbilityUnit()
local group Group=CreateGroup()
local boolexpr a=Condition(function Shout_banshee_Dmg_Filter1)
local integer Level = GetUnitAbilityLevel(Caster,'A000')
local timer Timer=CreateTimer()
call GroupEnumUnitsInRange(Group,GetUnitX(Caster),GetUnitY(Caster),700.,a)
call SaveUnitHandle(udg_h,GetHandleId(Timer),1,Caster)
call SaveGroupHandle(udg_h,GetHandleId(Timer),2,Group)
call SaveInteger(udg_h,GetHandleId(Timer),3,Level)
call AddSpecialEffectLoc("Abilities\\Spells\\Undead\\RaiseSkeletonWarrior\\RaiseSkeleton.mdl",GetUnitLoc(Caster))
call TimerStart(Timer,0.01,true,function Shout_banshee_Dmg_Main)
set Timer = null
set Caster = null
set Level = 0
set Group = null
set a = null
endfunction
//===========================================================================
function InitTrig_Shout_Banshee_Dmg takes nothing returns nothing
local trigger trg1=CreateTrigger()
set udg_h=InitHashtable()
call TriggerRegisterAnyUnitEventBJ( trg1, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( trg1, Condition( function Shout_banshee_Dmg_Conditions ) )
call TriggerAddAction( trg1, function Shout_banshee_Dmg_Actions )
set trg1=null
endfunction
и второе кастер посылает снаряд в цель снаряд должен как бы лететь и при подлете нанести урон и застанить: раньше это вроде работало а сейчас нет
function Faer_boll_Conditions takes nothing returns boolean
return( GetSpellAbilityId() == 'A007' )
endfunction
function Faer_boll_Filter takes nothing returns boolean
return IsPlayerEnemy(GetOwningPlayer(GetTriggerUnit()), GetOwningPlayer(GetFilterUnit())) and not IsUnitType(GetFilterUnit(), UNIT_TYPE_FLYING)
endfunction
function Faer_boll_Move takes nothing returns nothing
local timer Timer = GetExpiredTimer()
local integer Handle = GetHandleId(Timer)
local unit Dummy = LoadUnitHandle(udg_Hashtable,Handle,1)
local unit Target = LoadUnitHandle(udg_Hashtable,Handle,2)
local integer Level = LoadInteger(udg_Hashtable,Handle,3)
local unit Caster = LoadUnitHandle(udg_Hashtable,Handle,4)
local real Angle = Atan2(GetUnitY(Target)-GetUnitY(Dummy),GetUnitX(Target)-GetUnitX(Dummy))
call SetUnitPosition(Dummy,GetUnitX(Dummy)+30*Cos(Angle),GetUnitY(Dummy)+30*Sin(Angle))
if DistanceBetweenPoints(GetUnitLoc(Dummy),GetUnitLoc(Target)) <= 90 then
call RemoveUnit(Dummy)
// call DestroyEffect(AddSpecialEffectTarget("Abilities\\Weapons\\FireBallMissile\\FireBallMissile.mdl",Target,"origin"))
call UnitDamageTarget(Caster,Target, 30*Level, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_MAGIC, null)
endif
set Timer = null
set Handle = 0
set Dummy = null
set Target = null
set Level = 0
set Angle = 0
set Caster = null
endfunction
function Faer_boll_Actions takes nothing returns nothing
local timer Timer = CreateTimer()
local integer Handle = GetHandleId(Timer)
local unit Caster = GetTriggerUnit()
local location Target = GetSpellTargetLoc()
local group Group = CreateGroup()
local integer Level = GetUnitAbilityLevel(Caster,'A007')
local unit Dummy = CreateUnit(GetOwningPlayer(Caster),'h000',GetUnitX(Caster),GetUnitY(Caster),AngleBetweenPoints(GetUnitLoc(Caster),GetSpellTargetLoc()))
cal l SaveUnitHandle(udg_Hashtable,Handle,1,Dummy)
call SaveLocationHandle(udg_Hashtable,Handle,2,Target)
call SaveInteger(udg_Hashtable,Handle,3,Level)
call SaveUnitHandle(udg_Hashtable,Handle,4,Caster)
call GroupEnumUnitsInRangeOfLoc(Group, Target, 300,Condition(function Faer_boll_Filter))
call SaveGroupHandle(udg_Hashtable,Handle,5,Group)
call TimerStart(Timer,0.04,true,function Faer_boll_Move)
set Timer = null
set Handle = 0
set Caster = null
set Target = null
set Level = 0
set Dummy = null
endfunction
//===========================================================================
function InitTrig_Faer_boll takes nothing returns nothing
local trigger trg = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( trg, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( trg, Condition( function Faer_boll_Conditions ) )
call TriggerAddAction( trg, function Faer_boll_Actions )
call Preload("Abilities\\Weapons\\FireBallMissile\\FireBallMissile.mdl")
set trg = null
endfunction
Добавлено (20-03-2011, 20:24)
---------------------------------------------
спелы сделаны на основе канала