FAForever Forums
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Login
    The current pre-release of the client ("pioneer" in the version) is only compatible to itself. So you can only play with other testers. Please be aware!

    Need another perspective: Personal Shield enhancements, what's wrong here ?

    Scheduled Pinned Locked Moved Modding & Tools
    6 Posts 2 Posters 327 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • R Offline
      Resin_Smoker
      last edited by Resin_Smoker

      I've several 4DC units I'm working on that can self enhance to have personal shields. For all intensive purposes in comparison with the FAF client UAL0101 (Aeon commanders scripts & bp) these units should be setup correctly. However, what I am seeing is that the units can perform the enhancement but upon completions throw the following error...

      WARNING: Error running /lua/sim/tasks/EnhanceTask.lua script in CScriptObject at 1974e8f0: ...alliance\mods\4dfaf\units\ual0108\ual0108_script.lua(28): attempt to call method `CreatePersonalShield' (a nil value)
               stack traceback:
               	...alliance\mods\4dfaf\units\ual0108\ual0108_script.lua(28): in function `CreateEnhancement'-         	...gramdata\faforever\gamedata\lua.nx2\lua\sim\unit.lua(4306): in function `OnWorkEnd'
               	...rever\gamedata\lua.nx2\lua\sim\tasks\enhancetask.lua(85): in function <...rever\gamedata\lua.nx2\lua\sim\tasks\enhancetask.lua:59>
      

      I've gone over this unit with a fine tooth comb, checking and rechecking the pathing and verifying the structure of the enhancement in comparison with the Aeon commanders UAL0101 (FAF Client version).

      Unit Script

      -----------------------------------------------------------------------------
      --	File	 : /units/ual0108/ual0108_script.lua
      --
      --	Author(s): EbolaSoup, Resin Smoker, Optimus Prime, Vissroid
      --
      --	Summary  : Aeon light assault walker
      --
      --	Copyright © 2024 4DFAF, All rights reserved.
      -----------------------------------------------------------------------------
      
      local AWalkingLandUnit = import('/lua/aeonunits.lua').AWalkingLandUnit
      local ADFLaserLightWeapon = import('/lua/aeonweapons.lua').ADFLaserLightWeapon
      local AAAZealotMissileWeapon = import('/lua/aeonweapons.lua').AAAZealotMissileWeapon
      
      ual0108 = Class(AWalkingLandUnit) {
      	Weapons = {
      		MainGun = Class(ADFLaserLightWeapon) {},
      		RocketBackpack = Class(AAAZealotMissileWeapon) {},
      	},
      
      	CreateEnhancement = function(self, enh)
      		AWalkingLandUnit.CreateEnhancement(self, enh)
      		local bp = self:GetBlueprint().Enhancements[enh]
      		if enh == 'PersonalShield' then
      			self:AddToggleCap('RULEUTC_ShieldToggle')
      			self:SetEnergyMaintenanceConsumptionOverride(bp.MaintenanceConsumptionPerSecondEnergy or 0)
      			self:SetMaintenanceConsumptionActive()
      			self:CreatePersonalShield(bp)
      		elseif enh == 'PersonalShieldRemove' then
      			self:DestroyShield()
      			self:SetMaintenanceConsumptionInactive()
      			self:RemoveToggleCap('RULEUTC_ShieldToggle')
      		end
      	end,
      }
      TypeClass = ual0108
      

      Unit Blueprint snippet

      	Enhancements = {
      		Slots = {
      			Back = {
      				name = '<LOC _Back>',
      				x = -2,
      				y = -5,
      			},
      		},
      		PersonalShield = {
      			BuildCostEnergy = 200,
      			BuildCostMass = 40,
      			BuildTime = 167,
      			Icon = 'ptsg',
      			ImpactEffects = 'AeonShieldHit01',
      			MaintenanceConsumptionPerSecondEnergy = 5,
      			Name = '<LOC enhancements_0014>Personal Shield Generator',
      			OwnerShieldMesh = '/mods/4DFAF/units/ual0108/ual0108_PersonalShield_mesh',
                              PersonalShield = true,			
      			RegenAssistMult = 10,
      			ShieldEnergyDrainRechargeTime = 5,
      			ShieldMaxHealth = 150,
      			ShieldRechargeTime = 5,
      			ShieldRegenRate = 10,
      			ShieldRegenStartTime = 0.1,
      			Slot = 'Back',
      			UpgradeUnitAmbientBones = {
      				'bodyBase',
      			},
      			UpgradeEffectBones = {
      				'bodyBase',
      			},
      		},
      		PersonalShieldRemove = {
      			BuildCostEnergy = 1,
      			BuildCostMass = 1,
      			BuildTime = 0.1,
      			Icon = 'ptsg',
      			Name = '<LOC enhancements_0017>Remove Personal Shield',
      			Prerequisite = 'PersonalShield',
      			RemoveEnhancements = {
      				'PersonalShield',
      				'PersonalShieldRemove',
      			},
      			Slot = 'Back',
      		},	
      	},
      

      My unit path is /mods/4DFAF/units/ual0108....

      Can anyone spot what i may be missing from the enhancement process to throw the error posted above?

      Thanks in advance!

      Resin

      Kykhu Oss https://youtu.be/JUgyGTgeZb8
      Unit Thrower https://youtu.be/iV8YBXVxxeI
      Beam Tentacle https://youtu.be/le5SNwHvC4c
      Blackhole https://www.youtube.com/watch?v=D9NGQC5rr0c
      Resurection https://www.youtube.com/watch?v=WdbIQ4vHkMs

      R 1 Reply Last reply Reply Quote 0
      • R Offline
        Resin_Smoker @Resin_Smoker
        last edited by

        Forgot to add a copy of one of the units.
        ual0108.zip

        Kykhu Oss https://youtu.be/JUgyGTgeZb8
        Unit Thrower https://youtu.be/iV8YBXVxxeI
        Beam Tentacle https://youtu.be/le5SNwHvC4c
        Blackhole https://www.youtube.com/watch?v=D9NGQC5rr0c
        Resurection https://www.youtube.com/watch?v=WdbIQ4vHkMs

        1 Reply Last reply Reply Quote 0
        • N Online
          Nomander Balance Team
          last edited by

          I don't see a CreatePersonalShield in FAF code, did you mean CreateShield?

          R 1 Reply Last reply Reply Quote 0
          • R Offline
            Resin_Smoker @Nomander
            last edited by Resin_Smoker

            @nomander I'm not calling it directly, the create enhancement is. Same as how the commander does when it enhances itself.

            Also create shield from unit.lua contains the following...

                CreateShield = function(self, bpShield)
                    -- Copy the shield template so we don't alter the blueprint table.
                    local bpShield = table.deepcopy(bpShield)
                    self:DestroyShield()
            
                    if bpShield.PersonalShield then
                        self.MyShield = PersonalShield(bpShield, self)
                    elseif bpShield.AntiArtilleryShield then
                        self.MyShield = AntiArtilleryShield(bpShield, self)
                    elseif bpShield.PersonalBubble then
                        self.MyShield = PersonalBubble(bpShield, self)
                    elseif bpShield.TransportShield then
                        self.MyShield = TransportShield(bpShield, self)
                    else
                        self.MyShield = Shield(bpShield, self)
                    end
            
                    self:SetFocusEntity(self.MyShield)
                    self.Trash:Add(self.MyShield)
                end,
            

            Thus when create shield is called, the type of shield is later chosen.

            Kykhu Oss https://youtu.be/JUgyGTgeZb8
            Unit Thrower https://youtu.be/iV8YBXVxxeI
            Beam Tentacle https://youtu.be/le5SNwHvC4c
            Blackhole https://www.youtube.com/watch?v=D9NGQC5rr0c
            Resurection https://www.youtube.com/watch?v=WdbIQ4vHkMs

            1 Reply Last reply Reply Quote 0
            • N Online
              Nomander Balance Team
              last edited by

              self:CreatePersonalShield(bp) is a function only in the Steam version. You have to use self:CreateShield(bp) in FAF.

              1 Reply Last reply Reply Quote 0
              • R Offline
                Resin_Smoker
                last edited by

                It's working...

                Kykhu Oss https://youtu.be/JUgyGTgeZb8
                Unit Thrower https://youtu.be/iV8YBXVxxeI
                Beam Tentacle https://youtu.be/le5SNwHvC4c
                Blackhole https://www.youtube.com/watch?v=D9NGQC5rr0c
                Resurection https://www.youtube.com/watch?v=WdbIQ4vHkMs

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post