|
楼主 |
发表于 2010-11-16 10:08:01
|
显示全部楼层
纳尼!!
我已经都写成timer了。。好吧
其实我的目的是在注卵走到底的时候播放音效。hmm
似乎是废弃的音效 “evolution complete” 没有见到什么情况下用到。
include "TriggerLibs/dreamgalaxy"
unitgroup ZergQueen_Hatchery = UnitGroupEmpty();
void PlayLarvaSpawnReadySound () {
SoundPlay(SoundLink("Alert_ZergWarpTrainComplete", -1), PlayerGroupSingle(GetLocalPlayer()), 100.0, 0.0);
}
bool ZergQueen_CheckHatcheryState (bool testConds, bool runActions) {
unit u = null;
bool spawning = false;
UnitGroupLoopBegin (ZergQueen_Hatchery);
while (!UnitGroupLoopDone()) {
u = UnitGroupLoopCurrent();
if (u!=null){
spawning = UnitHasBehavior(u, "QueenSpawnLarvaTimer");
if (!spawning && DataTableGetBool(DataTable_Global, U2S(u)+"_SpawnLarva")) {
PlayLarvaSpawnReadySound();
}
DataTableSetBool(DataTable_Global, U2S(u)+"_SpawnLarva", spawning);
}
UnitGroupLoopStep();
}
UnitGroupLoopEnd();
return true;
}
bool ZergQueen_RegisterHatchery (bool testConds, bool runActions) {
unit u = EventUnitCreatedUnit();
if ( (UnitGetType(u) == "Hatchery") && (UnitGetOwner(u) == GetLocalPlayer()) ) {
//ScreenMsg("Hatchery added");
UnitGroupAdd(ZergQueen_Hatchery, u);
}
return true;
}
void ZergQueen_TriggerInit () {
trigger t;
t = TriggerCreate("ZergQueen_CheckHatcheryState");
TriggerAddEventTimePeriodic(t, 0.5, c_timeGame);
t = TriggerCreate("ZergQueen_RegisterHatchery");
TriggerAddEventUnitCreated(t, null, null, null);
} |
|