Forged Alliance Forever Forums
Moderator: Morax
local NShieldStructureUnit = import('/lua/nomadunits.lua').NShieldStructureUnit
local NomadEffectUtil = import('/lua/nomadeffectutilities.lua')
INB1162 = Class(NShieldStructureUnit) {
CreateBuildEffects = function( self, unitBeingBuilt, order )
NomadEffectUtil.CreateRepairBuildBeams( self, unitBeingBuilt, self:GetBlueprint().General.BuildBones.BuildEffectBones, self.BuildEffectsBag )
end,
CreateBuildEffects = function( self, unitBeingBuilt, order )
NomadEffectUtil.CreateNomadBuildSliceBeams( self, unitBeingBuilt, self:GetBlueprint().General.BuildBones.BuildEffectBones, self.BuildEffectsBag )
end,
CreateReclaimEffects = function( self, target )
NomadEffectUtil.PlayNomadReclaimEffects( self, target, self:GetBlueprint().General.BuildBones.BuildEffectBones or {0,}, self.ReclaimEffectsBag )
end,
CreateReclaimEndEffects = function( self, target )
NomadEffectUtil.PlayNomadReclaimEndEffects( self, target, self.ReclaimEffectsBag )
end,
}
TypeClass = INB1162
OnCreate = function(self)
CreateAttachedEmitter (self, 0, self:GetArmy(), 'your bpeffect path')
end,
# civilian structure with gun
local AddLights = import('/lua/nomadutils.lua').AddLights
local NRadarUnit = import('/lua/nomadunits.lua').NRadarUnit
local GattlingWeapon1 = import('/lua/nomadweapons.lua').GattlingWeapon1
local VizMarker = import('/lua/sim/VizMarker.lua').VizMarker
local CSoothSayerAmbient = import('/lua/EffectTemplates.lua').CSoothSayerAmbient
NRadarUnit = AddLights(NRadarUnit)
INB9001 = Class(NRadarUnit) {
Weapons = {
MainGun = Class(GattlingWeapon1) {
Rotates = false,
},
},
LightBones = { {'Light1', 'Light2', }, {}, {}, {'Light3', 'Light4', }, },
IntelEffects = {
{
Bones = { {'Light1', 'Light2', }, {}, {}, {'Light3', 'Light4', }, },
Offset = { 0, 0, 0, },
Type = 'Jammer01',
},
},
OnStopBeingBuilt = function(self)
NRadarUnit.OnStopBeingBuilt(self)
ChangeState( self, self.ExpandingVision )
self.ExpandingVisionDisableCount = 0
if self.OmniEffectsBag then
for k, v in self.OmniEffectsBag do
v:Destroy()
end
end
self.OmniEffectsBag = {}
for k, v in CSoothSayerAmbient do
table.insert( self.OmniEffectsBag, CreateAttachedEmitter(self, 'INB9001', self:GetArmy(), v):OffsetEmitter(0, 2.5, -1):ScaleEmitter(0.2) )
end
end,
OnKilled = function(self, instigator, type, overkillRatio)
local curRadius = self:GetIntelRadius('vision')
local position = self:GetPosition()
local army = self:GetAIBrain():GetArmyIndex()
NRadarUnit.OnKilled(self, instigator, type, overkillRatio)
local spec = {
X = position[1],
Z = position[3],
Radius = curRadius,
LifeTime = -1,
Army = army,
}
local vizEnt = VizMarker(spec)
vizEnt.DeathThread = ForkThread(self.VisibleEntityDeathThread, vizEnt, curRadius)
end,
VisibleEntityDeathThread = function(entity, curRadius)
local lifetime = 0
while lifetime < 30 do
if curRadius > 1 then
curRadius = curRadius - 1
if curRadius < 1 then
curRadius = 1
end
entity:SetIntelRadius('vision', curRadius)
end
lifetime = lifetime + 2
WaitSeconds(0.1)
end
entity:Destroy()
end,
OnIntelEnabled = function(self)
self.ExpandingVisionDisableCount = self.ExpandingVisionDisableCount - 1
if self.ExpandingVisionDisableCount == 0 then
if self.OmniEffectsBag then
for k, v in self.OmniEffectsBag do
v:Destroy()
end
self.OmniEffectsBag = {}
end
for k, v in CSoothSayerAmbient do
table.insert( self.OmniEffectsBag, CreateAttachedEmitter(self, 'INB9001', self:GetArmy(), v) )
end
ChangeState( self, self.ExpandingVision )
end
end,
OnIntelDisabled = function(self)
self.ExpandingVisionDisableCount = self.ExpandingVisionDisableCount + 1
if self.ExpandingVisionDisableCount == 1 then
if self.OmniEffectsBag then
for k, v in self.OmniEffectsBag do
v:Destroy()
end
self.OmniEffectsBag = {}
end
ChangeState( self, self.ContractingVision )
end
end,
ExpandingVision = State {
Main = function(self)
WaitSeconds(0.1)
while true do
if self:GetResourceConsumed() ~= 1 then
self.ExpandingVisionEnergyCheck = true
self:OnIntelDisabled()
end
local curRadius = self:GetIntelRadius('vision')
local targetRadius = self:GetBlueprint().Intel.MaxVisionRadius
if curRadius < targetRadius then
curRadius = curRadius + 1
if curRadius >= targetRadius then
self:SetIntelRadius('vision', targetRadius)
else
self:SetIntelRadius('vision', curRadius)
end
end
WaitSeconds(0.2)
end
end,
},
ContractingVision = State {
Main = function(self)
while true do
if self:GetResourceConsumed() == 1 then
if self.ExpandingVisionEnergyCheck then
self:OnIntelEnabled()
else
self:OnIntelDisabled()
self.ExpandingVisionEnergyCheck = true
end
end
local curRadius = self:GetIntelRadius('vision')
local targetRadius = self:GetBlueprint().Intel.MinVisionRadius
if curRadius > targetRadius then
curRadius = curRadius - 1
if curRadius <= targetRadius then
self:SetIntelRadius('vision', targetRadius)
else
self:SetIntelRadius('vision', curRadius)
end
end
WaitSeconds(0.2)
end
end,
},
}
TypeClass = INB9001
Users browsing this forum: No registered users and 1 guest