Author Topic: [Rejected] Retain ammoless weapons that emptied their clip  (Read 3567 times)

Offline Kzer-Za

  • Colonel
  • ****
  • Posts: 140
    • View Profile
[Rejected] Retain ammoless weapons that emptied their clip
« on: August 24, 2019, 12:12:50 pm »
Rejection reason: this is incompatible with the current OXCE architecture

Note: other things requested later in the thread have been implemented in the meantime (energy weapons, overheating, spending more than one ammo per shot, etc.)


Currently you can create a weapon that does not have "compatibleAmmo" but does have non-zero and non-infinite "clipSize". In that case this weapon disappears into thin air as soon as the clip is emptied. For example, I see such a fire extinguisher in one of the mods, it has three "ammo" and when they are spent, it disappears. Could such weapons not disappear, please, but just stay as empty weapons?

Why I'm asking for it?

First, in case of the said fire extinguisher, while it can't be used to extinguish fire anymore once the "ammo" is spent, it can still be used as a melee weapon. And it seems to be right for it to both have non-inifinite clip size, and to not have an actual compatibleAmmo.

Second, I would like to make a mod that makes laser weapons have a limited clip size, but without actual clips, so they could not be reloaded. Instead I would refill a certain amount of charges with a script "newTurnItem". That way I want to emulate that a laser can make a certain amount of shots before overheating, then it needs to cool down, then some more shots can be made. But with the current system, such a weapon disappears when the counter of ammo reaches zero, so while I can watch out for not depleting the ammo completely during my turn, but reaction shots become a disaster.

So, could you please make such weapons stay?
« Last Edit: February 19, 2023, 01:17:41 pm by Meridian »

Offline krautbernd

  • Commander
  • *****
  • Posts: 1116
    • View Profile
Re: [REQUEST] Retain ammoless weapons that emptied their clip
« Reply #1 on: August 24, 2019, 01:20:09 pm »
I support this request.

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11408
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: [REQUEST] Retain ammoless weapons that emptied their clip
« Reply #2 on: August 24, 2019, 01:25:17 pm »
If it ever happens, please make it a new function, as some mods use the mechanics as they are now.

Offline krautbernd

  • Commander
  • *****
  • Posts: 1116
    • View Profile
Re: [REQUEST] Retain ammoless weapons that emptied their clip
« Reply #3 on: August 24, 2019, 01:27:54 pm »
If it ever happens, please make it a new function, as some mods use the mechanics as they are now.
And possibly add an option to replace/transform 'emptied' weapons with another item.

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8597
    • View Profile
Re: [REQUEST] Retain ammoless weapons that emptied their clip
« Reply #4 on: August 24, 2019, 02:04:36 pm »
This has been requested several times and rejected several times.

The engine doesn't work that way.

If you want the weapon to stay after ammo is spent... you must define a weapon and a separate ammo.

Offline R1dO

  • Colonel
  • ****
  • Posts: 436
    • View Profile
Re: [REQUEST] Retain ammoless weapons that emptied their clip
« Reply #5 on: August 24, 2019, 03:01:14 pm »
Just in case you haven't thought of it

The described usage can be simulated using oxce functionalities: "tuLoad" and "tuUnload".

If you pick them high enough (for example halfway between the soldier's "minStats" and "maxStats") reloading effectively uses between 1 and 2 turns (depending if you apply it to one or both of them).

Offline Kzer-Za

  • Colonel
  • ****
  • Posts: 140
    • View Profile
Re: [REQUEST] Retain ammoless weapons that emptied their clip
« Reply #6 on: August 24, 2019, 04:15:57 pm »
The engine doesn't work that way.

If you want the weapon to stay after ammo is spent... you must define a weapon and a separate ammo.

Okay, if it's impossible, it's impossible. But creating a weapon and a separate ammo does not seem to work, for "overheating" lasers at least. If the weapon does not have "compatibleAmmo", then I can manipulate its ammo directly from "createItem" and "newTurnItem" via "getAmmoQuantity" and "setAmmoQuantity". But if it has a "compatibleAmmo", then I need to use "getAmmoQuantity" and "setAmmoQuantity" on the clip, not on the weapon.

So, if I create a separate ammo for a weapon, I need to define its clip, and manufacture/buy these clips, and load them into the craft. Otherwise they are not in the craft, and I can't do anything about their ammo. Perhaps someone could suggest a workaround?

Offline Eddie

  • Commander
  • *****
  • Posts: 560
    • View Profile
Re: [REQUEST] Retain ammoless weapons that emptied their clip
« Reply #7 on: August 26, 2019, 12:28:42 am »
No sure if this is engine compatible, but here goes:

Hackish workaround. Have an option "can only shoot if ammo >1". Increase max ammo by 1, display actual ammo as ammo -1. Item will stay at 1 ammo and not vanish, but can't shoot and will display ammo = 0.


Next idea for self-charging energy weapons:
A shot that consumes x amount of ammo per shot.
Say a heavy laser has 3 ammo, and the shot costs 3 ammo, recharge is 1 per turn. You can shoot it once every three turns.

Offline Kzer-Za

  • Colonel
  • ****
  • Posts: 140
    • View Profile
Re: [REQUEST] Retain ammoless weapons that emptied their clip
« Reply #8 on: August 26, 2019, 11:17:27 am »
The first suggestion is, unfortunately, impossible. The second looks interesting, but I'm not sure if it is possible. There are such parameters as costAimed/costSnap/costAuto, but it seems that the cost parameters can be only characteristics of the unit holding the weapon. Just in case it worked, I tried using

Code: [Select]
    costAimed:
      ammo: 2

but to no avail. Could anyone tell if it is possible to specify spending more than 1 ammo per shot, and if yes, then how?

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8597
    • View Profile
Re: [REQUEST] Retain ammoless weapons that emptied their clip
« Reply #9 on: August 26, 2019, 11:30:37 am »
Could anyone tell if it is possible to specify spending more than 1 ammo per shot, and if yes, then how?

No, cost includes only: time, energy, health, stun, morale and mana

Offline Kzer-Za

  • Colonel
  • ****
  • Posts: 140
    • View Profile
Re: [REQUEST] Retain ammoless weapons that emptied their clip
« Reply #10 on: August 26, 2019, 11:02:59 pm »
Hmm, I have thought of another mechanic for overheating: store overheating level in a tag, increase it with each shot, have several levels of overheating, and for exceeding each of them add TUs required for shots. However, I don't see a hook that could be triggered at making a shot. There really does not seem to be a way of limiting the lasers' firing capacity other than giving them ordinary clips, which is dull.

Offline Yankes

  • Commander
  • *****
  • Posts: 3194
    • View Profile
Re: [REQUEST] Retain ammoless weapons that emptied their clip
« Reply #11 on: August 27, 2019, 12:34:20 am »
In one WiP branch I made some triggers that are run at weapon use and could alter ammo numbers.

Offline Kzer-Za

  • Colonel
  • ****
  • Posts: 140
    • View Profile
Re: [REQUEST] Retain ammoless weapons that emptied their clip
« Reply #12 on: August 27, 2019, 11:03:24 am »
That's good to hear, I'll be waiting for it :)