Unrest Orders (turn delay & limitations)

Unrest Orders (turn delay & limitations); support/discussion/questions

Moderator: thunderchero

Post Reply
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1884
Joined: Sun Apr 27, 2008 2:00 am

Unrest Orders (turn delay & limitations)

Post by Spocks-cuddly-tribble »

Since I can't remember if this already has been posted somewhere on the forums:

Code: Select all

sub_43A6D4 unrest_order_turn_delay:

0043A706                 mov     eax, 3    // card
0043A70C                 mov     eax, 4   // kling/rom -> shared
0043A712                 mov     eax, 5   // fed/fer -> shared

sub_45FCE0 unrest_order_effect:

0045FD74                 add     eax, edx  // current morale + unrest order edifice.bst output
0045FD76                 xor     edx, edx
0045FD78                 mov     dx, [ebx+2F0h]  // base morale
0045FD7F                 cmp     eax, edx   // if greater than base morale 
0045FD81                 jge     loc_45FE93 // set morale = base morale
...
0045FD9C                 jl      short loc_45FD3C  // continue with order if result still lower than base morale
Reason for posting this are some older requests for buildings resp. a system feature with temporary effect (e.g. increasing research or intel). :idea:

So if anyone wants to mess with this they now know where to look for reference codes. Hacking ordInfo is required, of course (also for the 1 Item per turn limitation).
I don't know how many bugs is too many but that point is reached somewhere before however many in BotF is.
User avatar
Tethys
Past Administrator
Past Administrator
Posts: 2392
Joined: Fri Jul 18, 2008 2:00 am
Location: Your mom's bed ;)
Contact:

Re: Unrest Orders (turn delay & limitations)

Post by Tethys »

Additional info regarding what empire uses which turn delay (useful for changing who shares)

race_turn_delay

Code: Select all

0043A6C0	0x39ac0			dd offset		06 A7 43 00	// Card
0043A6C4	0x39ac4			dd offset		12 A7 43 00	// Fed
0043A6C8	0x39ac8			dd offset		12 A7 43 00	// Ferg
0043A6CC	0x39acc			dd offset		0C A7 43 00	// Kling
0043A6D0	0x39ad0			dd offset		0C A7 43 00	// Rom
Used in conjunction with:

Code: Select all

sub_43A6D4 unrest_order_turn_delay:

0043A706                 mov     eax, 3    // card
0043A70C                 mov     eax, 4   // kling/rom -> shared
0043A712                 mov     eax, 5   // fed/fer -> shared
Furthermore, there *appears* to be 8 free bytes after the 3 race delay mov's, and only 6 bytes are needed to create a race delay entry.. you see where I'm going... ;)


EXPERIMENTAL ! NOT TESTED

Code: Select all

0043A718                 mov     eax, 2   	// tbd

At 0x39b18 replace: 	00 00 00 00 00 00 	with		B8 02 00 00 00 C3
Now you must change one of the race_turn_delay offset locations to match this new location. If you wanted to give Ferengi a value of 2 (stimulus packages for all subjects of the Nagus!), you would navigate:

Code: Select all

At 0x39ac8 replace:	12	with		18
Not for the weak of heart...
Galaxies MOD v0.4.0 <--- GALM/Galaxies Mod latest version
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1884
Joined: Sun Apr 27, 2008 2:00 am

Re: Unrest Orders (turn delay & limitations)

Post by Spocks-cuddly-tribble »

Or you can go to town with custom values :wink:

At 0x39AFF enter:

Code: Select all

0043A6FF   8A0485 C0A64300   MOV AL,BYTE PTR DS:[EAX*4+43A6C0]
0043A706   C3                RETN
0043A707   90                NOP
0043A708   90                NOP
0043A709   90                NOP
0043A70A   90                NOP
And enter custom turn delays at old jump table 43A6C0 i.e. 0x39AC0 (card-rom) four bytes each
I don't know how many bugs is too many but that point is reached somewhere before however many in BotF is.
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1884
Joined: Sun Apr 27, 2008 2:00 am

Unrest Order (emergency morale program) Fix

Post by Spocks-cuddly-tribble »

The unrest orders (emergency morale programs) in BotF are somewhat frustrating:

- A bug limits morale to base morale if it gets higher due to other events/bonuses (see above code).
- In progress/preparation they do not prevent any negative events until morale increases above critical thresholds.
- During the preparation phase 'commencing' (see above turn delays) they have no effect at all.
- They disable all local Industry, Credits, Intel and Research outputs from the beginning (without notice/display):

Code: Select all

0043F4C9           mov   [ecx+48h], edx                    ; sets Industry output to zero
0043F4CC           mov   [ecx+4Ch], edx                    ; sets Credit output to zero
0043F4CF           mov   [ecx+50h], edx                    ; sets Research output to zero
0043F4D6           mov   [ecx+54h], edx                    ; sets Intel output to zero

Below patch fixes the base morale glitch and prevents negative morale events from the beginning.
NOT intel- or (ex)random-events = Rebellions (systInfo+80 fails here / ordInfo is too complicated).

Code: Select all

NAME: Unrest Order (emergency morale program) Fix
DESC: Fixes a base morale glitch + prevents negative morale events (not intel/random) in progress & preparation.
AUTHOR: Spocks-cuddly-tribble
URL: https://www.armadafleetcommand.com/onscreen/botf/viewtopic.php?p=58087#p58087

>> 0x0003e908 8b 51 42
>> 0x0005f164 8b 51 42 8b 84 44 84 00 00
>> 0x0005f16e c1 fa 10 c1 f8 10 01 d0 31 d2 66 8b 93 f0 02 00 00

<< 0x0003e908 eb 5e 90
<< 0x0005f164 0f b7 69 44 0f b7 93 f0 02
<< 0x0005f16e 00 3b ea 7d 2b 0f b6 84 44 86 00 00 00 03 c5 90 90

#0043F508    EB 5E               JMP SHORT 43F568  // skip morale events if unrest order
#0043F50A    90                  NOP

#0045FD64    0FB769 44           MOVZX EBP,WORD [ECX+44]   // current morale
#0045FD68    0FB793 F0020000     MOVZX EDX,WORD [EBX+2F0]  // base morale
#0045FD6F    3BEA                CMP EBP,EDX
#0045FD71    7D 2B               JGE SHORT 45FD9E          // current is better -> exit done
#0045FD73    0FB68444 86000000   MOVZX EAX,BYTE [ESP+EAX*2+86]  // unrest order edifice.bst output
#0045FD7B    03C5                ADD EAX,EBP
#0045FD7D    9090                NOP
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 “Unrest Orders (turn delay & limitations)”