#Changing controls for Power Stance

83 messages · Page 1 of 1 (latest)

stuck bear
#

A while back I got permission from the Elden Ring Reforged team to look over their hks file which included a swap for the controls of Power Stance to use the same controls as regular Paired weapons, for the sake of learning to implement it into my mod. However, with the new update, the old hks file for my mod needs to be rebuilt to work with the DLC, and the heavily altered code for the new patch's hks is proving difficult to compare to the old hks file with the changes I'm trying to bring forward.

The kicker here is that, foolishly, I did not leave comments on the additions I made to my own code, and after going back to the ERR hks file to do the same thing I did last time, their hks file for the newer versions now seems to be compiled differently, such that I can no longer read it. I'm not particularly great at hks coding, so recreating it completely from pure skill and memory is out of the question.

Other parts of my code that I made afterward have comments for me to look at and readapt to the new version, but when it comes to changing the powerstance controls so that l1 is block, r1 is dual attack, etc., I'm really kinda lost. Would anyone with hks know-how be able to give some advice on how to recreate this change?

ERR may have a handy option to switch between the two control styles, but I'm not so picky, and I'll settle for a straightup non-optional controls swap like I did last time

#

It's a bit hard to compare the old hks file with the new file when THIS is what the notepad++ compare bar looks like

viscid gust
#

I can give you an example in a bit.

#

I wrote it on the original HKS so it should be easy for you to see what changes.
I made it quick so I have not tested it much. but it should give you some idea.

#

Or just search for "-- Power stance mod"

Changes:

  • on IsEnableGuard function: to allow DualWielding to guard
  • on GetAttackRequest function: to make r1 do power stance atk and prevent powerstance on l1.
  • on JumpCommonFunction function : to make jump r1 do power stance atk
slow crescent
#

It is worth mentioning that Rellana's blades are set to "FALSE" and to enable guarding with them you need to change it to "TRUE". They are referenced by "sp_kind == 249" in the "IsEnableGuard()" function.

stuck bear
#

I got it working after seeing that hks file. Thank you. I'll just need to finish tweaks to the anibnd file so the movesets don't have delays and It's all fixed for the patch

The rellana blades I haven't gotten to try yet, but from how i understand it, the guard is disabled on it because it has unique left handed attacks, so I'll probably leave that alone

stuck bear
#

So I've noticed a little side effect of this change is that, while using power stance, any weapon skills that are stance based, like Square Off, are unable to use the light attack response, and instead just use a normal dual wield attack. I'm trying to scan the hks file for something that looks like it might be causing this, and it'd be great to have more eyes searching if you have a hunch

viscid gust
#

While at it I fixed some problems too.
fix jump attack (when close to landing)
fix dual weapon without power stance guard when press l1 on idle.
fix not able to trigger stance-based art when using power stance.

stuck bear
#

Think i also JUST managed to figure it out too lol

viscid gust
#

lol

stuck bear
#

the attack dual request wasn't checking for stance skills, and the stance functions weren't looking for the l1 variable, which the attack dual request uses

viscid gust
#

how do you fix it? I'm curious.

stuck bear
#

looking at yours, you had a MUCH cleaner solution lol, I'll prolly revert mine and use something like yours so there's less margin for error, I'm still not super smart at HKS.

I added the same stance skill check thats present in the right light request over to the dual light request, except with checks for l1 instead of r1 (since the end of the check performs the event based on l1's value), then went to all the drawstance functions and wherever there was a check for r1, i added an identical check for l1

#

it was supremely sloppy

stuck bear
#

it seems like something that was changed is effecting the guard behavior for everything except power stance. If i'm not power stancing, hitting guard more than once in quick succession will start throwing left hand attacks instead

#

i might see the cause

#

testing it

#

yep, gotta add back in
if IsWeaponCanGuard() == TRUE then return ATTACK_REQUEST_INVALID end
in the section for

-- Power stance mod : prevent L1 to do powerstance

#

after that i cant find any more issues

viscid gust
#

well... there will be more issues in a couple of hours. lol

slow crescent
#

I noticed an issue when replacing dual wielding attacks with R1. NPCs who dual wield will stop attacking and just block repeatedly. This is likely because they are trying to use the default wielding settings, which leads to this issue.

When you modify the code to enable dual wielding defense by switching attacks from L1 to R1, some AOWs have trouble performing the R1 action while dual wielding (Unsheathe, Night and Flame Stance, etc.).

I've thought of a few workarounds, but I can't say they fully work yet.

viscid gust
#

I think we can prevent NPC from going crazy by limiting these changes to players with env(IsCOMPlayer)

#

those AOW should be easy to fix, just like how we did on stance AOW.
Imitating how it works in R1 to L1. (on execAttack function)

#

test => fix => test => fix
Have this loop for a few more days and this system should be good to go.

slow crescent
viscid gust
#

I think. I'm not sure.

slow crescent
#

I created a function to check if it is the player requesting the action, if not, it returns false and ends.

"
function VZ_IsPlayerRequest()
if env(IsCOMPlayer) == FALSE then
return TRUE
end
return FALSE
end
"

Now, it would be possible to add an "if" that checks if it is the player requesting the action and prevent NPCs from having problems with dual-wielding attacks. I believe this will solve the problem.

#

Example:

if VZ_IsPlayerRequest() == TRUE then
if IsEnableDualWielding == HAND_RIGHT then
return ATTACK_REQUEST_DUAL_RIGHT
rest of the code....
end
end

stuck bear
# viscid gust

the r1 during stance skills issue was something that we, largely, fixed in this version. do you mean the ones you mentioned still have the issue with the changes in place?

#

also, if you figured out the check for if the target is the player thing to make sure the NPCs still attack, could you share the hks file you put it in?

slow crescent
slow crescent
#

If it is not the player requesting the action, then execute the vanilla code

#

I'm making this for the Sekiro Deflection mod, but I can show it here.

viscid gust
stuck bear
#

I'd appreciate it since my hks file currently replaces all the vanilla code, so seeing where the check goes in relation to the vanilla code will help me get that working.
As for the R1 during stance weapon arts, the part of that HKS file that fixed it was in the ExecAttack function, under "elseif request == ATTACK_REQUEST_DUAL_RIGHT then"
At the end where it performs the execevent, we replaced it with a check to exec the r1 variable if a stance weapon art is in use, but do the regular l1 variable otherwise
if artsr1 == TRUE then SetSwordArtsPointInfo(ACTION_ARM_R1, TRUE, r1) if r1 == "W_DrawStanceRightAttackLight" then SetSwordArtsWepCategory_DrawStanceRightAttackLight() end ExecEventAllBody(r1) else ExecEventAllBody(l1) end

stuck bear
slow crescent
viscid gust
#

Oh right those problem are still not fixed.

stuck bear
#

it seemed to fix the stance skill problem for me

#

but i only tested it with "square off"

slow crescent
#

Unsheathe works fine apparently

viscid gust
#
  • prevent these changes for NPC
  • problem with some AoWs (Unsheathe, Night and Flame Stance, etc.)
#

any bugs I missed?

stuck bear
#

there IS more code in the basic r1 attack functions (right and both) related to artsr1 and/or drawstance skill animations that we didn't add to the exec command for the dual attack. They could relate to any stance based skills that might still be broken, I might mess around with it in a bit

#

after i get my current problems sorted

slow crescent
stuck bear
#

the problem initially came to my attention because of wing stance. If you guys are testing dlc skills, that would be one to look at too to make sure it works

#

i dont have the dlc to do it myself

slow crescent
#

Hm.. good point. I'm going to sleep to work tomorrow, but I can test it soon.

viscid gust
stuck bear
viscid gust
#

wing stance working too

viscid gust
#

that HKS include some experiments I work on, just ignore them and focus on "-- Power stance mod"

This fixed are just adding another condition to check if request is from player or NPC.

stuck bear
#

I just found one more issue. Hopefully it's the last.
R1 during guard uses the function that checks for if you can do a shield poke attack, so that is currently defaulting to a standard r1 instead of a dual r1. Should be an easy fix, just make the r1 in that part of the code conditional on dual wielding or not

#

the quick fix im gonna test is if you search for "-- Shield Poke"
find
if is_spear == TRUE or is_rapier == TRUE or is_large_spear == TRUE or is_large_rapier == TRUE then if env(ActionDuration, ACTION_ARM_L1) > 0 then return ATTACK_REQUEST_ATTACK_WHILE_GUARD else return ATTACK_REQUEST_RIGHT_LIGHT end
and change it to
if is_spear == TRUE or is_rapier == TRUE or is_large_spear == TRUE or is_large_rapier == TRUE then if env(ActionDuration, ACTION_ARM_L1) > 0 then return ATTACK_REQUEST_ATTACK_WHILE_GUARD else if env(IsCOMPlayer) == FALSE then if isEnableDualWielding == HAND_RIGHT then return ATTACK_REQUEST_DUAL_RIGHT elseif isEnableDualWielding == HAND_LEFT then return ATTACK_REQUEST_DUAL_LEFT else return ATTACK_REQUEST_RIGHT_LIGHT end else return ATTACK_REQUEST_RIGHT_LIGHT end end

#

time to see if this works

#

nah there's more to it somewhere, but i do realize this doesn't need a player check, since an NPC would never get to the point where theyre blocking with l1 to begin with since their l1 attacks if they're dual wielding

#

so i cut that check out and im looking for the problem spot now

#

alright, i got it. Had to overhaul almost everything in the shield poke check
` if is_spear == TRUE or is_rapier == TRUE or is_large_spear == TRUE or is_large_rapier == TRUE then
-- If player is in power stance with dual spears or rapiers, use dual attack instead of shield poke
if isEnableDualWielding == HAND_RIGHT then
return ATTACK_REQUEST_DUAL_RIGHT
elseif isEnableDualWielding == HAND_LEFT then
return ATTACK_REQUEST_DUAL_LEFT
elseif env(ActionDuration, ACTION_ARM_L1) > 0 then
return ATTACK_REQUEST_ATTACK_WHILE_GUARD
else
return ATTACK_REQUEST_RIGHT_LIGHT
end
else
if is_arrow == TRUE or is_ballista == TRUE then
return ATTACK_REQUEST_ARROW_BOTH_RIGHT
end

            if is_crossbow == TRUE then
                g_ArrowSlot = 0
                act(ChooseBowAndArrowSlot, 0)
                return ATTACK_REQUEST_RIGHT_CROSSBOW
            end

-- If player is guarding while in power stance and hits r1, do dual attack
if env(ActionDuration, ACTION_ARM_L1) > 0 then
if isEnableDualWielding == HAND_RIGHT then
return ATTACK_REQUEST_DUAL_RIGHT
elseif isEnableDualWielding == HAND_LEFT then
return ATTACK_REQUEST_DUAL_LEFT
else
return ATTACK_REQUEST_RIGHT_LIGHT
end
end
end`

slow crescent
#

I created a customizable option to enable and disable power stance and noticed something peculiar. When power stance mode is disabled, Dual wielding works like vanilla, however, with Power stance mode enabled, the R1 attacks of dual wielding seem to be slower than vanilla.

Have you noticed anything like this with the dual wielding changes?

stuck bear
#

yeah that's something that happens even with the hard swap to controls. You need to accompany it with changes to the c0000 anibnd so the "cancel on rh attack" tae bits happen at the same time as the "cancel on lh attack" bits

slow crescent
#

Okay. I managed to make a more simplified and optimized system for powerstance, but Rellana's blades are only executing the first 2 attacks of R1.

slow crescent
#

I managed to solve it

split trench
#

What you did

slow crescent
#

I may share it soon, but I'm still working on it.

slow crescent
#

I'll explain how I did it, but the attacks are still a little slower than standard. Anyway, Murloc has already explained how to fix this

#

OK. I will mention the important points and what I modified

#

The first step is to locate the "IsEnableGuard()" function.

I added this code at the beginning of the function:

function IsEnableGuard() 
local style = c_Style 
local hand = HAND_LEFT 

if style == HAND_RIGHT_BOTH then 
hand = HAND_RIGHT 
end 
------------------------------------------ 
-- VIZZO - Enables the guard 
------------------------------------------ 
if VIZZO_IsPlayerRequest() == TRUE then -- Replace with: env(IsCOMPlayer) == FALSE 
  if PowerStanceMode() == TRUE then -- Ignore this 
    if VIZZO_CheckWeaponStyle() == DualWeaponStyle or VIZZO_CheckWeaponStyle() == DualWieldStyle then -- Replace with: env(GetEquipWeaponCategory, HAND_RIGHT) == env(GetEquipWeaponCategory, HAND_LEFT) or IsEnableDualWielding() ~= -1 
      return TRUE 
    end 
  end 
end 
------------------------------------------ 
rest of the code...
#

Second step, is to search for "if is_crossbow == TRUE and is_both == TRUE then" and add this after "end" :

if is_crossbow == TRUE and is_both == TRUE then
   return ATTACK_REQUEST_INVALID
end
------------------------------------------
-- VIZZO - PowerStanceMode
------------------------------------------
if VIZZO_IsPlayerRequest() == TRUE and VIZZO_CheckPowerStanceMode() == TRUE then -- Replace with: env(IsCOMPlayer) == FALSE
 local CheckDualStyle = VIZZO_CheckWeaponStyle() == DualWeaponStyle or VIZZO_CheckWeaponStyle() == DualWieldStyle
  if CheckDualStyle then -- Replace with: env(GetEquipWeaponCategory, HAND_RIGHT) == env(GetEquipWeaponCategory, HAND_LEFT) or IsEnableDualWielding() ~= -1 
     return ATTACK_REQUEST_INVALID
  end
end
------------------------------------------
#

Third step is to search for "swordartpoint_hand = HAND_LEFT" and add this after the "end" :

if c_Style == HAND_LEFT_BOTH then
   swordartpoint_hand = HAND_LEFT
end
------------------------------------------
-- VIZZO - PowerStanceMode
------------------------------------------
if VIZZO_IsPlayerRequest() == TRUE and VIZZO_CheckPowerStanceMode() == TRUE then -- Replace with: env(IsCOMPlayer) == FALSE
local CheckDualStyle = VIZZO_CheckWeaponStyle() == DualWeaponStyle or VIZZO_CheckWeaponStyle() == DualWieldStyle
     
if request == ATTACK_REQUEST_RIGHT_LIGHT and CheckDualStyle and artsr1 == FALSE then -- Replace "CheckDualStyle" with: env(GetEquipWeaponCategory, HAND_RIGHT) == env(GetEquipWeaponCategory, HAND_LEFT) or IsEnableDualWielding() ~= -1
  if env(ActionDuration, ACTION_ARM_L2) > 100 then
    request = ATTACK_REQUEST_BOTH_LIGHT
    end
  end
end
------------------------------------------
#

Fourth step is to search for "if GetEquipType(HAND_RIGHT, WEAPON_CATEGORY_STAFF) == TRUE and r1 ~= "W_AttackRightLight2" and r1 ~= "W_AttackRightLight3" then" and add this:

if env(GetSpEffectID, 19915) == TRUE then
    r1 = "W_AttackRightLight2"
end    
------------------------------------------
-- VIZZO - PowerStanceMode
------------------------------------------
if VIZZO_IsPlayerRequest() == TRUE and VIZZO_CheckPowerStanceMode() == TRUE then -- Replace with: env(IsCOMPlayer) == FALSE
local CheckStyle = VIZZO_CheckWeaponStyle()
local CheckDualStyle = CheckStyle == DualWeaponStyle or CheckStyle == DualWieldStyle
        
if IsEnableGuard() == TRUE and artsr1 == FALSE and CheckDualStyle and NextAttack == nil then -- Replace "CheckDualStyle" with: env(GetEquipWeaponCategory, HAND_RIGHT) == env(GetEquipWeaponCategory, HAND_LEFT) or IsEnableDualWielding() ~= -1
      is_Dual = TRUE

      if r1 == "W_AttackRightLightDash" then
      r1 = "W_AttackDualDash"
  elseif r1 == "W_AttackRightLightStep" then
      r1 = "W_AttackDualRolling"
  elseif r1 == "W_AttackRightBackstep" then
      r1 = "W_AttackDualBackStep"
  elseif r1 == "W_AttackRightLightStealth" then
      if IsUseStealthAttack(TRUE) == FALSE then
      r1 = "W_AttackDualRolling"
    else
      r1 = "W_AttackDualStealth"
    end
  elseif l1 == "W_AttackLeftLight1" then
      r1 = "W_AttackDualLight1"
  elseif l1 == "W_AttackLeftLight2" then
      r1 = "W_AttackDualLight2"
  elseif l1 == "W_AttackLeftLight3" then
      r1 = "W_AttackDualLight3"
  elseif l1 == "W_AttackLeftLight4" then
      r1 = "W_AttackDualLight4"
  elseif l1 == "W_AttackLeftLight5" then
      r1 = "W_AttackDualLight5"
   elseif l1 == "W_AttackLeftLight6" then
      r1 = "W_AttackDualLight6"
    else
      r1 = "W_AttackDualLight1"
    end
  end
end
------------------------------------------
ExecEventAllBody(r1)
#

Basically, that's it

#

As for the jump attacks, it's pretty much the same as what Murloc and Kaimod shared, so I don't think I need to show it

#

I explained how you can easily adapt my code for standalone use with the comments