Monster planet attacks & Borg spawning

Monster planet attacks & Borg spawning; support/discussion/questions

Moderator: thunderchero

Post Reply
User avatar
afc
Site Founder
Site Founder
Posts: 65
Joined: Fri Apr 25, 2008 2:00 am
Location: Sector 001
Contact:

Monster planet attacks & Borg spawning

Post by afc » Sun Jan 31, 2010 10:41 pm

This topic has been renamed from former: editing planet type after Borg Attack


When the borg destroy a system is it possible to have them wipe out the planets but not change them to barron worlds?

Spocks-cuddly-tribble wrote:Yes, in trek.exe at 0x4E8DD change 0F 83 to 90 E9.


Alternatively they could destroy all planets:

At asm-44F4B1:
call 4406F0 (super_nova_effect)
jmp 44F4DD

User avatar
Tethys
Past Administrator
Past Administrator
Posts: 2065
Joined: Fri Jul 18, 2008 2:00 am
Location: Your mom's bed ;)
Contact:

Post by Tethys » Wed Feb 03, 2010 2:30 pm

OH MY GOD SCT! The destruction will work great with the Doomsday Machine random! ha! thanks so much!!

Spocks-cuddly-tribble wrote:For this case the better workaround would be changing replacement-planet type from barren to gas giant & replace brg[l,m,s].ani with debris field grapics:

Code: Select all

44F561                 mov     edx, 1 // -> 3
Disable spawning:

Code: Select all

44F4DD                 jnb     loc_44F5D3 // -> jnb loc_44F4FD
However, you still must solve the borg transwarp issue...
Not for the weak of heart...
Image
GALM <--- GALM/Galaxies Mod

User avatar
Peter1981
Rear-Admiral
Rear-Admiral
Posts: 1118
Joined: Tue May 06, 2008 2:00 am
Location: England

Post by Peter1981 » Wed Feb 17, 2010 8:29 am

given that we know, thanks to gowron, how the program selects randomly a planet is it possible to destroy or borgify (at most) one planet at a time?

i always liked the borg but i just wish one planet could be change insted of the population smashing follwed by complete borgifiction?

Spocks-cuddly-tribble wrote:For only one planet replaced: (in total i.e. not one per turn!)

Code: Select all

- Check next planet:
44F592                 jmp     loc_44F4CA
44F5AD                 jmp     loc_44F4CA
44F5CE                 jmp     loc_44F4CA

change all to ->  jmp loc_44F5D3 // goto spawning

User avatar
count23
Lieutenant-Junior Grade
Lieutenant-Junior Grade
Posts: 66
Joined: Thu May 01, 2008 2:00 am

Post by count23 » Mon Mar 22, 2010 3:53 am

I think this would work wonders with the Crystaline Entity, instead of depopulating a system it de-terraforms it too.

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

Monster planet attacks & Borg spawning

Post by Spocks-cuddly-tribble » Sun Apr 03, 2011 9:41 am

Some important notes for editing:

=> the Ultimate Editor changes some code of sub_44F42C when altering shiplist (monster switch) or map size (for borg spawning)

=> before wasting too much time for custom modifications, be aware the global map- resp combat- behavior of monsters is not governed by sub_44F42C, see Monster Editing Info. E.g.:
- Borg / Map: stay IF system still populated ELSE transwarp jump to next (not monster occupied) system
- Tarellian / Combat: don't fire any weapons

=> whereas it's possible to add new system effects for other monster (e.g. +/- credits, morale, research...), adding corresponding new message pop-ups is a bit more complicated i.e. one would have to know about effects

=> enabling planetary defense (OBs/SH) against monster (or system damage besides pop loss), unfortunately, would be excessive work, since we cannot use even part of sub_466CF0(standard system attack). Also note the attack immediately on arrival setting.



At asm-44F3F0 is the switch/jump table for monster system behavior (case=4byte address of code sequence) sorted via shiplist.sst-ID, see also Extending the shiplist (Borg checks & Monster switches).


1. Population loss:

Code: Select all

-> Borg:
44F4A4                 cmp     ebx, 0Ah  // kill all if pop lower 10
44F7F3                 fmul    ds:5791B0 (0.5)  // pop loss 50%
44F802                 cmp     dword ptr [esp+20h], 14h  // if pop loss lower 20...
44F809                 mov     dword ptr [esp+20h], 9  // make pop loss 9 (odd values?)

-> Crystal Entity:
44F832                 cmp     esi, 5  // kill all if pop lower 5
44F8AB                 fmul    ds:5791A8 (0.3)  // pop loss 30%

-> Tarellian:
44F8DC                 cmp     edx, 5  // kill all if pop lower 5 
44F955                 fmul    ds:5791A0 (0.15)  // pop loss 15%

2. Planets after Borg Attack: (loc_44F4CA...)

Code: Select all

44F4E3                 cmp     byte ptr [esi+48h], 3 // if not a gas giant...
44F561                 mov     edx, 1 // change to barren
44F56F                 mov     al, [esi+38h] // planet size for brg[l,m,s].ani

3. Borg spawning: (loc_44F5D3...)

For adjusting probabilities see Scheme of the Random Events (#1.1). Turning off random events doesn't prevent spawning!

Code: Select all

44F635                 cmp    ds:58FDE0, 10h //exit if 16 or more cubes in game(redundant)

For difficulty level 1-5:

Random divisor:
44F65B                 mov     eax, 6
44F79A                 mov     edi, 4
44F7AD                 mov     esi, 3
44F7C0                 mov     ebx, 2
44F7D3                 mov     dword ptr [esp+1Ch], 2

44F683                 cmp     edx, 1 // if remainder not 1...
44F686                 jnz     loc_44F4FD  // no new cube

No new cube if number of cubes already in game:
44F660                 mov     ecx, 2
44F79F                 mov     ecx, 3
44F7B2                 mov     ecx, 4
44F7C5                 mov     ecx, 8
44F7DB                 mov     ecx, 10h

44F6A6                 mov     ebx, 24h // Monster race-ID to spawn

4. End turn code for system attack tasks: (prepare message screens)

Code: Select all

Borg: (loc_44F4FD)
44F539                 mov     dword ptr [edx+4], 24h // Borg race-ID

Crystal Entity: (loc_44F84B)
44F887                 mov     dword ptr [edx+4], 25h // Crystal race-ID

Tarellian: (loc_44F8F5)
44F931                 mov     dword ptr [edx+4], 29h // Tarellian race-ID
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

Fixing the Crystal Entity (+ Assimilated Systems)

Post by Spocks-cuddly-tribble » Wed May 04, 2016 3:53 pm

Let's rectify the last unfixed parts of the random events code. :smile:

Adding the Planet Killer: (replaces tarellian system 'attack')
viewtopic.php?f=231&t=319#p46143

Testing the Doomsday Machine I found the Crystal Entity, due to a calculation-bias, unable to depopulate the most systems, no matter how long it stays there. The fix-code also changes a random populated planet per turn to 'barren' to render the Crystal Lifeform more canon. :wink:

In order to accomplish this, code of 'negative climate shift' random event has been altered to keep barren planets barren (default changes barren to volcanic).

Random Events: (for disabling/lowering system events and adding counteractions for negative events)
viewtopic.php?f=229&t=1493&start=15#p46044


Since the Borg Queen is not amused about recolonizing assimilated systems :twisted: , contrary to sanity and canon :shock: , I also added a simple hex code correcting the oddity.


Fixing the Crystal Entity (enables depopulating systems & shifting populated random planet per turn to barren, due to randomness this can always be the same)

Code: Select all

0x4EC25 change 0x12 bytes -> 8B 75 40 83 FE 00 90 74 F1 EB 63 90 90 83 FE 07 73 6E
0x4EC93 change 0x18 bytes -> 8B 45 00 8B DC 8D 4B 04 33 D2 4A E8 ED C3 FF FF EB 8D 89 34 24 DB 04 24
0x4B13B -> 43 -> 59 

-asm--

0044F825   8B75 40      MOV ESI,[EBP+40]  // population
0044F828   83FE 00      CMP ESI,0
0044F82B   90           NOP
0044F82C  ^74 F1        JE 44F81F  // exit
0044F82E   EB 63        JMP 44F893  // goto shift planet
0044F830   90           NOP
0044F831   90           NOP
0044F832   83FE 07      CMP ESI,7
0044F835   73 6E        JNB 44F8A5

0044F893   8B45 00       MOV EAX,[EBP]
0044F896   8BDC          MOV EBX,ESP
0044F898   8D4B 04       LEA ECX,[EBX+4]
0044F89B   33D2          XOR EDX,EDX
0044F89D   4A            DEC EDX  // set negativ i.e. barren
0044F89E   E8 EDC3FFFF   CALL 44BC90 // shift populated random planet
0044F8A3  ^EB 8D         JMP SHORT 44F832
0044F8A5   893424        MOV DWORD [ESP],ESI
0044F8A8   DB0424        FILD DWORD [ESP]

climate shift negativ keep barren (default: change barren to volcanic)

0044BD3A   7C 59    JL 44BD95  // change barren -> barren
simple hex-code to make borg assimilated system un-colonizable

Code: Select all

0x4E962 -> 01 -> 03
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

Borg Attack Message fix for Uninhabited Systems

Post by Spocks-cuddly-tribble » Sun May 08, 2016 3:03 pm

Code: Select all

trek.exe at 0x4E897 change 0xA bytes to 83 7D 40 00 0F 8E B5 00 00 00

-asm--
0044F497   837D 40 00      CMP DWORD [EBP+40],0
0044F49B   0F8E B5000000   JLE 44F556
On the verge of a nervous breakdown? Try the relaxing tribble sounds.

User avatar
Kurn
Lieutenant-Junior Grade
Lieutenant-Junior Grade
Posts: 62
Joined: Thu Aug 12, 2010 2:00 am
Location: Germany

Re: Fixing the Crystal Entity (+ Assimilated Systems)

Post by Kurn » Wed Feb 13, 2019 2:26 am

Spocks-cuddly-tribble wrote:
Sat Apr 16, 2011 11:46 am
Crystal Entity / Tarellian -> erratic stay behavior i.e. won't stay long enough in systems for pop loss "if pop killed" events. Crystal doesn't even search for systems?
Spocks-cuddly-tribble wrote:
Wed May 04, 2016 3:53 pm
Fixing the Crystal Entity (enables depopulating systems & shifting populated random planet per turn to barren, due to randomness this can always be the same)
I've noticed in my mod that the crystal just waits now for over 100 turns in empty sectors...
Is there a hex code to make the crystal search for systems like the borg do?

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

Re: Monster planet attacks & Borg spawning

Post by Spocks-cuddly-tribble » Sun Feb 24, 2019 6:09 am

Monsters getting stuck on the map(or even disappear) is a mod independent problem.

'Monster editing info' should hold a post on monster map movements, but options are very limited. You can change the crystal value (second on the switch table if by monster race ID i.e. crystal 25h). But this might render the monster too destructive in low tech games and also affects planet killer if added.

Obligatory advice: you must start a new game to make it work and/or to prevent bugs.
On the verge of a nervous breakdown? Try the relaxing tribble sounds.

User avatar
Kurn
Lieutenant-Junior Grade
Lieutenant-Junior Grade
Posts: 62
Joined: Thu Aug 12, 2010 2:00 am
Location: Germany

Re: Monster planet attacks & Borg spawning

Post by Kurn » Sun Feb 24, 2019 10:33 am

Thanks for the information, Code Master. I also want to use the opportunity to thank you for all your great fixes! You really improved the game during all the years. Pesonally I think "Protecting the AI from Neutron Stars" was your finest fix.

Post Reply

Return to “Monster planet attacks & Borg spawning”

Who is online

Users browsing this forum: No registered users