Forged Alliance Forever Forged Alliance Forever Forums 2018-11-13T02:03:36+02:00 /feed.php?f=41&t=16863 2018-11-13T02:03:36+02:00 2018-11-13T02:03:36+02:00 /viewtopic.php?t=16863&p=169496#p169496 <![CDATA[Re: Variable drones number based on enhancement]]>

Ok, so steps to making any unit a drone carrier unit like the Blackop's Tempest or Goliath are:
(any half decent coder knows this already, consider this a beginner's guide to drones).

Basically 4 things are needed, first you make more DroneData tables, with different names ofc, inside the "carrier" unit's .bp script.
(ofc, you need to add other segments that pertain to drones, like 'PODSTAGINGPLATFORM' or GuardScanRadius (they are easy to spot compering a carrier and a non-carrier's .bp)).
Then you copy the entire code from Tempest's or Goliath's .script file concerning drones (I will have in my mod (Survival Mayhem&BO balance) the older version because...I made it before the Blackops patched it and also I needed to modify it a bit, for example the targets that the drones attack, the effects when they respawn. You can find it in the units folder of that mod, specifically units xaa9905, xaa9904, 3, 2 and 1.), the newest Blackops:unleashed patch did some changes as in it made the carriers (drone hosts ) into a new CLASS of units, and that file then gets called by every carrier .script, so that there is no need to set-up drones via them, the class script handles it instead when the carrier unit references it.

This is all you need to call it:

Code:
local BaseTransport = import('/lua/defaultunits.lua').BaseTransport                                                     
local AirDroneCarrier = import('/mods/BlackOpsFAF-Unleashed/lua/BlackOpsunits.lua').AirDroneCarrier        -- the bit that does the actual work, take a look to see what it does and how and how it is different than individual DroneSetup in my xaa9901-5 units in my mod)

XAA9901 = Class(BaseTransport, AAirUnit, AirDroneCarrier) {  --this is how we call the carrier Blackops script

-- Create drones                                                           --goes in OnStopBeingBuilt
        ChangeState(self, self.DroneMaintenanceState)
        AirDroneCarrier.InitDrones(self)          -- this creates them via the Blackops carrier script. Place it here to have drones right away, or place it under an enhancement to activate it via an enhancement

    OnDamage = function(self, instigator, amount, vector, damagetype)
        AAirUnit.OnDamage(self, instigator, amount, vector, damagetype)
        AirDroneCarrier.SetAttacker(self, instigator)
    end,

    --Drone control buttons
    OnScriptBitSet = function(self, bit)
        --Drone assist toggle, on
        if bit == 1 then
            self.DroneAssist = false
        --Drone recall button
        elseif bit == 7 then
            self:RecallDrones()
            --Pop button back up, as it's not actually a toggle
            self:SetScriptBit('RULEUTC_SpecialToggle', false)
        else
            AAirUnit.OnScriptBitSet(self, bit)
        end
    end,   
    OnScriptBitClear = function(self, bit)
        --Drone assist toggle, off
        if bit == 1 then
            self.DroneAssist = true
        --Recall button reset, do nothing
        elseif bit == 7 then
            return
        else
            AAirUnit.OnScriptBitClear(self, bit)
        end
    end,
   
    --Handles drone docking
    OnTransportAttach = function(self, attachBone, unit)
        self.DroneData[unit.Name].Docked = attachBone
        unit:SetDoNotTarget(true)
        BaseTransport.OnTransportAttach(self, attachBone, unit)
    end,
   
    --Handles drone undocking, also called when docked drones die
    OnTransportDetach = function(self, attachBone, unit)
        self.DroneData[unit.Name].Docked = false
        unit:SetDoNotTarget(false)
        if unit.Name == self.BuildingDrone then
            self:CleanupDroneMaintenance(self.BuildingDrone)
        end
        BaseTransport.OnTransportDetach(self, attachBone, unit)
    end,


    OnKilled = function(self, instigator, damagetype, overkillRatio)
        AAirUnit.OnKilled(self, instigator, damagetype, overkillRatio)

        --Kill our heartbeat thread
        KillThread(self.HeartBeatThread)
        --Clean up any in-progress construction
        ChangeState(self, self.DeadState)
        --Immediately kill existing drones
        self:KillAllDrones()
        local nrofBones = self:GetBoneCount() -1
        local watchBone = self:GetBlueprint().WatchBone or 0
    end,

    -- Set on unit death, ends production and consumption immediately
    DeadState = State {
        Main = function(self)
            if self.gettingBuilt == false then
                self:CleanupDroneMaintenance(nil, true)
            end
        end,


That's it as far as the carrier's .script file is concerned - mind you, that's the code for if you decide to make the Blackops script do the whole work. Seeing as how I needed the drones to target all units and not just air,and I wanted spawn and respawn effects to happen for drones, and some other things... I made individual drone carrier scripts. If you will need those, they will be available within Survival mayhem&BO balance mod, unit xaa9905-1

You can call DroneSetup from enhancements if you want drones to be gained through enhancement, or you can copy the whole carrier and DroneSetup script like I did in unit xaa9905 and then make several DroneSetups, each relevant to the different DroneData in carrier's .bp file
- that way you can call multiple drone configurations with different enhancements, for example 1.st enhancement gets you 4 drones, second gets you 4 more, third gets you 6 more (for a total of 14 ;)
IN BOTH THOSE CASES DRONE REBUILD WILL GET BROKEN AS SOON A S YOU BUILD OR MAKE AN ENHANCEMENT (if you have it)

NOW for the useful part - getting drones to rebuild.
-the 3.rd thing you need.
Using enhancements, or building with the unit changes the carrier's state, so that it is no longer DroneMaintenance.
We restart it using this, for each of the things that change the state (building, finishing building, stopping the build, getting enhancement)

Code:
WorkingState = State {  -- needed to fix drones not being rebuilt
        Main = function(self)
            while self.WorkProgress < 1 and not self.Dead do
                WaitSeconds(0.1)
            end
        end,

        OnWorkEnd = function(self, work)
            self:ClearWork()
            self:SetActiveConsumptionInactive()
            AddUnitEnhancement(self, work)
            self:CleanupEnhancementEffects(work)
            self:CreateEnhancement(work)
            self:PlayUnitSound('EnhanceEnd')
            self:StopUnitAmbientSound('EnhanceLoop')
            self:EnableDefaultToggleCaps()
            --ChangeState(self, self.IdleState)
            ChangeState(self, self.DroneMaintenanceState)
        end,   

        OnWorkFail = function(self, work)    --if you cancel an enhancement upgrade - i did not have time to test it yet
            self:ClearWork()
            self:SetActiveConsumptionInactive()
            self:PlayUnitSound('EnhanceFail')
            self:StopUnitAmbientSound('EnhanceLoop')
            self:CleanupEnhancementEffects()
            ChangeState(self, self.DroneMaintenanceState)
        end,
    },

    OnStartBuild = function(self, unitBuilding, order)  --same thing, but for when the carrier builds stuff
        AAirUnit.OnStartBuild(self, unitBuilding, order)
        self.UnitBeingBuilt = unitBuilding
        ChangeState(self, self.BuildingState)
      --  ChangeState(self, self.DroneMaintenanceState)
    end,

    OnStopBuild = function(self, unitBeingBuilt)
        AAirUnit.OnStopBuild(self, unitBeingBuilt)
        --ChangeState(self, self.FinishedBuildingState)
        ChangeState(self, self.DroneMaintenanceState)
    end,

    OnFailedToBuild = function(self)
        AAirUnit.OnFailedToBuild(self)
        ChangeState(self, self.DroneMaintenanceState)
    end,


The fourth thing is setting up the actual drone's .script and .bp file to make it into a drone, but you can copy that from BlackOps drones.

And that's it. 2 problems' though - the drones do not get rebuilt during carrier's time it is constructing units/buildings (but do when the building is done, or stopped)
and they do not spawn while the unit is getting an enhancement (but do as soon as you get it).
However, it could be argued that a unit cannot build 2 things at the same time, no? ;)

P.S. look for version 100+ of the Survival Mayhem&bo balance mod (i will upload it soon), earlier versions of it do not have units xaa9905,4,3,2,1 yet.

Statistics: Posted by DDDX — 13 Nov 2018, 02:03


]]>
2018-11-12T19:50:49+02:00 2018-11-12T19:50:49+02:00 /viewtopic.php?t=16863&p=169483#p169483 <![CDATA[Re: Variable drones number based on enhancement]]> .

Statistics: Posted by Franck83 — 12 Nov 2018, 19:50


]]>
2018-11-12T17:37:23+02:00 2018-11-12T17:37:23+02:00 /viewtopic.php?t=16863&p=169482#p169482 <![CDATA[Re: Variable drones number based on enhancement]]>

I managed to find a working state and implement it in my code ;)

Now not only do my drones rebuild after enhancing, it also works with multiple enhancements calling for different numbers of drones (so I am able to have more or less of them if I so desire, with different enhancements, and they will rebuild without the need for a big script like the UEF ACU has).

Simply duplicate the DroneSetup script and have it trigger for different enhancements, with multiple DroneData tables in the carrier's .bp file.

unsure if this can be done with different drones as models or must be with same drones (getting a non-existent bones error), no time to test it atm, but will give feedback later. It would be epic if it were possible ;) Possible workaround is editing drones themselves to get buffed if carrier gets enhancements.

-p.s. the code does not work during enhancing or building, no drones then-but does after they are finished or stopped. Good enough for me ;)


Code:
    WorkingState = State {  -- needed to fix drones not being rebuilt upon enhancement obtained
        Main = function(self)
            while self.WorkProgress < 1 and not self.Dead do
                WaitSeconds(0.1)
            end
        end,

        OnWorkEnd = function(self, work)
            self:ClearWork()
            self:SetActiveConsumptionInactive()
            AddUnitEnhancement(self, work)
            self:CleanupEnhancementEffects(work)
            self:CreateEnhancement(work)
            self:PlayUnitSound('EnhanceEnd')
            self:StopUnitAmbientSound('EnhanceLoop')
            self:EnableDefaultToggleCaps()
            --ChangeState(self, self.IdleState)
            ChangeState(self, self.DroneMaintenanceState)
        end,
},

    OnStartBuild = function(self, unitBuilding, order)   --for drones not being built when the carrier builds other stuff
        AAirUnit.OnStartBuild(self, unitBuilding, order)
        self.UnitBeingBuilt = unitBuilding
        ChangeState(self, self.BuildingState)
      --  ChangeState(self, self.DroneMaintenanceState)
    end,

    OnStopBuild = function(self, unitBeingBuilt)
        AAirUnit.OnStopBuild(self, unitBeingBuilt)
        --ChangeState(self, self.FinishedBuildingState)
        ChangeState(self, self.DroneMaintenanceState)
    end,

    OnFailedToBuild = function(self)
        AAirUnit.OnFailedToBuild(self)
        ChangeState(self, self.DroneMaintenanceState)
    end,

Statistics: Posted by DDDX — 12 Nov 2018, 17:37


]]>
2018-11-11T17:24:35+02:00 2018-11-11T17:24:35+02:00 /viewtopic.php?t=16863&p=169447#p169447 <![CDATA[Re: Variable drones number based on enhancement]]> Now, I have been able to fix the issue of not rebuilding drones while building other stuff, using the Tempest's script - to be honest I did not even notice the drones don't get rebuilt during my unit constructing other things.
The issue is fixed using this code:

Code:
    OnStartBuild = function(self, unitBuilding, order)
        AAirUnit.OnStartBuild(self, unitBuilding, order)
        self.UnitBeingBuilt = unitBuilding
        ChangeState(self, self.BuildingState)
    end,

    OnStopBuild = function(self, unitBeingBuilt)
        AAirUnit.OnStopBuild(self, unitBeingBuilt)
        ChangeState(self, self.FinishedBuildingState)
    end,

    OnFailedToBuild = function(self)
        AAirUnit.OnFailedToBuild(self)
        ChangeState(self, self.DroneMaintenanceState)
    end,


however, the states still get broken upon enhancing, and that is why the issue occurs. It is also why your proposed fix will now work :(
Now, there are 2 ways around this, one is a script for working state (enhancing), similar to this one for building state,
the other is forcing the drones to be rebuilt using the UEF acu's 2 engineer drones script.

I guess I could mutate and use the Blackops:ACUs script but as far as I can see each drone must be then set-up individually (and for 6,7,8+ drones that's a shitload of code)... so if anyone knows of a quick fix, a code for OnWorkBegin that is the same as this OnStartBuild that I quoted, I believe that will do the trick ;)

something like this...though I am pretty sure this is wrong ;)


OnWorkBegin = function(self)
AAirUnit.OnWorkBegin(self)
ChangeState(self, self.WorkingState)
end,

OnWorkEnd = function(self)
AAirUnit.OnWorkEnd(self)
ChangeState(self, self.FinishedWorkingState)
end,

OnWorkFailed = function(self)
AAirUnit.OnWorkEnd(self)
ChangeState(self, self.DroneMaintenanceState)
end,

Statistics: Posted by DDDX — 11 Nov 2018, 17:24


]]>
2018-11-09T13:43:47+02:00 2018-11-09T13:43:47+02:00 /viewtopic.php?t=16863&p=169381#p169381 <![CDATA[Re: Variable drones number based on enhancement]]>
It seems that enhancements broke the state machine thread. It should be able a fix this but it may need a time invest to understand the drone and the state machine archtecture.
Maybe somebody has some better drone knowledge.

The simple way to do an equal goal you want is to apply a buff on drones on enhancement. This would be quick, will have no side effects and best performance.

If you want a better graphic effect, you can increase size of your drone at enhancement (changing meshes). So you maybe have light, medium and heavy drones.

Statistics: Posted by Franck83 — 09 Nov 2018, 13:43


]]>
2018-11-07T20:51:21+02:00 2018-11-07T20:51:21+02:00 /viewtopic.php?t=16863&p=169350#p169350 <![CDATA[Re: Variable drones number based on enhancement]]>

Statistics: Posted by DDDX — 07 Nov 2018, 20:51


]]>
2018-11-07T15:27:37+02:00 2018-11-07T15:27:37+02:00 /viewtopic.php?t=16863&p=169342#p169342 <![CDATA[Re: Variable drones number based on enhancement]]>
Unfortunately I cannot open the .rar archive, says corrupted.
Mind uploading again, or sending directly to my e-mail? Imma send it to you on Discord.
many thanks for helping me with this bothersome issue ;)

Statistics: Posted by DDDX — 07 Nov 2018, 15:27


]]>
2018-11-07T14:38:23+02:00 2018-11-07T14:38:23+02:00 /viewtopic.php?t=16863&p=169341#p169341 <![CDATA[Re: Variable drones number based on enhancement]]>
There should be a way to add a new drone in the existing table if you have more time.

object

File --> https://ufile.io/gmf1x

Statistics: Posted by Franck83 — 07 Nov 2018, 14:38


]]>
2018-11-07T09:19:03+02:00 2018-11-07T09:19:03+02:00 /viewtopic.php?t=16863&p=169333#p169333 <![CDATA[Re: Variable drones number based on enhancement]]>

Right now I am at the point where the unit starts with no drones and gets them when it gets the apropriate ACU-style enhancement...but it would be much better if I could better manipulate the number of drones through enhancements (for example, have multiple stages of the drone-numbered enhancements, or the ability to replace the existing drones with other drone-like units, like you said).

And like I said, I can totally do that too, but...then they do not get rebuilt :/

Statistics: Posted by DDDX — 07 Nov 2018, 09:19


]]>
2018-11-07T00:51:45+02:00 2018-11-07T00:51:45+02:00 /viewtopic.php?t=16863&p=169332#p169332 <![CDATA[Re: Variable drones number based on enhancement]]> Statistics: Posted by HUSSAR — 07 Nov 2018, 00:51


]]>
2018-11-05T17:21:11+02:00 2018-11-05T17:21:11+02:00 /viewtopic.php?t=16863&p=169291#p169291 <![CDATA[Re: Variable drones number based on enhancement]]> http://rgho.st/6V5B6z7Yp --script file
http://rgho.st/7JCpjhp4H --blueprints

that's all you need for the unit to work (be sure to have BO Unleashed and TMayhem mods because the files reference them, but i am pretty sure you do already ;)
Personalshield is missing but who cares, that segment works.

Statistics: Posted by DDDX — 05 Nov 2018, 17:21


]]>
2018-11-05T16:09:56+02:00 2018-11-05T16:09:56+02:00 /viewtopic.php?t=16863&p=169281#p169281 <![CDATA[Re: Variable drones number based on enhancement]]> Statistics: Posted by Franck83 — 05 Nov 2018, 16:09


]]>
2018-11-05T14:34:01+02:00 2018-11-05T14:34:01+02:00 /viewtopic.php?t=16863&p=169278#p169278 <![CDATA[Re: Variable drones number based on enhancement]]>
the unit's .bp file is the same as is for any carrier unit, be it Tempest, Goliath or Yenzotha ;) Plus a secondary DroneData, that is.
I have removed most of the weapons from the blueprint cause the post otherwise excedes 60 000 symbols.

Your code, when implemented, gives me the following error upon using that enhancement:
Code:
WARNING: Error running lua script: Invalid bone identifier; must be a string, integer, or nil
         stack traceback:
            [C]: in function `IsValidBone'
            ...l mayhem&bo balance\units\xaa9904\xaa9904_script.lua(1288): in function <...l mayhem&bo balance\units\xaa9904\xaa9904_script.lua:1286>

Which is strange considering that DroneData and DroneData2 use the same attachpoints for drones and the same bone for an effect when a drone spawns.


Code:
UnitBlueprint {
    AI = {
        TargetBones = {
            'Hatch_Left',
            'Hatch_Right',
            'Attachpoint_Lrg_01',
            'Attachpoint_Med_03',
            'Exhaust01',
            'Turret_Front01',
            'Turret_Front',     
            'Left_Attachpoint02',
            'Right_Attachpoint05',
            'Left_Attachpoint12',
            'Right_Attachpoint06',
        },
        GuardScanRadius = 110,
        AssistHeartbeatInterval = 0.5,
        DroneControlRange = 120,
        DroneReturnRange = 70,
        AirMonitorRange = 160,
    },
    Air = {
        AutoLandTime = 50,
        BankFactor = 0.1,
        BankForward = false,
        CanFly = true,
        CirclingDirChangeFrequencySec = 1,
        CirclingElevationChangeRatio = 0.25,
        CirclingRadiusChangeMaxRatio = 0.9,
        CirclingRadiusChangeMinRatio = 0.6,
        CirclingRadiusVsAirMult = 0.66,
        CirclingTurnMult = 3,
        KLift = 1.5,
        KLiftDamping = 3,
        KMove = 0.45,
        KMoveDamping = 2,
        KRoll = 1,
        KRollDamping = 1,
        KTurn = 0.5,
        KTurnDamping = 2,
        LiftFactor = 1,
        MaxAirspeed = 4.5,
        StartTurnDistance = 10,
        TransportHoverHeight = 22,
    },
    Audio = {
        AirUnitWaterImpact = Sound {
            Bank = 'Explosions',
            Cue = 'Expl_Water_Lrg_01',
            LodCutoff = 'UnitMove_LodCutoff',
        },
        AmbientMove = Sound {
            Bank = 'UAA',
            Cue = 'UAA0104_Move_Loop',
            LodCutoff = 'UnitMove_LodCutoff',
        },
        DeathExplosion = Sound {
            Bank = 'UAADestroy',
            Cue = 'UAA_Destroy_Air_Killed',
            LodCutoff = 'UnitMove_LodCutoff',
        },
        Destroyed = Sound {
            Bank = 'UAADestroy',
            Cue = 'UAA_Destroy_Air',
            LodCutoff = 'UnitMove_LodCutoff',
        },
        Killed = Sound {
            Bank = 'UAADestroy',
            Cue = 'UAA_Destroy_Air_Killed',
            LodCutoff = 'UnitMove_LodCutoff',
        },
        Landing = Sound {
            Bank = 'UAA',
            Cue = 'UAA0104_Move_Land',
            LodCutoff = 'UnitMove_LodCutoff',
        },
        Load = Sound {
            Bank = 'UAA',
            Cue = 'UAA0104_Unit_Load',
            LodCutoff = 'UnitMove_LodCutoff',
        },
        StartMove = Sound {
            Bank = 'UAA',
            Cue = 'UAA0104_Move_Start',
            LodCutoff = 'UnitMove_LodCutoff',
        },
        StopMove = Sound {
            Bank = 'UAA',
            Cue = 'UAA0104_Move_Stop',
            LodCutoff = 'UnitMove_LodCutoff',
        },
        Thruster = Sound {
            Bank = 'UAA',
            Cue = 'UAA0104_Move_Thruster',
            LodCutoff = 'UnitMove_LodCutoff',
        },
        UISelection = Sound {
            Bank = 'Interface',
            Cue = 'Aeon_Select_Air',
            LodCutoff = 'UnitMove_LodCutoff',
        },
        Unload = Sound {
            Bank = 'UAA',
            Cue = 'UAA0104_Unit_Unload',
            LodCutoff = 'UnitMove_LodCutoff',
        },
        CaptureLoop = Sound {
            Bank = 'UAL',
            Cue = 'UAL0001_Capture_Loop',
            LodCutoff = 'UnitMove_LodCutoff',
        },
        Construct = Sound {
            Bank = 'UAL',
            Cue = 'UAL0001_Construct_Start',
            LodCutoff = 'UnitMove_LodCutoff',
        },
        ConstructLoop = Sound {
            Bank = 'UAL',
            Cue = 'UAL0001_Construct_Loop',
            LodCutoff = 'UnitMove_LodCutoff',
        },
        EnhanceEnd = Sound {
            Bank = 'UnitsGlobal',
            Cue = 'GLB_Enhance_Stop',
            LodCutoff = 'UnitMove_LodCutoff',
        },
        EnhanceFail = Sound {
            Bank = 'UnitsGlobal',
            Cue = 'GLB_Enhance_Fail',
            LodCutoff = 'UnitMove_LodCutoff',
        },
        EnhanceLoop = Sound {
            Bank = 'UnitsGlobal',
            Cue = 'GLB_Enhance_Loop',
            LodCutoff = 'UnitMove_LodCutoff',
        },
        EnhanceStart = Sound {
            Bank = 'UnitsGlobal',
            Cue = 'GLB_Enhance_Start',
            LodCutoff = 'UnitMove_LodCutoff',
        },
        ReclaimLoop = Sound {
            Bank = 'UAL',
            Cue = 'UAL0001_Reclaim_Loop',
            LodCutoff = 'UnitMove_LodCutoff',
        },
        StartCapture = Sound {
            Bank = 'UAL',
            Cue = 'UAL0001_Capture_Start',
            LodCutoff = 'UnitMove_LodCutoff',
        },
        StartReclaim = Sound {
            Bank = 'UAL',
            Cue = 'UAL0001_Reclaim_Start',
            LodCutoff = 'UnitMove_LodCutoff',
        },
        UISelection = Sound {
            Bank = 'Interface',
            Cue = 'Aeon_Select_Commander',
            LodCutoff = 'UnitMove_LodCutoff',
        },
    },
    AverageDensity = 1,
    Buffs = {
        Regen = {
            Level1 = 150,
            Level2 = 190,
            Level3 = 230,
            Level4 = 270,
            Level5 = 310,
        },
    },
    BuildIconSortPriority = 60,
    Categories = {
        'PRODUCTSC1',
        'BUILTBYTIER3COMMANDER',     
        'NEEDMOBILEBUILD',
        'DRAGBUILD',
        'SELECTABLE',
        'AEON',
        'MOBILE',
        'AIR',
        'ANTIAIR',
        'GROUNDATTACK',
        'EXPERIMENTAL',
        'VISIBLETORECON',
        'RECLAIMABLE',
        'OVERLAYANTIAIR',
        'OVERLAYDIRECTFIRE',
        'ALPHA',
        'ALPHA_4',
        'ECONOMIC',
        'COMMAND',
        'MASSPRODUCTION',
        'ENERGYPRODUCTION',
        'REPAIR',
        'ENGINEER',
        'CONSTRUCTION',
        'RECLAIM',
        'CAPTURE',
        'PATROLHELPER',
        'OVERLAYRADAR',
        'INTELLIGENCE',
        'OVERLAYSONAR',
        'OVERLAYINDIRECTFIRE',
        'COUNTERINTELLIGENCE',
        'OVERLAYCOUNTERINTEL',
        'CANNOTUSEAIRSTAGING',
        'ANTIMISSILE',
        'SILO',
        'OVERLAYDEFENSE',
        'TELEPORT',
        'DEFENSE',
        'TIER3',
        --'PODSTAGINGPLATFORM',   --not enough room for commands, that's why this is neutralized, however it does not affect my issue active or not
    },
    CollisionOffsetX = 0,
    CollisionOffsetZ = -1.5,
    CollisionOffsetY = -1,
    Defense = {
        AirThreatLevel = 329,
       -- LambdaField = {
        --    AttachBone = 'baa0309',
         --   Radius = 65,
        --    Probability = 90,
       -- },
        ArmorType = 'Commander',
        EconomyThreatLevel = 0,
        Health = 20000,
        MaxHealth = 20000,
        RegenRate = 110,
        SubThreatLevel = 0,
        SurfaceThreatLevel = 8,
        MaxTeleRange = 100,
    },   
    Description = '<LOC xaa9904_desc>Level 4 hero',
    Display = {
        Abilities = {
            '<LOC ability_aa>Anti-Air',
            '<LOC ability_customizable>Customizable',
            '<LOC ability_engineeringsuite>Engineering Suite',
            '<LOC ability_notcap>Not Capturable',
            '<LOC ability_radar>Radar',
            '<LOC ability_sonar>Sonar',
            '<LOC ability_depthcharge>Depth Charges',           
            '<LOC ability_stun>Restoration Field',
            '<LOC ability_deathaoe>Volatile',
            '<LOC ability_massive>Massive',
            '<LOC ability_aadrones>Drones',
            '<LOC ability_teleport>Teleport',
            '<LOC ability_stun>EMP Weapon',
            --'<LOC ability_lambdafield>Lambda Field',
            '<LOC ability_stratmissiledef>Strategic Missile Defense',
            '<LOC ability_tacmissiledef>Tactical Missile Defense',
            --'<LOC ability_torpedo>Torpedoes',
        },
        AnimationPermOpen = '/mods/BlackOpsFAF-Unleashed/units/BAA0309/BAA0309_aopen01.sca',
        ForcedBuildSpin = 90,
        LayerChangeEffects = {
            AirLand = {
                Effects = {
                    {
                        Bones = {
                            'UAA0104',
                        },
                        Type = 'Landing01',
                    },
                },
            },
            LandAir = {
                Effects = {
                    {
                        Bones = {
                            'UAA0104',
                        },
                        Type = 'TakeOff01',
                    },
                },
            },
        },
        Mesh = {
            IconFadeInZoom = 130,
            LODs = {
                {
                    MeshName = '/mods/BlackOpsFAF-Unleashed/units/BAA0309/BAA0309_LOD0.scm',
                    AlbedoName = '/mods/BlackOpsFAF-Unleashed/units/BAA0309/BAA0309_Albedo.dds',
                    NormalsName = '/mods/BlackOpsFAF-Unleashed/units/BAA0309/BAA0309_NormalsTS.DDS',
                    SpecularName = '/mods/BlackOpsFAF-Unleashed/units/BAA0309/BAA0309_SpecTeam.dds',
                    LODCutoff = 300,
                    Scrolling = true,
                    ShaderName = 'Aeon',
                },
            },
        },
        PlaceholderMeshName = 'UXB0000',
        SpawnRandomRotation = false,
        UniformScale = 0.10,
    },
    DroneData = {                     --default 2 drones when you spawn
        Drone1 = {
            Attachpoint = 'Attachpoint_Lrg_01',
            UnitID = 'SUAL0105',
        },
        Drone2 = {
            Attachpoint = 'Attachpoint_Lrg_01',
            UnitID = 'SUAL0105',
        },
    },
    DroneData2 = {   --more drones if you choose the enhancement in question (Swarm Protocol). You will lack icons for enhancements, but they work blank so...who cares ;)
        Drone3 = {
            Attachpoint = 'Attachpoint_Lrg_01',
            UnitID = 'SUAL0105',
        },
        Drone4 = {
            Attachpoint = 'Attachpoint_Lrg_01',
            UnitID = 'SUAL0105',
        },
        Drone5 = {
            Attachpoint = 'Attachpoint_Lrg_01',
            UnitID = 'SUAL0105',
        },
        Drone6 = {
            Attachpoint = 'Attachpoint_Lrg_01',
            UnitID = 'SUAL0105',
        },
    },
    Economy = {
        BuildCostEnergy = 5000,
        BuildCostMass = 600,
        BuildTime = 300,
        BuildRate = 45,
        BuildableCategory = {
            'BUILTBYTIER1ENGINEER AEON',
            'BUILTBYTIER2ENGINEER AEON',
            'BUILTBYTIER3ENGINEER AEON',
            'BUILTBYALPHAA1',
            'BUILTBYALPHAA2',
            'BUILTBYALPHAA4',
            'uab1105',
            'uab1106',
        },
        MaintenanceConsumptionPerSecondEnergy = 1,
        MaxBuildDistance = 33,
        NaturalProducer = true,
        NeedToFaceTargetToBuild = false,
        ProductionPerSecondEnergy = 1000,
        ProductionPerSecondMass = 10,
        StorageEnergy = 2000,
        StorageMass = 800,
        TeleportBurstEnergyCost = 5,
        TeleportEnergyMod = 7.273,
        TeleportMassMod = 33.33,
        TeleportTimeMod = 0.0000667,
    },----------------------------------------------------------------------------------------------------------------------------------------------------------
    Enhancements = {
        Slots = {
            Back = {
                name = '<LOC _Back>',
                x = -2,
                y = -5,
            },
            LCH = {
                name = '<LOC _LCH>',
                x = 50,
                y = -10,
            },
            RCH = {
                name = '<LOC _RCH>',
                x = -12,
                y = -10,
            },
        },
        GuardianProtocol = {
            BuildCostEnergy = 25000,
            BuildCostMass = 1280,
            BuildTime = 1000,
            BuildableCategoryAdds = 'BUILTBYALPHAA3',
            Icon = 'turret',
            Name = 'Guardian protocol I',
            NewBuildRate = 30,
            NewHealth = 4000,             --20000 total
            NewRegenRate = 35,
            Slot = 'Back',
        },
        GuardianProtocolRemove = {
            BuildCostEnergy = 1,
            BuildCostMass = 1,
            BuildTime = 0.1,
            Icon = 'turret',
            Name = 'Remove Guardian protocol I',
            Prerequisite = 'GuardianProtocol',
            RemoveEnhancements = {
                'GuardianProtocol',
                'GuardianProtocolRemove',
            },
            Slot = 'Back',
        },
        GuardianProtocol2 = {
            BuildCostEnergy = 39000,
            BuildCostMass = 2920,
            BuildTime = 2200,
            BuildableCategoryAdds = 'BUILTBYALPHAA4',
            Icon = 'turret2',
            Name = 'Guardian protocol II',
            NewBuildRate = 40,
            NewHealth = 4000,
            NewRegenRate = 50,
            Prerequisite = 'GuardianProtocol',
            Slot = 'Back',
        },
        GuardianProtocol2Remove = {
            BuildCostEnergy = 1,
            BuildCostMass = 1,
            BuildTime = 0.1,
            Icon = 'turret2',
            Name = 'Remove Guardian protocol II',
            Prerequisite = 'GuardianProtocol2',
            RemoveEnhancements = {
                'GuardianProtocol',
                'GuardianProtocol2',
                'GuardianProtocol2Remove',
            },
            Slot = 'Back',
        }, 
        ApocalypticEngineering = {
            BuildCostEnergy = 50000,
            BuildCostMass = 5600,
            BuildTime = 6600,
            Icon = 'health',
            Name = 'Structural integrity protocol',
            Prerequisite = 'GuardianProtocol2',
            NewHealth = 5000,
            Slot = 'Back',
            NewRegenRate = 70,
        },
        ApocalypticEngineeringRemove = {
            BuildCostEnergy = 1,
            BuildCostMass = 1,
            BuildTime = 0.1,
            Icon = 'health',
            Name = 'Remove Structural integrity protocol',
            Prerequisite = 'ApocalypticEngineering',
            RemoveEnhancements = {
                'GuardianProtocol',
                'GuardianProtocol2',
                'ApocalypticEngineering',
                'ApocalypticEngineeringRemove',
            },
            Slot = 'Back',
        },     
        TorpedoLauncher = {
            BuildCostEnergy = 22000,
            BuildCostMass = 1040,
            BuildTime = 960,
            Icon = 'exrtorp1',
            Name = 'Seaworth protocol I',
            NewHealth = 2500,
            NewRegenRate = 25,
            Slot = 'Back',
        },
        TorpedoLauncherRemove = {
            BuildCostEnergy = 1,
            BuildCostMass = 1,
            BuildTime = 0.1,
            Icon = 'exrtorp1',
            Name = 'Remove Seaworth protocol I',
            Prerequisite = 'TorpedoLauncher',
            RemoveEnhancements = {
                'TorpedoLauncher',
                'TorpedoLauncherRemove',
            },
            Slot = 'Back',
        },
        ImprovedTorpLoader = {
            BuildCostEnergy = 38000,
            BuildCostMass = 3300,
            BuildTime = 1800,
            Icon = 'exrtorp2',
            Name = 'Seaworth protocol II',
            Prerequisite = 'TorpedoLauncher',
            NewHealth = 3500,
            NewRegenRate = 40,           
            TorpRoF = 0.6,
            Slot = 'Back',
        },
        ImprovedTorpLoaderRemove = {
            BuildCostEnergy = 1,
            BuildCostMass = 1,
            BuildTime = 0.1,
            Icon = 'exrtorp2',
            Name = 'Remove Seaworth protocol II',
            Prerequisite = 'ImprovedTorpLoader',
            RemoveEnhancements = {
                'TorpedoLauncher',
                'ImprovedTorpLoader',
                'ImprovedTorpLoaderRemove',
            },
            Slot = 'Back',
        },
        AdvancedWarheads = {
            BuildCostEnergy = 35000,
            BuildCostMass = 2800,
            BuildTime = 1300,
            Icon = 'exrtorp3',
            Name = 'Sea Guardian protocol',
            Prerequisite = 'ImprovedTorpLoader',
            NewHealth = 3000,
            NewRegenRate = 25,
            TorpDamage = 400,
            Slot = 'Back',
        },
        AdvancedWarheadsRemove = {
            BuildCostEnergy = 1,
            BuildCostMass = 1,
            BuildTime = 0.1,
            Icon = 'exrtorp3',
            Name = 'Remove Sea Guardian protocol',
            Prerequisite = 'AdvancedWarheads',
            TorpDamage = -400,
            RemoveEnhancements = {
                'TorpedoLauncher',
                'ImprovedTorpLoader',
                'AdvancedWarheads',
                'AdvancedWarheadsRemove',
            },
            Slot = 'Back',
        },
        ShieldBattery4 = {
            BuildCostEnergy = 37000,
            BuildCostMass = 2440,
            BuildTime = 1500,
            Icon = 'S1',
            ImpactEffects = 'AeonShieldHit01',
            Name = 'Defense protocol I',
            OwnerShieldMesh = '/mods/Survival Mayhem&BO balance/units/XAA9904/XAA9904_personalshield_mesh',
            PersonalShield = true,
            RegenAssistMult = 10,
            MaintenanceConsumptionPerSecondEnergy = 100,
            ShieldEnergyDrainRechargeTime = 2,
            ShieldMaxHealth = 5000,
            ShieldRechargeTime = 34,
            ShieldRegenRate = 300,
            ShieldRegenStartTime = 0,
            ShieldSize = 3,
            ShieldVerticalOffset = 0,
            Slot = 'RCH',
        },
        ShieldBattery4Remove = {
            BuildCostEnergy = 1,
            BuildCostMass = 1,
            BuildTime = 0.1,
            Icon = 'S1',
            Name = 'Remove Defense Protocol',
            Prerequisite = 'ShieldBattery4',
            RemoveEnhancements = {
                'ShieldBattery4',
                'ShieldBattery4Remove',
            },
            Slot = 'RCH',
        },
        ExpandedShieldBubble4 = {
            BuildCostEnergy = 43000,
            BuildCostMass = 3300,
            BuildTime = 2100,
            Icon = 'S3',
            ImpactEffects = 'AeonShieldHit01',
            ImpactMesh = '/effects/entities/ShieldSection01/ShieldSection01_mesh',
            Mesh = '/effects/entities/Shield01/Shield01_mesh',
            MeshZ = '/effects/entities/Shield01/Shield01z_mesh',
            Name = 'Defense protocol II',
            Prerequisite = 'ShieldBattery4',
            MaintenanceConsumptionPerSecondEnergy = 150,
            ShieldEnergyDrainRechargeTime = 5,
            ShieldEnhancementNumber = 5,
            ShieldMaxHealth = 11000,
            ShieldRechargeTime = 31,
            ShieldRegenRate = 300,
            ShieldRegenStartTime = 0,
            ShieldSize = 23,
            ShieldVerticalOffset = -12,
            Slot = 'RCH',
        },
        ExpandedShieldBubble4Remove = {
            BuildCostEnergy = 1,
            BuildCostMass = 1,
            BuildTime = 0.1,
            Icon = 'S3',
            Name = 'Remove Defense protocol II',
            Prerequisite = 'ExpandedShieldBubble4',
            RemoveEnhancements = {
                'ShieldBattery4',
                'ExpandedShieldBubble4',
                'ExpandedShieldBubble4Remove',
            },
            Slot = 'RCH',
        },
        ImprovedShieldBattery4 = {
            BuildCostEnergy = 50000,
            BuildCostMass = 4500,
            BuildTime = 2600,
            Icon = 'S2',
            ImpactEffects = 'AeonShieldHit01',
            ImpactMesh = '/effects/entities/ShieldSection01/ShieldSection01_mesh',
            Mesh = '/effects/entities/Shield01/Shield01_mesh',
            MeshZ = '/effects/entities/Shield01/Shield01z_mesh',
            Name = 'Defense protocol III',
            Prerequisite = 'ExpandedShieldBubble4',
            MaintenanceConsumptionPerSecondEnergy = 200,
            ShieldEnergyDrainRechargeTime = 5,
            ShieldMaxHealth = 18000,
            ShieldRechargeTime = 30,
            ShieldRegenRate = 350,
            ShieldRegenStartTime = 0,
            ShieldSize = 25,
            ShieldVerticalOffset = -14,
            Slot = 'RCH',
        },
        ImprovedShieldBattery4Remove = {
            BuildCostEnergy = 1,
            BuildCostMass = 1,
            BuildTime = 0.1,
            Icon = 'S2',
            Name = 'Remove Defense protocol III',
            Prerequisite = 'ImprovedShieldBattery4',
            RemoveEnhancements = {
                'ShieldBattery',
                'ExpandedShieldBubble4',
                'ImprovedShieldBattery4',
                'ImprovedShieldBattery4Remove',
            },
            Slot = 'RCH',
        },
        PhasonBeamCannon4 = {
            BuildCostEnergy = 40000,
            BuildCostMass = 3140,
            BuildTime = 1800,
            Icon = 'exrgec1',
            Name = 'Offense protocol',
            OblivionPDRoF = 0.75,            --0.55
            OblivionPDDamage = 100,          --600
            bigGunRoF = 0.075,            --0.045
            bigGunDamage = 200,              --400
            Slot = 'RCH',
        },
        PhasonBeamCannon4Remove = {
            BuildCostEnergy = 1,
            BuildCostMass = 1,
            BuildTime = 0.1,
            Icon = 'exrgec1',
            Name = 'Remove Offense protocol',
            Prerequisite = 'PhasonBeamCannon',
            OblivionPDRoF = 0.55,
            OblivionPDDamage = -100,          --600
            bigGunRoF = 0.045,
            bigGunDamage = -200,
            RemoveEnhancements = {
                'PhasonBeamCannon4',
                'PhasonBeamCannon4Remove',
            },
            Slot = 'RCH',
        },
        DualMiasmaArtillery4 = {
            BuildCostEnergy = 50000,
            BuildCostMass = 4990,
            BuildTime = 2300,
            Icon = 'exrzb2',
            Name = 'Energy beam focus',
            Prerequisite = 'PhasonBeamCannon4',
            Slot = 'RCH',
        },
        DualMiasmaArtillery4Remove = {
            BuildCostEnergy = 1,
            BuildCostMass = 1,
            BuildTime = 0.1,
            Icon = 'exrzb2',
            Name = 'Remove Energy beam focus',
            Prerequisite = 'DualMiasmaArtillery4',
            RemoveEnhancements = {
                'PhasonBeamCannon4',
                'DualMiasmaArtillery4',
                'DualMiasmaArtillery4Remove',
            },
            Slot = 'RCH',
        },
        OverchargeAmplifierA = {
            BuildCostEnergy = 60000,
            BuildCostMass = 5400,
            BuildTime = 2600,
            Icon = 'overcharge',
            Name = 'Overcharge protocol',
            Prerequisite = 'DualMiasmaArtillery4',
            NewProjectileBlueprint = '/mods/BlackOpsFAF-ACUs/projectiles/OmegaOverCharge01/OmegaOverCharge01_proj.bp',
            OverChargeRoF = 0.06,            --0.03
           -- OverChargeMaxRange = 40,
            Slot = 'RCH',
        },
        OverchargeAmplifierARemove = {
            BuildCostEnergy = 1,
            BuildCostMass = 1,
            BuildTime = 0.1,
            NewProjectileBlueprint = '/projectiles/SDFChronatronCannon02/SDFChronatronCannon02_proj.bp',
            Icon = 'overcharge',
            Name = 'Remove Overcharge protocol',
            Prerequisite = 'OverchargeAmplifierA',
            RemoveEnhancements = {
                'PhasonBeamCannon4',
                'DualMiasmaArtillery4',
                'OverchargeAmplifierA',
                'OverchargeAmplifierARemove',
            },
            Slot = 'RCH',
        },
        ScavengerProtocol = {
            BuildCostEnergy = 45000,
            BuildCostMass = 4280,
            BuildTime = 2000,
            BuildableCategoryAdds = 'BUILTBYALPHAA4',
            Icon = 'rec',
            Name = 'Scavenger protocol',
            NewBuildRate = 50,
            NewHealth = 3000,             --20000 total
            NewRegenRate = 50,           
            Radius = 25,
            RegenCeiling = 300,  --300
            RegenPerSecond = 0.02,  --0.032
            MaxHealthFactor = 1.2,
           -- UnitCategory = 'BUILTBYTIER3FACTORY, BUILTBYQUANTUMGATE, NEEDMOBILEBUILD',
            Slot = 'LCH',
        },
        ScavengerProtocolRemove = {
            BuildCostEnergy = 1,
            BuildCostMass = 1,
            BuildTime = 0.1,
            Icon = 'rec',
            Name = 'Remove Scavenger protocol I',
            Prerequisite = 'ScavengerProtocol',
            RemoveEnhancements = {
                'ScavengerProtocol',
                'ScavengerProtocolRemove',
            },
            Slot = 'LCH',
        },
        SkyTrackerProtocol = {
            BuildCostEnergy = 40000,
            BuildCostMass = 3900,
            BuildTime = 2000,
            Icon = 'sky',
            Name = 'SkyTracker Protocol',
            Prerequisite = 'ScavengerProtocol',
            Slot = 'LCH',
        },
        SkyTrackerProtocolRemove = {
            BuildCostEnergy = 1,
            BuildCostMass = 1,
            BuildTime = 0.1,
            Icon = 'sky',
            Name = 'Remove SkyTracker Protocol',
            Prerequisite = 'SkyTrackerProtocol',
            RemoveEnhancements = {
                'ScavengerProtocol',
                'SkyTrackerProtocol',
                'SkyTrackerProtocolRemove',
            },
            Slot = 'LCH',
        },
        SurvivalProtocol = {
            BuildCostEnergy = 60000,
            BuildCostMass = 6600,
            BuildTime = 2600,
            Icon = 'hfield',
            Name = 'Survival protocol',           
            Radius = 30,
            RegenCeiling = 400,  --300
            RegenPerSecond = 0.03,  --0.032
            MaxHealthFactor = 1.3,
            Prerequisite = 'SkyTrackerProtocol',
            Slot = 'LCH',
        },
        SurvivalProtocolRemove = {
            BuildCostEnergy = 1,
            BuildCostMass = 1,
            BuildTime = 0.1,
            Icon = 'hfield',
            Name = 'Remove Survival protocol',
            Prerequisite = 'SurvivalProtocol',
            RemoveEnhancements = {
                'ScavengerProtocol',
                'SkyTrackerProtocol',
                'SurvivalProtocol',
                'SurvivalProtocolRemove',
            },
            Slot = 'LCH',
        },       
        SummonerProtocol = {               --this should give me  +4 drones, from the starting 2
            BuildCostEnergy = 60000,
            BuildCostMass = 6600,
            BuildTime = 2600,
            Icon = 'summon',
            Name = 'Summoner protocol',
            Radius = 25,
            RegenCeiling = 300,  --300
            RegenPerSecond = 0.02,  --0.032
            MaxHealthFactor = 1.2,
            Slot = 'LCH',
        },
        SummonerProtocolRemove = {
            BuildCostEnergy = 1,
            BuildCostMass = 1,
            BuildTime = 0.1,
            Icon = 'summon',
            Name = 'Remove Summoner protocol',
            Prerequisite = 'SummonerProtocol',
            RemoveEnhancements = {
                'SummonerProtocol',
                'SummonerProtocolRemove',
            },
            Slot = 'LCH',
        }, 
        Summoner2Protocol = {
            BuildCostEnergy = 40000,
            BuildCostMass = 3900,
            BuildTime = 2000,
            Icon = 'arta',
            Name = 'Summoner Advanced Protocol',
            Prerequisite = 'SummonerProtocol',
            Slot = 'LCH',
        },
        Summoner2ProtocolRemove = {
            BuildCostEnergy = 1,
            BuildCostMass = 1,
            BuildTime = 0.1,
            Icon = 'arta',
            Name = 'Remove Summoner Advanced Protocol',
            Prerequisite = 'Summoner2Protocol',
            RemoveEnhancements = {
                'SummonerProtocol',
                'Summoner2Protocol',
                'Summoner2ProtocolRemove',
            },
            Slot = 'LCH',
        },
        ALVSTProtocol = {
            BuildCostEnergy = 60000,
            BuildCostMass = 6600,
            BuildTime = 2600,
            Icon = 'artemis',
            Name = 'ALVST protocol',           
            Radius = 30,
            RegenCeiling = 400,  --300
            RegenPerSecond = 0.03,  --0.032
            MaxHealthFactor = 1.3,
            Prerequisite = 'Summoner2Protocol',
            Slot = 'LCH',
        },
        ALVSTProtocolRemove = {
            BuildCostEnergy = 1,
            BuildCostMass = 1,
            BuildTime = 0.1,
            Icon = 'artemis',
            Name = 'Remove ALVST protocol',
            Prerequisite = 'ALVSTProtocol',
            RemoveEnhancements = {
                'SummonerProtocol',
                'Summoner2Protocol',
                'ALVSTProtocol',
                'ALVSTProtocolRemove',
            },
            Slot = 'LCH',
        },     
    },
        -----------------------------------------------------------------------------------------------------------------------------------------------------------------
        ----------------------------------------------------------------------------------------------------------------------------------------------------------------
    Footprint = {
        MaxSlope = 0.25,
        SizeX = 10,
        SizeZ = 13,
    },
    General = {       
        BuildBones = {
            AimBone = 'Left_Attachpoint01',
            BuildEffectBones = {
                'Left_Attachpoint01',
            },
            PitchBone = 'Left_Attachpoint01',
            YawBone = 'Left_Attachpoint01',
        },
        Category = 'Gunship',
        Classification = 'RULEUC_MilitaryAircraft',
        CommandCaps = {
            RULEUCC_Attack = true,
            RULEUCC_CallTransport = true,
            RULEUCC_Capture = true,
            RULEUCC_Ferry = false,
            RULEUCC_Guard = true,
            RULEUCC_Move = true,
            RULEUCC_Nuke = false,
            RULEUCC_Patrol = true,
            RULEUCC_Reclaim = true,
            RULEUCC_Repair = true,
            RULEUCC_RetaliateToggle = true,
            RULEUCC_Stop = true,
            RULEUCC_SiloBuildNuke = false,
            RULEUCC_SiloBuildTactical = true,
            RULEUCC_Teleport = true,
            RULEUCC_Transport = false,
            RULEUCC_Overcharge = true,
        },
        --ConstructionBar = true,
        FactionName = 'Aeon',
        Icon = 'air',   
        SelectionPriority = 2,
        TechLevel = 'RULEUTL_Secret',
        UnitName = 'ALPHA',
        UnitWeight = 1,
    },
    Intel = {
        VisionRadius = 70,
        CloakFieldRadius = 25,    -- Used only to show teleport range
        SonarRadius = 60,
        RadarRadius = 120,
        OmniRadius = 40,
    },
    Interface = {
        HelpText = 'Level 4 flying, evolving, upgradeable hero unit. Be careful not to lose it.',
    },
    LifeBarHeight = 0.105,
    LifeBarOffset = 4.8,
    LifeBarSize = 10,
    Physics = {
        BuildOnLayerCaps = {
            LAYER_Air = true,
            LAYER_Land = false,
            LAYER_Orbit = false,
            LAYER_Seabed = false,
            LAYER_Sub = false,
            LAYER_Water = false,
        },
        --AttackElevation    = 16.0,
        Elevation = 16.0,
        GroundCollisionOffset = 1.6,
        FuelRechargeRate = 70,
        FuelUseTime = 2000,
        MaxSpeed = 0.5,
        MeshExtentsX = 6.5,
        MeshExtentsY = 4,
        MeshExtentsZ = 6.5,
        MotionType = 'RULEUMT_Air',
    },
    SelectionSizeX = 6.8,
    SelectionSizeZ = 8,
    SelectionThickness = 0.42,
    SizeX = 5.8,
    SizeY = 3.7,
    SizeZ = 9,
    StrategicIconName = 'icon_experimental_generic',
    StrategicIconSortPriority = 65,
    Transport = {
        AirClass = false,
        Class2AttachSize = 2,
        Class3AttachSize = 4,
        TransportClass = 10,
    },
    UseOOBTestZoom = 200,
    Veteran = {
        Level1 = 30,
        Level2 = 60,
        Level3 = 90,
        Level4 = 120,
        Level5 = 150,
    },
    Weapon = {
        {
            AboveWaterTargetsOnly = true,
            Audio = {
                BarrelLoop = Sound {
                    Bank = 'UAS',
                    Cue = 'UAS_Turret_Lrg_Loop',
                    LodCutoff = 'WeaponBig_LodCutoff',
                },
                BarrelStart = Sound {
                    Bank = 'UAS',
                    Cue = 'UAS_Turret_Lrg_Start',
                    LodCutoff = 'WeaponBig_LodCutoff',
                },
                Fire = Sound {
                    Bank = 'UASWeapon',
                    Cue = 'UAS0401_Cannon_Oblivion',
                    LodCutoff = 'WeaponBig_LodCutoff',
                },
                MuzzleChargeStart = Sound {
                    Bank = 'UASWeapon',
                    Cue = 'UAS0401_Cannon_Oblv_Charge',
                    LodCutoff = 'WeaponBig_LodCutoff',
                },
            },
            BallisticArc = 'RULEUBA_LowArc',
            CollideFriendly = false,
            Damage = 5000,
            DamageRadius = 7,
            DamageType = 'Normal',
            DisplayName = 'Oblivion Cannon',
            FireTargetLayerCapsTable = {
                Land = 'Land|Water|Seabed',
                Water = 'Land|Water|Seabed',
                Air = 'Land|Water|Seabed',
            },
            FiringRandomness = 2.6,
            FiringTolerance = 0,
            Label = 'MainGun',                                                                  -- Oblivion right
            MaxRadius = 40,
            MuzzleChargeDelay = 0.6,
            MuzzleSalvoDelay = 0,
            MuzzleSalvoSize = 1,
            MuzzleVelocity = 30,
            MuzzleVelocityReduceDistance = 130,
            NotExclusive = true,
            ProjectileId = '/projectiles/ADFOblivionCannon04/ADFOblivionCannon04_proj.bp',
            ProjectileLifetime = 10,
            RackBones = {
                {
                    MuzzleBones = {
                        'Muzzle_R01',
                    },
                    RackBone = 'Turret_Right01',
                },
            },
            RackFireTogether = false,
            RackRecoilDistance = 0,
            RackReloadTimeout = 10,
            RackSalvoChargeTime = 0,
            RackSalvoReloadTime = 0,
            RackSalvoSize = 1,
            RackSlavedToTurret = false,
            RangeCategory = 'UWRC_DirectFire',
            RateOfFire = 0.2,
            SlavedToBody = false,
            TargetCheckInterval = 5,
            TargetPriorities = {
                'SPECIALHIGHPRI',
                'EXPERIMENTAL',
                'DEFENSE',
                'TECH3 MOBILE',
                'TECH2 MOBILE',
                'TECH1 MOBILE',
                'SPECIALLOWPRI',
                'ALLUNITS',
            },
            TargetRestrictDisallow = 'UNTARGETABLE',
            TrackingRadius = 1.15,
            TurretBoneMuzzle = 'Muzzle_R01',
            TurretBonePitch = 'Turret_Right01',
            TurretBoneYaw = 'Turret_Right01',
            TurretDualManipulators = false,
            TurretPitch = 40,
            TurretPitchRange = 50,
            TurretPitchSpeed = 30,
            TurretYaw = 0,
            TurretYawRange = 180,
            TurretYawSpeed = 10,
            Turreted = true,
            WeaponCategory = 'Direct Fire Naval',
        },
        {
            AboveWaterTargetsOnly = true,
            Audio = {
                BarrelLoop = Sound {
                    Bank = 'UAS',
                    Cue = 'UAS_Turret_Lrg_Loop',
                    LodCutoff = 'WeaponBig_LodCutoff',
                },
                BarrelStart = Sound {
                    Bank = 'UAS',
                    Cue = 'UAS_Turret_Lrg_Start',
                    LodCutoff = 'WeaponBig_LodCutoff',
                },
                Fire = Sound {
                    Bank = 'UASWeapon',
                    Cue = 'UAS0401_Cannon_Oblivion',
                    LodCutoff = 'WeaponBig_LodCutoff',
                },
                MuzzleChargeStart = Sound {
                    Bank = 'UASWeapon',
                    Cue = 'UAS0401_Cannon_Oblv_Charge',
                    LodCutoff = 'WeaponBig_LodCutoff',
                },
            },
            BallisticArc = 'RULEUBA_LowArc',
            CollideFriendly = false,
            Damage = 6000,
            DamageRadius = 6,
            DamageType = 'Normal',
            DisplayName = 'Oblivion Cannon',
            FireTargetLayerCapsTable = {
                Land = 'Land|Water|Seabed',
                Water = 'Land|Water|Seabed',
                Air = 'Land|Water|Seabed',
            },
            FiringRandomness = 3.3,
            FiringTolerance = 0,
            Label = 'MainGun01',                                                  -- Oblivion left
            MaxRadius = 40,
            MuzzleChargeDelay = 0.5,
            MuzzleSalvoDelay = 0,
            MuzzleSalvoSize = 1,
            MuzzleVelocity = 30,
            MuzzleVelocityReduceDistance = 130,
            NotExclusive = true,
            ProjectileId = '/projectiles/ADFOblivionCannon04/ADFOblivionCannon04_proj.bp',
            ProjectileLifetime = 10,
            RackBones = {
                {
                    MuzzleBones = {
                        'Muzzle_L',
                    },
                    RackBone = 'Turret_Left',
                },
            },
            RackFireTogether = false,
            RackRecoilDistance = 0,
            RackReloadTimeout = 10,
            RackSalvoChargeTime = 0,
            RackSalvoReloadTime = 0,
            RackSalvoSize = 1,
            RackSlavedToTurret = false,
            RangeCategory = 'UWRC_DirectFire',
            RateOfFire = 0.2,
            SlavedToBody = false,
            TargetCheckInterval = 5,
            TargetPriorities = {
                'SPECIALHIGHPRI',
                'DEFENSE',
                'TECH3 MOBILE',
                'TECH2 MOBILE',
                'TECH1 MOBILE',
                'SPECIALLOWPRI',
                'ALLUNITS',
            },
            TargetRestrictDisallow = 'UNTARGETABLE',
            TrackingRadius = 1.15,
            TurretBoneMuzzle = 'Muzzle_L',
            TurretBonePitch = 'Turret_Left',
            TurretBoneYaw = 'Turret_Left',
            TurretDualManipulators = false,
            TurretPitch = 40,
            TurretPitchRange = 50,
            TurretPitchSpeed = 30,
            TurretYaw = 0,
            TurretYawRange = 180,
            TurretYawSpeed = 10,
            Turreted = true,
            WeaponCategory = 'Direct Fire Naval',
        },
        {
            AlwaysRecheckTarget = true,
            AimsStraightOnDisable = true,
            Audio = {
                BeamLoop = Sound {
                    Bank = 'URLWeapon',
                    Cue = 'URL0402_Beam_Loop',
                    LodCutoff = 'Weapon_LodCutoff',
                },
                BeamStart = Sound {
                    Bank = 'TM_AEONWEAPONS',
                    Cue = 'AEONNOVACATBLUELASERFX',
                    LodCutoff = 'Weapon_LodCutoff',
                },
                BeamStop = Sound {
                    Bank = 'URLWeapon',
                    Cue = 'URL0402_Beam_Stop',
                    LodCutoff = 'Weapon_LodCutoff',
                },
                Unpack = Sound {
                    Bank = 'URLWeapon',
                    Cue = 'URL0402_Beam_Charge',
                    LodCutoff = 'Weapon_LodCutoff',
                },
            },
            BallisticArc = 'RULEUBA_LowArc',
            BeamCollisionDelay = 0.1,
            BeamLifetime = 1.2,
            CannotAttackGround = true,
            CollideFriendly = false,
            ContinuousBeam = false,
            Damage = 480,
            DamageFriendly = false,
            DamageType = 'Normal',
            DamageRadius = 2,
            DisplayName = 'Blue Laser',
            FireTargetLayerCapsTable = {
                Land = 'Air',
                Water = 'Air',
                Air = 'Air',
            },
            FiringRandomness = 0,
            FiringTolerance = 1.1,
            Label = 'laserblue3',                                          --aa 3
            MaxRadius = 55,
            MuzzleSalvoDelay = 0,
            MuzzleSalvoSize = 1,
            RackBones = {
                {
                    MuzzleBones = {
                        'Muzzle_F',
                    },
                    RackBone = 'Turret_Front',
                },
            },
            RackFireTogether = false,
            RackRecoilDistance = 0,
            RackReloadTimeout = 10,
            RackSalvoChargeTime = 0,
            RackSalvoReloadTime = 0,
            RackSalvoSize = 1,
            RackSlavedToTurret = false,
            RangeCategory = 'UWRC_AntiAir',
            RateOfFire = 0.05,
            TargetCheckInterval = 1.4,
            TargetPriorities = {
                'EXPERIMENTAL',
                'SPECIALHIGHPRI',
                'AIR MOBILE HIGHPRIAIR',
                'AIR MOBILE TECH3 BOMBER',
                'AIR MOBILE BOMBER',
                'AIR MOBILE GROUNDATTACK',
                'AIR MOBILE TRANSPORTATION',
                'AIR MOBILE',
                'ALLUNITS',
            },
            TargetRestrictDisallow = 'UNTARGETABLE',
            TrackingRadius = 1.4,
            TurretBoneMuzzle = 'Muzzle_F',
            TurretBonePitch = 'Turret_Front',
            TurretBoneYaw = 'Turret_Front',
            TurretDualManipulators = false,
            TurretPitch = 0,
            TurretPitchRange = 145,
            TurretPitchSpeed = 50,
            TurretYaw = 0,
            TurretYawRange = 180,
            TurretYawSpeed = 50,
            Turreted = true,
            WeaponCategory = 'Anti Air',
        },
        {
            AboveWaterTargetsOnly = true,
            Audio = {
                Fire = Sound {
                    Bank = 'UALWeapon',
                    Cue = 'UAB2301_Cannon_Oblivion_Fire',
                    LodCutoff = 'Weapon_LodCutoff',
                },
                MuzzleChargeStart = Sound {
                    Bank = 'UALWeapon',
                    Cue = 'UAB2301_Cannon_Oblivion_Charge',
                    LodCutoff = 'Weapon_LodCutoff',
                },
            },
            BallisticArc = 'RULEUBA_LowArc',
            CollideFriendly = false,
            Damage = 600,
            DamageFriendly = false,
            DamageRadius = 3,
            DamageType = 'Normal',
            DisplayName = 'Oblivion Cannon',
            FireTargetLayerCapsTable = {
                Land = 'Land|Water|Seabed',
                Water = 'Land|Water|Seabed',
                Air = 'Land|Water|Seabed',
            },
            FiringRandomness = 2.8,
            FiringTolerance = 0.5,
            Label = 'MainGun4',                                        --Oblivion PD back1
            LeadTarget = true,
            MaxRadius = 40,
            MuzzleChargeDelay = 0.5,
            MuzzleSalvoDelay = 0,
            MuzzleSalvoSize = 1,
            MuzzleVelocity = 35,
            ProjectileId = '/projectiles/ADFOblivionCannon03/ADFOblivionCannon03_proj.bp',
            ProjectileLifetimeUsesMultiplier = 1.15,
            ProjectilesPerOnFire = 1,
            RackBones = {
                {
                    MuzzleBones = {
                        'Attachpoint_Med_07',
                    },
                    RackBone = 'Attachpoint_Med_07',
                },
            },
            RackFireTogether = false,
            RackRecoilDistance = 0,
            RackReloadTimeout = 10,
            RackSalvoChargeTime = 0,
            RackSalvoFiresAfterCharge = false,
            RackSalvoReloadTime = 0,
            RackSalvoSize = 1,
            RackSlavedToTurret = false,
            RangeCategory = 'UWRC_DirectFire',
            RateOfFire = 0.55,
            TargetCheckInterval = 1,
            TargetPriorities = {
                'SPECIALHIGHPRI',
                'MOBILE',
                'STRUCTURE DEFENSE',
                'SPECIALLOWPRI',
                'ALLUNITS',
            },
            TargetRestrictDisallow = 'UNTARGETABLE',
            TrackingRadius = 1.15,
            TurretBoneMuzzle = 'Attachpoint_Med_07',
            TurretBonePitch = 'Attachpoint_Med_07',
            TurretBoneYaw = 'Attachpoint_Med_07',
            TurretDualManipulators = false,
            TurretPitch = 0,
            TurretPitchRange = 150,
            TurretPitchSpeed = 30,
            TurretYaw = 0,
            TurretYawRange = 180,
            TurretYawSpeed = 80,
            Turreted = true,
            WeaponCategory = 'Direct Fire',
            WeaponUnpacks = false,
        },
        {
            AboveWaterTargetsOnly = true,
            Audio = {
                Fire = Sound {
                    Bank = 'UALWeapon',
                    Cue = 'UAB2301_Cannon_Oblivion_Fire',
                    LodCutoff = 'Weapon_LodCutoff',
                },
                MuzzleChargeStart = Sound {
                    Bank = 'UALWeapon',
                    Cue = 'UAB2301_Cannon_Oblivion_Charge',
                    LodCutoff = 'Weapon_LodCutoff',
                },
            },
            BallisticArc = 'RULEUBA_LowArc',
            CollideFriendly = false,
            Damage = 600,
            DamageFriendly = false,
            DamageRadius = 3,
            DamageType = 'Normal',
            DisplayName = 'Oblivion Cannon',
            FireTargetLayerCapsTable = {
                Land = 'Land|Water|Seabed',
                Water = 'Land|Water|Seabed',
                Air = 'Land|Water|Seabed',
            },
            FiringRandomness = 2.5,
            FiringTolerance = 1.5,
            Label = 'MainGun5',                                               --Oblivion PD back2
            LeadTarget = true,
            MaxRadius = 40,
            MuzzleChargeDelay = 0.5,
            MuzzleSalvoDelay = 0,
            MuzzleSalvoSize = 1,
            MuzzleVelocity = 35,
            ProjectileId = '/projectiles/ADFOblivionCannon03/ADFOblivionCannon03_proj.bp',
            ProjectileLifetimeUsesMultiplier = 1.15,
            ProjectilesPerOnFire = 1,
            RackBones = {
                {
                    MuzzleBones = {
                        'Right_Attachpoint06',
                    },
                    RackBone = 'Right_Attachpoint06',
                },
            },
            RackFireTogether = false,
            RackRecoilDistance = 0,
            RackReloadTimeout = 10,
            RackSalvoChargeTime = 0,
            RackSalvoFiresAfterCharge = false,
            RackSalvoReloadTime = 0,
            RackSalvoSize = 1,
            RackSlavedToTurret = false,
            RangeCategory = 'UWRC_DirectFire',
            RateOfFire = 0.75,
            TargetCheckInterval = 1,
            TargetPriorities = {
                'SPECIALHIGHPRI',
                'MOBILE',
                'STRUCTURE DEFENSE',
                'SPECIALLOWPRI',
                'ALLUNITS',
            },
            TargetRestrictDisallow = 'UNTARGETABLE',
            TrackingRadius = 1.15,
            TurretBoneMuzzle = 'Right_Attachpoint06',
            TurretBonePitch = 'Right_Attachpoint06',
            TurretBoneYaw = 'Right_Attachpoint06',
            TurretDualManipulators = false,
            TurretPitch = 0,
            TurretPitchRange = 150,
            TurretPitchSpeed = 30,
            TurretYaw = 0,
            TurretYawRange = 180,
            TurretYawSpeed = 20,
            Turreted = true,
            WeaponCategory = 'Direct Fire',
            WeaponUnpacks = false,
        },
        {
            AboveWaterTargetsOnly = true,
            Audio = {
                Fire = Sound {
                    Bank = 'UALWeapon',
                    Cue = 'UAB2301_Cannon_Oblivion_Fire',
                    LodCutoff = 'Weapon_LodCutoff',
                },
                MuzzleChargeStart = Sound {
                    Bank = 'UALWeapon',
                    Cue = 'UAB2301_Cannon_Oblivion_Charge',
                    LodCutoff = 'Weapon_LodCutoff',
                },
            },
            BallisticArc = 'RULEUBA_LowArc',
            CollideFriendly = false,
            Damage = 600,
            DamageFriendly = false,
            DamageRadius = 3,
            DamageType = 'Normal',
            DisplayName = 'Oblivion Cannon',
            FireTargetLayerCapsTable = {
                Land = 'Land|Water|Seabed',
                Water = 'Land|Water|Seabed',
                Air = 'Land|Water|Seabed',
            },
            FiringRandomness = 3.1,
            FiringTolerance = 0.5,
            Label = 'MainGun6',                                                --Oblivion PD 3
            LeadTarget = true,
            MaxRadius = 40,
            MuzzleChargeDelay = 0.5,
            MuzzleSalvoDelay = 0,
            MuzzleSalvoSize = 1,
            MuzzleVelocity = 35,
            ProjectileId = '/projectiles/ADFOblivionCannon03/ADFOblivionCannon03_proj.bp',
            ProjectileLifetimeUsesMultiplier = 1.15,
            ProjectilesPerOnFire = 1,
            RackBones = {
                {
                    MuzzleBones = {
                        'Attachpoint_Med_06',
                    },
                    RackBone = 'Attachpoint_Med_06',
                },
            },
            RackFireTogether = false,
            RackRecoilDistance = 0,
            RackReloadTimeout = 10,
            RackSalvoChargeTime = 0,
            RackSalvoFiresAfterCharge = false,
            RackSalvoReloadTime = 0,
            RackSalvoSize = 1,
            RackSlavedToTurret = false,
            RangeCategory = 'UWRC_DirectFire',
            RateOfFire = 0.45,
            TargetCheckInterval = 1,
            TargetPriorities = {
                'SPECIALHIGHPRI',
                'MOBILE',
                'STRUCTURE DEFENSE',
                'SPECIALLOWPRI',
                'ALLUNITS',
            },
            TargetRestrictDisallow = 'UNTARGETABLE',
            TrackingRadius = 1.15,
            TurretBoneMuzzle = 'Attachpoint_Med_06',
            TurretBonePitch = 'Attachpoint_Med_06',
            TurretBoneYaw = 'Attachpoint_Med_06',
            TurretDualManipulators = false,
            TurretPitch = 0,
            TurretPitchRange = 150,
            TurretPitchSpeed = 30,
            TurretYaw = 0,
            TurretYawRange = 180,
            TurretYawSpeed = 80,
            Turreted = true,
            WeaponCategory = 'Direct Fire',
            WeaponUnpacks = false,
        },       
        {
            AboveWaterTargetsOnly = true,
            Audio = {
                Fire = Sound {
                    Bank = 'TM_AEONWEAPONS',
                    Cue = 'BROT3HAMPLASMAFIRE',
                    LodCutoff = 'Weapon_LodCutoff',
                },
            },
            BallisticArc = 'RULEUBA_LowArc',
            CollideFriendly = false,
            Damage = 400,
            DamageRadius = 5,
            DamageType = 'Normal',
            DamageFriendly = false,
            DisplayName = 'Cluster rockets',
            FireTargetLayerCapsTable = {
                Land = 'Land|Water|Seabed',
                Water = 'Land|Water|Seabed',
                Air = 'Land|Water|Seabed',
            },
            FiringTolerance = 2,
            Label = 'bigGun',                                                             -- cluster rockets
            MaxRadius = 40,
            MinRadius = 10,
            MuzzleChargeDelay = 2,
            MuzzleSalvoDelay = 0,
            MuzzleSalvoSize = 1,
            MuzzleVelocity = 15,
            ProjectileId = '/mods/TotalMayhem/projectiles/BROT3BTBOTproj/BROT3BTBOTproj_proj.bp',
            ProjectileLifetimeUsesMultiplier = 3,
            ProjectilesPerOnFire = 1,
            RackBones = {
                {
                    MuzzleBones = {
                        'Attachpoint_Lrg_01',
                        'Attachpoint_Lrg_02',
                    },
                    RackBone = 'Attachpoint_Lrg_01',
                },
            },
            RackFireTogether = false,
            RackRecoilDistance = 0,
            RackReloadTimeout = 10,
            RackSalvoChargeTime = 0,
            RackSalvoReloadTime = 0,
            RackSalvoSize = 1,
            RackSlavedToTurret = false,
            RangeCategory = 'UWRC_IndirectFire',
            RateOfFire = 0.045,
            RenderFireClock = true,
            TargetCheckInterval = 0.5,
            TargetPriorities = {
                'EXPERIMENTAL',
                'SPECIALHIGHPRI',
                'TECH3 MOBILE',
                'TECH2 MOBILE',
                'TECH1 MOBILE',
                'STRUCTURE DEFENSE',
                'SPECIALLOWPRI',
                'ALLUNITS',
            },
            TargetRestrictDisallow = 'UNTARGETABLE',
            TrackingRadius = 1,
            TurretBoneMuzzle = 'Attachpoint_Lrg_01',
            TurretBonePitch = 'Attachpoint_Lrg_01',
            TurretBoneYaw = 'Attachpoint_Lrg_01',
            TurretDualManipulators = false,
            TurretPitch = 0,
            TurretPitchRange = 90,
            TurretPitchSpeed = 190,
            TurretYaw = 0,
            TurretYawRange = 60,
            TurretYawSpeed = 190,
            Turreted = true,
            WeaponCategory = 'Direct Fire Experimental',
            WeaponRepackTimeout = 0,
            WeaponUnpacks = false,
       },
        {
            Damage = 100333,
            DamageFriendly = true,
            DamageRadius = 28,
            DamageType = 'Normal',
            DisplayName = 'Air Crash',
            DummyWeapon = true,
            FiringTolerance = 2,
            Label = 'DeathImpact',
            WeaponCategory = 'Death',
        },
    },
    Wreckage = {
        Blueprint = '/props/DefaultWreckage/DefaultWreckage_prop.bp',
        EnergyMult = 0,
        HealthMult = 0.9,
        MassMult = 0.1,
        ReclaimTimeMultiplier = 1,
        WreckageLayers = {
            Air = false,
            Land = true,
            Seabed = false,
            Sub = false,
            Water = false,
        },
    },
}

Statistics: Posted by DDDX — 05 Nov 2018, 14:34


]]>
2018-11-04T15:19:41+02:00 2018-11-04T15:19:41+02:00 /viewtopic.php?t=16863&p=169238#p169238 <![CDATA[Re: Variable drones number based on enhancement]]>
Code:
DroneSetup2 = function(self)
        -- Drone handle table, used to issue orders to all drones at once
        self.DroneTable = {}

When you call your code part at the enhancement, you clear the current DroneTable to be replaced with your own. But what about the 2 existing BO drones ?
You call again some maintenance existing thread, and that not quite good for code stability.

Here is the tread that orders drone repairs then rebuild. If your drones don't rebuild, there is something that should be wrong in the rebuild conditions.
Code:
    DroneMaintenanceState = State {
        Main = function(self)
            self.DroneMaintenance = true           
            -- Resume any interrupted drone rebuilds
            if self.BuildingDrone then
                ChangeState(self, self.DroneRebuildingState)
            end           
            -- Check for dead or damaged drones
            while self and not self:IsDead() and not self.BuildingDrone do
                for droneName, droneData in self.DroneData do
                    if not droneData.Active or (droneData.Active and droneData.Damaged and droneData.Docked) then
                        self.BuildingDrone = droneName
                        ChangeState(self, self.DroneRebuildingState)
                    end
                end
                WaitTicks(2)
            end
        end,

        OnPaused = function(self)
            ChangeState(self, self.PausedState)
        end,
    },


So Im not sure that theses conditions are valid after your setup2 :
Code:
if not droneData.Active or (droneData.Active and droneData.Damaged and droneData.Docked) then


So a simple fix maybe use the table.insert function instead a clear and deepcopy

So your setup2 (you should change the name of setup2 by a more reco name) should be modified

So your setup2 code part :
Code:
    -- Initial drone setup - loads globals, DroneData table, and creates drones
    DroneSetup2 = function(self)
        -- Drone handle table, used to issue orders to all drones at once
        self.DroneTable = {}
       
        -- Drone construction globals
        self.BuildingDrone = false
        self.ControlRange = self:GetBlueprint().AI.DroneControlRange or 70
        self.ReturnRange = self:GetBlueprint().AI.DroneReturnRange or (ControlRange / 2)
        self.AssistRange = self.ControlRange + 10
        self.AirMonitorRange = self:GetBlueprint().AI.AirMonitorRange or (self.AssistRange / 2)
        self.HeartBeatInterval = self:GetBlueprint().AI.AssistHeartbeatInterval or 1

        self.DroneData = table.deepcopy(self:GetBlueprint().DroneData2)
       
        -- Load other data from drone BP and spawn drones
        for droneName, droneData in self.DroneData do
            -- Set drone name variable
            if not droneData.Name then
                droneData.Name = droneName
            end
            droneData.Blueprint = table.deepcopy(GetUnitBlueprintByName(droneData.UnitID))
            droneData.Economy = droneData.Blueprint.Economy
            droneData.BuildProgress = 1

            -- Create this drone
            self:ForkThread(self.CreateDrone, droneName)
        end
           
        -- Assist/monitor heartbeat thread
        self.HeartBeatThread = self:ForkThread(self.AssistHeartBeat)
       
        -- Begin drone maintenance monitoring
        ChangeState(self, self.DroneMaintenanceState)
    end,
   


Should be more like this one :
Code:
   
   -- Enh new drone setup - creates 2 new drones from enh
    AddingEnhDronesSetup = function(self)
   
      local NewdronesFromEnh = table.deepcopy(self:GetBlueprint().DroneData2)
      table.insert(self.DroneTable, NewdronesFromEnh)
 
        -- Load other data from drone BP and spawn drones from enh
        for droneName, droneData in NewdronesFromEnh do
            -- Set drone name variable
            if not droneData.Name then
                droneData.Name = droneName
            end
            droneData.Blueprint = table.deepcopy(GetUnitBlueprintByName(droneData.UnitID))
            droneData.Economy = droneData.Blueprint.Economy
            droneData.BuildProgress = 1

            -- Create this drone
            self:ForkThread(self.CreateDrone, droneName)
        end
    end,


I can't test this code, but it should give you some help and direction for fixing your code.

Statistics: Posted by Franck83 — 04 Nov 2018, 15:19


]]>
2018-11-03T10:17:18+02:00 2018-11-03T10:17:18+02:00 /viewtopic.php?t=16863&p=169193#p169193 <![CDATA[Re: Variable drones number based on enhancement]]>
A side thought, if we get this code to behave like it should, it could I guess give the ability to have several different units as drones, provided which enhancement you obtain and which DroneData table is called. Imagine a Blackops acu that can have builder drones OR fighter drones, depending what you pick (a suggestion perhaps for future BO:ACUs update ;)

Statistics: Posted by DDDX — 03 Nov 2018, 10:17


]]>