Missiong icons for enhancements

Everything about mods can be found here.

Moderator: Morax

Missiong icons for enhancements

Postby DDDX » 22 Oct 2018, 16:10

Hi, community. Have a small problem that is driving me crazy.


Anyways, made my custom unit upgradeable. Gave it enhancements, and they work like a charm apart from the blasted icon.
Functionality, descriptions, removal -all else works. Whatever I do cannot get the icons to work.
A friend of mine helped make the icons for it, but...nope.
Info:
They are of proper size and format, they are in ...textures\ui\common\game\aeon-enhancements where they need to be, there are 4 versions (for up, down...)
code in my unit's bp:

Code: Select all
  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 = 12000,
                BuildCostMass = 720,
                BuildTime = 500,
                BuildableCategoryAdds = 'BUILTBYALPHAA1',
                Icon = 'turret',
                Name = 'Guardian protocol I',
                NewBuildRate = 20,
                NewHealth = 2000,
                NewRegenRate = 20,
                Slot = 'RCH',
            },
            GuardianProtocolRemove = {
                BuildCostEnergy = 1,
                BuildCostMass = 1,
                BuildTime = 0.1,
                Icon = 'turret',
                Name = 'Remove Guardian protocol I',
                Prerequisite = 'GuardianProtocol',
                RemoveEnhancements = {
                    'GuardianProtocol',
                    'GuardianProtocolRemove',
                },
                Slot = 'RCH',
                },
            },


.script:

Code: Select all
Code: Select all
    CreateEnhancement = function(self, enh, removal)
            AAirUnit.CreateEnhancement(self, enh)

            local bp = self:GetBlueprint().Enhancements[enh]
            if not bp then return end

            local bp = self:GetBlueprint().Enhancements[enh]
            --T2 Engineering
            if enh =='GuardianProtocol' then
                local cat = ParseEntityCategory(bp.BuildableCategoryAdds)
                self:RemoveBuildRestriction(cat)
                --self:updateBuildRestrictions()
                --self:AddBuildRestriction( categories.AEON * (categories.BUILTBYTIER2ENGINEER + categories.BUILTBYTIER3ENGINEER - categories.SBROT1EXPD) )
                --if not Buffs['AeonACUT2BuildRate'] then
                    BuffBlueprint {
                        Name = 'AeonACUT2BuildRate',
                        DisplayName = 'ALPHAT2BuildRate',
                        BuffType = 'ACUBUILDRATE',
                        Stacks = 'REPLACE',
                        Duration = -1,
                        Affects = {
                            BuildRate = {
                                Add =  bp.NewBuildRate - self:GetBlueprint().Economy.BuildRate,
                                Mult = 1,
                            },
                            MaxHealth = {
                                Add = bp.NewHealth,
                                Mult = 1.0,
                            },
                            Regen = {
                                Add = bp.NewRegenRate,
                                Mult = 1.0,
                            },
                        },
                    }
               -- end
                Buff.ApplyBuff(self, 'AeonACUT2BuildRate')
            elseif enh =='GuardianProtocolRemove' then
                local bp = self:GetBlueprint().Economy.BuildRate
                if not bp then return end
                self:RestoreBuildRestrictions()
                self:AddBuildRestriction( categories.AEON * (categories.BUILTBYALPHAA1 + categories.BUILTBYTIER1ENGINEER + categories.BUILTBYTIER2ENGINEER + categories.BUILTBYTIER3ENGINEER - categories.uab1105 - categories.uab1106) )                                     
                if Buff.HasBuff( self, 'AeonACUT2BuildRate' ) then
                    Buff.RemoveBuff( self, 'AeonACUT2BuildRate' )
                end
            end
        end,



even got a blasted description for it, and it works...but not the icon, the icon is this muddy olive-yellow square and nothing else :/

What am I missing? What am I doing wrong? Going crazy over here...such simple things derail me ufff....
Check out my 2 maps: "Survival_Mayhem&BO_3d_v1" "Survival_Mayhem&BO_3d_RPG"
as well as my mod: "Survival Mayhem&BO balance"
-- let me know of any bugs or issues regarding those 3.
DDDX
Avatar-of-War
 
Posts: 170
Joined: 21 Mar 2016, 16:13
Has liked: 18 times
Been liked: 16 times
FAF User Name: DDDX

Re: Missiong icons for enhancements

Postby Franck83 » 22 Oct 2018, 20:53

Hi DDDX,

Take a look at the Cybran Dream mod. It adds a single enhancement to the Cybran ACU with icon support.
Alliance of Heroes Mod is out ! Try it ! It's in the Mod Vault !
User avatar
Franck83
Evaluator
 
Posts: 538
Joined: 30 Dec 2016, 11:59
Location: France
Has liked: 114 times
Been liked: 122 times
FAF User Name: Franck83

Re: Missiong icons for enhancements

Postby DDDX » 23 Oct 2018, 11:59

no you don't understand. I can place, for example, Improved engineering in the .bp and .script files of any, let's say TM or BO units (just to test) and it will have an icon for enhancing.
However, if i do the exact same for my own mod, with my own custom units - the enhancement works BUT no icon, just an olive square.
Yes the custom unit has it's icon, i know the 2 are related.
The only thing I can think of is that the units in my mod are not registering on the Global icon support or something, concerning enhancement icons. And I do not know why.

To clarify - i have stripped my unit of all code apart from the absolute basic, put it inside the BO Unleashed unit folder, put it's icon in the icons folder, put in the code for the t2 aeon enhancement in .bp and .script in both my unit and BO':Unleasheds Inquisitor (only for testing purposes, i got no desire to mess up BO Unleashed ;)
Result? Inquisitor can upgrade to t2 engineering (with assistance cause it has 0 build power) - has enhancement icon
My custom unit can too, but - no enhancement icon.

Now that makes me think that my custom unit needs to be listed somewhere?
That led me to ...\Mods\BlackOpsFAF-Unleashed\lua\customunits - TM has the same section. I don't have that in my mod, but let's test it on BO with my custom unit. Added
Code: Select all
UnitList = {
    T4AirExperimental1 = {
        UEF = {'bea0402', 70}, -- Citadel MKII (Experimental Aerial Fortress)
        --Cybran = {'bra0409', 40}, -- Gargantuan (Experimental Assault Transport)
        Aeon = {'alphaa1', 40}, -- RPG unit
    },
}
to the file that handles air experimentals, still no icon on my unit.

What's the purpose of the .lua's in the "customunits" folder - or a better question - what file is the unit list called from???
Ty if you can solve this one for me....I've hit a wall.
Check out my 2 maps: "Survival_Mayhem&BO_3d_v1" "Survival_Mayhem&BO_3d_RPG"
as well as my mod: "Survival Mayhem&BO balance"
-- let me know of any bugs or issues regarding those 3.
DDDX
Avatar-of-War
 
Posts: 170
Joined: 21 Mar 2016, 16:13
Has liked: 18 times
Been liked: 16 times
FAF User Name: DDDX

Re: Missiong icons for enhancements

Postby Franck83 » 23 Oct 2018, 12:55

Hi DDDX,

The custom units folder in BlackOpsFAF seems from description to be about Sorian AI support. It doesn't seem related to icon stuff.
I don't have time this week but i will take a look at it later.

Maybe give a try at the Hook/Ui/help/unitdescriptions.lua file. There are some icon related stuff here.
Alliance of Heroes Mod is out ! Try it ! It's in the Mod Vault !
User avatar
Franck83
Evaluator
 
Posts: 538
Joined: 30 Dec 2016, 11:59
Location: France
Has liked: 114 times
Been liked: 122 times
FAF User Name: Franck83

Re: Missiong icons for enhancements

Postby PhilipJFry » 23 Oct 2018, 13:06

i just read through this quickly so sry if i missed anything
did you check this folder in the blackops mod for faf?
Code: Select all
\hook\textures\ui\common\game\

there are 4 folders (one for each faction) with an FACTION-enhancements_layout.lua
example of the aeon-enhancements_layout.lua
Code: Select all
layout = {
    ['haes_btn_sel'] = {left = 1, top = 0, width = 63, height = 64, },
    ['haes_btn_down'] = {left = 2, top = 2, width = 60, height = 60, },
    ['haes_btn_over'] = {left = 2, top = 2, width = 60, height = 60, },
    ['haes_btn_up'] = {left = 2, top = 2, width = 60, height = 60, },
   
    ['fsh1_btn_sel'] = {left = 1, top = 0, width = 63, height = 64, },
    ['fsh1_btn_down'] = {left = 2, top = 2, width = 60, height = 60, },
    ['fsh1_btn_over'] = {left = 2, top = 2, width = 60, height = 60, },
    ['fsh1_btn_up'] = {left = 2, top = 2, width = 60, height = 60, },
   
    ['fep1_btn_sel'] = {left = 1, top = 0, width = 63, height = 64, },
    ['fep1_btn_down'] = {left = 2, top = 2, width = 60, height = 60, },
    ['fep1_btn_over'] = {left = 2, top = 2, width = 60, height = 60, },
    ['fep1_btn_up'] = {left = 2, top = 2, width = 60, height = 60, },
}
cats>dogs
post logs
User avatar
PhilipJFry
Supreme Commander
 
Posts: 2635
Joined: 23 Mar 2016, 21:16
Location: Austria
Has liked: 232 times
Been liked: 348 times
FAF User Name: PhilipJFry

Re: Missiong icons for enhancements

Postby DDDX » 23 Oct 2018, 13:44

yup been there before posting here. I tried it both ways,by implementing
Code: Select all
layout = {
    ['turret_btn_sel'] = {left = 1, top = 0, width = 63, height = 64},
    ['turret_btn_down'] = {left = 2, top = 2, width = 60, height = 60},
    ['turret_btn_over'] = {left = 2, top = 2, width = 60, height = 60},
    ['turret_btn_up'] = {left = 2, top = 2, width = 60, height = 60}
}


(turret is the name of my 4 icons for the custom enhancement that unlocks a certain turret while all else is restricted).
I am aware of the unitdescriptions.lua file. Tried that as well.
made there a description for my alphaa1 unit:
Code: Select all
Description['alphaa1'] = "<LOC Unit_Description_20009> Level 1 ALPHA - a hero unit. While fairly basic, it is upgradeable into bigger, better versions, with special weapons and abilities. Can assist, repair and reclaim wrecks. Armed with weak air-to-ground weapons, and average anti-air weapons.\nEVOLVES into a level 2 ALPHA unit when it has killed 20.000 mass.\n\n---DO NOT LOSE YOUR ALPHA, you cannot get a new one!---"

I have, ofc, tried with the most basic of basics, like I said, copy-pasted the Improved aeon engineering enhancement (and just it) from aeon's BO ACU, to see if that changes things, and corrected the Description['alphaa1-exles1'] = "<LOC Unit_Description_20014> so that the name points to the correct set of icons, but NOPE.
Like I said, when I did the exact same thing for the Inquisitor (minus the Description change), the icon worked.

It amazes me that a complex enhancement script can work like a charm (or even 3-4 custom enhancements together) but a simple thing like an icon can be such a pain in the ass to make...
Check out my 2 maps: "Survival_Mayhem&BO_3d_v1" "Survival_Mayhem&BO_3d_RPG"
as well as my mod: "Survival Mayhem&BO balance"
-- let me know of any bugs or issues regarding those 3.
DDDX
Avatar-of-War
 
Posts: 170
Joined: 21 Mar 2016, 16:13
Has liked: 18 times
Been liked: 16 times
FAF User Name: DDDX

Re: Missiong icons for enhancements

Postby DDDX » 23 Oct 2018, 15:46

SOLVED IT ;)

It was the name. The custom name was the problem.
Ok for all you future modders who will decide a Megalith needs an enhancement that gives it +50 000 hp or x1.5 range :p
As long as you are doing that to regular units, you should be fine copy-pasting the enhancement code from ACUs (mutatis mutandis).
HOWEVER, if you brilliantly name your hero unit "ALPHAA1" like I did, thinking alpha=to easier distinguish it, A=aeon, 1=first form, the game can oblige almost perfectly.
In all aspects but one. Icons for enhancements. Because enhancements follow the logic that if a unit starts with ua=Aeon, if it's ue=UEF etc etc...so naturally when it got my al(pha01) it did not know what that "AL" was. Yes you can name your unit "littlemisssnowflake" if you like and almost all will work about it. Almost.

Simply changing my unit's name (and all follow-up stuff) from "ALPHAA1" to XAA9901" fixed it.
Why XAA, well that's the code from FA for units that are added to SupCom with that expansion (namely, for Restorer) - i figured that code must be able to be registered for icons, and I was right. It could have very well been an "UAA9901" name. Why 9901, well i figured noone would have taken a 99.. code :p

Be careful to write all of the code down when copying, and you should be perfectly able to use any unit, with any name, rename it to either the standard vanilla SC or the standard FA naming scheme, and be able to add to it as many enhancements, from ACUs, BO:ACUs, or modified ones like I did.
Ufff...imagine GC's or Megas with an optional HP or dmg buff...Scathis with an upgradeable range OR dmg area...if you got the time and ress to enhance it :p

Now, i noticed this file called SimCallbacks.lua in the ...\Mods\BlackOpsFAF-Unleashed\hook\lua folder, and it has a section like this:
Code: Select all
-- overwrite the original function. Destructive hook !
local LetterArray = { ["Aeon"] = "ua", ["UEF"] = "ue", ["Cybran"] = "ur", ["Seraphim"] = "xs" }
local BOLetterArray = { ["Aeon"] = "ba", ["UEF"] = "be", ["Cybran"] = "br", ["Seraphim"] = "bs" }

Callbacks.CapMex = function(data, units)
    local units = EntityCategoryFilterDown(categories.ENGINEER, SecureUnits(units))
    if not units[1] then return end
    local mex = GetEntityById(data.target)
    if not mex or not EntityCategoryContains(categories.MASSEXTRACTION * categories.STRUCTURE, mex) then return end
    local pos = mex:GetPosition()
    local msid

    for _, u in units do
        local FactionName = u:GetBlueprint().General.FactionName
        if u:CanBuild(BOLetterArray[FactionName]..'b1106') then
            msid = BOLetterArray[FactionName]..'b1106'
        else
            msid = LetterArray[FactionName]..'b1106'
        end
        IssueBuildMobile({u}, Vector(pos.x, pos.y, pos.z-2), msid, {})
        IssueBuildMobile({u}, Vector(pos.x+2, pos.y, pos.z), msid, {})
        IssueBuildMobile({u}, Vector(pos.x, pos.y, pos.z+2), msid, {})
        IssueBuildMobile({u}, Vector(pos.x-2, pos.y, pos.z), msid, {})
    end
end

Now I get that the first part is there to tell the engine that a unit starting with "ba" is indeed aeon of Blackops, but seing how I got no clue what the rest of the code does, I guess imma stick to my discovered method of not naming units "littlemisssnowflake" or ALPHAxyz or whatnot...

damn...the fact that TM and BO have all units named fairly similar should have been a giveaway that is an important thing and not just someone's OCD....
Anyways, hope this helps someone else with their enhancement struggles on custom units.
Goodspeed, off to coding my RPG monsters ;)
Check out my 2 maps: "Survival_Mayhem&BO_3d_v1" "Survival_Mayhem&BO_3d_RPG"
as well as my mod: "Survival Mayhem&BO balance"
-- let me know of any bugs or issues regarding those 3.
DDDX
Avatar-of-War
 
Posts: 170
Joined: 21 Mar 2016, 16:13
Has liked: 18 times
Been liked: 16 times
FAF User Name: DDDX

Re: Missiong icons for enhancements

Postby Franck83 » 23 Oct 2018, 16:25

DDDX wrote:SOLVED IT ;)
Ufff...imagine GC's or Megas with an optional HP or dmg buff...Scathis with an upgradeable range OR dmg area...if you got the time and ress to enhance it :p


Alliance of Heroes got already all this stuff (with AI support, casting powers...) ;).
Alliance of Heroes Mod is out ! Try it ! It's in the Mod Vault !
User avatar
Franck83
Evaluator
 
Posts: 538
Joined: 30 Dec 2016, 11:59
Location: France
Has liked: 114 times
Been liked: 122 times
FAF User Name: Franck83

Re: Missiong icons for enhancements

Postby DDDX » 23 Oct 2018, 23:04

yeah well, I cannot use AOH for my survival..needs to go in a similar - but different - direction. Ty for your help. Imma take a better look at your code.
Check out my 2 maps: "Survival_Mayhem&BO_3d_v1" "Survival_Mayhem&BO_3d_RPG"
as well as my mod: "Survival Mayhem&BO balance"
-- let me know of any bugs or issues regarding those 3.
DDDX
Avatar-of-War
 
Posts: 170
Joined: 21 Mar 2016, 16:13
Has liked: 18 times
Been liked: 16 times
FAF User Name: DDDX


Return to Mods & Tools

Who is online

Users browsing this forum: No registered users and 1 guest