looking for a programmatic way of determining fist fight 'state'.
currently, the game simply sets current weapon to PW_Fists, and prevents the player from swapping weapons until the fight is over.
that's fine, and works as long as you don't try to change the weapon auto-switch code to allow automatic switching FROM fists (during a monster fight).
however, the game prevents auto-swapping from fists specifically because it doesn't want the game/player to swap weapons during a fist fight.
it works fine (returns PW_Fists), as long as opponent you attack is using fists (!hasPhysicalWeapon; see playerWeaponHolster.ws, GetMostConvenientMeleeWeapon) otherwise (like in BnW gwent brawl) where they're holding clubs, it fails.
Of course, it only fails if you attempt to implement a feature to automatically switch from fists to a sword in actual combat... which doesn't exist in the base game... specifically prevents auto-swap from fists during ANY fights, because of this oversight...
if... i could find the code which starts/ends a fist fight sequence, could add a variable... but, it's probably coded into each quest separately (not as a variable, just sets playerWeapon to PW_Fists on a quest by quest basis)...
it's literally that one line that is the problem. it was originally meant to check for fist fights, until they started giving them weapons...
if only there were some way to check for a condition at this juncture and determine fist fight 'state'... or go back to not giving them weapons...
targetToDrawAgainst is a dwarf in the BnW gwent brawl, which classifies as 'human' since it isn't a 'monster'. it then fails the !hasPhysicalWeapon check, since it's holding a club, and also the hostile check.
then this line in r4Player.ws seems to later have been implemented as a 'fix', which just prevents the player from ever auto-switching from PW_Fists during combat... evident in the use of 'this.' object, which is redundant and unnecessary.
returns false for the dwarves, maybe since they're holding clubs.
this is indeed simply set per quest, per npc, with an action block elsewhere, ie: (quest_function.ws).
However, as noted above, the npcs.fistFightForcedFromQuest variable is not always set, which means preferedCombatStyle == EBG_Combat_Fists will also return false for those NPCs, and i can't find any actual functions which begin/end a fist fight sequence. these simply set a property (sometimes) on quest NPCs, and if none are set to 'EBG_Combat_Fists', then there's no way of even determining that.
SOLVED:
Ah, I suppose I can just use IsActionAllowed( EIAB_DrawWeapon ), which should and does return false during that sequence, but curiously isn't even a condition in GetMostConvenientMeleeWeapon (playerWeaponHolster.ws) or DoAttack (r4Player.ws)... only ProcessCombatActionBuffer (r4Player.ws), which is bypassed in some cases via GetMostConvenientMeleeWeapon.
There actually is a variable called 'fistFightMiniGameEnabled' and function 'IsFistFightMinigameEnabled()' in r4Players.ws, which i didn't even realize i used previously (4 year old code haha), and 2 functions called OnStartFistfightMinigame and OnEndFistfightMinigame.
I suppose either solution is fine: IsActionAllowed( EIAB_DrawWeapon ) or IsFistFightMinigameEnabled()... oddly, checks are in the wrong places though.
currently, the game simply sets current weapon to PW_Fists, and prevents the player from swapping weapons until the fight is over.
that's fine, and works as long as you don't try to change the weapon auto-switch code to allow automatic switching FROM fists (during a monster fight).
however, the game prevents auto-swapping from fists specifically because it doesn't want the game/player to swap weapons during a fist fight.
it works fine (returns PW_Fists), as long as opponent you attack is using fists (!hasPhysicalWeapon; see playerWeaponHolster.ws, GetMostConvenientMeleeWeapon) otherwise (like in BnW gwent brawl) where they're holding clubs, it fails.
Of course, it only fails if you attempt to implement a feature to automatically switch from fists to a sword in actual combat... which doesn't exist in the base game... specifically prevents auto-swap from fists during ANY fights, because of this oversight...
if... i could find the code which starts/ends a fist fight sequence, could add a variable... but, it's probably coded into each quest separately (not as a variable, just sets playerWeapon to PW_Fists on a quest by quest basis)...
Code:
if ( targetToDrawAgainst.IsHuman() && ( !hasPhysicalWeapon || ( targetToDrawAgainst.GetAttitude( thePlayer ) != AIA_Hostile ) ) )
{
ret = PW_Fists;
}
if only there were some way to check for a condition at this juncture and determine fist fight 'state'... or go back to not giving them weapons...
targetToDrawAgainst is a dwarf in the BnW gwent brawl, which classifies as 'human' since it isn't a 'monster'. it then fails the !hasPhysicalWeapon check, since it's holding a club, and also the hostile check.
Code:
if ( this.GetCurrentMeleeWeaponType() != PW_Fists && weapon != this.GetCurrentMeleeWeaponType() )
Code:
(CNewNPC)targetToDrawAgainst.fistFightForcedFromQuest
Code:
npcs[i].fistFightForcedFromQuest = true;
Code:
latent quest function BlockGamePlayFunctionality
quest function CombatStateChange
latent quest function EnableFistFightMiniGame
SOLVED:
Ah, I suppose I can just use IsActionAllowed( EIAB_DrawWeapon ), which should and does return false during that sequence, but curiously isn't even a condition in GetMostConvenientMeleeWeapon (playerWeaponHolster.ws) or DoAttack (r4Player.ws)... only ProcessCombatActionBuffer (r4Player.ws), which is bypassed in some cases via GetMostConvenientMeleeWeapon.
There actually is a variable called 'fistFightMiniGameEnabled' and function 'IsFistFightMinigameEnabled()' in r4Players.ws, which i didn't even realize i used previously (4 year old code haha), and 2 functions called OnStartFistfightMinigame and OnEndFistfightMinigame.
I suppose either solution is fine: IsActionAllowed( EIAB_DrawWeapon ) or IsFistFightMinigameEnabled()... oddly, checks are in the wrong places though.
Last edited: