|
刷怪的,具体思路我也晓得,也检查不出毛病。
但就是不刷怪....
第一个 地图开始1秒的时候
function SetUnitXY takes nothing returns nothing
local integer i = GetStoredInteger(udg_Cache,"变量","i")
call StoreInteger(udg_Cache,"变量","i", i+1) //累加变量 i
call SetUnitUserData( GetEnumUnit(), i ) // 设置单位自定义值为i
call StoreReal(udg_Cache,"刷新点","X"+I2S(i), GetUnitX(GetEnumUnit())) //储存单位X轴
call StoreReal(udg_Cache,"刷新点","Y"+I2S(i), GetUnitY(GetEnumUnit())) //储存单位Y轴
endfunction
function Trig_Map_Actions takes nothing returns nothing
local player p = Player(PLAYER_NEUTRAL_AGGRESSIVE)
local group g = CreateGroup()
call CreateUnit( p, 'n001', 1348.6, -4407.6, 61.1 )
call CreateUnit( p, 'n001', 1274.2, -4466.6, 60.5 )
call GroupEnumUnitsInRect(g,GetPlayableMapRect(),null) //新建单位组(全地图内的所有单位)
call ForGroup(g,function SetUnitXY) //选取单位组内单位做动SetUnitXY
call DestroyGroup(g) //删除单位组
set g = null
call DestroyTrigger( GetTriggeringTrigger() ) //删除当前触发
endfunction
//===========================================================================
function InitTrig_Map takes nothing returns nothing
set gg_trg_Map = CreateTrigger( )
call TriggerRegisterTimerEventSingle( gg_trg_Map, 1.00 )
call TriggerAddAction( gg_trg_Map, function Trig_Map_Actions )
endfunction
第二个 刷怪的
function Trig_kill_Conditions takes nothing returns boolean
local integer i = GetUnitFoodMade(GetTriggerUnit()) //获取单位提供人口
local integer j = GetUnitUserData(GetTriggerUnit()) //获取单位自定义值
local effect e = null
local unit u = null
local real x
local real y
if i > 0 and not IsUnitType(GetTriggerUnit(), UNIT_TYPE_HERO) then
//提供人口大于0 且 触发单位不是一个英雄
set x = GetStoredReal(udg_Cache,"刷新点","X"+I2S(j)) //读取单位X轴
set y = GetStoredReal(udg_Cache,"刷新点","Y"+I2S(j)) //读怪单位Y轴
if IsUnitHidden(GetTriggerUnit()) then //单位是显示的
set u = CreateUnit(GetOwningPlayer(GetTriggerUnit()), GetUnitTypeId(GetTriggerUnit()), x, y, 180)
//创建单位
call SetUnitUserData( u, j ) //设置单位自定义值
set e = AddSpecialEffectTarget("Abilities\\Spells\\Undead\\RaiseSkeletonWarrior\\RaiseSkeleton.mdl",u,"origin")
//创建特效在单位身上
call DestroyEffect( e ) //删除特效
else
set u = CreateUnit(GetOwningPlayer(GetTriggerUnit()), GetUnitTypeId(GetTriggerUnit()), x, y, 180)
call UnitApplyTimedLife( u, 'BHwe', i ) //设置单位生命计时器
call SetUnitUserData( u, j ) //设置单位自定义值
call ShowUnit( u,false ) //隐藏单位
endif
endif
set e = null |
|