Having troubles to create and change grenade discharger shells / module

so…
i wanted to create a “new” types of grenade launchers through entities.

more precisely, make an m1 garand with HE rifle frag grenades ( opposed as the default AP ), and another M1 with smoke rifle grenades.

problem is, i don’t really know what to precisely do.

let alone changing even the type of the rifle grenade.

so, what i tried to do, was to copy the properties of the M7, and change them to accomodate the M1_grenade_launcher which it’s based on the M1903 USMC grenade launcher, which does have the HE rifle grenades. ( that is, correct and historical shape of what would have been largely used on the m1 for grenadiers of the us army )

code
m1_garand_with_grenade_launcher_gun_item{
  _use:t="main_weap_slots"
  _use:t="ironsights_open_semiauto"
  animchar__res:t="m1_garand_grenade_launcher_m7_char"
  gun__blk:t="content/enlisted/gamedata/weapons/m1_garand_grenade_launcher_m7.blk"
  item__template:t="m1_garand_with_grenade_launcher_gun_item"
  item__proto:t="content/enlisted/gamedata/weapons/m1_garand_grenade_launcher_m7.blk"
  item__locDetails:t="7.62x33mm;"
  item__id:i=0
  item__weapTemplate:t="m1_garand_grenade_launcher_m7_gun"
  item__name:t="items/m1_garand_grenade_launcher_m7"
  item__weapType:t="semiauto"
  item__weight:r=4.3
  gun__locName:t="M1 Garand with grenade launcher M7"
  gun__statName:t="semiauto"
  gun__sightsDistance:r=0.05
  gun__shotFreq:r=5.333
  gun__automaticReload:b=no
  gun_spread__maxDeltaAngle:r=0.28
  gun_deviation__omegaRange:p2=30.0, 90.0
  gun_deviation__omegaDevInc:p2=0.1, 0.6
  gun_deviation__movementRange:p2=2.1, 4.0
  gun_deviation__movementDevInc:p2=0.0, 15.0
  gun_deviation__onShotDeviationChange:r=0.0
  gun_deviation__shotTau:r=0.1
  gun_deviation__extraDeviationTau:r=0.3
  gun_deviation__maxDeviation:r=25.0
  gun__reloadTime:r=2.9
  gun__altReloadTime:r=3.4
  gun__showChamberedAmmo:b=no
  gun__boltFreq:r=7.0
  gun__kineticDamageMult:r=1.06

  "gun__ammoHolders:array"{
    ammoHolders:t="m1_garand_magazine"
  }

  "gun__shells:array"{
    shells:t="content/enlisted/gamedata/weapons/bullets/30_06_springfield_semiauto.blk"
  }

  "gun__firingModes:array"{

    "mode:object"{
      modeType:t="burst"
      burstSize:i=1
    }
  }

  "gun__firingModeNames:array"{
    mode:t="semi_auto"
  }
}

m1_garand_with_grenade_launcher_gun{
  _use:t="equipable_gun"
  _use:t="semiauto_ww2_preset"
  _use:t="mgun_gun_shot_dry_sound"
  _use:t="rifle_gun_aim_sound"
  _use:t="m1_garand_grenade_launcher_m7"
  _use:t="rifle_muzzle_preset"
  _use:t="hit_effect_group_8_12mm"
  gun_shell_ejection__timeMult:r=0.35
  gun__standOffset:p3=0.2, 0.05, 0.15
  gun__crouchOffset:p3=0.2, -0.07, 0.25
  gun__length:r=0.4
  gun__recoilAmount:r=0.138
  gun__recoilDirAmount:r=0.76
  gun__recoilDir:r=0.35
  gun__visualRecoilMult:r=0.7
  gun_attach__slot:t="weapon"
  meleeSoundType:t="rifle"

  "gun_sound__shotPath:shared:object"{
    _tags:t="sound"
    path:t="/weapon/rifle/m1"
  }

  "sound_irqs:shared:object"{
    _tags:t="sound"

    "reload1:object"{
      path:t="/weapon/rifle/m1/reload1/change_ammo"
    }

    "reload2:object"{
      path:t="/weapon/rifle/m1/reload2/change_ammo"
    }

    "reload3:object"{
      path:t="/weapon/rifle/m1/reload3/change_ammo"
    }

    "boltAction:object"{
      path:t="/weapon/rifle/m1/bolt_action"
    }

    "modActivate:object"{
      path:t="/weapon/antivehicle/mortyr_grenade_launcher/mod_activate"
    }

    "modDeactivate:object"{
      path:t="/weapon/antivehicle/mortyr_grenade_launcher/mod_deactivate"
    }

    "modReload:object"{
      path:t="/weapon/antivehicle/mortyr_grenade_launcher/mod_reload"
    }
  }

  "gun_mods__slots:object"{

    "grenade_launcher:object"{
      m1_grenade_launcher:t="m1_grenade_launcher"
    }
  }

  "gun__mountPoints:shared:array"{

    "point:object"{
      type:t="rest"
      recoil:r=0.65
      offset:p3=0.68, 0.005, -0.005
    }
  }
}

garand_with_grenade_launcher_gun{
  _use:t="m1_garand_with_grenade_launcher_gun"
  _use:t="m1_garand_with_grenade_launcher_gun_item"
  "gun_mods__slots:object"{

    "grenade_launcher:object"{
      m1_grenade_launcher:t="m1_grenade_launcher"
    }
  }
}

but… it doesn’t work.

it tells me that the m1_gr[…] is not allowed in the slot tags, only the m7.

but… how do i change that

as far as i’m aware, nor the proto or the actual referential blks or what have you contains those slots tags.

not even in the grenade it self for rifles

m1_garand_grenade_launcher_m7_gun.blkx code
stat_name:t="semiauto"
selWeaponVar:t="m1_garand_grenade_launcher_m7"

ownerAnimVars{
  reye_offset_fwd0:r=-0.1
  gun_offset_along:r=0.1
  gun_offset_across:r=0.02
  gun_offset_up:r=0.0
}

gunFlash{

  gunFx_main{
    fx:t="muzzle_flash"
    scale:r=0.04
  }

  gunFx_add_1{
    fx:t="side_muzzle_flash"
    scale:r=0.02
  }

  gunFx_add_2{
    fx:t="side_muzzle_flash"
    scale:r=0.02
  }

  gunFx_add_3{
    fx:t="side_muzzle_flash"
    scale:r=0.02
  }

  gunFx_add_bolt{
    fx:t="side_muzzle_flash"
    scale:r=0.01
  }
}

nor the actual grenades

m2
mass:r=0.59
momentOfInertia:p3=0.04, 0.008, 0.04
caliber:r=0.03
speed:r=65.0
speedPitch:r=1.5
maxDistance:r=6.0
physMat:t="grenadeRay"
useFutureContacts:b=yes
frictionGround:r=0.5
bullets:i=1
noSleepAtTheSlopeCos:r=0.766
logCCD:b=no
entityTemplate:t="m2_rifle_grenade_phys"
entityPhysTemplate:t="m2_rifle_grenade_phys"
explosiveType:t="tnt"
explosiveMass:r=0.031

visual{
  template:t="m2_rifle_grenade_item+item_in_world"
}

collisionResource{

  props{
    volumeBox:t="box"
  }
}

ccdSpheres{
  ccd:p4=0.05, 0.0, 0.0, 0.015
  ccd:p4=0.2, 0.0, 0.0, 0.015
  ccd:p4=-0.05, 0.0, 0.0, 0.015
}

splashDamage{
  radius:p2=1.0, 10.0
  penetration:p2=15.0, 2.0
  damage:r=20.0
  dmgOffset:p3=0.0, 0.25, 0.0
}

explFx{
  fxScale:p2=0.8, 0.9
  effectTemplName:t="explosion_effect_small+disable_effect_sfx"
}

explSound{
  explSoundPath:t="impact/grenade"
}

damage{

  explosive{
    strengthEquivalent:r=1.0
    brisanceEquivalent:r=1.0
  }
}

solver{
  energyConservation:r=0.85
}

has anyone managed to find a solution or… suggests what i should do ?

if not, oh well. thanks anyway.

1 Like

In weapon entity you will need to edit gun_mods__slots.


And then in grenade_launcher entity need to edit gunAttachable__slotTag

Don’t forgot to add new shell inside grenade_launcher. And maybe ammo holders too.

1 Like

Probably because you pickup old weapon instead new (m1_garand_with_grenade_launcher_gun or garand_with_grenade_launcher_gun)

1 Like

ah…

i see clearly now.

but… i’m a bit confused.

why doesn’t the m7 it self has the m9a1 as shell, etc?

like,

all i could find inside, was:

stat_name:t="launcher"
selWeaponVar:t="m7_grenade_launcher"

ownerAnimVars{
  reye_offset_fwd0:r=-0.0
  gun_offset_along:r=0.0
  gun_offset_across:r=0.0
  gun_offset_up:r=0.0
}

gunFlash{

  gunFx_main{
    fx:t="muzzle_flash"
    scale:r=1.0
  }
}

It’s probably code for animchar or smth like it. Maybe some additional code for entity. Probably code for weapon modificaions will be with others weap mods. Or you can use editor properties for entities.blk.

1 Like

right.

i did as followed,

and we are much closer now:

m1_garand_with_grenade_launcher_gun{
  _use:t="equipable_gun"
  _use:t="semiauto_ww2_preset"
  _use:t="mgun_gun_shot_dry_sound"
  _use:t="rifle_gun_aim_sound"
  _use:t="m1_garand_grenade_launcher_m7"
  _use:t="rifle_muzzle_preset"
  _use:t="hit_effect_group_8_12mm"
  gun_shell_ejection__timeMult:r=0.35
  gun__standOffset:p3=0.2, 0.05, 0.15
  gun__crouchOffset:p3=0.2, -0.07, 0.25
  gun__length:r=0.4
  gun__recoilAmount:r=0.138
  gun__recoilDirAmount:r=0.76
  gun__recoilDir:r=0.35
  gun__visualRecoilMult:r=0.7
  gun_attach__slot:t="weapon"
  meleeSoundType:t="rifle"

  "gun_sound__shotPath:shared:object"{
    _tags:t="sound"
    path:t="/weapon/rifle/m1"
  }

  "sound_irqs:shared:object"{
    _tags:t="sound"

    "reload1:object"{
      path:t="/weapon/rifle/m1/reload1/change_ammo"
    }

    "reload2:object"{
      path:t="/weapon/rifle/m1/reload2/change_ammo"
    }

    "reload3:object"{
      path:t="/weapon/rifle/m1/reload3/change_ammo"
    }

    "boltAction:object"{
      path:t="/weapon/rifle/m1/bolt_action"
    }

    "modActivate:object"{
      path:t="/weapon/antivehicle/mortyr_grenade_launcher/mod_activate"
    }

    "modDeactivate:object"{
      path:t="/weapon/antivehicle/mortyr_grenade_launcher/mod_deactivate"
    }

    "modReload:object"{
      path:t="/weapon/antivehicle/mortyr_grenade_launcher/mod_reload"
    }
  }

  "gun_mods__slots:object"{

    "grenade_launcher:object"{
      m7_grenade_launcher:t="m7_grenade_launcher"
    }
  }

  "gun__mountPoints:shared:array"{

    "point:object"{
      type:t="rest"
      recoil:r=0.65
      offset:p3=0.68, 0.005, -0.005
    }
  }
}

garand_with_grenade_launcher_gun{
  _use:t="m1_garand_with_grenade_launcher_gun"
  _use:t="m1_garand_with_grenade_launcher_gun_item"
  "gun_mods__slots:object"{

    "grenade_launcher:object"{
      m7_grenade_launcher:t="m7_grenade_launcher"
    }
  }
}

m7_grenade_launcher{
  _override:b=yes

  "gun__ammoHolders:array"{
    ammoHolders:t="m2_rifle_grenade_item"
  }

  "gun__shells:array"{
  gun__shells:t="content/enlisted/gamedata/weapons/grenades/m2_rifle_grenade.blk"
  }
}

which, the grenade launchers now recognizes the grenades being used…

image

… slight problem is, it doesn’t actually let me use them.

am i doing something wrong?

could you… elaborate a bit more on that?

1 Like

Looks like fine, but it seems not working because of gun__ammoHolders.


To be honest i’m not very sure. Soon will check it.

1 Like

It’s weird.

m7_grenade_launcher{
  _override:b=yes

  "gun__ammoHolders:array"{
    gun__ammoHolders:t="content/enlisted/gamedata/weapons/grenades/m24_flash.blk"
    gun__ammoHolders:t="content/enlisted/gamedata/weapons/grenades/m24_smoke.blk"
    gun__ammoHolders:t="content/enlisted/gamedata/weapons/shells/rpzb_gr_4992.blk"
    gun__ammoHolders:t="m24_grenade_item"
    gun__ammoHolders:t="rpzb_gr_4322_item"
  }

  "gun__shells:array"{
    gun__shells:t="content/enlisted/gamedata/weapons/grenades/m24_flash.blk"
    gun__shells:t="content/enlisted/gamedata/weapons/grenades/m24_smoke.blk"
    gun__shells:t="content/enlisted/gamedata/weapons/shells/rpzb_gr_4992.blk"
    gun__shells:t="content/enlisted/gamedata/weapons/grenades/m24.blk"
    gun__shells:t="content/enlisted/gamedata/weapons/shells/rpzb_gr_4322.blk"
  }
}

I success used all grenades (they explode/disappers instantly) and some projectiles. Probably problem on your projectile entity code?

so…

you’re telling me that rifle grenades cannot use other types of grenades ( that are from others type of rifle grenades ) but only default grenades?

It can use any grenades and not only. Rocket launcher projectiles too. You probably can’t use it because did some error in entity. In item or phys entity. I mean there maybe some error in m2_rifle_grenade entities.

UPD: Ah. My bad. Just noted that m2 rifle grenade in game.
Well… It works fine?

  "gun__ammoHolders:array"{
    gun__ammoHolders:t="content/enlisted/gamedata/weapons/grenades/m24_flash.blk"
    gun__ammoHolders:t="content/enlisted/gamedata/weapons/grenades/m24_smoke.blk"
    gun__ammoHolders:t="m24_grenade_item"
    gun__ammoHolders:t="content/enlisted/gamedata/weapons/shells/rpzb_gr_4992.blk"
    gun__ammoHolders:t="rpzb_gr_4322_item"
    gun__ammoHolders:t="content/enlisted/gamedata/weapons/grenades/m2_rifle_grenade.blk"
  }

  "gun__shells:array"{
    gun__shells:t="content/enlisted/gamedata/weapons/grenades/m24_flash.blk"
    gun__shells:t="content/enlisted/gamedata/weapons/grenades/m24_smoke.blk"
    gun__shells:t="content/enlisted/gamedata/weapons/grenades/m24.blk"
    gun__shells:t="content/enlisted/gamedata/weapons/shells/rpzb_gr_4992.blk"
    gun__shells:t="content/enlisted/gamedata/weapons/shells/rpzb_gr_4322.blk"
    gun__shells:t="content/enlisted/gamedata/weapons/grenades/m2_rifle_grenade.blk"
  }

(And even when m2_rifle_grenade_item).

Try to change ammoHolders to gun__ammoHolders, but idk. Kinda weird that it not work.

i’m not… joking.

it doesn’t work for me:

m7_grenade_launcher{
  _override:b=yes

  "gun__ammoHolders:array"{
    ammoHolders:t="content/enlisted/gamedata/weapons/grenades/m2_rifle_grenade.blk"
    ammoHolders:t="m2_rifle_grenade_item"
  }

  "gun__shells:array"{
  gun__shells:t="content/enlisted/gamedata/weapons/grenades/m2_rifle_grenade.blk"
  }
}

it’s a fresh blk and entities too.

like, no other changes were made

Edit

because i’m an idiot.

i see:

it’s:

gun__ammoHolders:t="content/enlisted/gamedata/weapons/grenades/m2_rifle_grenade.blk"

not…

ammoHolders:t="content/enlisted/gamedata/weapons/grenades/m2_rifle_grenade.blk"

Second edit.

still doesn’t work.

i don’t… understand why it’s not working

wait… inside the actual weapon or the m7 discharger? the second, right?

omg

i’m the dumbest individual in this universe.

so, it worked. ( even though the model of the grenade is incorrect )

i was pressing the wrong button because i forgot that i changed bindings from the live version, to the editor

1 Like

I’m too. It’s weird. Returning back to code. Can you resent it to me?

Probably problems are in m1_garand_with_grenade_launcher_gun_item or garand_with_grenade_launcher_gun

1 Like

Nice! Talking about ammoHolders. It seems that it works fine too.

This probably we can’t change, because it’s part of animchar… But maybe it’s possible to hide this grenade and use attached animchar.

1 Like

right.

now that’s out of the way,

i managed to make a somewhat working m1_garand with the HE grenade discharger.
( many thanks! )

m1_garand_with_grenade_launcher_gun_item{
  _use:t="main_weap_slots"
  _use:t="ironsights_open_semiauto"
  animchar__res:t="m1_garand_grenade_launcher_m7_char"
  gun__blk:t="content/enlisted/gamedata/weapons/m1_garand_grenade_launcher_m7.blk"
  item__template:t="m1_garand_with_grenade_launcher_gun_item"
  item__proto:t="content/enlisted/gamedata/weapons/m1_garand_grenade_launcher_m7.blk"
  item__locDetails:t="7.62x33mm;"
  item__id:i=0
  item__weapTemplate:t="m1_garand_grenade_launcher_m7_gun"
  item__name:t="items/m1_garand_grenade_launcher_m7"
  item__weapType:t="semiauto"
  item__weight:r=4.3
  gun__locName:t="M1 Garand with grenade launcher M7"
  gun__statName:t="semiauto"
  gun__sightsDistance:r=0.05
  gun__shotFreq:r=5.333
  gun__automaticReload:b=no
  gun_spread__maxDeltaAngle:r=0.28
  gun_deviation__omegaRange:p2=30.0, 90.0
  gun_deviation__omegaDevInc:p2=0.1, 0.6
  gun_deviation__movementRange:p2=2.1, 4.0
  gun_deviation__movementDevInc:p2=0.0, 15.0
  gun_deviation__onShotDeviationChange:r=0.0
  gun_deviation__shotTau:r=0.1
  gun_deviation__extraDeviationTau:r=0.3
  gun_deviation__maxDeviation:r=25.0
  gun__reloadTime:r=2.9
  gun__altReloadTime:r=3.4
  gun__showChamberedAmmo:b=no
  gun__boltFreq:r=7.0
  gun__kineticDamageMult:r=1.06

  "gun__ammoHolders:array"{
    ammoHolders:t="m1_garand_magazine"
  }

  "gun__shells:array"{
    shells:t="content/enlisted/gamedata/weapons/bullets/30_06_springfield_semiauto.blk"
  }

  "gun__firingModes:array"{

    "mode:object"{
      modeType:t="burst"
      burstSize:i=1
    }
  }

  "customProps:object"{
    "gunMods:object"{
      grenade_launcher:t="m7_grenade_launcher"
    }
  }

  "gun__firingModeNames:array"{
    mode:t="semi_auto"
  }
}

m1_garand_with_grenade_launcher_gun{
  _use:t="equipable_gun"
  _use:t="semiauto_ww2_preset"
  _use:t="mgun_gun_shot_dry_sound"
  _use:t="rifle_gun_aim_sound"
  _use:t="m1_garand_grenade_launcher_m7"
  _use:t="rifle_muzzle_preset"
  _use:t="hit_effect_group_8_12mm"
  gun_shell_ejection__timeMult:r=0.35
  gun__standOffset:p3=0.2, 0.05, 0.15
  gun__crouchOffset:p3=0.2, -0.07, 0.25
  gun__length:r=0.4
  gun__recoilAmount:r=0.138
  gun__recoilDirAmount:r=0.76
  gun__recoilDir:r=0.35
  gun__visualRecoilMult:r=0.7
  gun_attach__slot:t="weapon"
  meleeSoundType:t="rifle"

  "gun_sound__shotPath:shared:object"{
    _tags:t="sound"
    path:t="/weapon/rifle/m1"
  }

  "sound_irqs:shared:object"{
    _tags:t="sound"

    "reload1:object"{
      path:t="/weapon/rifle/m1/reload1/change_ammo"
    }

    "reload2:object"{
      path:t="/weapon/rifle/m1/reload2/change_ammo"
    }

    "reload3:object"{
      path:t="/weapon/rifle/m1/reload3/change_ammo"
    }

    "boltAction:object"{
      path:t="/weapon/rifle/m1/bolt_action"
    }

    "modActivate:object"{
      path:t="/weapon/antivehicle/mortyr_grenade_launcher/mod_activate"
    }

    "modDeactivate:object"{
      path:t="/weapon/antivehicle/mortyr_grenade_launcher/mod_deactivate"
    }

    "modReload:object"{
      path:t="/weapon/antivehicle/mortyr_grenade_launcher/mod_reload"
    }
  }

  "gun_mods__slots:object"{

    "grenade_launcher:object"{
      m7_grenade_launcher:t="m7_grenade_launcher"
    }
  }

  "customProps:object"{
    "gunMods:object"{
      grenade_launcher:t="m7_grenade_launcher"
    }
  }

  "gun__mountPoints:shared:array"{

    "point:object"{
      type:t="rest"
      recoil:r=0.65
      offset:p3=0.68, 0.005, -0.005
    }
  }
}

garand_with_grenade_launcher_gun{
  _use:t="m1_garand_with_grenade_launcher_gun"
  _use:t="m1_garand_with_grenade_launcher_gun_item"
  "gun_mods__slots:object"{

    "grenade_launcher:object"{
      m7_grenade_launcher:t="m7_grenade_launcher"
    }
  }
}

m7_grenade_launcher{
  _override:b=yes

  "gun__ammoHolders:array"{
    gun__ammoHolders:t="content/enlisted/gamedata/weapons/grenades/m2_rifle_grenade.blk"
    gun__ammoHolders:t="m2_rifle_grenade_item"
    gun__ammoHolders:t="content/enlisted/gamedata/weapons/grenades/m24_smoke.blk"
  }

  "gun__shells:array"{
  gun__shells:t="content/enlisted/gamedata/weapons/grenades/m2_rifle_grenade.blk"
  gun__shells:t="content/enlisted/gamedata/weapons/grenades/m24_smoke.blk"
  }
}

but i have following up questions.

how can i do something similar for smokes instead? [Answered]

edit.

i found the solution, ( thanks to you of the past lmao )

m7_grenade_launcher{
  _override:b=yes

  "gun__ammoHolders:array"{
    gun__ammoHolders:t="content/enlisted/gamedata/weapons/grenades/m2_rifle_grenade.blk"
    gun__ammoHolders:t="m2_rifle_grenade_item"
    gun__ammoHolders:t="content/enlisted/gamedata/weapons/shells/mine_o832_smoke.blk"
  }

  "gun__shells:array"{
  gun__shells:t="content/enlisted/gamedata/weapons/grenades/m2_rifle_grenade.blk"
  gun__shells:t="content/enlisted/gamedata/weapons/shells/mine_o832_smoke.blk"
  }
}

mine_o832_phys_base{
  _override:b=yes
  shell__fuseTime:r=0.2
  shell__explNodeIdx:i=1
}

i tried with grenades such as m24 smoke grenade, but it disappears after being lunched,

so i opted for mortars projectiles, and reduced the time to impact in the phys

which it worked :open_mouth:

but, the second question still stand unfortunately.

is it possible to display the current shell in use?

i’m not sure if grenades can be chosed either.

like, it’s kinda hard to tell the difference between a HE and a smoke grenade.

dunno if i can make it to switch somehow

1 Like

Yeah. Probably because grenades have different phys or something like it.

Hmmm… Not very sure. I’ll check it later and try something.

As I know… There some property that let you set icons for ammo. Something that looks like ammo_holder__iconName:t=“ui/skin#submachine_gun_veteran.svg”. Maybe it will work on grenade launcher ammo too. But it works only if you add _use:t=“gun_with_switchable_ammo_holders” to weapon entity. And probably switch works only if you in mortair mode.

1 Like