Monster Editing Info

Monster Editing Info; support/discussion/questions

Moderator: thunderchero

User avatar
DCER
Code Master
Code Master
Posts: 683
Joined: Sat Apr 26, 2008 2:00 am

Monster Editing Info

Post by DCER »

========================================================

See also:

-> Scheme of the Random Events (#2 appearing on map)

-> Monster planet attacks & Borg spawning

-> Extending the shiplist (Borg checks & Monster switches)

-> Domination victory conditions (BORG)

========================================================


UE won't allow you to copy or delete aliens, because it depends on to always have 10 of them.

If you know how to hex edit, you can try to open trek.exe and set all of these values:

address value

323291 Borg Cube ID (0x4EEDB) 73
323803 Calamarain ID (0x4F0DB) 74
323674 Chodak ID (0x4F05A) 75
323611 Crystal Entity ID (0x4F01B) 76
324087 Combat Drone ID (0x4F1F7) 77
324018 Edo Guardian ID (0x4F1B2) 78
323873 Gomtuu ID (0x4F121) 79
324146 Husnock ID (0x4F232) 7A
323955 Tarellian ID (0x4F173) 7C

set them to the Borg Cube ID. It might work and instead of the other monsters only cubes will spawn.

If you copy or remove ships in UE, it will reset these values to the previous ones. So you'll need to edit these values on each edit again.
User avatar
DCER
Code Master
Code Master
Posts: 683
Joined: Sat Apr 26, 2008 2:00 am

Post by DCER »

I've tried the method I wrote briefly and it only sort of works.

I set all the aliens to the Borg and the Edo started with a Borg cube above their heads. The cube assimilated the system and then a new cube spawned in another system.

Problem is the Edo god won't move from the Edo system and the new cube which was created on the other side of the map above an empty system also won't move from it. Looks like two Edo gods.

When engaged, the original Edo cube complains the Edo system is not inhabited by Edos.

Code: Select all

-------------------------------------
ST:BOF Sat Aug  9 22:30:17 2008

Version Under Test: 72
File: ..\..\source\game\military\battle.c, Line: 2293, system->inhabitants == EDOS
Initialize State: 31
Player Empire: 1	Starting Seed: 1218313722
Galaxy shape: 0	Galaxy Size: 2
Turn State: 20
Turn Number: 13
In another test I engaged the Combat Drone. No crash, fought the cube, but the cube behaved as the Combat drone. Even the name was the minosians (though the name reference can easily be changed in trek.exe).

EDIT:

If anyone wants to play with this, there's a way to set which monster is the Edo and Minosians.

at 0x050F40 is the Minosians value
at 0x050B44 is the Edo God

These values set how the monster behaves in combat as well as which ship it will take from the list of monster ships. But doesn't effect ship map movement.

To get the internal monster index - subtract the value with 0x24 (36)

Monster indexes:

0 - Borg Cube 24
1 - Crystal Entity 25
2 - Chodak 26
3 - Calamarain 27
4 - Gomtuu 28
5 - Tarellian 29
6 - Edo Guardian 2A
7 - Combat Drone 2B
8 - Orbital Battery
9 - Husnock 2C

EDIT: fixed the index list to add orbital battery index - WARNING - using 8 will throw an error
Last edited by DCER on Mon Aug 11, 2008 4:55 pm, edited 1 time in total.
User avatar
DCER
Code Master
Code Master
Posts: 683
Joined: Sat Apr 26, 2008 2:00 am

Post by DCER »

To change the minor race the Edo Guardian accompanies, set these two values to the minor race id:

0x50B1C and 0x70714, if you set them to a high value (for instance 0x24), the Edo Guardian will be disabled. Only minor race ids will work here!

If you sign a membership treaty, the alien will consider you an ally just like before with the Edo set.

At 0x50B1D and 0x70715 are two values that are part of two jump instructions.

In vanilla they are set to "jump if not equal to" (0x0F85). This causes only the set race to have the guardian.

If one sets it to 0x0F84 (jump if equal to) all races, but the set one will have a guardian. Each guardian is tied to the race it protects, meaning if you sign membership with the Edo, their guardian will consider you an ally, but the Talarian one won't. Set the race to a high value (>0x23) and all minor race will have the guardian.
Chernabog
Lieutenant-Commander
Lieutenant-Commander
Posts: 102
Joined: Fri Oct 02, 2009 2:00 am

A sneaky request...

Post by Chernabog »

@SCT

After reading the results of your research into all things regarding random events, I think (hope) there is a very simple way to complete the objective for monsters that I am looking for in my mod.

Basically, every time a monster is generated, I need it to always be the same one (specifically the Husnock raider from vanilla). Your research indicates that this can be done, but not what those specific ID's could be (i'm guessing you havent found that bit out yet).
2.4 => Monster Opportunity (sub_44B220)


Subroutine 44B220 can be called with eax [monster race-ID] or [-1] = 1:7 random chance for each mobile monster (i.e. Edo God & Combat Drone are invalid).

Valide monster race IDs are read from ds:5A36D4 via index value.
=> Scheme of the Random Events

I am quite happy to have a play with this to find out which ID is what however I can't get my head around the whole assembler to hex marlarky. So ... could you tell me a simple hex (replace blah for blah) way of being able to set just the monster ID value into sub_44B220?

If this is not a simple thing then no worries, but thought i'd ask anyway :)

Regards,

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

Post by Spocks-cuddly-tribble »

Chernabog wrote:every time a monster is generated, I need it to always be the same one
See "assembler offests" for converting to hex (UE can do for you, btw)


For the 3 paths in sub_44B220 (eax -1 each):

Code: Select all

44CBFE                 mov     eax, 0FFFFFFFFh // (for down counter)
44CC93                 mov     eax, 0FFFFFFFFh // (for F6)
44CD9E                 mov     eax, 0FFFFFFFFh // (for random generator)
hex code each -> B8 FF FF FF FF


And for (see domination victory conditions)

Code: Select all

44E306                 mov     eax, 24h // borg 
hex code -> B8 24 00 00 00


Monster race IDs are:

Borg Cube 24
Crystal Entity 25
Chodak 26
Calamarain 27
Gomtuu 28
Tarellian 29
Edo Guardian 2A
Combat Drone 2B
Husnock 2C
Last edited by Spocks-cuddly-tribble on Fri Apr 29, 2022 7:35 pm, 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.
Chernabog
Lieutenant-Commander
Lieutenant-Commander
Posts: 102
Joined: Fri Oct 02, 2009 2:00 am

Post by Chernabog »

Spocks-cuddly-tribble wrote:
Chernabog wrote:I really dont want all that assimilating going on ... I wonder ... can this be turned off (the borg system attacks)?
At asm-44F3F0 change 8F F4 44 00 to -> 56 F5 44 00 (see info on switches)
Nice, thanks SCT, when I get a moment I will try this out :)

... I'm guessing that with this set no new cubes will be spawned... but no worries, tests will prove yes or no :)

Thanks again,

C.

EDIT:


Couldn't help myslef ...

This seems to work fine. The cube will just sit over a populated system and stay there (but not destroy the population), it would be nice if it could be convinced to move on but its not that important.

Thanks SCT, the Borg can no go into my mod :)

Regards,

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

Monster Combat Behavior

Post by Spocks-cuddly-tribble »

As announced, the progress made with commands in tactical combat allows for a more specific analysis and editing of monster behavior in combat. Unfortunately, monsters are still not edit friendly (i.e. the IDs are spammed all over trek.exe using many switches with unfavourable shared code). This is aggravated by the fact that parts of the auto battle & tactical combat code are unfinished resp. massively flawed. Nevertheless, here is some fodder for the hardcore modders:



1.) "Hail"-(before entering the tactical combat screen) & Edo God bug

Sub_478D04 determines whether opponent(s) accept an auto-hail. The Edo God is mistakenly on the list of friendly monsters (i.e. Edo war check is missing). Thus, one can conquer the Edo without destroying the guardian and later on it will consider the oppressor as ally and destroy all liberation forces.


:arrow: Edo God auto-hail bug-fix:

Code: Select all

Trek.exe at 0x78365
replace: (42 bytes)
66 3D 29 00 73 14 66 3D 28 00 75 1E B8 01 00 00 00 83 C4 18 5D 5F 5E 59 5B C3 0F 86 22 FF FF FF 66 3D 2A 00 0F 84 18 FF FF FF
with:
3C 2A 74 16 3C 29 74 04 3C 28 75 1E B8 01 00 00 00 83 C4 18 5D 5F 5E 59 5B C3 8B 44 24 10 80 3C 85 B8 24 5A 00 04 75 E4 90 90

code changes:

478F65     3C 2A                CMP AL, 2A   // Edo God ID
478F67     74 16                JE SHORT 478F7F   // goto Edo war check
478F69     3C 29                CMP AL, 29   // Tarellian ID
478F6B     74 04                JE SHORT 478F71   // goto friendly
478F6D     3C 28                CMP AL, 28   // Gomtuu ID

478F7F     8B4424 10            MOV EAX, [ESP+10]   // player race ID
478F83     803C85 B8245A00 04   CMP BYTE [EAX*4+5A24B8], 4   // AlienInfo war check
478F8B    ^75 E4                JNZ SHORT 478F71   // goto friendly
478F8D     9090                 NOP
Some more known issues with the auto-battle: (sub_527E50)
  • if the hail gets rejected then auto battle performes just as if never hail was used, unlike in tactical combat there is no risk using auto-hail
  • no Exp. Points from auto battle
  • some data just seems to be ignored: distance, agility, scale
  • effects of map objects like the nebular (sub_474880 -> shields & agility) are discarded
Side Note: Only the Tarellian monster is affected by the nebular effect in tactical combat:

Code: Select all

47490B                 cmp     word ptr [eax+1DCh], 29h // Tarellian_only

2.) Monster behavior during tactical turns (& auto battle turns?)

The monster combat behavior is (partly) controlled by sub_47715C (f.e. not the hail end combat option or Gomtuu effect).

At asm-4770C0 there is the monster switch / case - monster race-ID (stored at ds:597864[+1DC]):

0 - Borg Cube 24
1 - Crystal Entity 25
2 - Chodak 26
3 - Calamarain 27
4 - Gomtuu 28
5 - Tarellian 29
6 - Edo Guardian 2A
7 - Combat Drone 2B
8 - Husnock 2C


Behavior of some monster depends on opponents' commands (asm-adr.of switch tables):

4770E4 - Chodak
477108 - Gomtuu
477138 - Edo God ( the command check is skipped for enemies of the Edo )

Command code key: (for switch cases -1 / stored at ds:597864[+1FC])

01 Charge
02 Assault
03 Harry
04 Circle
05 Strafe
06 Flyby
07 Evade
08 Cloak
09 Ram
0A Retreat
0B -inoperative-
0C Open hailing frequencies
0D Hold position


F.e. for Tarellian:

Code: Select all

4773D8                 mov     dword ptr [edi+1FCh], 0C // hail command (for movement)
4773E2                 or      dh, 10h // lock weapons (redundant for hail)

3.) Global behavior in combat (e.g. the hail end combat option)

I didn't test this in detail, but the following seem to be the relevant controls:

sub_477670 -> loc_477875

Code: Select all

477887                 cmp     ax, 28h // Gomtuu
477891                 cmp     ax, 26h // Chodak
477A1D                 cmp     ax, 29h // Tarrelian
-> sub_478A5C -> monster race switch table at 478A10 (Chodak, Gomtuu & Tarrelian accept hail)

sub_472374 -> monster race switch table at 472354

sub_4780C0 -> monster race switch table at 4780C0 (offensive vs. unclear monster / ally check?)

Unknown purpose:
sub_4786DC -> monster race switch table at 4786C0 -> loc_4787EB for Combat Drone & Husnock
sub_554160 -> monster race switch table at 554140 -> loc_55439E for Combat Drone
Last edited by Spocks-cuddly-tribble on Fri Apr 29, 2022 7:41 pm, 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
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1883
Joined: Sun Apr 27, 2008 2:00 am

Monster Cloak

Post by Spocks-cuddly-tribble »

Proper enabling of monster cloak turned out to be a bit more complicated than expected, but here it is. :)


During tests, I observed some mod-independent bugs with the Edo God:
  • sometimes the auto-battle end message/voiceover & morale effect is wrong (f.e. "hail" with all ships destroyed or "retreat" with ships still in Edo sector)
  • due to some AI behavior-bugs the monster cloak does not prevent the "Edo training" misuse via the one uncloaked ship tactic or via using "cloak" command in tactical combat
  • even if the first-turn default command in tactical combat requires a target then ships won't fire at the Edo God (i.e. one can move to a dead angle behind the monster to kill it with a single ship resp. do "Edo training" without cloak ability). For the "charge & assault" commands this unchanged first-turn command bug leads to a crash:

    Code: Select all

    File: ai\assault.c, Line: 562, entity->ship.shipData.targetIsEntity

:arrow: Enabling the Monster Cloak

Unlike for stations, the monster code is prepared for cloak, but requires the cloak default fix for task forces, which enables the F1 map cloak for monster.



1.) Auto Battle

1.a) Monster de-cloak shields fix for auto battle

Code: Select all

Trek.exe at 0x127BC2
replace: (25 bytes)
8B B0 78 01 00 00 C7 40 38 00 00 00 00 83 FE 01 75 07 80 A0 90 03 00 00 FD
with:
80 B8 78 01 00 00 06 74 10 C6 40 38 00 50 E8 CB 03 00 00 80 60 68 FD 58 90


005287C2     80B8 78010000 06   CMP BYTE [EAX+178], 6
005287C9     74 10              JE SHORT 5287DB
005287CB     C640 38 00         MOV BYTE [EAX+38], 0
005287CF     50                 PUSH EAX
005287D0     E8 CB030000        CALL 528BA0
005287D5     8060 68 FD         AND BYTE [EAX+68], 0FD
005287D9     58                 POP EAX
005287DA     90                 NOP
1.b) Disabling the monster cloak only for auto-battle (1.a is redundant for this)

This option is meant to protect the AI (auto-battling only) from losing main fleets against cloaked monsters.

Code: Select all

Trek.exe at 0x1272C6
replace: (36 bytes)
C7 42 38 00 00 00 00 83 FB 01 0F 85 D8 00 00 00 89 D0 E8 83 0C 00 00 F6 40 58 01 74 07 C7 42 38 01 00 00 00
with:
83 FB 07 75 1F C7 42 38 00 00 00 00 80 8A 38 03 00 00 FC 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90


00527EC6     83FB 07            CMP EBX, 7
00527EC9     75 1F              JNZ SHORT 527EEA
00527ECB     C742 38 00000000   MOV DWORD [EDX+38], 0
00527ED2     808A 38030000 FC   OR BYTE [EDX+338], 0FC
00527ED9     90...              NOP *17

2.) Tactical Combat

2.a) Initial cloak fix for monster

Code: Select all

Trek.exe at 0x11FE0D
replace: (8 bytes)
39 C1 0F 85 20 03 00 00
with:
B8 01 00 00 00 90 90 90


00520A0D   B8 01000000   MOV EAX, 1
00520A12   909090        NOP
2.b) Enforced "Hold" command with locked weapons fix

Sub_47215C enforces the "Hold" command for opponents of fully cloaked fleets resp. de-cloaks ships if all fleets are fully cloaked. Due to a bug in sub_471DD0 it mistakenly enforces the "Hold" command for Tarellian/29, Combat Drone/2B & Husnock/2C if they are cloaked themselves. Make sure that the monster switch in loc_472278 jumps to 47221A for all monster with map/initial cloak.

Code example for Combat Drone (2B) with cloak:

Code: Select all

Trek.exe at 0x7167D
replace: (14 bytes)
66 8B 8B DC 01 00 00 83 E9 24 66 83 F9 06
with:
8A 8B DC 01 00 00 83 E9 24 83 F9 07 74 8F


0047227D     8A8B DC010000   MOV CL, [EBX+1DC]
00472283     83E9 24         SUB ECX, 24
00472286     83F9 07         CMP ECX, 7
00472289    ^74 8F           JE SHORT 47221A
2.c) Monster staying cloaked + de-cloak shields fix

Sub_528840 determines via the given command whether a cloaked ship will stay cloaked or de-cloak during the tactical turn (result of the call from 496E5C seems to be ignored, maybe this is a bug). By default the commands "cloak, retreat & hold" keep ships cloaked. Since some monster use the "hold" command, they just stay cloaked and do nothing without code adjusting:

Code: Select all

Trek.exe at 0x11EF48
replace: (39 bytes)
8B 40 48 E8 F0 8C 00 00 85 C0 75 1B C7 45 34 02 00 00 00 66 83 7B 28 2B 0F 84 D0 FB FF FF 80 4B 58 10 E9 C7 FB FF FF
with:
66 83 7B 28 24 7D 1C 8B 40 48 E8 E9 8C 00 00 85 C0 75 14 C7 45 34 02 00 00 00 80 4B 58 10 E9 CB FB FF FF 80 65 68 FD


0051FB48   66:837B 28 24     CMP WORD [EBX+28], 24 // if a monster...
0051FB4D   7D 1C             JGE SHORT 51FB6B  // de-cloak with shields fix 
0051FB4F   8B40 48           MOV EAX, [EAX+48] // given command
0051FB52   E8 E98C0000       CALL 528840 // stay cloaked check via command
0051FB57   85C0              TEST EAX, EAX
0051FB59   75 14             JNZ SHORT 51FB6F // de-cloak ship
0051FB5B   C745 34 02000000  MOV DWORD [EBP+34], 2  // stay cloaked
0051FB62   804B 58 10        OR BYTE [EBX+58], 10  // lock weapons
0051FB66  ^E9 CBFBFFFF       JMP 51F736
0051FB6B   8065 68 FD        AND BYTE [EBP+68], 0FD // unlock shields
In order to share the shields fix with ships, the jump at 51FB59 could be changed from 51FB6F to 51FB6B and below unlock ship shields statements removed, but I don't think it's necessary.

Code: Select all

00523280   80A0 90030000 FD  AND BYTE [EAX+390], 0FD
00523EC1   80A0 90030000 FD  AND BYTE [EAX+390], 0FD
00524CE5   80A0 90030000 FD  AND BYTE [EAX+390], 0FD
00525798   80A0 90030000 FD  AND BYTE [EAX+390], 0FD
3.) Monster using the "cloak" command in tactical combat

Note: there are some issues with the "cloak" command - see Commands in tactical combat.

3.a) Cloak command for Combat Drone

Code: Select all

Trek.exe at 0x76A2B
replace: (27 bytes)
C7 87 FC 01 00 00 05 00 00 00 80 8F 0C 02 00 00 02 83 C4 18 5D 5F 5E 5A 59 5B C3
with:
B0 05 F6 47 38 01 75 02 B0 08 88 87 FC 01 00 00 80 8F 0C 02 00 00 02 EB 13 90 90


0047762B   B0 05              MOV AL, 5  // strafe attack (default) or...
0047762D   F647 38 01         TEST BYTE [EDI+38], 1  // if uncloaked...
00477631   75 02              JNZ SHORT 477635
00477633   B0 08              MOV AL, 8  // ...cloak
00477635   8887 FC010000      MOV [EDI+1FC], AL
0047763B   808F 0C020000 02   OR BYTE [EDI+20C], 2
00477642   EB 13              JMP SHORT 477657
00477644   9090               NOP
3.b) Special monster cloak command (unlock shields & weapons)

Whilst the default, with locking shields & weapons, is reasonable for player using the cloak command, it would be way too easy to kill the combat drone...

Code: Select all

Trek.exe at 0x1696B5
replace: (30 bytes)
E8 A6 E8 FB FF 80 48 58 10 89 D0 E8 DB E8 FB FF 8A 78 68 8B 4C 24 14 80 CF 02 51 88 78 68
with:
80 B8 78 01 00 00 07 74 0E 80 88 0C 02 00 00 10 80 88 90 03 00 00 02 8B 4C 24 14 51 90 90


0056A2B5   80B8 78010000 07   CMP BYTE [EAX+178], 7 // if a monster...
0056A2BC   74 0E              JE SHORT 56A2CC // ...do not lock weapons & shields
0056A2BE   8088 0C020000 10   OR BYTE [EAX+20C], 10  // lock weapons
0056A2C5   8088 90030000 02   OR BYTE [EAX+390], 2  // lock shields (ships)
0056A2CC   8B4C24 14          MOV ECX, [ESP+14]
0056A2D0   51                 PUSH ECX
0056A2D1   9090               NOP
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: 1883
Joined: Sun Apr 27, 2008 2:00 am

Combat Drone

Post by Spocks-cuddly-tribble »

Following piece of code places the combat drone and sets for up to 6 free systems an "Artifacts" random value in [systInfo+68h]:

Code: Select all

00451AF7                 mov     ecx, 0C8h       ; random divisor 200
00451B01                 cmp     edx, 4
00451B04                 jge     short next_system  (if result 4+)
00451B06                 inc     ebp             ; system count for special value
00451B07                 cmp     edx, 2
00451B0A                 jge     no_drone_random_0_99 (if result 2-3)
00451B10                 cmp     dword ptr [esp+0Ch], 0  // check drone done marker
00451B15                 jnz     no_drone_random_0_99
00451B1B                 mov     eax, 1          ; prepare drone done marker
00451B25                 mov     [esp+0Ch], eax  ; set drone done marker
- for Drone system:
00451B6E                 mov     ecx, 1F4h       ; random divisor 500
00451B82                 mov     [edi+68h], dx   ; set random 0-499
- for up to 6 free systems:
00451BC1                 cmp     ebp, 7       // systems limit
00451BC4                 jge     next_system
00451BDB                 mov     ecx, 64h        ; random divisor 100
00451BE5                 mov     [edi+68h], dx   ; set random 0-99
So for free systems there is a default chance of 2 [random results 0-1] : 200 (i.e. 1/100 aka 1%) to get the combat drone. Turning the drone done marker into a count would allow for more than one drone.

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", see "Artifacts" Display fix for Special Systems: viewtopic.php?p=46221#p46221 :idea:
Image

Code: Select all

NAME: Combat Drone only with Random Events
DESC: Places Combat Drone and 'artifacts' systems only if Random Events ON (low tech AI protection).
AUTHOR: Spocks-cuddly-tribble
URL: https://www.armadafleetcommand.com/onscreen/botf/viewtopic.php?p=33718#p33718

>> 0x00050e82 4c 24 10 8b 3d c8 36 5a 00 01 cf 66 83 7f 44 ff 74 52 0f bf cb 31 d2 89 c8 66
>> 0x00050e9d 57 44
>> 0x00050fad 8b 7c 24 10 81 c7 28 03
>> 0x00050fb6 00 43 89 7c 24 10
>> 0x00050fbd b0

<< 0x00050e82 3d c8 36 5a 00 03 7c 24 10 80 7f 44 ff 0f 84 1a 01 00 00 0f b7 57 44 0f bf cb
<< 0x00050e9d c1 90
<< 0x00050fad eb 0d 80 3d 46 2b 5a 00
<< 0x00050fb6 0f 85 2a ff ff ff
<< 0x00050fbd e9


#00451A81     8B3D C8365A00       MOV EDI,[5A36C8] // systInfo
#00451A87     037C24 10           ADD EDI,[ESP+10] // + current entry
#00451A8B     807F 44 FF          CMP BYTE[EDI+44],0FF // if no pop...
#00451A8F     0F84 1A010000       JE 451BAF // ...check random events for artifacts & combat drone
#00451A95     0FB757 44           MOVZX EDX,WORD [EDI+44] // pop race IDD
#00451A99     0FBFCB              MOVSX ECX,BX  // system ID
#00451A9C     8BC1                MOV EAX,ECX // system ID
#00451A9E     90                  NOP

#00451BAD     EB 0D               JMP SHORT 451BBC // go next system
#00451BAF     803D 462B5A00 00    CMP BYTE [5A2B46],0 // random events ON?
#00451BB6    ^0F85 2AFFFFFF       JNZ 451AE6 // yes -> 'artifacts' & combat drone
#00451BBC    ^E9 E9FEFFFF         JMP 451AAA // no -> skip go next system
Places Combat Drone & 'artifacts' only if Random Events ON in new-game settings (later change of random events in options screen won't affect Combat Drone & 'artifacts' in that game). So Random Events OFF could be used to protect the AIs/player from close drone placements in low tech/epic games. :wink:



Change System Name to Minos Fix (updating planet the names requires re-loading saved game)

Code: Select all

00451B86     83C7 08    ADD EDI, 8
00451B89     909090     NOP

00451B91     9090       NOP
Won't work for planet names when using this custom planet names fix: viewtopic.php?f=9&t=1337 (which disables cardassian/romulan planet sorting fix)

In this case only one planet name can be changed (default always last / remotest planet).

Planet 'Minos' Position Fix (instead of the System Name fix)

Code: Select all

trek.exe at 0x50F78 change 7 bytes to: 0F B6 47 6A 48 D1 E8

00451B78     0FB647 6A    MOVZX EAX, BYTE [EDI+6A]  // number of planets
00451B7C     48           DEC EAX    // -1 for index
00451B7D     D1E8         SHR EAX, 1   // divide by 2 to get index to rename
Last edited by Spocks-cuddly-tribble on Sun Oct 30, 2022 12:01 pm, edited 5 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
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1883
Joined: Sun Apr 27, 2008 2:00 am

Monster Map Movements

Post by Spocks-cuddly-tribble »

At asm-4337D0 sets a switch table (via monster race ID) map-programs for newly generated monsters (valid IDs are 0-4).

0 = don't move
1 = erratic/slow (sub_4332F0)
2-4 = jump to star systems (sub_ 433010)

Code: Select all

004337D0              3_borg
004337D4              1_Crystal_Gomtuu
004337D8              2_Chodak_Cala_Tarell
004337DC              2_Chodak_Cala_Tarell
004337E0              1_Crystal_Gomtuu
004337E4              2_Chodak_Cala_Tarell
004337E8              0_EdoGod_Drone
004337EC              0_EdoGod_Drone
004337F0              4_Husnock
Analysing the whole code of sub_4336D0 would be too time-consuming, but here is some info on programs 2-4.

Borg program 3 means stay if inhabited.

Code: Select all

0043305A                 cmp     edx, 3 // program check
Else there is a stay chance of 75% for inhabited systems i.e. programs 2 and 4 seem to do exactly the same.

Code: Select all

004331A7                 mov     ecx, 4  // random value 0-3
004331B1                 test    edx, edx  // move on if  0
Monster map speed = distance to the next star system + random value in sectors

Code: Select all

00433276                 mov     ecx, 0Ah // random 0-9
Sub_433010 checks the distance in sectors, adds a random value and stores the system with the lowest result as destination system. IIRC monsters can disappear from the map?


:arrow: Avoid AI Systems Fix for Monster Programs 2-4

This should help preventing games ruined due to monster assaults on the AI empires (especially borg).

Code: Select all

trek.exe at 0x325DB new code 0xF bytes:

6B C0 65 8B 15 C8 36 5A 00 80 7C C2 04 01 90

-asm code:
004331DB     6BC0 65         IMUL EAX, EAX ,65 // system ID
004331DE     8B15 C8365A00   MOV EDX, [5A36C8]  //address systInfo
004331E4     807CC2 04 01    CMP BYTE [EDX+EAX*8+4], 1 // AI check
004331E9     90              NOP
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: 1883
Joined: Sun Apr 27, 2008 2:00 am

Adding the Planet Killer

Post by Spocks-cuddly-tribble »

Omission broken/unfinished feature fix wrt. the Doomsday Machine files in stbof.res (cone.hob / gif)

System attack destroys one planet/turn via conversion to gas giant displaying 'debris field' ani file 'asfs.ani' (tarellian won't affect population anymore)

Tactical combat / Map behavior is same as crystal entity, but shipmodel (hob)& shipstats(shiplist.sst entry) are unique


file requirements:

- asfs.ani -> viewtopic.php?t=1269
- shiplist.sst edited entry of 'Orbital Battery' monster to 'Doomsday Machine' (default-ID 7B, best copy & past crystal entry and adapt ship ID, ship type must be monster 08)
- ship-pack including all files assigned to the shiplist.sst entry e.g. i_T10 30, 60, 120, 170, 270(for system attack) .tga
- lexicon.dic edited entries: 39 to 'Antiproton Beam', 40 to 'Planet Killer' and 205 to 'Alien Entity'


lexicon entry for tactical combat is unused 0x28(default alien artifacts discovered) set this to 'Planet Killer' and shiplist.sst label to 'Doomsday Machine'


'crystal entity' message workaround (monster ID 25h shared with planet killer)

monster raceID 25h reads lexicon entry 205 'the crystal entity' change to -> 'Alien Entity'

shiplist.sst entry of crystal -> 'Unknown Lifeform' change to -> 'Crystal Lifeform'



trek.exe code changes: (in-depth asm code at end of this post)

Code: Select all

44B210 valid_monster_race_IDs -> add 2D   // 0x4A61C -> 2C 00 00 -> 2D 00 2C
44B242                 movsw              // 0x4A642 -> 66 -> 90
44B373           cmp     bx, 7 -> 8       // 0x4A776 -> 07 -> 08
44B35B           mov     ecx, 0Eh -> 10h  // 0x4A75C -> 0E -> 10

0x4A712 -> 0xC bytes -> 0F B6 1C 5C 53 80 FB 2D 75 02 B3 25
0x4A73E -> 4   bytes -> 8B C3 90 90

0x4EEC3 -> 0xB bytes  -> 8D 43 DC 3C 08 0F 87 6A 01 00 00
0x4F033 -> 0x26 bytes -> E9 BB 00 00 00 66 C7 84 24 72 01 00 00 7B 00 B8 28 00 00 00 B3 25 8D BC 24 20 01 00 00 E9 9E 00 00 00 90 90 90 90

44FED0 (set monster race ID) OB -> Crystal  // 0x4F2F0 -> 5E -> B4

planet killer system attack (former tarellian code)
0x4E810 ->    6 bytes -> C7 F8 44 00 56 F5
0x4ECCF -> 0x24 bytes -> 0F B6 45 6A 48 7C 1A 8B B5 B0 00 00 00 6B C8 4C 8D 04 31 33 D2 B2 03 3A 50 48 75 52 83 E9 4C 7D EF E9 61 FC
0x4ED3D -> 0x43 bytes -> 8D 70 28 33 DB E8 39 E8 FE FF C7 06 61 73 66 73 80 4D 71 02 66 83 7D 44 FF 74 98 8B 45 00 E8 10 41 FF FF 8D 4D 40 3B 01 7F 02 89 01 B3 29 85 C0 75 08 8B 45 00 E8 09 0E FF FF 89 5C 24 20 E9 75 FF FF FF


NOTE: OB / Doomsday shiplist.sst ID must be changed when extending shiplist!

0044FC38   66:C78424 72010000 7B00  MOV WORD [ESP+172], 7B // shplist.sst ID
Cosmetics

Code: Select all

Popup Screen after system attack

0x639A9 -> E1 04 -> 28 00

004645A8   B8 28000000    MOV EAX, 28  // read lexicon entry 40 'alien artifacts' change to 'Planet Killer'


i_t07270.tga picture of tarellian can be edited or code changed to read i_t10270.tga instead: (Option)

0x17837F -> 30 37 -> 31 30 // load i_t10270.tga



Phaser label

0x49FD0 -> 0xA bytes -> B8 27 00 00 00 EB 1B 90 90 90

0044ABD0   B8 27000000    MOV EAX,27  // load unused lexicon entry 39 change this to 'Antiproton Beam'
0044ABD5   EB 1B          JMP 44ABF2
0044ABD7   90             NOP


Torpedo label

0x49D44 -> B0 A9 -> BE AA  = OB/Planet Killer shares Crystal Entity lexicon entry 929 'CE Torp'
This are in total 15 required code changes + option to load i_t10270.tga instead of i_t07270.tga


During the test, the first victims of the planet killer turned out to be the mintakans, losing all 7 habitable planets to the Doomsday Machine. "The Picard" was not around to help. So light a candle for them....


ASM listing of changes

Code: Select all

0x4A712 -> 0xC bytes -> 0F B6 1C 5C 53 80 FB 2D 75 02 B3 25
0x4A73E -> 4   bytes -> 8B C3 90 90

0044B312   0FB61C5C    MOVZX EBX,BYTE [ESP+EBX*2]
0044B316   53          PUSH EBX
0044B317   80FB 2D     CMP BL,2D
0044B31A   75 02       JNZ 44B31E
0044B31C   B3 25       MOV BL,25

0044B33E   8BC3        MOV EAX,EBX
0044B340   90          NOP
0044B341   90          NOP


set monster Index 25(crystal) ship ID 7B(OB) -> esi shipID / eax lexicon -> jmp 44FC24

0x4EEC3 -> 0xB bytes  -> 8D 43 DC 3C 08 0F 87 6A 01 00 00
0x4F033 -> 0x26 bytes -> E9 BB 00 00 00 66 C7 84 24 72 01 00 00 7B 00 B8 28 00 00 00 B3 25 8D BC 24 20 01 00 00 E9 9E 00 00 00 90 90 90 90

0044FAC3   8D43 DC          LEA EAX,[EBX-24]
0044FAC6   3C 08            CMP AL,8
0044FAC8   0F87 6A010000    44FC38 goto OB / Planet Killer

0044FC33   E9 BB000000              JMP 44FCF3
0044FC38   66:C78424 72010000 7B00  MOV WORD [ESP+172], 7B // shplist.sst ID
0044FC42   B8 28000000              MOV EAX, 28 // lexicon 40 "alien artifacts"
0044FC47   B3 25                    MOV BL, 25  // crystal combat/map behavior
0044FC49   8DBC24 20010000          LEA EDI,DWORD PTR SS:[ESP+120]
0044FC50   E9 9E000000              44FCF3
0044FC55   90                       NOP *4


planet killer = tarellian (now = exit) 0x4E810 -> 6 bytes -> C7 F8 44 00 56 F5

0x4ECCF -> 0x24 bytes -> 0F B6 45 6A 48 7C 1A 8B B5 B0 00 00 00 6B C8 4C 8D 04 31 33 D2 B2 03 3A 50 48 75 52 83 E9 4C 7D EF E9 61 FC

0x4ED3D -> 0x43 bytes -> 8D 70 28 33 DB E8 39 E8 FE FF C7 06 61 73 66 73 80 4D 71 02 66 83 7D 44 FF 74 98 8B 45 00 E8 10 41 FF FF 8D 4D 40 3B 01 7F 02 89 01 B3 29 85 C0 75 08 8B 45 00 E8 09 0E FF FF 89 5C 24 20 E9 75 FF FF FF

0044F8CF   0FB645 6A       MOVZX EAX,BYTE [EBP+6A] number of planets
0044F8D3   48              DEC EAX
0044F8D4   7C 1A           JL 44F8F0  // exit
0044F8D6   8BB5 B0000000   MOV ESI,[EBP+B0] planet entry array
0044F8DC   6BC8 4C         IMUL ECX,EAX,4C
0044F8DF   8D0431          LEA EAX,[ECX+ESI]
0044F8E2   33D2            XOR EDX,EDX
0044F8E4   B2 03           MOV DL,3    // skip gas giants
0044F8E6   3A50 48         CMP DL,BYTE [EAX+48]
0044F8E9   75 52           JNZ 44F93D  // change planet
0044F8EB   83E9 4C         SUB ECX,4C
0044F8EE  ^7D EF           JGE 44F8DF  // planet loop
0044F8F0  ^E9 61FCFFFF     JMP 44F556  // exit

0044F93D   8D70 28            LEA ESI,[EAX+28]
0044F940   33DB               XOR EBX,EBX
0044F942   E8 39E8FEFF        CALL 43E180 Change_Planet_entry_eax_to_edx
0044F947   C706 61736673      MOV DWORD [ESI],73667361 // asfs[.ani]
0044F94D   804D 71 02         OR BYTE [EBP+71],2  // set asteroid bldg. req. flag
0044F951   66:837D 44 FF      CMP WORD [EBP+44],0FFFF  // -1 if uninhabitated
0044F956  ^74 98              JE 44F8F0  // exit
0044F958   8B45 00            MOV EAX,[EBP]
0044F95B   E8 1041FFFF        CALL 443A70  GetSytemPopCap
0044F960   8D4D 40            LEA ECX,[EBP+40]
0044F963   3B01               CMP EAX,[ECX]
0044F965   7F 02              JG 44F969
0044F967   8901               MOV [ECX],EAX
0044F969   B3 29              MOV BL,29
0044F96B   85C0               TEST EAX,EAX
0044F96D   75 08              JNZ 44F977
0044F96F   8B45 00            MOV EAX,[EBP]
0044F972   E8 090EFFFF        CALL 440780  pop killed clear files
0044F977   895C24 20          MOV [ESP+20],EBX
0044F97B  ^E9 75FFFFFF        JMP 44F8F5
files required when using Adding_the_Planet_Killer.patch
planet_killer.zip
(267.47 KiB) Downloaded 179 times
Last edited by Spocks-cuddly-tribble on Tue Dec 24, 2019 10:09 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
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 7848
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Re: Monster Editing Info

Post by thunderchero »

here is planet killer in action (combat)
inaction.png
inaction.png (176.89 KiB) Viewed 14276 times
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1883
Joined: Sun Apr 27, 2008 2:00 am

EDO GOD blind angles (fix)

Post by Spocks-cuddly-tribble »

The EDO GOD phaser slot data is corrupted, causing blind angles where its 'multiphasic disruptors' can't hit attackers.

Code: Select all

# EDO GOD T05 Beam Firing Arcs (fix) - Trek.exe Phaser Slots
>> 0x1904DC 90 90 90 90 09 05 A0
<< 0x1904DC C0 C0 C0 C0 09 05 C0
Last edited by Spocks-cuddly-tribble on Fri Apr 29, 2022 9:03 pm, 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
EnPhreg
Lieutenant-Commander
Lieutenant-Commander
Posts: 130
Joined: Thu Jul 10, 2008 2:00 am

Re: Monster Editing Info

Post by EnPhreg »

i'm right in my assumption that if i'm installing the "Cloak_enabled_for_Edo_God_Combat Drone" (1.b/ 2.a,b,c/ 3.a,b) and enabling the cloak for the edo god, i still have to deal with these bugs?:
During tests, I observed some mod-independent bugs with the Edo God:

sometimes the auto-battle end message/voiceover & morale effect is wrong (f.e. "hail" with all ships destroyed or "retreat" with ships still in Edo sector)
due to some AI behavior-bugs the monster cloak does not prevent the "Edo training" misuse via the one uncloaked ship tactic or via using "cloak" command in tactical combat
even if the first-turn default command in tactical combat requires a target then ships won't fire at the Edo God (i.e. one can move to a dead angle behind the monster to kill it with a single ship resp. do "Edo training" without cloak ability). For the "charge & assault" commands this unchanged first-turn command bug leads to a crash:
User avatar
rxz1000
Cadet 2nd Year
Cadet 2nd Year
Posts: 7
Joined: Sun Sep 08, 2013 1:17 pm

Re: Monster Editing Info

Post by rxz1000 »

Hi all,

I have recently modded my game (UDM is the base which I hope is ok as its intended for just me) with loads of ships and all was fine and has been until I encounter the Terek Nor (Old Edo Guardian monster).

I have changed the Terek Nor model to the Borg Nexus station as I want that monster and planet to start as a rogue borg faction (separate from the main borg monster as it wont assimilate). I overwrote the Bajor minor to be Borg using UE in all cases.

When I encountered the system I instead got a Cardassian level 2 colony ship (ID 1 in my ship list) instead, then the game crashed.

My EDO Guardian ID in UE 257 (the Borg monster starts at 252).

Looking at all the above I'm struggling to understand how to sort this crash and ship mismodel out? I can use hex programme to mod as now have 25 techs per area.

Any help will be appreciated.
Post Reply

Return to “Monster Editing Info”