Construction structure idea falls flat (Fixed number bonus to system industry)

General Modding Information/Questions; support/discussion/questions

Moderator: thunderchero

Forum rules
:idea: Please search before starting new topic. :idea:
There is a good chance it has already been asked.
Post Reply
User avatar
Final Run
Lieutenant-Junior Grade
Lieutenant-Junior Grade
Posts: 89
Joined: Mon Apr 13, 2015 3:34 pm

Construction structure idea falls flat (Fixed number bonus to system industry)

Post by Final Run »

Hey there. I've been musing about new modding ideas in aftermath of this years tournament and the limited release of my new MP mod on discord. It was fun, but restless as I am I decided to work on my next botf project.

Anyway, I thought why not add structure that adds a fixed number to system industry total- sort of how Utopia Planitia adds a certain number to shipbuilding only or how simulators boost research 100 each. However, no sooner than I started work on new buildpics in photoshop for said structure, I realized it's actually not feasible to add via UE. Either the structure would not show up in the build-list or would replace the regular industrial buildings that require pop maintenance-- curiously the structure could still be powered in the energy window in the latter situation, though adds it nothing to the industrial total.

Of course, there are ones the with multiplier that I know work fine, but that route doesn't really align with what I'm trying to achieve. I'm guessing overriding this limitation to only %total would involve a major or impossible code change, unless there is some other mod I don't know of that has successfully adds a structure that somehow achieves what I described. If there is, please let me know.

(I suppose if this doesn't pan out, I suppose a structure that can adds a fixed credit sum per turn is still on the table)
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1961
Joined: Sun Apr 27, 2008 2:00 am

Re: Construction structure idea falls flat (Fixed number bonus to system industry)

Post by Spocks-cuddly-tribble »

Final Run wrote: Thu Nov 23, 2023 4:21 pmstructure that adds a fixed number to system industry

a structure that can adds a fixed credit sum per turn
Code for structures with static industry bonus require many patches from this topic (new output ID 0x2D): viewtopic.php?p=32983#p32983

Static +credits bonus isn't prepared in this project, but should be quite easy to implement. Let me know if you really want it?

Plus there is an unused hidden feature in BotF. Each building can have support cost in credits per turn: viewtopic.php?p=30656#p30656
So a negative support cost value should do what you want: + X credits per turn :wink: (but without proper ingame display).
I don't know how many bugs is too many but that point is reached somewhere before however many in BotF is.
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 7965
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Re: Construction structure idea falls flat (Fixed number bonus to system industry)

Post by thunderchero »

all bonus types work, but vanilla bonus descriptions don't list if it is a local or empire wide bonus

the bonus type for "industry" used in labor screen can not be used for standard structures

so any new industry structures would use energy.

you should also apply "Fixing empire-wide bonus addresses & some local bugs"

and use a edited edifbnft.bst with better descriptions (MUM, UDM iirc) have local/empire listed in descriptions

viewtopic.php?p=32983#p32983

and what he ↑ said lol
User avatar
Final Run
Lieutenant-Junior Grade
Lieutenant-Junior Grade
Posts: 89
Joined: Mon Apr 13, 2015 3:34 pm

Re: Construction structure idea falls flat (Fixed number bonus to system industry)

Post by Final Run »

Spocks-cuddly-tribble wrote: Thu Nov 23, 2023 4:52 pm
Final Run wrote: Thu Nov 23, 2023 4:21 pmstructure that adds a fixed number to system industry

a structure that can adds a fixed credit sum per turn
Code for structures with static industry bonus require many patches from this topic (new output ID 0x2D): viewtopic.php?p=32983#p32983

Static +credits bonus isn't prepared in this project, but should be quite easy to implement. Let me know if you really want it?

Plus there is an unused hidden feature in BotF. Each building can have support cost in credits per turn: viewtopic.php?p=30656#p30656
So a negative support cost value should do what you want: + X credits per turn :wink: (but without proper ingame display).
So there is a potential work-around? Wow! Well, if the static industry bonus is possible (albeit with the many patches) I might just focus my attention there for now.

Although, I find the credit bonus incredibly interesting (maybe for for speeding up the early game grind perhaps) I'm not sure where or how it would be used or what in-universe explanation I could conjure up. My imagination is a bit lacking atm, so while I want to note interest I don't need absolutely need it for my current testing :wink:
User avatar
Final Run
Lieutenant-Junior Grade
Lieutenant-Junior Grade
Posts: 89
Joined: Mon Apr 13, 2015 3:34 pm

Re: Construction structure idea falls flat (Fixed number bonus to system industry)

Post by Final Run »

thunderchero wrote: Thu Nov 23, 2023 5:13 pm all bonus types work, but vanilla bonus descriptions don't list if it is a local or empire wide bonus
Well damn, I'm really glad I took the time to pose this question! :grin:

So, lots more possibilities than I previously imagined...
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1961
Joined: Sun Apr 27, 2008 2:00 am

Re: Construction structure idea falls flat (Fixed number bonus to system industry)

Post by Spocks-cuddly-tribble »

Final Run wrote: Thu Nov 23, 2023 5:17 pmSo there is a potential work-around? so while I want to note interest I don't need absolutely need it for my current testing :wink:
In theory there is an easy way to get the given patches/features to do what you want (almost -> without system credits & income preview?).

As thunderchero says first you need to edit an edifbnft.bst with all new (and better) output descrition strings.

Best you also add the new ground defense 0x33 & 0x34 (even if you don't plan on using them): viewtopic.php?p=32993#p32993

Then just add another entry string for new ID 0x35 (index so new string 54 dec) and name it e.g. +Credits.
There is no code for this output type, so it does nothing.
Now create you new + Credits structure(s) using output type 0x35.
Set output value to e.g. 50 so game will display +50 credits per turn (but no real effect).
Now set support cost to -50 for real effect (just remember you always have to edit fake + value and real -support value).

But I don't think the game will add the value to the preview of the system credit output and the displayed total income. :sad:
I don't know how many bugs is too many but that point is reached somewhere before however many in BotF is.
User avatar
Final Run
Lieutenant-Junior Grade
Lieutenant-Junior Grade
Posts: 89
Joined: Mon Apr 13, 2015 3:34 pm

Re: Construction structure idea falls flat (Fixed number bonus to system industry)

Post by Final Run »

Spocks-cuddly-tribble wrote: Thu Nov 23, 2023 5:49 pm
In theory there is an easy way to get the given patches/features to do what you want (almost -> without system credits & income preview?).

As thunderchero says first you need to edit an edifbnft.bst with all new (and better) output descrition strings.

Best you also add the new ground defense 0x33 & 0x34 (even if you don't plan on using them): viewtopic.php?p=32993#p32993

Then just add another entry string for new ID 0x35 (index so new string 54 dec) and name it e.g. +Credits.
There is no code for this output type, so it does nothing.
Now create you new + Credits structure(s) using output type 0x35.
Set output value to e.g. 50 so game will display +50 credits per turn (but no real effect).
Now set support cost to -50 for real effect (just remember you always have to edit fake + value and real -support value).

But I don't think the game will add the value to the preview of the system credit output and the displayed total income. :sad:
I look forward implementing all of these changes in new builds. Shame about the the lack of preview for credits with the negative support cost route, but not sure I would mind it that much as long as everyone understood that it actually worked.

In the meantime, been looking at these codes to a make an opening for a static industry bonus structure. Actually, I've gone agaisnt my better judgement and tried to write a patch file for bof patcher while all sleepy (using the first code I saw in the link to your other post) and was wondering if it might break the trek.exe

Code: Select all

NAME: 
DESC: 
AUTHOR: Pakled Coder
URL: 

>> 0x43AFA 8B 51 50 66 01 50 10 8B 51 54 66 01 50 12 66 8B 91 88 00 00 00 66 01 50 02 8B 51 58 66 01 50 14 8B B1 98 00 00 00 66 01 70 04 8B 51 30 66 01 50 06 90 66 8B 78 16 66 8B 91
<< 0x43AFA 8B 51 50 66 01 50 10 8B 51 54 66 01 50 12 66 8B 91 88 00 00 00 66 01 50 02 8B 51 58 66 01 50 14 8B B1 98 00 00 00 66 01 70 04 8B 51 30 66 01 50 06 90 66 8B 78 16 66 8B 91


#trek.exe at 0x43AFA new code 0x39 bytes:


#004446FA     8B51 50            MOV EDX, [ECX+50]
#004446FD     66:0150 10         ADD [EAX+10], DX  // % economic intel
#00444701     8B51 54            MOV EDX, [ECX+54]
#00444704     66:0150 12         ADD [EAX+12], DX  // % scientific intel

#00444713     8B51 58            MOV EDX, [ECX+58]
#00444716     66:0150 14         ADD [EAX+14], DX  // % military intel
#0044471A     8BB1 98000000      MOV ESI, [ECX+98]
#00444720     66:0170 04         ADD [EAX+4], SI  // % raiding
#00444724     8B51 30            MOV EDX, [ECX+30]
#00444727     66:0150 06         ADD [EAX+6], DX  // % industry
#0044472B     90                 NOP

#00444730     66:8B91 90000000   MOV DX, [ECX+90]  // % traderoute credits
What could possibly go wrong? :cool:
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1961
Joined: Sun Apr 27, 2008 2:00 am

Re: Construction structure idea falls flat (Fixed number bonus to system industry)

Post by Spocks-cuddly-tribble »

The default code doesn't understand negative values for building support costs, so my above idea won't work. But here is a better solution with right preview displays (just no energy check, so even powered down structures provide the credit bonus). New output ID 0x35 +credits test patch:

Static_Credits_Bonus.patch
(793 Bytes) Downloaded 13 times


Yeah, the idea with the Pakled patch works and is fast to do, but without any undo option. So if there is any bug or conflict you are 100% snafued.

Since the matter is quite confusing, a Pakled multi patch with all codes you need from the other topic:

Pakled_multi.patch
(3.21 KiB) Downloaded 18 times
But note conflicts with intel and research tech bonuses (if you plan on using them): viewtopic.php?p=33046#p33046
I don't know how many bugs is too many but that point is reached somewhere before however many in BotF is.
User avatar
Final Run
Lieutenant-Junior Grade
Lieutenant-Junior Grade
Posts: 89
Joined: Mon Apr 13, 2015 3:34 pm

Re: Construction structure idea falls flat (Fixed number bonus to system industry)

Post by Final Run »

Spocks-cuddly-tribble wrote: Fri Nov 24, 2023 9:18 am The default code doesn't understand negative values for building support costs, so my above idea won't work. But here is a better solution with right preview displays (just no energy check, so even powered down structures provide the credit bonus). New output ID 0x35 +credits test patch:


Static_Credits_Bonus.patch



Yeah, the idea with the Pakled patch works and is fast to do, but without any undo option. So if there is any bug or conflict you are 100% snafued.

Since the matter is quite confusing, a Pakled multi patch with all codes you need from the other topic:


Pakled_multi.patch

But note conflicts with intel and research tech bonuses (if you plan on using them): viewtopic.php?p=33046#p33046
Ha, it's no problem that, and thanks. If it will make my private pakled mod build finally "go" than it's worth it.

Curious about the conflicts with intel/research though. Is that with all or just certain types of bonus? (local, empire)
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1961
Joined: Sun Apr 27, 2008 2:00 am

Re: Construction structure idea falls flat (Fixed number bonus to system industry)

Post by Spocks-cuddly-tribble »

It's just about new tech bonus factors (vanilla +2% per tech level for manned food, industry & energy).

Some mods use +X% per tech level for manned intel and/or research, in that case you need to replace parts of the Pakled multi patch (local +% intel and/or research fix) with codes specified in the tech bonus factor topic.
I don't know how many bugs is too many but that point is reached somewhere before however many in BotF is.
Post Reply

Return to “General Modding Information/Questions”