OpenXcom Forum

Modding => OXCE Suggestions NEW => OpenXcom Extended => OXCE Suggestions Rejected => Topic started by: Kzer-Za on August 24, 2019, 12:12:50 pm

Title: [Rejected] Retain ammoless weapons that emptied their clip
Post by: Kzer-Za 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?
Title: Re: [REQUEST] Retain ammoless weapons that emptied their clip
Post by: krautbernd on August 24, 2019, 01:20:09 pm
I support this request.
Title: Re: [REQUEST] Retain ammoless weapons that emptied their clip
Post by: Solarius Scorch 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.
Title: Re: [REQUEST] Retain ammoless weapons that emptied their clip
Post by: krautbernd 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.
Title: Re: [REQUEST] Retain ammoless weapons that emptied their clip
Post by: Meridian 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.
Title: Re: [REQUEST] Retain ammoless weapons that emptied their clip
Post by: R1dO 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).
Title: Re: [REQUEST] Retain ammoless weapons that emptied their clip
Post by: Kzer-Za 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?
Title: Re: [REQUEST] Retain ammoless weapons that emptied their clip
Post by: Eddie 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.
Title: Re: [REQUEST] Retain ammoless weapons that emptied their clip
Post by: Kzer-Za 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?
Title: Re: [REQUEST] Retain ammoless weapons that emptied their clip
Post by: Meridian 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
Title: Re: [REQUEST] Retain ammoless weapons that emptied their clip
Post by: Kzer-Za 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.
Title: Re: [REQUEST] Retain ammoless weapons that emptied their clip
Post by: Yankes 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.
Title: Re: [REQUEST] Retain ammoless weapons that emptied their clip
Post by: Kzer-Za on August 27, 2019, 11:03:24 am
That's good to hear, I'll be waiting for it :)