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

Add "anim_group" to setWeaponProperty() #609

Open
Einheit-101 opened this Issue Sep 28, 2018 · 5 comments

Comments

Projects
None yet
3 participants
@Einheit-101

Einheit-101 commented Sep 28, 2018

Description
(Moved from https://bugs.multitheftauto.com/view.php?id=8396)
Currently it is not possible to change animation groups of weapons. It is impossible to crouch with a rocket launcher, for example.
Replacing animations while aiming does not work because the player does no longer move his legs while aiming when a custom animation is used and it also doesnt make it possible to crouch the player.

Describe the solution you'd like
The possibility to change the anim_group of certain weapons would make it possible to crouch the player with any weapon and new walking animations could then be loaded with engineReplaceAnimation() if necessary.

@saml1er

This comment has been minimized.

Member

saml1er commented Sep 30, 2018

This is something hardcoded into GTA which stops a player from crouching with weapons like rocket launcher. It'll be better if you make a list of such animations that are restricted to some weapons only. It can be patched, like this function to allow crouching:

bool __cdecl CTaskSimpleDuck::CanPedDuck(CPed *a1)
{
  eWeaponType v1; // edi
  char v2; // al
  CWeaponInfo *v3; // eax
  bool result; // al

  result = 0;
  if ( CPed::IsPlayer(a1) && a1->m_dwMoveState >= 6 )
    return result;
  v1 = a1->m_aWeapons[a1->m_nActiveWeaponSlot].m_nType;
  v2 = CPed::GetWeaponSkill(a1);
  v3 = CWeaponInfo::GetWeaponInfo(v1, v2);
  if ( !v3->m_eFireType
    || v3->m_eFireType == 5
    || a1->m_aWeapons[a1->m_nActiveWeaponSlot].m_nType == 41
    || ((unsigned int)v3->m_nFlags >> 13) & 1 )
  {
    result = 1;
  }
  return result;
}

By the way, how do you plan on allowing scripters to modify the default behavior? Adding new properties to setGlitchEnabled?

@Einheit-101

This comment has been minimized.

Einheit-101 commented Sep 30, 2018

About number 1: i will create a list soon

About number 2: this should alter the animation group:
setWeaponProperty("rocket launcher", "anim_group" THE_GROUP)
A group like the one that M4 has should automatically allow crouch.
Forcing a player crouched with rocket launcher and default animation group will crash GTA because there is no crouch animation in that default group.

@Einheit-101

This comment has been minimized.

Einheit-101 commented Sep 30, 2018

Weapons that have no reload animations and reloadPedWeapon() does not animate:
Grenade, molotov, gas grenade, satchel, rocket launcher, rocket launcher HS, shotgun, flamethrower, sniper, minigun, spraycan, fire extinguisher, camera
(anim groups "grenade", "flame", "rocket", "sniper", "shotgun", "shotgunbad", "spraycan")

Weapons that do not allow crouch:
Minigun, flamethrower, rocket launcher, rocket launcher HS, fire extinguisher, grenade, gas grenade, molotov, satchel, camera
(anim groups "grenade", "flame", "rocket")

Changing anim_group of rifle/sniper to the group that M4 has would not change anything except that it would have a reload animation, which would be a nice addition.

€DIT:::
-Spraycan allows crouching. Corrected this.
-Camera does not allow crouching despite having the "rifle" anim group, maybe it is disabled by GTA code.
-"colt_cop" anim_group is not available at all, it is the animation that AI Cops use in GTA:SA
-anim_group is an integer for MTA, but in weapon.dat it is a string, i prefer the string because its straightforward. Rifle (33) returns the anim_group "27" and it is "sniper" in weapon.dat.

@qaisjp qaisjp changed the title from [Request] Add "anim_group" to setWeaponProperty() to Add "anim_group" to setWeaponProperty() Sep 30, 2018

@saml1er

This comment has been minimized.

Member

saml1er commented Oct 2, 2018

@Einheit-101 Thanks, I'll look into it soon.

@Einheit-101

This comment has been minimized.

Einheit-101 commented Oct 2, 2018

Take your time, but #462 is more important in my opinion.

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