Jump to content

How to prevent saber staff NPCs from using fast style?


Recommended Posts

I've noticed this bug has been unsolved from various forums I've looked at. It seems to only happen when the player wields the same weapon type too. Tried to fix it without diving into the code, through npc and sab files, but that doesn't work, so I'm 99% sure its a hardcode issue.

The problem with that is the references are too vast and complex for all the different saber styles, especially ones with restrictions like the dual and staff, to sift through.

Does anyone have experience in solving this issue, or know where to start looking at least?

Droidy365 likes this
Link to comment
  • RebornKyle changed the title to How to prevent saber staff NPCs from using fast style?
18 hours ago, mrwonko said:

What exactly is the bug? Do NPCs sometimes turn off one blade to use fast style, or do they use fast style with both blades extended?

Basically when you as the player wield a saber staff, other NPCs who wield saber staffs will start out using the expected stance, but then for whatever reason changes to fast style, with both blades extended. This effect lasts until they die, I think.

I also think that dual wielding (2 separate single blades) is affected by this, same method as above but just with dual wielding stance instead, they'll start using fast stance with both blades active. I don't use that stance much though so I can only say I've seen it, not that I regularly encounter it.

From the 4 forums I saw on the topic, it might affect OpenJK users. I myself use JAEnhanced, so I can confirm that it does happen with at least one OpenJK mod.

No idea why this happens, because it only occurs when the player is also using those styles. Single lightsaber users would not encounter this bug, the NPC correctly uses all available styles to it when this happens.

So to sum, staff players will encounter bugged staff NPCs, dual players may encounter bugged dual NPCs, single players unaffected.

Link to comment

There's a hardcode in the game code that sets the NPC's style to fast whenever they take damage.

It's primarily seen with modded assets since the function that handles saber style logic has a few hard code cases with the base npcs. I don't have the code in front of me right now since I'm currently at work, but this was a problem with Galactic Legacy before it was corrected.

Droidy365 likes this
Link to comment
7 hours ago, Linken said:

There's a hardcode in the game code that sets the NPC's style to fast whenever they take damage.

It's primarily seen with modded assets since the function that handles saber style logic has a few hard code cases with the base npcs. I don't have the code in front of me right now since I'm currently at work, but this was a problem with Galactic Legacy before it was corrected.

I see, thank you Linken. Do you remember where the problem was in the hardcode? Or did you have to write new code to correct it? Perfectly fine for doing either, but as we all know the code is old and a spaghetti filled mess, any place to start is a great one. BTW, kudos for fixing so much with your mod too, its very impressive how well it plays, and how well everything is integrated all together, from the JAO mod inside to the new missions recently created.

Link to comment
On 8/28/2024 at 11:03 PM, RebornKyle said:

I see, thank you Linken. Do you remember where the problem was in the hardcode? Or did you have to write new code to correct it? Perfectly fine for doing either, but as we all know the code is old and a spaghetti filled mess, any place to start is a great one. BTW, kudos for fixing so much with your mod too, its very impressive how well it plays, and how well everything is integrated all together, from the JAO mod inside to the new missions recently created.

I think it's here on line 5336, of course it's been FOREVER since I did this.

I can't for the life of me remember if doing Q_irand(SS_FAST, SS_TAVION) fixed it, even for dual/staff wielders, but it's a good place to start, probably even in the function itself.

image.png.5b002aa2fd385cc7c2d0599a16000efc.png

Link to comment
20 hours ago, Linken said:

I think it's here on line 5336, of course it's been FOREVER since I did this.

I can't for the life of me remember if doing Q_irand(SS_FAST, SS_TAVION) fixed it, even for dual/staff wielders, but it's a good place to start, probably even in the function itself.

image.png.5b002aa2fd385cc7c2d0599a16000efc.png

Unfortunately the replacement didn't seem to do it. I replaced the SS_FAST flag with the Q_irand(SS_FAST, SS_TAVION), results were the same. When I have more time I'll look a little further at the function call itself

Link to comment

I looked further at the function, the first set of statements set the styles of specific NPC types, that's understandable, but unlikely to be the cause, as both allies and enemies are affected by this, and the code only affects single style NPC types like the cultists or certain ranks. The rest of it I'm not too sure about, it seems like edge cases in case of switching past the enumerated types of styles, and a final block for debugging. That part could be the issue, but I don't see an easy fix for that in this file. I'm afraid I don't know where to go further.

 

Droidy365 likes this
Link to comment

I twiddled my thumbs for way too long before I realized I can just look at the code for SWGL on GitHub and see what the differences between mine and @Linken's are. I think I've effectively ruled out the function changes for Jedi_AdjustSaberAnimLevel. Doing combinations of, and also just changing them all to SWGL version, yielded the same results no matter what. I'll keep looking further and compare the two files later, to see if something else may be the key.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...