LoneGazebo / Community-Patch-DLL

Community Patch for Civilization V - Brave New World
Other
285 stars 157 forks source link

New promotions with invisibility do not work properly #10398

Open adaneslavo opened 10 months ago

adaneslavo commented 10 months ago

VP 4.2.5:

I created a promotion and a counterpromotion giving the invisibility on demand. 2023-10-26_22h13_43 2023-10-26_22h13_29 Now I went to the city, and declared war to the city-state. Few weird behaviours were met then:

So from what I can see, Invisibility while given, it cannot be removed, even when promotion is not longer available; Invisibility different than base one for submarines is not recognized and thus not countered.

Some pictures for the better reception: Enemy Pikeman moved to the city in 2 turns (green arrow). My warrior was moved (blue arrow): obraz

Enemy Archer can only shoot the Artillery (it was not given the invisibility before). Warrior and the Pikeman (they have had the invisibility before) cannot be attacked by the city nor the Archer: obraz

Enemy city produced new unit and it was moved to the tile were my invisible unit was, then it was moved. Enemy unit lost its model, and regained it after clicking on it. 2023-10-26_22h25_10 2023-10-26_22h25_16 2023-10-26_22h25_21

When I replaced units that had the invisibility with fresh ones, everything worked as intended, so city and units correclty attacked them: 2023-10-26_22h32_39

n-core commented 10 months ago

It's not a bug, it's more like a hardcoded limitation within the DLL. You can't add invisible units besides Submarines (by using INVISIBLE_SUBMARINE).

Me and @azum4roll visited this stuff a while back, and it could be possible to make the InvisibleInfos table moddable. You might want to investigate it yourself by looking at the cpp files itself.

Not so recent discussion on the Discord server: https://discord.com/channels/707403015845576735/721545254703988796/1078343779687342101

n-core commented 10 months ago

This should be marked as Feature Request, not bugs.

Tekamthi commented 10 months ago

Yeah I've played around with this as well... My conclusion: invisible_submarine is the only one that is truly useable, unless we wanted some kind of invisible spy units etc.

Even if you use invisible_submarine, but have it turn on and off (ie same unit has promo that enables it, and then loses this promo), the game UI doesn't recognize this properly, and at least to human player the now-visible unit's 3d model will appear and disappear on the map as though it were still invisible. I infer this is game engine stuff beyond the .DLL even.

One theoretical idea I have not tested... Unit tables have fields for IsConvertUnit, which appears to trigger off an hp threshold, ie unit drops below x hp, it transforms to another unit entirely. Again I have never tested, but theorize you could use this to toggle invisibility on and off. It's probably the only way without using Lua (though you could just do same in Lua much more flexibly)

If this could actually be FIXED to have multiple different invisibility categories that work correctly, and bonus if they toggle on and off as expected too, these would be highly desirable modding features

n-core commented 10 months ago

The reason why you can't add more InvisibleType is because while INVISIBILE_SUBMARINE ID is 0, if you add another invisible type, then the ID is 1. Unfortunately, NUM_INVISIBLE_TYPES ID value is 1 in the cpp which conflicts with the added invisible type, so this is the hardcoded limitation in the cpp function.

If you try to do it for the enemy unit, that unit is invisible, but you can't see it with your unit even with the right SeeInvisible value.

We need to make it so that NUM_INVISBLE_TYPES doesn't conflict with its value when adding more invisible types.

adaneslavo commented 10 months ago

Another Spaghetti code by Firaxis.

Hokath commented 2 months ago

It turns out that MOD_GLOBAL_EXTRA_INVISIBLE_TYPE will turn NUM_INVISIBLE_TYPES from 1 to... 2 However in my test the invisibility you get is like total invisibility -- being adjacent to the unit doesn't reveal it.