|
发表于 2012-4-26 14:52:11
|
显示全部楼层
globals
constant integer HOOKER_COUNT = 6 // 妓女的数量
constant player HOOKER_OWNER // 妓女的所有者
unit array hookers //记录妓女
integer array hookerIds // 记录每个妓女的模型样式
location array hookersBackLocs // 记录每个妓女的家地点
location array hookersToLocs // 记录每个妓女的演出地点
trigger gg_trg_Hookers = null
endglobals
function InitGlobals takes nothing returns nothing
hookerKinds[0] = 'u00a'
hookersHomes[0] = Location(256,256)
hookersToLocs[0] = Location(365,412)
//.... 初始化各项数据
endfunction
function gg_trg_Hookers_Actions takes nothing returns nothing
local integer i = 0
local
if (GetTimeOfDay()>=6 and GetTimeOfDay<7 and hookers==null) then
loop
exitwhen i > HOOKER_COUNT
set i = i +1
set hookers = CreateUnitAtLoc(HOOKER_OWNER,hookerIds,hookersBackLocs)
call IssuePointOrderLoc(hookers,"move",hookersToLocs)
endloop
elseif (GetTimeOfDay() > 6 and GetTimeOfDay < 18) then
loop
exitwhen i > HOOKER_COUNT
set i = i +1
call SetUnitAnimation(hookers,"dance")
endloop
elseif (GetTimeOfDay()>=18 and GetTimeOfDay<19 and hookers!=null) then
loop
exitwhen i > HOOKER_COUNT
set i = i +1
call IssuePointOrderLoc(hookers,"move",hookersBackLocs)
set hookers = null
endloop
endif
endfunction
function Init_trg_Hookers takes nothing returns nothing
set gg_trg_Hookers = CreateTrigger()
TriggerRegisterTimerEvent(gg_trg_Hookers,5.0,true)
TriggerAddAction(gg_trg_Hookers,function gg_trg_Hookers_Actions)
endfunction
//PS:按照自己的思路写的,初始化参数暂时没有设定(因为木有参考数据)。回去测试下代码再给你测试地图吧。 |
|