aliens

Author Topic: [Answered] (OXCE) Can I replace the melee attack with a ranged attack?  (Read 5311 times)

Offline The Martian

  • Commander
  • *****
  • Posts: 754
  • "It implores you to listen to its arguments..."
    • View Profile
I'm attempting to replace the weapon melee attack with a grenade launcher as shown in the "UFOpaedia Ruleset Reference Nightly" example.

The command to fire the Grenade appears at the top of the weapon action list in place of the melee attack as expected.

The weapon loads normal rifle clips and it will also load 1 grenade round in the inventory screen, however on the battlescape the icon for the rifle displays that it has 15 bullets and 0 grenades loaded.

Additionally when I attempt to fire it the message "There is no one there!" is displayed and the weapon does not fire.

Is there an additional step to override the melee slot?

Here is the code I'm using for the rifle:

Code: [Select]
  - type: STR_RIFLE_GRENADE_LAUNCHER
    size: 0.2
    costSell: 2250
    weight: 8
    bigSprite: 1
    floorSprite: 1
    handSprite: 0
    bulletSprite: 2
    fireSound: 76
#    compatibleAmmo:
#      - STR_RIFLE_CLIP
#      - STR_RIFLE_AA_CLIP
    ammo:
      0:
        compatibleAmmo: [ STR_RIFLE_CLIP, STR_RIFLE_AA_CLIP ]
        tuLoad: 5
        tuUnload: 2
      1:
        compatibleAmmo: [ STR_RIFLE_CLIP, STR_RIFLE_AA_CLIP ]
        tuLoad: 5
        tuUnload: 2
      2:
        compatibleAmmo: [ STR_RIFLE_CLIP, STR_RIFLE_AA_CLIP ]
        tuLoad: 5
        tuUnload: 2
      3:
        compatibleAmmo: [ STR_LAUNCHER_FRAG, STR_LAUNCHER_INC, STR_LAUNCHER_SMOKE, STR_LAUNCHER_ELERIUM ]
        tuLoad: 5
        tuUnload: 2
    accuracyAuto: 35
    accuracySnap: 60
    accuracyAimed: 110
    tuAuto: 35
    tuSnap: 25
    tuAimed: 70
    battleType: 1
    twoHanded: true
    invWidth: 1
    invHeight: 3
    attraction: 8
    tuMelee: 45
    accuracyMelee: 50
    listOrder: 2100
    confMelee:
      shots: 1
      name: STR_GRENADE_LAUNCHER_SHOT
      ammoSlot: 1
      arcing: true

Also on the inventory screen it does not display any indication that the weapon is loaded with a secondary ammo type. Only the normal rifle clip is displayed as loaded when I mouse over the rifle.
« Last Edit: February 11, 2023, 06:47:37 pm by Meridian »

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8598
    • View Profile
"ammoSlot: 3" instead of "ammoSlot: 1" ?

Offline The Martian

  • Commander
  • *****
  • Posts: 754
  • "It implores you to listen to its arguments..."
    • View Profile
I've changed confMelee: to ammoSlot: 3 however I'm still getting the "There is no one there!" message instead of the grenade firing.

On the plus side the secondary ammo counter is now displaying a 1 for the loaded grenade on the battlescape by the weapon icon.


Code: [Select]
  - type: STR_RIFLE_GRENADE_LAUNCHER
    size: 0.2
    costSell: 2250
    weight: 8
    bigSprite: 1
    floorSprite: 1
    handSprite: 0
    bulletSprite: 2
    fireSound: 76
#    compatibleAmmo:
#      - STR_RIFLE_CLIP
#      - STR_RIFLE_AA_CLIP
    ammo:
      0:
        compatibleAmmo: [ STR_RIFLE_CLIP, STR_RIFLE_AA_CLIP ]
        tuLoad: 5
        tuUnload: 2
      1:
        compatibleAmmo: [ STR_RIFLE_CLIP, STR_RIFLE_AA_CLIP ]
        tuLoad: 5
        tuUnload: 2
      2:
        compatibleAmmo: [ STR_RIFLE_CLIP, STR_RIFLE_AA_CLIP ]
        tuLoad: 5
        tuUnload: 2
      3:
        compatibleAmmo: [ STR_LAUNCHER_FRAG, STR_LAUNCHER_INC, STR_LAUNCHER_SMOKE, STR_LAUNCHER_ELERIUM ]
        tuLoad: 5
        tuUnload: 2
    accuracyAuto: 35
    accuracySnap: 60
    accuracyAimed: 110
    tuAuto: 35
    tuSnap: 25
    tuAimed: 70
    battleType: 1
    twoHanded: true
    invWidth: 1
    invHeight: 3
    attraction: 8
    tuMelee: 45
    accuracyMelee: 50
    listOrder: 2100
    confMelee:
      shots: 1
      name: STR_GRENADE_LAUNCHER_SHOT
      ammoSlot: 3
      arcing: true
« Last Edit: September 09, 2019, 12:11:12 am by The Martian »

Offline The Martian

  • Commander
  • *****
  • Posts: 754
  • "It implores you to listen to its arguments..."
    • View Profile
It appears if I get the X-Com unit point blank with the enemy it can perform a melee attack using the "Launch Grenade" action... and this action consumes the grenade ammo, but still acts as a normal melee attack instead of an explosive.

So the melee action slot does seem to be assigned to the correct ammo now, it just isn't acting as a projectile.

Edit:
Aside from changing confMelee:'s ammoSlot: 1 to ammoSlot: 3 is there something else I can reconfigure?

I tried defining confAuto:, confSnap: & confAimed: just in case all four confAction: variables needed to be setup but the problem did not resolve.
« Last Edit: September 09, 2019, 12:59:24 am by The Martian »

Offline Yankes

  • Commander
  • *****
  • Posts: 3194
    • View Profile
right now each action is hardcore to its normal behavior, range is range and melee is melee, changing this will need lot of work because game depend on this atack types to change logic everywhere to match correct behavior

Offline The Martian

  • Commander
  • *****
  • Posts: 754
  • "It implores you to listen to its arguments..."
    • View Profile
right now each action is hardcore to its normal behavior, range is range and melee is melee . . .

If that is the case please be aware that the tutorial found in the UFOpaedia is in error about being able to re-assign the melee action to a projectile.

Quote from: UFOpaedia
In OXCE, you can load multiple different types of ammo into one gun at the same time. This allows you to create, for example, a rifle with a built-in grenade launcher. There are up to 4 ammo slots, and they correspond to Aimed/Snap/Auto/Melee action... so you need to "sacrifice" one of the shot types to have a different ammo slot. Going back to the rifle with a grenade launcher example, you could have the rifle with Aimed/Snap/Auto and sacrifice the Melee action for implementing let's say a snap shot for the grenade launcher.
Code: [Select]
Example:

 - type: STR_WEAPON_WITH_4_AMMO_SLOTS
   ammo:
     0:
       compatibleAmmo: [ STR_AMMO_1, STR_AMMO_2 ]
       tuLoad: 5
       tuUnload: 2
     1:
       compatibleAmmo: [ STR_AMMO_3 ]
       tuLoad: 10
       tuUnload: 4
     2:
       compatibleAmmo: [ STR_AMMO_1, STR_AMMO_4 ]
       tuLoad: 10
       tuUnload: 4
     3:
       compatibleAmmo: [ STR_GRENADE ]
       tuLoad: 20
       tuUnload: 8

A mapping between actions and ammo slots (see above).

Example:
Code: [Select]
- type: STR_RIFLE_WITH_A_GRENADE_LAUNCHER
   confAimed:
     shots: 1
     name: STR_AIMED_SHOT
     ammoSlot: 0
     arcing: false
   confSnap:
     shots: 2
     name: STR_DOUBLE_SNAP_SHOT
     ammoSlot: 0
     arcing: false
   confAuto:
     shots: 10
     name: STR_CRAZY_AUTO_SHOT
     ammoSlot: 0
     arcing: false
   confMelee:
     shots: 1
     name: STR_LAUNCH_GRENADE
     ammoSlot: 3
     arcing: true






« Last Edit: September 09, 2019, 01:35:21 am by The Martian »

Offline efrenespartano

  • Commander
  • *****
  • Posts: 748
  • I know a lot about the law and other lawyerings.
    • View Profile
I had this exact issue with a M16/M03 rifle with GL, so I just change it to Aimed shot.

But... How about adding the Melee attack some range? Is it possible to have a ranged melee attack?

Enviado desde mi LG-M400 mediante Tapatalk


Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8598
    • View Profile
If that is the case please be aware that the tutorial found in the UFOpaedia is in error about being able to re-assign the melee action to a projectile.

Description updated.

wcho035

  • Guest
Will this multiple ammo setup work on HWP?

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8598
    • View Profile
Will this multiple ammo setup work on HWP?

Don't know.
Most likely not.

Offline Yankes

  • Commander
  • *****
  • Posts: 3194
    • View Profile
If that is the case please be aware that the tutorial found in the UFOpaedia is in error about being able to re-assign the melee action to a projectile.
I probably mess up my future plans with current implementation. I will fix description today.

wcho035

  • Guest
Hi, I am experimenting with this like the others. So I have one of my weapon coding here. It is not working as plan, perhaps someone can correct me?

 - type: STR_FLINTLOCK
    size: 0.1
    costBuy: 200
    costSell: 150
    weight: 5
    bigSprite: 817
    floorSprite: 678
    handSprite: 995
    bulletSprite: 1
    fireSound: 4
#    compatibleAmmo:
#      - STR_SINGLESHOTCART
#    accuracySnap: 50
#    accuracyAimed: 70
#    tuSnap: 35
#    tuAimed: 45
    battleType: 1
    invWidth: 1
    invHeight: 2
    maxRange: 12
    ammo:
      0:
        compatibleAmmo: [ STR_SINGLESHOTCART ]
        tuLoad: 5
        tuUnload: 2
      1:
        compatibleAmmo: [ STR_GRENADE ]
        tuLoad: 10
        tuUnload: 4
    confAimed:
      shots: 1
      name: STR_AIMED_SHOT
      ammoSlot: 0
      arcing: false
      accuracyAimed: 70
      tuAimed: 45
    confAimed:
      shots: 1
      name: STR_GRENADE_SHOT
      ammoSlot: 1
      arcing: true
      accuracyAimed: 70
      tuAimed: 45

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8598
    • View Profile
Can't have confAimed twice.

Use ruleset validator for basic syntax validation.

wcho035

  • Guest
  - type: STR_FLINTLOCK
    size: 0.1
    costBuy: 200
    costSell: 150
    weight: 5
    bigSprite: 817
    floorSprite: 678
    handSprite: 995
    bulletSprite: 1
    fireSound: 4
#    compatibleAmmo:
#      - STR_SINGLESHOTCART
    accuracySnap: 50
    accuracyAimed: 70
    tuSnap: 35
    tuAimed: 45
    battleType: 1
    invWidth: 1
    invHeight: 2
    maxRange: 12
    ammo:
      0:
        compatibleAmmo: [ STR_SINGLESHOTCART ]
        tuLoad: 5
        tuUnload: 2
      1:
        compatibleAmmo: [ STR_GRENADE ]
        tuLoad: 10
        tuUnload: 4
    confAimed:
      shots: 1
      name: STR_GRENADE_SHOT
      ammoSlot: 1
      arcing: true   

I have updated the code, but no grenade ammo showing.

wcho035

  • Guest
I got it, you can't use normal grenade as an ammo. Has to be an assigned ammo type. Damned. I was hoping to put less ammo type in my game.