Random Events

Random Events; support/discussion/questions

Moderator: thunderchero

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

Example: Lowering system-specific random event frequency

Post by Spocks-cuddly-tribble »

Lowering the frequency of the system-specific random events to 20% of the default level without making them too erratic

i.e. Vanilla, impossible, 30 systems held, you get a negative system event by an average of every 7-8th turn, with this code only every 35-40th turn (technically wrt. mathematical combinatorics not accurate, but true for the average Joe).

See @1.1
44BFB3 jz short loc_44BFD2 -> remove
44BFCD cmp edx, 4 -> cmp edx, 7

Code: Select all

trek.exe 0x04B3B3 ->  9090  // initial frequency bitmask fix
trek.exe 0x04B3CF -> 07
See @1.4
Data field in trek.exe at 0x18DB5C: (actual used values i.e. not 0x18DB58!)
hexcode: 34 08 00 00 D0 07 00 00 08 07 00 00 72 06 00 00 E8 03 00 00
Defaults: 2100 / 2000 / 1800 / 1650 / 1000 ; (divisor for difficulty levels 1-5)

-> multiply all values with 2.5

Code: Select all

trek.exe at 0x18DB5C change 0x10 bytes to

8214000088130000941100001D100000C4090000

Option (if still too many system events on impossible) set 5th value x3
0x18DB6C -> B80B0000

Example disable Super Nova (See @1.4)

44C014 switch/jump table: (case / 4byte address of code sequence)
goto asm 44C014 +4*0 (bitmask) -> copy 4 byte
goto asm 44C014 +4*3 (Super Nova) -> paste 4 byte from bitmask

Code: Select all

trek.exe at 0x04B420 change E7 C2 44 00 to -> 1B C2 44 00
Simple hex code for no system events (See @1)

44BF30 53 push ebx -> C3 (retn)

Code: Select all

trek.exe at 0x4B330 change 53 to -> C3
Disabling the system-specific Random Events for AI ->@8:
viewtopic.php?t=1805#p24589
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: 1927
Joined: Sun Apr 27, 2008 2:00 am

Borg Initial Requirements Fix

Post by Spocks-cuddly-tribble »

In order to repair the first appearing of the borg, we access the highest empire tech level in game (e.g. energy tech 7), also part of the flawed minor race evolution limit: viewtopic.php?f=187&t=13#p24357

Minimum tech requirement for the cube is obtained via 11-[difficulty level], i.e. on 'impossible' there is now a need of at least a major tech level 6 for the first Borg Cube to appear.


Original requirement wrt. build cost of at least one empire's war fleet is the cube build cost * 1.25 (default 43,674 * 1.25 = 54,592.5): viewtopic.php?p=10788#p10788

Given the cubes overpowered default values, this limit is considerably too low. Below code calculates cube cost * 2.5 (i.e. default 43,674 * 2.5 = 109,185) via integer arithmetics, i.e. the old borg multiplier [ds:5791B8] is unused.


Borg Initial Requirements Fix

Code: Select all

trek.exe at 0x04E6AA change 0x39 bytes to

B00A2A05442B5A003A0530435B007D510FB784241C0100008D0480D1E8890424DB0424DB81B401000090909090909090909090909090909090

-asm-
0044F2AA   B0 0A                MOV AL,0A                    //   10
0044F2AC   2A05 442B5A00        SUB AL, [5A2B44]        //   - difficulty level(1-5) = 5-9
0044F2B2   3A05 30435B00        CMP AL, [5B4330]        //   EmpsMaxTech
0044F2B8   7D 51                JGE SHORT 44F30B             //   exit no cube
0044F2BA   0FB78424 1C010000    MOVZX EAX,WORD [ESP+11C]     //   cube build cost
0044F2C2   8D0480               LEA EAX, [EAX+EAX*4]         //   *5
0044F2C5   D1E8                 SHR EAX,1                    //   /2 (*5/2 = *2.5)
0044F2C7   890424               MOV DWORD PTR SS:[ESP],EAX
0044F2CA   DB0424               FILD DWORD PTR SS:[ESP]
0044F2CD   DB81 B4010000        FILD DWORD PTR DS:[ECX+1B4]  // empire war fleet cost
0044F2D3   90...                NOP
This leaves crystal entity and calamarain as the most dangerous unrestricted monsters.

Avoid AI Systems Fix for Monster Programs 2-4: viewtopic.php?p=34119#p34119 :idea:
Last edited by Spocks-cuddly-tribble on Thu May 12, 2022 6:29 am, edited 2 times in total.
I don't know how many bugs is too many but that point is reached somewhere before however many in BotF is.
User avatar
Martok
Rear-Admiral
Rear-Admiral
Posts: 1210
Joined: Thu May 01, 2008 2:00 am

Re: Example: Lowering system-specific random event frequency

Post by Martok »

Spocks-cuddly-tribble wrote:Lowering the frequency of the system-specific random events to 20% of the default level without making them too erratic

i.e. Vanilla, impossible, 30 systems held, you get a negative system event by an average of every 7-8th turn, with this code only every 35-40th turn (technically wrt. mathematical combinatorics not accurate, but true for the average Joe).

Out of curiosity (and not to sound greedy), but is it possible to lower the frequency to 0, or at least close to it?

I've always despised the system-specific random events: supernovas, comet strikes, climate shifts (I find that one especially annoying -- it really blows seeing your lovely M-class world being suddenly changed to a barren J-class), etc. I would love to play the game with random events enabled if not for these; as is, I always feel compelled to play BOTF with random events turned off so I don't have to worry about anything happening to my systems.


Of course, my even asking is a moot point. I'm technically incompetent, so it's not like I could figure out how to make any changes to the code anyway (I look at all your marvelous work, SCT, and it might as well be in Russian for all that I can understand it)... :oops:
"Evil is easy, and has infinite forms." -- Pascal
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 7934
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Re: Random Events

Post by thunderchero »

Martok wrote:Out of curiosity (and not to sound greedy), but is it possible to lower the frequency to 0, or at least close to it?
the last section of sct post
Spocks-cuddly-tribble wrote:Simple hex code for no system events (See @1)

44BF30 53 push ebx -> C3 (retn)

Code: Select all

trek.exe at 0x4B330 change 53 to -> C3
if you can use QD patcher here is patch
Simple_hex_code_for_no_system_events.patch
(207 Bytes) Downloaded 198 times
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1927
Joined: Sun Apr 27, 2008 2:00 am

No system-specific random events, but keep Rebellions (Option)

Post by Spocks-cuddly-tribble »

Alternatively, here is a simple hex code to disable system-specific random events, but keeping the Initial test for rebellions (see @1.2).

It's mistakenly part of the random events. The code for penalties for low morale is flawed:

viewtopic.php?f=242&t=1082#p18755

Code: Select all

trek.exe at 0x04B5B7 change 7E 27 to -> 90 90

044C1B7   jle   short select_event -> nop
You can disable this for AI, see above. :wink:
I don't know how many bugs is too many but that point is reached somewhere before however many in BotF is.
User avatar
Martok
Rear-Admiral
Rear-Admiral
Posts: 1210
Joined: Thu May 01, 2008 2:00 am

Re: Random Events

Post by Martok »

Thank you, gentlemen. Thank you very much. :)
"Evil is easy, and has infinite forms." -- Pascal
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1927
Joined: Sun Apr 27, 2008 2:00 am

Modifying System Events

Post by Spocks-cuddly-tribble »

Here are some new options to play with: :smile:


- new positive system events
- measures to prevent negative system events (not always appropriate) - most notably the Supernova got 3 new features


1.) New System Events (they have no event messages!) (former bitmask - cases 0, 8, 9 & C)


case 0 = hidden dilithium source discovered

Code: Select all

trek.exe at 0x4B61C change 6 bytes to 4E 71 08 FE 46 6E

-asm-
0044C21B   804E 71 08    OR BYTE [ESI+71],8  // set dilithium flag
0044C21F   FE46 6E       INC BYTE [ESI+6E]   // dilithium resource level +1
cases 8 & 9 = stranded ship discovered and refloated (if 'special system' add special ship for system owner in sector)

Special systems see:
viewtopic.php?f=231&t=319#p33718

case 8 = random minor ship (default IDs 0x69-0x72, 10 ships)
case 9 = add fixed ship ID (default 4C = B'rel II)

Suggestion for case 9:

Create a shiplist.sst entry with ship ID lower than borg (first monster) and higher than last minor ship. When duplicating monster entry make sure ship type is set to standard type (0,1,2,3 or 4). shiptech.sst set to cannot be build by any major/minor. This would allow for funny Chodak, Tarellian or Combat Drone under control of a major race (map range of -1 could force the drone to stay in sector, unless retreat), or even an unique ship like a 'future' ship.

Code: Select all

trek.exe at 0x4B872 change 0x24 bytes to

0F B7 46 68 85 C0 74 ED B1 0A F6 F1 B2 69 02 D4 EB 08 80 7E 68 00 74 DD B2 4C 0F BF 06 E8 AC 9D FF FF EB D1

-asm-
case 8
0044C472   0FB746 68       MOVZX EAX,WORD [ESI+68]
0044C476   85C0            TEST EAX,EAX
0044C478  ^74 ED           JE SHORT 44C467
0044C47A   B1 0A           MOV CL,0A   // number of minor race ships in shiplist.sst
0044C47C   F6F1            DIV CL
0044C47E   B2 69           MOV DL,69   // first minor race ship ID in shiplist.sst
0044C480   02D4            ADD DL,AH
0044C482   EB 08           JMP SHORT 44C48C
case 9
0044C484   807E 68 00      CMP BYTE [ESI+68],0
0044C488  ^74 DD           JE SHORT 44C467
0044C48A   B2 4C           MOV DL,4C    //  ship ID to add
0044C48C   0FBF06          MOVSX EAX,WORD [ESI]
0044C48F   E8 AC9DFFFF     CALL 446240
0044C494  ^EB D1           JMP SHORT 44C467
case C = no pop growth this turn (entire food surplus eroded by Tribbles :razz: )

Code: Select all

trek.exe at 0x4B98B change 7 bytes to

C6 86 20 03 00 00 01

-asm-
0044C58B   C686 20030000 01   MOV BYTE [ESI+320],1


2.) Counteractions & new features for Negative System Events


- Super Nova -

counteraction: Starbase (permanentely orbiting sun with a powerfull injector device for inversed trilithium-particles)

This gives starbases a meaning, since only default advantage over outposts is the sector claim value:
viewtopic.php?f=122&t=2183#p30258

Even without a starbase, at the first time only the sun animation gets changed, indicating the sun becomes unstable i.e. probability is significantly lower than any other event. Due to the indiction one still might have the time to build a starbase. :wink:

Sun animation files to alter:

copy and change duplicate names to s-s-...
s-r-map.tga
s-r-maps.tga
s-r-.ani -> copy has to be edited to use altered tga files including info text like DANGER of NOVA or SUN UNSTABLE


If despite everything the system gets destroyed, at least a free colony ship gets added to sector for emergency evacuation. :smile:

Change event text 'All live has been destroyed...' to for example: all planets have been destroyed, colony ship built for emergency evacuation...

Code: Select all

trek.exe at 0x4B6E7 change 0x6E bytes to

80 3D 44 2B 5A 00 03 7E EC 80 7E 30 00 74 E6 80 7E 31 04 75 E0 8B 46 4C 6B C0 6F 8B 04 85 E8 1A 5B 00 83 78 04 01 74 CD 0F BF 06 E8 F9 A8 06 00 0F B7 40 08 80 FC FF 74 0B E8 8B EC FF FF 80 78 2C 07 74 B1 80 7E 34 73 74 0C FE 46 34 EB A6 90 90 90 90 90 90 90 8B 46 4C 33 D2 B2 05 E8 67 91 00 00 0F BF D0 8B 06 E8 ED 9E FF FF B7 04

-asm-
0044C2E7   803D 442B5A00 03   CMP BYTE PTR DS:[5A2B44],3  // not difficulty level 1-3
0044C2EE  ^7E EC              JLE SHORT 44C2DC
0044C2F0   807E 30 00         CMP BYTE PTR DS:[ESI+30],0  // no home systems
0044C2F4  ^74 E6              JE SHORT trek-org.0044C2DC
0044C2F6   807E 31 04         CMP BYTE PTR DS:[ESI+31],4  // red giant only
0044C2FA  ^75 E0              JNZ SHORT 44C2DC
0044C2FC   8B46 4C            MOV EAX,DWORD PTR DS:[ESI+4C]
0044C2FF   6BC0 6F            IMUL EAX,EAX,6F
0044C302   8B0485 E81A5B00    MOV EAX,DWORD PTR DS:[EAX*4+5B1AE8]  // empsInfo+50h adr_provInfo
0044C309   8378 04 01         CMP DWORD PTR DS:[EAX+4],1   // not last system held
0044C30D  ^74 CD              JE SHORT 44C2DC
0044C30F   0FBF06             MOVSX EAX,WORD PTR DS:[ESI]
0044C312   E8 F9A80600        CALL 4B6C10      // get sector.lst entry
0044C317   0FB740 08          MOVZX EAX,WORD PTR DS:[EAX+8]
0044C31B   80FC FF            CMP AH,0FF     // check station ID
0044C31E   74 0B              JE SHORT 44C32B
0044C320   E8 8BECFFFF        CALL 44AFB0   // get StarbaseInfo entry
0044C325   8078 2C 07         CMP BYTE PTR DS:[EAX+2C],7  // not with a starbase
0044C329  ^74 B1              JE SHORT 44C2DC
0044C32B   807E 34 73         CMP BYTE PTR DS:[ESI+34],73 // check picture 's'
0044C32F   74 0C              JE SHORT 44C33D         // goto nova
0044C331   FE46 34            INC BYTE PTR DS:[ESI+34]  // change picture 'r' to 's'
0044C334  ^EB A6              JMP SHORT 44C2DC exit
0044C336   90                 NOP
0044C337   90                 NOP
0044C338   90                 NOP
0044C339   90                 NOP
0044C33A   90                 NOP
0044C33B   90                 NOP
0044C33C   90                 NOP
0044C33D   8B46 4C            MOV EAX,DWORD PTR DS:[ESI+4C]
0044C340   33D2               XOR EDX,EDX
0044C342   B2 05              MOV DL,5
0044C344   E8 67910000        CALL 4554B0     // get shipID of CS
0044C349   0FBFD0             MOVSX EDX,AX
0044C34C   8B06               MOV EAX,DWORD PTR DS:[ESI]
0044C34E   E8 ED9EFFFF        CALL 446240     // add colony ship
0044C353   B7 04              MOV BH,4

- Comet Strike -

counteraction:

option A = 1+ powered OBs

Code: Select all

trek.exe at 0x4B6C5 change 0x12 bytes to

0F BF 06 50 E8 C6 A5 FF FF 85 C0 58 75 09 90 90 90 90

-asm-
0044C2C5   0FBF06        MOVSX EAX,WORD[ESI]
0044C2C8   50            PUSH EAX
0044C2C9   E8 C6A5FFFF   CALL 446894
0044C2CE   85C0          TEST EAX,EAX
0044C2D0   58            POP EAX
0044C2D1   75 09         JNZ SHORT 44C2DC
0044C2D3   90 90 90 90   nop
option B = systems containing a Gas Giant are protected

Code: Select all

trek.exe at 0x4B6C5 change 0x12 bytes to

F6 46 70 08 75 11 90 90 90 90 0F BF 06 90 90 90 90 90

-asm-
0044C2C5   F646 70 08    TEST BYTE PTR DS:[ESI+70],8  // gas giant
0044C2C9   75 11         JNZ SHORT 44C2DC
0044C2CB   90 90 90 90   nop
0044C2CF   0FBF06        MOVSX EAX,WORD [ESI]
0044C2D2   90 *5         NOP

- Climate Shift Negative -

counteraction:

option A = powered Shield Generator

Code: Select all

trek.exe at 0x4B829 change 0x16 bytes to

0F BF 06 E8 5F A3 FF FF 83 F8 01 7D 31 90 8D 5C 24 08 8D 4C 24 0C

-asm-
0044C429   0FBF06         MOVSX EAX,WORD [ESI]
0044C42C   E8 5FA3FFFF    CALL 446790  // get SH output
0044C431   83F8 01        CMP EAX,1
0044C434   7D 31          JGE 44C467
0044C436   90             NOP
0044C437   8D5C24 08      LEA EBX,DWORD PTR SS:[ESP+8]
0044C43B   8D4C24 0C      LEA ECX,DWORD PTR SS:[ESP+C]
option B = systems containing a Gas Giant are protected

Code: Select all

trek.exe at 0x4B839 change 6 bytes to

F6 46 70 08 75 28

-asm-
0044C439   F646 70 08    TEST BYTE PTR DS:[ESI+70],8
0044C43D   75 28         JNZ SHORT trek-org.0044C467

- Earthquake -

counteraction: active scanner (tomographic tectonic scan for early detection & measures)

Code: Select all

trek.exe at 0x4B7AE change 0x12 bytes to

0F BF 06 E8 7A 88 FF FF 85 C0 75 0B 90 90 90 0F BF 06

-asm-
0044C3AE   0FBF06           MOVSX EAX,WORD PTR DS:[ESI]
0044C3B1   E8 7A88FFFF      CALL 444C30
0044C3B6   85C0             TEST EAX,EAX
0044C3B8   75 0B            JNZ SHORT 44C3C5
0044C3BA   90               NOP
0044C3BB   90               NOP
0044C3BC   90               NOP
0044C3BD   0FBF06           MOVSX EAX,WORD PTR DS:[ESI]

Patch:

Code: Select all

NAME: Modifying System Events (ECM example) required files: (s-s-map.tga, s-s-maps.tga & s-s-.ani)
DESC: Adds new positive system events, measures to prevent negative system events & some events unlock unused edifice.bst building requirements.
AUTHOR: Spocks-cuddly-tribble
URL: https://www.armadafleetcommand.com/onscreen/botf/viewtopic.php?p=46098#p46098

# new case 0 (disabled due to game balance issues)
# >> 0x4B61C 8E 06 03 00 00 20
# << 0x4B61C 4E 71 08 FE 46 6E

# new cases 8 (ship IDs 69h+ /0xA ships) & 9 (ship ID 50h)
>> 0x4B872 80 8E 07 03 00 00 08 31 C0 83 C4 14 5D 5F 5E 59 5B C3 80 8E 07 03 00 00 10 31 C0 83 C4 14 5D 5F 5E 59 5B C3
<< 0x4B872 0F B7 46 68 85 C0 74 ED B1 0A F6 F1 B2 69 02 D4 EB 08 80 7E 68 00 74 DD B2 50 0F BF 06 E8 AC 9D FF FF EB D1

# new case C
>> 0x4B98B 80 8E 04 03 00 00 20
<< 0x4B98B C6 86 20 03 00 00 01

# Super Nova special code
>> 0x4B6E7 66 8B 1D 44 2B 5A 00 66 83 FB 01 0F 84 22 FE FF FF 66 83 FB 02 0F 84 18 FE FF FF 66 83 FB 03 0F 84 0E FE FF FF 80 7E 30 00 0F 84 04 FE FF FF 31 D2 8A 56 4C 8D 04 D5 00 00 00 00 01 D0 C1 E0 02 01 D0 C1 E0 02 89 C2 C1 E0 02 29 D0 05 98 1A 5B 00 8B 40 50 E8 E0 EF 0C 00 83 F8 01 0F 84 D1 FD FF FF 8A 7E 31 80 FF 04 0F 85 C5 FD FF FF
<< 0x4B6E7 80 3D 44 2B 5A 00 03 7E EC 80 7E 30 00 74 E6 80 7E 31 04 75 E0 8B 46 4C 6B C0 6F 8B 04 85 E8 1A 5B 00 83 78 04 01 74 CD 0F BF 06 E8 F9 A8 06 00 0F B7 40 08 80 FC FF 74 0B E8 8B EC FF FF 80 78 2C 07 74 B1 80 7E 34 73 74 0C FE 46 34 EB A6 90 90 90 90 90 90 90 8B 46 4C 33 D2 B2 05 E8 67 91 00 00 0F BF D0 8B 06 E8 ED 9E FF FF B7 04

# Comet Strike special code -> counteraction option A = 1+ powered OBs 
>> 0x4B6C5 8A AE 07 03 00 00 80 CD 02 0F BF 06 88 AE 07 03 00 00
<< 0x4B6C5 0F BF 06 50 E8 C6 A5 FF FF 85 C0 58 75 09 90 90 90 90

# Climate Shift Negative special code -> counteraction option A = powered Shield Generator
>> 0x4B829 8A 86 07 03 00 00 8D 4C 24 0C 0C 40 8D 5C 24 08 88 86 07 03 00 00
<< 0x4B829 0F BF 06 E8 5F A3 FF FF 83 F8 01 7D 31 90 8D 5C 24 08 8D 4C 24 0C

# Earthquake special code -> counteraction = powered Scanner
>> 0x4B7AE 8A 96 04 03 00 00 80 CA 04 0F BF 06 88 96 04 03 00 00
<< 0x4B7AE 0F BF 06 E8 7A 88 FF FF 85 C0 75 0B 90 90 90 0F BF 06
Last edited by Spocks-cuddly-tribble on Sat Oct 29, 2022 8:32 am, edited 3 times in total.
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: 7934
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Re: Random Events

Post by thunderchero »

so many questions where to start.....

case 0
very interesting, so no structure would be required?

case 8
lots of possibilities and expandable (with more minor ships)

case 9
I would bet it was intended for a Promellian battle cruiser?
Spocks-cuddly-tribble wrote:(if 'special system' add special ship for system owner in sector)
so there would be limited to up to 6 'special system' each game for both case 8 and 9? and could that number be changed for larger maps?

case C
minor loss if only one turn, any possibility to edit to something else?

- Super Nova - Counteractions
could check be changed to a building ID example "Super nova protection grid" if no grid system destroyed but system turns into dilithium Asteroid belt and maybe place animation in system? territory claim would determine race who get bonus ditlh?

- Comet Strike - and - Climate Shift Negative - Counteractions
don't have any ideas at present, but I am guessing 1+ powered OBs and powered Shield Generator could be changed to just about structure available bonus?

- Earthquake - Counteractions
Not sure I understand how this would work is the active scanner (tomographic tectonic scan for early detection & measures) a new structure?

this would give many new reasons to play with random events on :grin:

Nice work Sct

BTW I still wonder what they had planned for planet killer (cone.hob)
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1927
Joined: Sun Apr 27, 2008 2:00 am

Re: Random Events

Post by Spocks-cuddly-tribble »

thunderchero wrote:case 0
very interesting, so no structure would be required?
The system basically just becomes a regular dilithium system (i.e. you won't notice a difference if dilithium was already present, unless you use asteroid belt dil. buildings) https://www.youtube.com/watch?v=ShxnbsrfBnw :wink:

note; due to an interface bug, changes to F1 map icons of stars and system bonuses (due to borg or random events) require re-loading of save-game to show up. Only the bottom display is up to date.

case 9
I would bet it was intended for a Promellian battle cruiser?
I simply had to share main code for 8 & 9, so I created at least a small deviation.

Drone and special systems were supposed to have "Artifacts" (loc_4FD30F). Should be displayed when moving mouse to terraformed planet instead of "terraform done/required", but is empty or shows race name (populated), even when the value is set.

so there would be limited to up to 6 'special system' each game for both case 8 and 9? and could that number be changed for larger maps?
Info is in linked post,

Limit of 6 systems (exit check, hence 7) is not main point (unmodded you need 350+ stars to run into it). Just disable it setting a high value.

Code: Select all

00451BC1                 cmp     ebp, 7       // systems limit
More important is the probability per system to become special:

Code: Select all

00451B01                 cmp     edx, 4
4 divided by the random divisor 200 = default 2% per system (percentage = value/2) i.e. average 1 of 50 systems

A map featuring about 500 stars and a probability of 5% per star (for check *2 = 0xA) has about 25 special systems. So a limit of 100(0x64) should be fine.

case C
minor loss if only one turn, any possibility to edit to something else?
Of course, but most changes are 6-15 bytes only, implementing simple knowledge of fileinfo (mainly systInfo) and fitting subroutines. So we are very limited. For example 'dilithium source exhausted' i.e. decreasing dil source level and removing dil from system when 0 wouldn't work properly, since buildings with lost requirements won't be auto-removed and so on.... Add building by ID would be easy.

could check be changed to a building ID example "Super nova protection grid"
I considered using buildings exclusively used for random events and discarded it due to a couple of reasons. For instance:
- build list confusing, spammed, even when playing without random events
- code issues with power check for those buildings (simple are: OB, SH, scanner and yards)

system destroyed but system turns into dilithium Asteroid belt and maybe place animation in system? territory claim would determine race who get bonus ditlh?
no code support for this, even the code setting the pulsar/wormhole building requirement flags, based on adjacent sectors, is unusable broken

- Comet Strike - and - Climate Shift Negative - Counteractions
don't have any ideas at present, but I am guessing 1+ powered OBs and powered Shield Generator could be changed to just about structure available bonus?
See above, when it comes to power check, simple are: OB, SH, scanner and yards

- Earthquake - Counteractions
Not sure I understand how this would work is the active scanner (tomographic tectonic scan for early detection & measures) a new structure?
no, it's just an excuse to assign (sort of unsuitable) features to given structures, like:

-shield generator can be modified to adapt feature of a Weather Control System (i.e. atmosphere/clima stabilisator)
- OBs as a sort of asteroid/comet deflector device

note; the buildings must be powered all the time, minimum 2 turns before the event (same as with system attack and OBs, switching on when attacker has arrived is too late).

So you have to 'pay' the energy cost (i.e. often the manpower to provide it) as price for the insurance against random system event damage.

BTW I still wonder what they had planned for planet killer (cone.hob)
I'd say probably killing planets :wink: Most likely discarded due to TNG licence restriction, like the space amoeba files.
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: 1927
Joined: Sun Apr 27, 2008 2:00 am

"Artifacts" Display fix for Special Systems

Post by Spocks-cuddly-tribble »

Drone and special systems were supposed to have "Artifacts" (loc_4FD30F).
Should be displayed when moving mouse to terraformed planet instead of 'terraform done/required':

Artifacts.png
Artifacts.png (192.59 KiB) Viewed 1774 times

Code: Select all

0xFC732 change E4 -> B6

4FD331  ^E9 B6FDFFFF   JMP 4FD0EC
So determining special systems becomes a bit easier when using 'New System Events' 8 & 9 (see above). :wink:


Special systems see: viewtopic.php?f=231&t=319#p33718
Spocks-cuddly-tribble wrote:
so there would be limited to up to 6 'special system' each game for both case 8 and 9? and could that number be changed for larger maps?
Limit of 6 systems (exit check, hence 7) is not main point (unmodded you need 350+ stars to run into it). Just disable it setting a high value.

Code: Select all

00451BC1                 cmp     ebp, 7       // systems limit
More important is the probability per system to become special:

Code: Select all

00451B01                 cmp     edx, 4
4 divided by the random divisor 200 = default 2% per system (percentage = value/2) i.e. average 1 of 50 systems

A map featuring about 500 stars and a probability of 5% per star (for check *2 = 0xA) has about 25 special systems. So a limit of 100(0x64) should be fine.
Last edited by Spocks-cuddly-tribble on Sun Oct 30, 2022 11:53 am, edited 1 time in total.
I don't know how many bugs is too many but that point is reached somewhere before however many in BotF is.
User avatar
EnPhreg
Lieutenant-Commander
Lieutenant-Commander
Posts: 130
Joined: Thu Jul 10, 2008 2:00 am

Re: Random Events

Post by EnPhreg »

F6 = monster opportunity at the end of that turn, assuming random events=yes & delay time is over, else first turn if both conditions are met. E.g. impossible/unmodded the earliest monster opportunity is at turn 11, i.e. soonest at beginning of turn 12 a monster on the map.
i'm right in my assumption that the F6 key works also without the -MUDD command??
and if i'm right with my above assumption, is it possible to deactivate the F6 key??
User avatar
Soulvoid
Cadet 4th Year
Cadet 4th Year
Posts: 18
Joined: Tue Oct 28, 2014 11:12 am

Re: Example: Lowering system-specific random event frequency

Post by Soulvoid »

Spocks-cuddly-tribble wrote:Lowering the frequency of the system-specific random events to 20% of the default level without making them too erratic

Example disable Super Nova (See @1.4)

44C014 switch/jump table: (case / 4byte address of code sequence)
goto asm 44C014 +4*0 (bitmask) -> copy 4 byte
goto asm 44C014 +4*3 (Super Nova) -> paste 4 byte from bitmask

Code: Select all

trek.exe at 0x04B420 change E7 C2 44 00 to -> 1B C2 44 00
Thank you for the terrific info in your post's on this topic. They have been extremely helpful for editing things the way that I want them.
One question, I did as you suggested in this example and open trek.exe in HxD hex editor(my fav one) and changed the values there to your suggested values at the proper address. I decided to go with this fix during a game after my best system went nova. Disabled this feature and tested with a previous save game right before the nova. Nova still happened, do I need to do more then just change the first field inside of the hex editor in your example or do I need to start/test this on a new game? Im guessing the latter but your input would be much appreciated! Thank you
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 7934
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Re: Random Events

Post by thunderchero »

Soulvoid wrote:do I need to start/test this on a new game?
correct, most changes like this require starting new game.
User avatar
jonesie85two
Lieutenant-Commander
Lieutenant-Commander
Posts: 201
Joined: Sat Apr 26, 2008 2:00 am

Re: Random Events

Post by jonesie85two »

44C830 switch/jump table: (case / 4byte address of code sequence)

0: bitmask
1: Credits gained
2: Credits lost
3: diplomatic / attitude change
4: bitmask
5: Hull Virus
6: no event (end code for all events / test next empire)
7: bitmask
8: bitmask
9: Research points lost
A: no event
B: Research points gained


Hi, Im looking in to replacing the 'Diplomatic Atitude change' option from the Empire-specific non system events list with a less annoying option.

a few questions.

1/ is that annoying message.... government has changed , less happy with you the one that i would be changing if i replace the diplomatic/attitude change option?

2/ Im converting 44CB30 via UE... which leads me to 0x4bc30 in the TREK.EXE. Is this the correct location of the events table?

3/ Below is what i see at 0x4bc30 (using HxD hex editor whist viewing the Vanilla Trek.exe installed via the BOTF All-in-One installer.

2E C9 44 00 3A C9 44 00 93 C9 44 00 EC C9 44 00
0D CA 44 00 19 CA 44 00 9B C8 44 00 38 CA 44 00
44 CA 44 00 50 CA 44 00 C8 CB 44 00 0D CB 44 00

is it seperated like this.. with each set of 4 bytes being one of the items in the list above?

2E C9 44 00 3A C9 44 00 93 C9 44 00 EC C9 44 00
0D CA 44 00 19 CA 44 00 9B C8 44 00 38 CA 44 00
44 CA 44 00 50 CA 44 00 C8 CB 44 00 0D CB 44 00


Sorry for the hassle fellas.

- Jonesie
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 7934
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Re: Random Events

Post by thunderchero »

I have problems understanding bitmask myself, but some of those message may also be due to intel not random events.

sorry
Post Reply

Return to “Random Events”