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 » Wed Jul 30, 2008 11:41 am

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

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 » Sat Aug 09, 2008 5:48 pm

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 » Mon Aug 11, 2008 5:15 am

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 » Tue May 11, 2010 5:29 pm

@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: 723
Joined: Sun Apr 27, 2008 2:00 am

Post by Spocks-cuddly-tribble » Thu May 13, 2010 11:14 am

Chernabog wrote:every time a monster is generated, I need it to always be the same one
@ providing custom code alterations in hex (aside of bug-fixes)

Those days are gone, never to return. (due to shortage of time)

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


Tethys wrote:Will your monsters information include how to allow multiple *gods* using different monsters, such as Minosian EP607 or perhaps a station in place of the Husnock?
Yes, but not in the way you think. It will point you to the various code sequences wich have to be analysed and re-written (not just simple change of values). Keep in mind that the in-depth machanic (i.e. absolute coding) of BotF was never intended to be modifiable. Conservative estimate: at least 50 working hours (assuming profound asm-knowledge). And no, we're not so crazy to do that. It's the job of the requesting modders.


Here is an uncommented preview of some unsorted stuff from my IDA-notepad:


Switches for monster behavior:

Be careful with Edo God & Gomtuu (complex dynamic data assigned -> for relationship to majors)

Code: Select all

433834                 sub     eax, 24h        ; switch 9 cases
472284                 sub     ecx, 24h        ; switch 7 cases
472643                 cmp     ax, 7           ; switch 8 cases
472BE0                 sub     edi, 24h        ; switch 9 cases
4761FB                 sub     eax, 24h        ; switch 7 cases
477190                 cmp     ax, 8           ; switch 9 cases
478116                 sub     esi, 24h        ; switch 9 cases
4787CF                 sub     eax, 24h        ; switch 7 cases
478AF2                 sub     eax, 24h        ; switch 9 cases
4919C4                 sub     eax, 24h        ; switch 8 cases
4AA252                 sub     eax, 24h        ; switch 8 cases
4ADBD9                 sub     ebx, 24h        ; switch 9 cases
52895C                 sub     edx, 24h        ; switch 8 cases
554353                 sub     eax, 24h        ; switch 8 cases
56BE9D                 sub     eax, 24h        ; switch 7 cases
For modding of switches see:

Weapon labels of ships/ Beams & Torpedoes (section 3)
and
Extending the shiplist (last post)



-> update topic

@ Post 1

sub_44FAA4 add_the_Monster (maybe off_44FA80)

@ Post 2

0x50F40 // sub_4519C0 Map_finish_sol_Minos (loc_451AE6)
0x50B44 // sub_450A84 Setup_civstart (loc_451714)

@ Post 3

0x50B1C // sub_450A84 Setup_civstart (loc_451714)
0x70714 // sub_471124 test_battle_team_eax_0_yes edo/gomtoo (loc_471310)


=> for EDO GOD

dead_races_BitMask ds:5A2B50/5A2B54

ds:5A2490 load_for_EDO_dip_test

471124 test_battle_team_eax_0_yes
47131B test byte ptr ds: 5A2B50 (dead/not in game - race bit mask )+2, 4

430480 AI_ship_controll
43061A cmp bx, 2Ah
430620 test byte ptr ds:dead_races_BitMask_1+2, 4

sub_47715C monster_behavior_check_24
4773FC test byte ptr ds:dead_races_BitMask_1+2, 4

552900 combat_switch_edo_check1
552995 cmp word ptr [edi+1DCh], 2Ah
5529A3 test byte ptr ds:dead_races_BitMask_1+2, 4

552A60 combat_switch_edo_check2
552AA3 cmp word ptr [eax+1DCh], 2Ah
552AB1 test byte ptr ds:dead_races_BitMask_1+2, 4

552D40 combat_switch_edo_check3
552E1A cmp word ptr [esi+1DCh], 2Ah
552E28 test byte ptr ds:dead_races_BitMask_1+2, 4


=> minosian code

451A8D cmp word ptr [edi+44h], 0FFFFh -> 0x50E91 raceID(=none) minosian


-> for monster AI controll (map movement)

call sub_44FAA4 (add Monster) pushed: monster-ID, coordinate1, coordinate2
mov [eax from sub_51B2B0], ax

call sub_51BA20 (monster_list_stuff)

mov eax, Monster_ID (e.g. 0x24 borg)
call sub_4036A0 (Main_AI_control)


ds: 5A36D4 (monster_lst? 8byte entry)
esp ??? 1-2 monster race ID / 3-4 fleet ID


44F3D0 MonsterProcessTurn

44F42C monster_system_attack
44FEF8 Monsters_2


450020 monster_game_start

450060 for_monster_game_start
51B0A0 and_7F_Monster_?
44FEF8 Monsters_2
On the verge of a nervous breakdown? Try the relaxing tribble sounds.

Chernabog
Lieutenant-Commander
Lieutenant-Commander
Posts: 102
Joined: Fri Oct 02, 2009 2:00 am

Post by Chernabog » Wed May 19, 2010 3:31 am

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: 723
Joined: Sun Apr 27, 2008 2:00 am

Monster Combat Behavior

Post by Spocks-cuddly-tribble » Thu Jun 23, 2011 10:29 am

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
  • many data just seems to be ignored: accuracy, defence, distance, agility...
  • 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
On the verge of a nervous breakdown? Try the relaxing tribble sounds.

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

Monster Cloak

Post by Spocks-cuddly-tribble » Sun Jul 10, 2011 1:04 pm

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
On the verge of a nervous breakdown? Try the relaxing tribble sounds.

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

Combat Drone

Post by Spocks-cuddly-tribble » Wed Jan 18, 2012 8:06 am

Following piece of code places the combat drone and sets for up to 6 free systems a random value in [systInfo+68h]. It's a shame that MicroProse hadn't the time to implement all the unfinished ideas...

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.


Change System Name to Minos Fix

Code: Select all

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

00451B91     9090       NOP
Note this won't work for planet names when using this custom planet names fix:
viewtopic.php?f=9&t=1337

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
On the verge of a nervous breakdown? Try the relaxing tribble sounds.

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

Monster Map Movements

Post by Spocks-cuddly-tribble » Tue Mar 06, 2012 3:09 pm

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
On the verge of a nervous breakdown? Try the relaxing tribble sounds.

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

Adding the Planet Killer

Post by Spocks-cuddly-tribble » Tue May 03, 2016 3:43 pm

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

Code: Select all

Tactical Combat - Option to switch Crystal Entity & Planet Killer from 'Hold' to 'Charge'

0x764C4 -> A2 71 -> 46 76
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 + the option for Tactical Combat + 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 32 times
On the verge of a nervous breakdown? Try the relaxing tribble sounds.

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

Re: Monster Editing Info

Post by thunderchero » Wed May 04, 2016 11:54 pm

here is planet killer in action (combat)
inaction.png
inaction.png (176.89 KiB) Viewed 4311 times

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

Re: Monster Editing Info

Post by Spocks-cuddly-tribble » Sun Jun 26, 2016 3:45 pm

Warning -> Tactical Combat - Option to switch Crystal Entity & Planet Killer from 'Hold' to 'Charge' -> will cause a crash vs. cloaked fleets!
On the verge of a nervous breakdown? Try the relaxing tribble sounds.

User avatar
EnPhreg
Lieutenant-Commander
Lieutenant-Commander
Posts: 130
Joined: Thu Jul 10, 2008 2:00 am

Re: Monster Editing Info

Post by EnPhreg » Sun Jul 17, 2016 1:45 pm

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 » Sat Sep 17, 2016 12:43 pm

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”

Who is online

Users browsing this forum: No registered users