Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swing Speed #1352

Open
xMirroRx opened this issue Dec 5, 2024 · 2 comments
Open

Swing Speed #1352

xMirroRx opened this issue Dec 5, 2024 · 2 comments

Comments

@xMirroRx
Copy link

xMirroRx commented Dec 5, 2024

ON=@Hittry
ARGN1=0 // I can't reach the hit speeds I want, it would be great if this was increased and the ARGN1 value went negative, making the hit faster.

In this way, a restriction of 0 value has been created and the Propsun Swing feature cannot meet the desired needs.

I also seem to remember very well that this was further accelerated in 56b behavior.

@canerksk
Copy link
Contributor

canerksk commented Dec 6, 2024

I had previously conveyed the issue to decision makers @raydienull and @cbnolok . I had conveyed that it was problematic and needed to be completely changed and reconsidered, we are waiting...

My opinion is that not making the combat mechanism fully customizable with scripts possible from the very beginning is the biggest mistake. There have been many personal changes made to the combat mechanism, but no changes have been made to provide this possibility.

for example;

 _SetTimeoutD(m_atFight.m_iRecoilDelay);   // Wait for the recoil time. 
 
..
..
		if (!IsSetCombatFlags(COMBAT_ANIM_HIT_SMOOTH))
			_SetTimeoutD(m_atFight.m_iSwingAnimationDelay);
		else
			_SetTimeoutD(iSwingAnimationDelayInSeconds * TENTHS_PER_SEC);

Why can't I change this value with the script?

or

UpdateAnimate((ANIM_TYPE)m_atFight.m_iSwingAnimation, false, false, iSwingAnimationDelayInSeconds ); Why can't I change these values ​​with the script? (This is where the synchronization problem between the hit and the swing animation occurs.)

Why were strange Combat settings added and why weren't they made to be set with the desired value via a local variable under the trigger?

WAR_SWING_TYPE CChar::Fight_Hit must undergo a complete overhaul.

@canerksk
Copy link
Contributor

canerksk commented Dec 6, 2024

in its simplest form,

    byte bAnimFrameDelay = 0;
    int16 iRecoil1Delay        = m_atFight.m_iRecoilDelay;
    int16 iRecoil2Delay        = 10;
    int16 iSwingAnimationDelay = m_atFight.m_iSwingAnimationDelay;

    if (!IsSetCombatFlags(COMBAT_ANIM_HIT_SMOOTH))
        iRecoil2Delay = m_atFight.m_iSwingAnimationDelay;

    // Do i have to wait for the recoil time?
    if (m_atFight.m_iWarSwingState == WAR_SWING_EQUIPPING)
    {
        m_atFight.m_iSwingAnimation = (int16)GenerateAnimate(ANIM_ATTACK_WEAPON);

        if ( IsTrigUsed(TRIGGER_HITTRY) )
        {

            CScriptTriggerArgs Args(0, 0, pWeapon);
            Args.m_VarsLocal.SetNum("Anim", m_atFight.m_iSwingAnimation);
            Args.m_VarsLocal.SetNum("SwingAnimDelay", iSwingAnimationDelay);
            Args.m_VarsLocal.SetNum("Recoil1Delay", iRecoil1Delay);
            Args.m_VarsLocal.SetNum("Recoil2Delay", iRecoil2Delay);
            Args.m_VarsLocal.SetNum("AnimFrameDelay", bAnimFrameDelay);
            if ( OnTrigger(CTRIG_HitTry, pCharTarg, &Args) == TRIGRET_RET_TRUE )
                return WAR_SWING_READY;

            m_atFight.m_iSwingAnimation = (int16)(Args.m_VarsLocal.GetKeyNum("Anim"));
            iSwingAnimationDelay        = (int16)(Args.m_VarsLocal.GetKeyNum("SwingAnimDelay"));
            iRecoil1Delay               = (int16)(Args.m_VarsLocal.GetKeyNum("Recoil1Delay"));
            iRecoil2Delay               = (int16)(Args.m_VarsLocal.GetKeyNum("Recoil2Delay"));
            bAnimFrameDelay             = (int16)(Args.m_VarsLocal.GetKeyNum("AnimFrameDelay"));
        }
        _SetTimeoutD(iRecoil1Delay); // Wait for the recoil time.
        m_atFight.m_iWarSwingState = WAR_SWING_READY;
        return WAR_SWING_READY;
    }

	// I have waited for the recoil time, then i can start the swing
	if ( m_atFight.m_iWarSwingState == WAR_SWING_READY )
	{
		if (fSwingNoRange) // We don't want the animation to display if we are outside of range.
		{
			int	iMinDist = pWeapon ? pWeapon->GetRangeL() : 0;
			int	iMaxDist = Fight_CalcRange(pWeapon);
			if (dist <  iMinDist || dist > iMaxDist)
				return WAR_SWING_READY;
		}
		m_atFight.m_iWarSwingState = WAR_SWING_SWINGING;
		Reveal();

		if ( !IsSetCombatFlags(COMBAT_NODIRCHANGE) && CanSee(pCharTarg) )
        {
			UpdateDir(pCharTarg);
        }
        UpdateAnimate((ANIM_TYPE)m_atFight.m_iSwingAnimation, false, false, bAnimFrameDelay);
        _SetTimeoutD(iRecoil2Delay);
		return WAR_SWING_SWINGING;
	}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants