Forged Alliance Forever Forged Alliance Forever Forums 2015-06-05T00:56:30+02:00 /feed.php?f=41&t=9957 2015-06-05T00:56:30+02:00 2015-06-05T00:56:30+02:00 /viewtopic.php?t=9957&p=100976#p100976 <![CDATA[Re: how move sera regen(+new max hp) aura on units?]]>
Here is the script and bp for the ship.

Code:
local SSeaUnit = import('/lua/seraphimunits.lua').SSeaUnit
local Buff                 = import('/lua/sim/Buff.lua')

local EffectTemplate       = import('/lua/EffectTemplates.lua')
local Entity               = import('/lua/sim/Entity.lua').Entity
local AIUtils              = import('/lua/AI/aiutilities.lua')


tcss0201 = Class(SSeaUnit) {

    ShieldEffects = {
        '/effects/emitters/seraphim_regenerative_aura_01_emit.bp',
    },


    # Copy of XSL0001_script's RegenBuffThread with slight alterations (Enhancement and RegenField)
    RegenBuffThread = function(self)
        while not self:IsDead() do
            # Get friendly units in the area (including self)
            local units = AIUtils.GetOwnUnitsAroundPoint(self:GetAIBrain(), categories.ALLUNITS, self:GetPosition(), self:GetBlueprint().RegenAura.RegenRadius)

            # Give them a 5 second regen buff
            for _,unit in units do
                Buff.ApplyBuff(unit, 'SeraphimRegenFieldMoo')
            end

            #Wait 5 seconds
            WaitSeconds(5)
        end
    end,


    OnStopBeingBuilt = function( self, builder, layer )

        SSeaUnit.OnStopBeingBuilt( self, builder, layer )

   self.ShieldEffectsBag = {}
    end,


    OnCreate = function(self)

        SSeaUnit.OnCreate(self)

        if not self.ShieldEffectsBag then
            self.ShieldEffectsBag = {}
        end
               
        local bpRA = self:GetBlueprint().RegenAura

        if not Buffs['SeraphimRegenFieldMoo'] then
            BuffBlueprint {
                Name        = 'SeraphimRegenFieldMoo',
                DisplayName = 'SeraphimRegenFieldMoo',
                BuffType    = 'COMMANDERAURA',
                Stacks      = 'REPLACE',
                Duration    = 5,
                Affects     = {
                    RegenPercent = {
                        Add   = 0,
                        Mult  = bpRA.RegenPerSecond or 0.1,
                        Ceil  = bpRA.RegenCeiling,
                        Floor = bpRA.RegenFloor,
                    },
                },
            }
        end

        table.insert( self.ShieldEffectsBag, CreateAttachedEmitter( self, 'XSS0304', self:GetArmy(), '/effects/emitters/seraphim_regenerative_aura_01_emit.bp' ) )
        self.RegenThreadHandle = self:ForkThread(self.RegenBuffThread)

    end,

}


Code:
UnitBlueprint {
    AI = {
        GuardRadius = 10,
        TargetBones = {
            'XSS0304',
        },
    },
    Audio = {
        AmbientMove = Sound {
            Bank = 'XSL',
            Cue = 'XSL0307_Move_Loop',
            LodCutoff = 'UnitMove_LodCutoff',
        },
        Destroyed = Sound {
            Bank = 'XSL_Destroy',
            Cue = 'XSL_Destroy_Land_Lrg',
            LodCutoff = 'UnitMove_LodCutoff',
        },
        StartMove = Sound {
            Bank = 'XSL',
            Cue = 'XSL0307_Move_Start',
            LodCutoff = 'UnitMove_LodCutoff',
        },
        StopMove = Sound {
            Bank = 'XSL',
            Cue = 'XSL0307_Move_Stop',
            LodCutoff = 'UnitMove_LodCutoff',
        },
        UISelection = Sound {
            Bank = 'SeraphimSelect',
            Cue = 'Seraphim_Select_Naval',
            LodCutoff = 'UnitMove_LodCutoff',
        },
    },
    Buffs = {
        Regen = {
            Level1 = 1,
            Level2 = 2,
            Level3 = 4,
            Level4 = 6,
            Level5 = 8,
        },
    },
    BuildIconSortPriority = 50,
    Categories = {
      'PRODUCTFA',
        'SELECTABLE',
        'BUILTBYTIER2FACTORY',
        'BUILTBYTIER3FACTORY',
        'SERAPHIM',
        'MOBILE',
        'SHIELD',
      'DEFENSE',
        'NAVAL',
        'TECH2',
        'VISIBLETORECON',
        'RECLAIMABLE',
        'OVERLAYMISC',
      'DEFENSIVEBOAT',
    },
    Defense = {
        AirThreatLevel = 0,
        ArmorType = 'Normal',
        EconomyThreatLevel = 0,
        Health = 3000,
        MaxHealth = 3000,
        RegenRate = 30,
        SubThreatLevel = 0,
        SurfaceThreatLevel = 9,
    },
    Description = '<LOC tcss0201_desc>Regen Field Generator',
    Display = {
        Abilities = {
            '<LOC ability_regeneration>Regeneration Field',
        },
        IdleEffects = {
            Water = {
                Effects = {
                    {
                        Bones = {
                            'XSS0304',
                        },
                        Scale = 0.5,
                        Type = 'SeaIdle01',
                    },
                },
            },
        },
        Mesh = {
            IconFadeInZoom = 130,
            LODs = {
                {
                    LODCutoff = 120,
                    LookupName = '/textures/environment/Falloff_seraphim_lookup.dds',
                    Scrolling = true,
                    ShaderName = 'Seraphim',
                },
                {
                    AlbedoName = 'tcss0201_lod1_albedo.dds',
                    LODCutoff = 180,
                    LookupName = '/textures/environment/Falloff_seraphim_lookup.dds',
                    ShaderName = 'Seraphim',
                    SpecularName = 'tcss0201_lod1_specteam.dds',
                },
            },
        },
        MovementEffects = {
            Water = {
                Effects = {
                    {
                        Bones = {
                            'XSS0304',
                        },
                        Offset = {
                            0,
                            0,
                            -0.5,
                        },
                        Scale = 0.9,
                        Type = 'BackWake',
                    },
                },
            },
        },
        PlaceholderMeshName = 'UXL0009',
        SpawnRandomRotation = true,
        UniformScale = 0.04,
    },
    Economy = {
        BuildCostEnergy = 12000,
        BuildCostMass = 1000,
        BuildTime = 3200,
        MaintenanceConsumptionPerSecondEnergy = 200,
        TeleportEnergyMod = 0.15,
        TeleportMassMod = 1,
        TeleportTimeMod = 0.01,
    },
   CollisionOffsetY = -0,
    General = {
        Category = 'Ship',
        Classification = 'RULEUC_MilitaryShip',
        CommandCaps = {
            RULEUCC_Attack = false,
            RULEUCC_CallTransport = false,
            RULEUCC_Capture = false,
            RULEUCC_Guard = true,
            RULEUCC_Move = true,
            RULEUCC_Nuke = false,
            RULEUCC_Patrol = true,
            RULEUCC_Pause = false,
            RULEUCC_Reclaim = false,
            RULEUCC_Repair = false,
            RULEUCC_RetaliateToggle = false,
            RULEUCC_Stop = true,
            RULEUCC_Transport = false,
        },
        FactionName = 'Seraphim',
        Icon = 'sea',
        TechLevel = 'RULEUTL_Advanced',
        UnitName = '<LOC tcss0201_name>Ztheris-ioz',
        UnitWeight = 1,
    },
    Intel = {
        VisionRadius = 32,
      WaterVisionRadius = 32,
    },
    Interface = {
        HelpText = '<LOC tcss0201_help>Regen Field Generator',
    },
    LifeBarHeight = 0.075,
    LifeBarOffset = 1.5,
    LifeBarSize = 0.75,
    Physics = {
        BackUpDistance = 5,
        BankingSlope = 0,
        BuildOnLayerCaps = {
            LAYER_Air = false,
            LAYER_Land = false,
            LAYER_Orbit = false,
            LAYER_Seabed = false,
            LAYER_Sub = false,
            LAYER_Water = true,
        },
        CatchUpAcc = 10,
        DragCoefficient = 0.2,
        MaxAcceleration = 7,
        MaxBrake = 7,
        MaxSpeed = 7,
        MaxSpeedReverse = 7,
        MaxSteerForce = 5,
        MeshExtentsX = 2.25,
        MeshExtentsY = 2,
        MeshExtentsZ = 12,
        MinSpeedPercent = 0,
        MotionType = 'RULEUMT_Water',
        TurnRadius = 10,
        TurnRate = 60,
    },
    RegenAura = {
        RegenRadius    = 36,
        RegenCeiling   = 600,
        RegenFloor     = 0,
        RegenPerSecond = 0.005,
    },
    SelectionSizeX = 0.6,
    SelectionSizeZ = 1.8,
    SelectionThickness = 0.37,
    SizeX = 1,
    SizeY = 0.8,
    SizeZ = 2.6,
    StrategicIconName = 'icon_ship2_shield',
    StrategicIconSortPriority = 125,
}




Enjoy!

Edit: Oh, and my mod with the Regen Field building is already done. I tried to upload it to the vault, but I'm not sure if it took right. Its called CiviliansV2. Its a mod that adds the civilian buildings to multiplayer with various modifications.

Statistics: Posted by RavenCurow — 05 Jun 2015, 00:56


]]>
2015-06-04T13:49:25+02:00 2015-06-04T13:49:25+02:00 /viewtopic.php?t=9957&p=100953#p100953 <![CDATA[Re: how move sera regen(+new max hp) aura on units?]]> didnt you add something else on blue print?

On with mod you wan making this building, its seems interesting, and if its done would like see it in all in reality,, and thx for reply also imagine sera building with this ability.

Statistics: Posted by Ithilis_Quo — 04 Jun 2015, 13:49


]]>
2015-06-02T07:31:06+02:00 2015-06-02T07:31:06+02:00 /viewtopic.php?t=9957&p=100819#p100819 <![CDATA[Re: how move sera regen(+new max hp) aura on units?]]>
Script
Code:
AmbientEffects = 'ST2PowerAmbient',
       ShieldEffects = {
        '/effects/emitters/seraphim_regenerative_aura_01_emit.bp',
       },
       
    --OnStopBeingBuilt = function(self,builder,layer)
   --    SStructureUnit.OnCreate(self,builder,layer)
   --    self:DisableUnitIntel('CloakField')
   -- end,


    # Copy of XSL0001_script's RegenBuffThread with slight alterations (Enhancement and RegenField)
    RegenBuffThread = function(self)
        while not self:IsDead() do
            # Get friendly units in the area (including self)
            local units = AIUtils.GetOwnUnitsAroundPoint(self:GetAIBrain(), categories.ALLUNITS, self:GetPosition(), self:GetBlueprint().RegenAura.RegenRadius)

            # Give them a 5 second regen buff
            for _,unit in units do
                Buff.ApplyBuff(unit, 'SeraphimRegenFieldMoo')
            end

            #Wait 5 seconds
            WaitSeconds(5)
        end
    end,




    OnStopBeingBuilt = function(self)

        SStructureUnit.OnStopBeingBuilt(self)
      self:SetMaintenanceConsumptionActive()
      self:DisableUnitIntel('CloakField')
        if not self.ShieldEffectsBag then
            self.ShieldEffectsBag = {}
        end
        self.ShieldEffectsBag = {}
        local army =  self:GetArmy()
        if self.AmbientEffects then
            for k, v in EffectTemplate[self.AmbientEffects] do
            CreateAttachedEmitter(self, 'XSC2201', army, v):ScaleEmitter(0)
            end
        end
               
        local bp = self:GetBlueprint().RegenAura

        if not Buffs['SeraphimRegenFieldMoo'] then
            BuffBlueprint {
                Name = 'SeraphimRegenFieldMoo',
                DisplayName = 'SeraphimRegenFieldMoo',
                BuffType = 'COMMANDERAURA',
                Stacks = 'REPLACE',
                Duration = 5,
                Affects = {
                    RegenPercent = {
                        Add = 0,
                        Mult = bp.RegenPerSecond or 0.1,
                        Ceil = bp.RegenCeiling,
                        Floor = bp.RegenFloor,
                    },
                    #MaxHealth = {
                    #    Add = 0,
                    #    Mult = bp.MaxHealthFactor or 1.0,
                    #    DoNoFill = true,
                    #},                       
                },
            }
        end

        table.insert( self.ShieldEffectsBag, CreateAttachedEmitter( self, 'XSC2201', self:GetArmy(), '/effects/emitters/seraphim_regenerative_aura_01_emit.bp' ) )
        self.RegenThreadHandle = self:ForkThread(self.RegenBuffThread)

    end,

The disable unit intel line is because I used a cloak field radius line in the bp to act as a visual representation of the regen field radius.

Now you may have to tailor this to your unit script as this is for a structure and not a naval unit.

In the bp I added this into the physics lines

Code:
RegenAura = {
        RegenRadius    = 10,
        RegenCeiling   = 200,
        RegenFloor     = 0,
        RegenPerSecond = 0.1,
        MaxHealthFactor = 1.1,
    },

Statistics: Posted by RavenCurow — 02 Jun 2015, 07:31


]]>
2015-05-20T02:23:39+02:00 2015-05-20T02:23:39+02:00 /viewtopic.php?t=9957&p=100278#p100278 <![CDATA[Re: how move sera regen(+new max hp) aura on units?]]> I'm not sure where the call would be, which was why I was trying to figure out how to add it to the blueprint, but I don't really know much about the blueprint, so I would ask resin_smoker or crotalus or coding_squirrel

Statistics: Posted by quark036 — 20 May 2015, 02:23


]]>
2015-05-18T21:55:16+02:00 2015-05-18T21:55:16+02:00 /viewtopic.php?t=9957&p=100223#p100223 <![CDATA[Re: how move sera regen(+new max hp) aura on units?]]>
what i do in code. on units script on end i add this code (its copypast from xsl0001 script):

Code:
################### CARRIER BUFF ###############
   
   RegenBuffThread = function(self)
        local bp = self:GetBlueprint().Enhancements.RegenAura
        local unitCat = ParseEntityCategory( bp.UnitCategory or 'BUILTBYTIER3FACTORY + BUILTBYQUANTUMGATE + NEEDMOBILEBUILD')

        while not self:IsDead() do
            #Get friendly units in the area (including self)
            local units = AIUtils.GetOwnUnitsAroundPoint(self:GetAIBrain(), unitCat, self:GetPosition(), bp.Radius)
           
            #Give them a 5 second regen buff
            for _,unit in units do
                Buff.ApplyBuff(unit, 'SeraphimACURegenAura')
            end
           
            #Wait 5 seconds
            WaitSeconds(5)
        end
    end,
   
   
   CreateEnhancement = function(self, enh)
        SWalkingLandUnit.CreateEnhancement(self, enh)

        local bp = self:GetBlueprint().Enhancements[enh]
       
        # Regenerative Aura
        if enh == 'RegenAura' then

            if not Buffs['SeraphimACURegenAura'] then   # AURA BUFF
                BuffBlueprint {
                    Name = 'SeraphimACURegenAura',
                    DisplayName = 'SeraphimACURegenAura',
                    BuffType = 'COMMANDERAURA',
                    Stacks = 'REPLACE',
                    Duration = 5,
                    Affects = {
                        RegenPercent = {
                            Add = 0,
                            Mult = bp.RegenPerSecond or 0.1,
                            Ceil = bp.RegenCeiling,
                            Floor = bp.RegenFloor,
                        },
                    },
                }
            end


on blue print under buff section add this:

Code:
BuffFields = {
        RegenField = 'SeraphimACURegenBuffField',
    },


It was nothing say about concrete buff, so i was think it would found data from another file what define bufffield what is on unit.lua. because nothing happend, so i also add this section, and put it under buffFields:
Code:
   RegenAura = {
            ACUAddHealth = 1000,         #added
            BuildCostEnergy = 4500,
            BuildCostMass = 600,
            BuildTime = 600,
            Icon = 'nrf',
            Name = '<LOC enhancements_0125>Restoration Field',
            Radius = 22, # 15
            RegenCeiling = 15, # 75
            RegenFloor = 0,
            RegenPerSecond = 0.02, # 0.0055555555
            UnitCategory = 'BUILTBYTIER3FACTORY, BUILTBYQUANTUMGATE, NEEDMOBILEBUILD',      #added
        },



but still nothing happend. This was loking too easy, and dont work, or i do something dumb :/
on maintance, i probably need new toggle for new function. or use old toggle that loks similar I know how to set maintance, problem is that dont know how to set new function, to work, and where in .bp add new section about this function.

Statistics: Posted by Ithilis_Quo — 18 May 2015, 21:55


]]>
2015-05-18T03:02:56+02:00 2015-05-18T03:02:56+02:00 /viewtopic.php?t=9957&p=100182#p100182 <![CDATA[Re: how move sera regen(+new max hp) aura on units?]]>
I'm not sure about the energy toggle, sorry. You could probably copy code from things like the stealth on cybran fighters. That would be fairly similar-energy for an ability.

Statistics: Posted by quark036 — 18 May 2015, 03:02


]]>
2015-05-17T00:18:35+02:00 2015-05-17T00:18:35+02:00 /viewtopic.php?t=9957&p=100144#p100144 <![CDATA[how move sera regen(+new max hp) aura on units?]]>
My plan is have units (carrier) with similar aura as have seraphin ACU (new max hp and some regeneration), but because its on ACU on Enchancment part i dont know how and where i can copypast it. (And because i want this aura consumption some energy with toggle, would like for toggle use same symbol aura on acu upgrade, but dont know where i must add new toggle, and also where i can found sera aura icon)

Can someone give me advice how to do it ? (advice can be on very basic programing level :) )

Statistics: Posted by Ithilis_Quo — 17 May 2015, 00:18


]]>