Forged Alliance Forever Forged Alliance Forever Forums 2016-12-01T01:06:25+02:00 /feed.php?f=40&t=13585 2016-12-01T01:06:25+02:00 2016-12-01T01:06:25+02:00 /viewtopic.php?t=13585&p=139841#p139841 <![CDATA[Re: [Modding] new enhancements for units]]> Statistics: Posted by vongratz — 01 Dec 2016, 01:06


]]>
2016-11-30T22:05:17+02:00 2016-11-30T22:05:17+02:00 /viewtopic.php?t=13585&p=139828#p139828 <![CDATA[Re: [Modding] new enhancements for units]]> It was the slot definitions I didn't have, totally missed that! Weirdly, it doesn't seem to relate to the issues with the ACU though.
I had the weapon stuff already ;)
thanks for the help!

Statistics: Posted by Dudekahedron — 30 Nov 2016, 22:05


]]>
2016-11-30T20:51:40+02:00 2016-11-30T20:51:40+02:00 /viewtopic.php?t=13585&p=139825#p139825 <![CDATA[Re: [Modding] new enhancements for units]]>
You'll need to define the Slots on your unit blueprint, refer to either the ACU or SCU for that. If the slots aren't defined, then the interface will throw errors, and that's likely what you're seeing. The key hint was the function 'CreateTabs'.

Secondly, you may need to define a weapon in your blueprint, like any other, and see that it's set to a disabled state when the unit is first created. I assume that you've done that by your use of the 'SetWeaponEnabledByLabel', but I just thought I'd mention it.

Statistics: Posted by Sprouto — 30 Nov 2016, 20:51


]]>
2016-11-30T19:25:11+02:00 2016-11-30T19:25:11+02:00 /viewtopic.php?t=13585&p=139818#p139818 <![CDATA[[Modding] new enhancements for units]]> Me again. Relatively simple question;
I am trying to create an enhancement for a shield generator:
Basically just adding a weapon who's muzzle is located on the shield?

From script.lua:
Code:
    CreateEnhancement = function(self, enh)
       TShieldStructureUnit.CreateEnhancement(self,enh)
       local bp = self:GetBlueprint().Enhancements[enh]
       if not bp then return end
       # Restraining order
       if enh == 'RestrainingOrder' then
          local blueprint = self:GetBlueprint()
          CreateSlider(self,'muzzle', blueprint.Defense.Shield.ShieldSize, 0, 0, 1000, true)
          self:SetWeaponEnabledByLabel('PhasonBeam',true)
       elseif enh == 'RestrainingOrderRemove' then
          local blueprint = self:GetBlueprint()
          CreateSlider(self,'muzzle', -blueprint.Defense.Shield.ShieldSize, 0, 0, 1000, true)
          self:SetWeaponEnabledByLabel('PhasonBeam',false)
       end
    end,   


From unit.bp:
Code:
    Enhancements = {
        RestrainingOrder = {
            BuildCostEnergy = 10000,
            BuildCostMass = 1000,
            BuildTime = 1000,
            Icon = 'cd',
            Name = 'Restraining Order',
            Slot = 'Back',
        },
        RestrainingOrderRemove = {
            BuildCostEnergy = 1,
            BuildCostMass = 1,
            BuildTime = 0.1,
            Icon = 'cd',
            Name = 'Remove Restraining Order',
            Prerequisite = 'RestrainingOrder',
            RemoveEnhancements = {
                'RestrainingOrder',
                'RestrainingOrderRemove',
            },
            Slot = 'Back',
        },
    },


The enhancement option doesn't appear for the unit, and I get weird glitchiness with the ACU (not sure if related), any ideas?
Code:
WARNING: Error running '/lua/ui/game/gamemain.lua:OnSelectionChanged': ...nce\gamedata\lua.scd\lua\ui\controls\specialgrid.lua(143): attempt to call method `Hide' (a nil value)
         stack traceback:
            ...nce\gamedata\lua.scd\lua\ui\controls\specialgrid.lua(143): in function `CalcVisible'
            ...nce\gamedata\lua.scd\lua\ui\controls\specialgrid.lua(167): in function `Refresh'
            ...orever\gamedata\lua.nx2\lua\ui\game\construction.lua(367): in function `OnCheck'
            ...alliance\gamedata\mohodata.scd\lua\maui\checkbox.lua(45): in function `SetCheck'
            ...orever\gamedata\lua.nx2\lua\ui\game\construction.lua(475): in function `CreateTabs'
            ...orever\gamedata\lua.nx2\lua\ui\game\construction.lua(357): in function `OnCheck'
            ...alliance\gamedata\mohodata.scd\lua\maui\checkbox.lua(45): in function `SetCheck'
            ...orever\gamedata\lua.nx2\lua\ui\game\construction.lua(2210): in function `OnSelection'
            ...\faforever\gamedata\lua.nx2\lua\ui\game\gamemain.lua(491): in function <...\faforever\gamedata\lua.nx2\lua\ui\game\gamemain.lua:465>

Thanks

Statistics: Posted by Dudekahedron — 30 Nov 2016, 19:25


]]>