Can someone please explain the proper way to add a custom sponsor banner? I have not found one full example on how to do this. There is a small section in the SDK docs that makes it sound like this is easy to do, but it is too vague and I find it very incomplete.
I'll describe what I am doing, hopefully someone can fill in the blanks:
1) I created a custom mission sponsor with working decal/logo. For this example, we'll call the sponsor ID "MySponsor".
2) I took the 3 entity (.ent) files from an existing banner (USA) with corresponding material (.mtl) file and texture.
3) Renamed the .ent files - Flag_01_MySponsor, Flag_02_MySponsor, Flag_03_MySponsor
4) Renamed the material file and then edited the flag .ent files to reference this new material name.
5) Renamed the texture and then edited the material file to reference the new texture name.
6) Imported the 3 banner entities via the mod editor.
7) Added the mission sponsor banner entity suffix in the mod editor (banners_name = "MySponsor")
I had doubts it would work....and I was right Edit: Disregard below, it works with the above steps (1-7)
I then found SkiRich's example from his NASA Sponsor mod. Here is his code that I modified with my sponsor info as a test:
The custom banner worked with this added code but unfortunately, this not a proper solution.
The code doesn't reference all of the actual banners in the game. So if you are using this mod, you are currently missing some banners. For example SpaceY - if you choose this sponsor then you will get the default IMM (Hand Shake) flag instead.
More importantly, you can easily update this code with all of the current sponsor flags but the same problem will happen again when someone else creates a custom banner mod in this fashion. The reason being that the code under "local BannerSponsorEntityMap" must declare all sponsor banners. If you only declare your custom one, then all of the banners wont be available. This creates the imposibility of multiple mods having custom sponsor banners with this code.
It would be nice if there was a way to inject new sponsors without affecting the existing ones but I am just learning lua.
There has to be a better way of doing this. There's a reason there aren't any mission sponsor mods with custom banners. I'm hoping a dev or someone can finally shed some light on the proper steps to create them.
I'll describe what I am doing, hopefully someone can fill in the blanks:
1) I created a custom mission sponsor with working decal/logo. For this example, we'll call the sponsor ID "MySponsor".
2) I took the 3 entity (.ent) files from an existing banner (USA) with corresponding material (.mtl) file and texture.
3) Renamed the .ent files - Flag_01_MySponsor, Flag_02_MySponsor, Flag_03_MySponsor
4) Renamed the material file and then edited the flag .ent files to reference this new material name.
5) Renamed the texture and then edited the material file to reference the new texture name.
6) Imported the 3 banner entities via the mod editor.
7) Added the mission sponsor banner entity suffix in the mod editor (banners_name = "MySponsor")
I had doubts it would work....and I was right Edit: Disregard below, it works with the above steps (1-7)
I then found SkiRich's example from his NASA Sponsor mod. Here is his code that I modified with my sponsor info as a test:
local BannerSponsorEntityMap = {
CNSA = "China",
ESA = "Europe",
ISRO = "India",
Roscosmos = "Russia",
MySponsor = "MySponsor"
}
function OnMsg.ClassesGenerate()
function SponsorBannerBase:GetEntity()
if lf_print then print("Running Banner GetEntity") end
local sponsor = GameTime() ~= 0 and GetMissionSponsor().id
local entity = ""
if sponsor == "MySponsor" then
return self.banner .. "MySponsor"
end
if BannerSponsorEntityMap[sponsor] then
entity = self.banner .. (BannerSponsorEntityMap[sponsor] or "") or self.banner .. (sponsor or "")
end
if not IsValidEntity(entity) then
entity = self.banner .. "IMM"
end
return entity
end
end
CNSA = "China",
ESA = "Europe",
ISRO = "India",
Roscosmos = "Russia",
MySponsor = "MySponsor"
}
function OnMsg.ClassesGenerate()
function SponsorBannerBase:GetEntity()
if lf_print then print("Running Banner GetEntity") end
local sponsor = GameTime() ~= 0 and GetMissionSponsor().id
local entity = ""
if sponsor == "MySponsor" then
return self.banner .. "MySponsor"
end
if BannerSponsorEntityMap[sponsor] then
entity = self.banner .. (BannerSponsorEntityMap[sponsor] or "") or self.banner .. (sponsor or "")
end
if not IsValidEntity(entity) then
entity = self.banner .. "IMM"
end
return entity
end
end
The custom banner worked with this added code but unfortunately, this not a proper solution.
The code doesn't reference all of the actual banners in the game. So if you are using this mod, you are currently missing some banners. For example SpaceY - if you choose this sponsor then you will get the default IMM (Hand Shake) flag instead.
More importantly, you can easily update this code with all of the current sponsor flags but the same problem will happen again when someone else creates a custom banner mod in this fashion. The reason being that the code under "local BannerSponsorEntityMap" must declare all sponsor banners. If you only declare your custom one, then all of the banners wont be available. This creates the imposibility of multiple mods having custom sponsor banners with this code.
It would be nice if there was a way to inject new sponsors without affecting the existing ones but I am just learning lua.
There has to be a better way of doing this. There's a reason there aren't any mission sponsor mods with custom banners. I'm hoping a dev or someone can finally shed some light on the proper steps to create them.
Last edited: