re4_tweaks
re4_tweaks copied to clipboard
Change the Percentage of Leaving a Plaga
Describe the feature you'd like to see added
There could be an option for you to increase or decrease the chance of a Plaga spawning on an enemy
FWIW I found that em10SetParasite seems responsible for spawning the plaga, seems that cEm10::move calls that based on some sort of timer (this+0x74C float), haven't found where that timer is actually first set though.
em10 is huge (500+ funcs) and has a ton of stuff I haven't started reversing yet though, likely it's one of the em10_R**** funcs responsible for it.
Interesting your analysis, is that in these functions is also the maximum limit of Plaga per scenario? for mods this percentage function would be amazing
Hmm, it might be em10ChgParasiteCk that decides it, seems to use
(randomNum % 10) is less than 5
to decide it, maybe that means a 50% chance?
If that passes then it calls em10LostHead with param 2, which then sets up the this+0x74C float based on another random number (will always be set to at least 1 though)
If you want to try changing it, search EXE for F7 F9 83 FA 05 7D 9E and change the 05 to what percent you want (6 should be 60%, 9 for 90%, etc), hopefully should work.
There does seem to be some more checks in that func & inside em10LostHead, not completely sure what it's checking though, but could be some kind of max limit there.
the max limit may be referring to the maximum amount of plagas spawned at once. The plaga spawn chance drops to 0% when there's already 2 plagas spawned
Oh interesting, looking at that em10ChgParasiteCk func there does seem to be a check for 2, just before the randomNum stuff I mentioned, by calling into Ctrl12CntCk - ctrl12 count check?
Seems there's also something that changes it to 1 depending on something in the games globals, not really sure what it's checking there though. (E: looks like it's something related to the dynamic difficulty / "point" system)
If anyone wants to test changing it you should be able to search for B8 02 00 00 00 38 81 98 in the EXE, and change 02 to how many you like, not sure if that'll actually work or not though, could be some other limit in place too.
(for the alternate value it uses based on global search for B8 01 00 00 00 8B 96 E0 and change 01)
@emoose We did the tests and only the percentage that worked we put 0A and it always gave 100%, but it didn't work to increase the number of Plaga that can be spawned per scenario
Hello. I was trying to do parasite override myself before reading this topic fully. I think i'm able to do what the title of the topic says.
Just like emoose said, im using em10ChgParasiteCk.
on call to em10ChgParasiteCk, before calling the original code, im changing following 2 values: (1) pEn->flag_3D0 |= 0x100000; (2) pEn->type_101 = 8; pEn is an argument 1, which a is pointer to cEm10.
And then I call the original em10ChgParasiteCk.
This makes parasite to spawn on every eligible death. (eg. suplex kill is no an eligible death). Look at the code of em10ChgParasiteCk, to see how it's done in the game there. (1) seems like a flag check that is parasite related. (2) bypasses the call to random-number check that the game is doing (looks like the check is always of 50% possibility otherwise).
Patching em10ChgParasiteCk on a single breakpoint usually doesn't work, as the game calls em10ChgParasiteCk multiple times on the death of the same enemy.
But to allow infiinte parasites, ie. not be limited to 2, Ctrl12CntCk needs to be patched in turn, But this is simple, it just need to always return 0. EDIT: argument no.2 needs to be checked as well. It is a counter index, and it needs to be checked if it is 4 - the parasite counter index.
Patching the assembly instructions directly would work too, but I think this is the graceful way.
Hope this makes sense.