不是UI mod, 这个还得折腾下。
我把script贴出来分析下如何实现的吧, 以A的T3侦察机为例:
local AAirUnit = import(‘/lua/aeonunits.lua’).AAirUnit
UAA0302 = Class(AAirUnit)
{
OnStopBeingBuilt = function(self, builder, layer)
AAirUnit.OnStopBeingBuilt(self) 飞飞一旦从飞机厂出来
if self:GetAIBrain().BrainType == ‘Human’ then 假如是人类玩家
self:ForkThread(self.FindExperimentalTarget) 将执行“查找实验单位”的指令
end
end,
FindExperimentalTarget = function(self) “查找实验单位”的指令
local bp = self:GetBlueprint()
local aiBrain = self:GetAIBrain()
local Radius = bp.Intel.VisionRadius 查找范围 = 飞飞视野
while true do
local location = self:GetPosition()
local units = aiBrain:GetUnitsAroundPoint( categories.EXPERIMENTAL, location, Radius, 'Enemy') 在其视野64范围内筛选“T4” “敌军”
for _,unit in units do 符合条件的话
self:PlayUnitSound(‘ExperimentalDetected’) 飞飞发出 “检测到实验单位”警报声, 这个声音已经加到bp里面去了, 我们在这里调用一下就可以了。 (这个声音文件我不是特别满意, 本来想找个电脑提示音"Experimental Unit Detected", 类似"Commander under Attack"之类的, 一直不成功! 各位大大, 知道的话告诉一声啊!
self:ForkThread(self.LifeThread) 并执行“时间”指令
end
#Wait 1 second
WaitSeconds(1)
end
end,
LifeThread = function(self) “时间”指令
local aiBrain = self:GetAIBrain()
–Queue up random Patrol
local x,y,z = unpack(self:GetPosition()) 以目前自身位置为中心
for i=1, 100 do
IssuePatrol({self}, {x + Random(-5, 5), y, z + Random(-5, 5)}) 以5为半径做盘旋
end
#Wait 10 seconds
WaitSeconds(10) 过10秒钟
IssueClearCommands( {self} ) 清除上一个指令 (不清除的话, 飞飞会一直在那里盘旋, 哪怕T4已经远离!)
IssuePatrol({self}, {x + Random(-10, 10), y, z + Random(-10, 10)}) 以10为半径做盘旋, (这样90%可能性盘旋在T4单位周围, 特别是T4陆军, 空军T4的话很快就被其强悍的防空做掉了, 海军T4我无法测试, AI不做海军T4, 从来没有见过。)
end,
}
TypeClass = UAA0302
绝对原创, XP给加精吧? UI MOD我看看能否做出来, 不保证!