somehow I use this code disable the counter on axe mode.
-------------------------------------------------------------------------------- -- Injection Functions for Switch Axe Offense -------------------------------------------------------------------------------- local function executeCounterAttack() if switchAxeMode ~= "Sword Mode" then return end -- Skip if not in Sword Mode local char = player:call("get_Character") if not char then return end char:call("changeActionRequest(app.AppActionDef.LAYER, ace.ACTION_ID, System.Boolean)", 0, NewActionID(2, 31), false) end -------------------------------------------------------------------------------- -- Early Hook: Offensive Injection for Switch Axe -- -- When an enemy attack is detected early (via checkAngleLimit or preHitCheck), -- always inject the counter attack (Cat 2, Index 31) regardless of mode. -------------------------------------------------------------------------------- local actionInjected = false mod.HookFunc("app.HitController", "checkAngleLimit(app.HitInfo)", function(args) if CurrentWeaponType ~= CONST.WeaponType.SwitchAxe or switchAxeMode == "Axe Mode" or not args[3] then return end -- Skip unnecessary checks local hitInfo = sdk.to_managed_object(args[3]) if checkIsMaster(hitInfo) and (os.clock() - lastInjectionTime) >= injectionCooldown then executeCounterAttack() lastInjectionTime = os.clock() actionInjected = true end end, function(retval) if actionInjected then actionInjected = false return sdk.to_ptr(false) end return retval end )
I opened the Lua file in Notepad and made the modifications, but it's still triggering the sword counterattack in axe mode. 😢 Is there something I might have missed?
This worked great! I am curious, are you able to make it only possible to use Rising Slash when the character is in a state that can do it? Currently it can interrupt the charging and release of a Full Release Slash as well.
Hey, brother, I made some minor changes to realize this requirement. Now this script will only be triggered in sword mode, but not in axe mode. Because the content of the script is too long, I can't send it directly in the comment area. Please visit the online clipboard below to get it and replace the whole content of the original script. https://paste.ubuntu.com/p/f2q2HYMyWV/
I have two small ideas to realize next.1. Let the script not be triggered under the charging and release of a full release SLAS in sword mode. It may be safer to trigger the script when charging, but it will be very strange in multiplayer online mode, so I hope to disable it in this state. 2. You can trigger Offset Rising Slash in axe mode.
I don't have a good idea at present. I'm still thinking about it and hope it can be realized one day. (Not native English, this passage is generated by translation software, I hope there will be no ambiguity.)
Hi man, first of all, thank you for this script!!!
I was wondering: how do you find the action ID of any attack etc. in order to make .lua script in MH Wilds? Because I would like to try to learn on my side, but I can't find any tutorial or else on how to do it ... For instance, in your script, the counterattack uses "NewActionID(2, 31)", but how and where did you find this information?
can you make this your own mod? i dont think the mod author is updating this and i cant figure out how to open lua files. if u want to help walk me through this, feel free too. The mod is working for me but the lua file shows me nothing when i open it with windows text.
It's a shame there's no setting to change it so it's not always a shortcut key for ON/OFF. Would that be possible? Plus, the counterattack isn't natural with the axe countering the sword, which makes it very awkward, considering it's not a possible combo.
I would like to suggest a alternative and more simple solution to the problem with auto-guarding with specifically SnS.
Normally by repeatedly using "guard slash" in SnS, it will always block the monster's attacks and sometimes even perfect block it. Clashes and offensive guard still activates from "guard slash" even if the block is not a perfect block. Offensive guard even activates on all blocks even if they are not perfect blocks because the interval for offensive guard is more forgiving than a perfect block.
Therefore a solution could be a mod that automatically does "guard slashes" (plural) when a monster tries to hit you. By always doing "guard slashes" you will at the very least guard the monsters attacks and sometimes even perfect guard it. It activates offensive guard and clashes, and hopefully makes the hit detection problem more simpler because you could repeatedly use "guard slash" before getting attacked instead of trying to perfectly time it.
I have very limited knowledge of coding, for that reason I can't make this myself. However I would just like to put this out here if someone is capable of creating such a mod and would most definitely appreciate it!
If you re read the description you'll notice that the maker will not answer your questions and will not provide future support, they just posted this to show a scuffed simple way of how to mod this for someone else to fix.
27 comments
extract the .lua file and just put it in:
SteamLibrary > steamapps > common > MonsterHunterWilds > reframework > autorun
--------------------------------------------------------------------------------
-- Injection Functions for Switch Axe Offense
--------------------------------------------------------------------------------
local function executeCounterAttack()
if switchAxeMode ~= "Sword Mode" then return end -- Skip if not in Sword Mode
local char = player:call("get_Character")
if not char then return end
char:call("changeActionRequest(app.AppActionDef.LAYER, ace.ACTION_ID, System.Boolean)", 0, NewActionID(2, 31), false)
end
--------------------------------------------------------------------------------
-- Early Hook: Offensive Injection for Switch Axe
--
-- When an enemy attack is detected early (via checkAngleLimit or preHitCheck),
-- always inject the counter attack (Cat 2, Index 31) regardless of mode.
--------------------------------------------------------------------------------
local actionInjected = false
mod.HookFunc("app.HitController", "checkAngleLimit(app.HitInfo)",
function(args)
if CurrentWeaponType ~= CONST.WeaponType.SwitchAxe or switchAxeMode == "Axe Mode" or not args[3] then return end -- Skip unnecessary checks
local hitInfo = sdk.to_managed_object(args[3])
if checkIsMaster(hitInfo) and (os.clock() - lastInjectionTime) >= injectionCooldown then
executeCounterAttack()
lastInjectionTime = os.clock()
actionInjected = true
end
end,
function(retval)
if actionInjected then
actionInjected = false
return sdk.to_ptr(false)
end
return retval
end
)
not in axe mode.
Because the content of the script is too long, I can't send it directly
in the comment area. Please visit the online clipboard below to get it
and replace the whole content of the original script.
https://paste.ubuntu.com/p/f2q2HYMyWV/
I have two small ideas to realize next.1. Let the script not be triggered under the charging and release of a
full release SLAS in sword mode. It may be safer to trigger the script
when charging, but it will be very strange in multiplayer online mode,
so I hope to disable it in this state.
2. You can trigger Offset Rising Slash in axe mode.
I don't have a good idea at present. I'm still thinking about it and hope it can be realized one day.
(Not native English, this passage is generated by translation software, I hope there will be no ambiguity.)
I was wondering: how do you find the action ID of any attack etc. in order to make .lua script in MH Wilds? Because I would like to try to learn on my side, but I can't find any tutorial or else on how to do it ... For instance, in your script, the counterattack uses "NewActionID(2, 31)", but how and where did you find this information?
Thank you in advance, and take care.
if u want to help walk me through this, feel free too. The mod is working for me but the lua file shows me nothing when i open it with windows text.
Plus, the counterattack isn't natural with the axe countering the sword, which makes it very awkward, considering it's not a possible combo.
Normally by repeatedly using "guard slash" in SnS, it will always block the monster's attacks and sometimes even perfect block it. Clashes and offensive guard still activates from "guard slash" even if the block is not a perfect block. Offensive guard even activates on all blocks even if they are not perfect blocks because the interval for offensive guard is more forgiving than a perfect block.
Therefore a solution could be a mod that automatically does "guard slashes" (plural) when a monster tries to hit you. By always doing "guard slashes" you will at the very least guard the monsters attacks and sometimes even perfect guard it. It activates offensive guard and clashes, and hopefully makes the hit detection problem more simpler because you could repeatedly use "guard slash" before getting attacked instead of trying to perfectly time it.
I have very limited knowledge of coding, for that reason I can't make this myself. However I would just like to put this out here if someone is capable of creating such a mod and would most definitely appreciate it!
No it doesnt support gunlance.