aliens

Author Topic: [DONE][Suggestion] Spawning weapons with loaded ammo  (Read 2450 times)

Offline Kato

  • Captain
  • ***
  • Posts: 51
  • ASHU is coming
    • View Profile
[DONE][Suggestion] Spawning weapons with loaded ammo
« on: September 23, 2022, 07:33:10 pm »
We have items: STR_PISTOL (weapon), STR_PISTOL_CLIP (ammo item for our weapon, clip size is N - let it be 12 for example).

Possible situations:

1.
Code: [Select]
    mapBlocks:
        items:
          STR_PISTOL:
            - [1, 1, 1]
Result: there is 1 item in the tile - a pistol with no ammo loaded.

2.
Code: [Select]
    mapBlocks:
        items:
          STR_PISTOL, {STR_PISTOL_CLIP}:
            - [1, 1, 1]
Result: there is a pistol with ammo item loaded, ammo quantity is 12.

3.
Code: [Select]
    mapBlocks:
        items:
          STR_PISTOL, {STR_PISTOL_CLIP, 9}:
            - [1, 1, 1]
Result: there is a pistol with ammo item loaded, ammo quantity is 9.

4.
Code: [Select]
    mapBlocks:
        items:
          STR_PISTOL, {STR_RIFLE_CLIP}:
            - [1, 1, 1]
Result: there are 2 separate items in the tile - a pistol with no ammo loaded and a rifle clip. Because STR_RIFLE_CLIP is not compatible ammo for STR_PISTOL.

5.
Code: [Select]
    mapBlocks:
        items:
          STR_PISTOL, {STR_RIFLE}, {STR_PISTOL_CLIP}:
            - [1, 1, 1]
Result: there are 3 separate items in the tile - a pistol with no ammo loaded, a rifle with no ammo loaded and a pistol clip. Because STR_RIFLE is not compatible ammo for STR_PISTOL and STR_PISTOL_CLIP is defined as ammo item for ammo slot #2, but STR_PISTOL have only 1 ammo slot.

6. Now we have multiammo gun with 3 ammo slots.
Code: [Select]
    mapBlocks:
        items:
          STR_MULTIAMMO_GUN, {STR_MULTIAMMO_GUN_CLIP_A}, {}, {STR_MULTIAMMO_GUN_CLIP_C, 3}:
            - [1, 1, 1]
Result: there is a multiammo gun in the tile. It is loaded with STR_MULTIAMMO_GUN_CLIP_A in ammo slot #1, ammo quantity is default for this ammo item. Ammo slot #2 is empty. Ammo slot #3: there is STR_MULTIAMMO_GUN_CLIP_C loaded, ammo quantity is 3.

Ammo quantity cannot be negative or zero. When trying to set ammo quantity bigger than ammo item clipSize, it will return item clipSize.

This conception gonna be useful in situations when you
- find a treasure;
- exploring an old battlefield;
- trying to rob military stores;
- in any situation when you need a loaded weapon on your map.

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11721
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: [Suggestion] Spawning weapons with ammo loaded
« Reply #1 on: September 23, 2022, 07:36:39 pm »
Well, spawning loaded weapons on the floor would be very useful.

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3347
    • View Profile
Re: [Suggestion] Spawning weapons with ammo loaded
« Reply #2 on: September 24, 2022, 02:40:52 pm »
First of all syntax is not valid yaml, and can't be used like this.

I think better would be new property `itemsSpecial` or some thing like this where:
Code: [Select]
    mapBlocks:
        itemsSpecial:
          - type: STR_PISTOL
            pos:
              - [1, 1, 1]
And now we can add more detailed configs.

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11721
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: [Suggestion] Spawning weapons with ammo loaded
« Reply #3 on: September 24, 2022, 03:27:25 pm »
First of all syntax is not valid yaml, and can't be used like this.

I think better would be new property `itemsSpecial` or some thing like this where:
Code: [Select]
    mapBlocks:
        itemsSpecial:
          - type: STR_PISTOL
            pos:
              - [1, 1, 1]
And now we can add more detailed configs.

What properties would itemsSpecial cover? Because if it's loaded weapons only, then the name is too generic - why not use simply loadedWeapon. But if there are other potential uses, then sure.

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3347
    • View Profile
Re: [Suggestion] Spawning weapons with ammo loaded
« Reply #4 on: September 24, 2022, 06:15:21 pm »
I would roll in this fuse or other operations that could be applied to new spawned item

Offline Finnik

  • Commander
  • *****
  • Posts: 508
  • Finnik#0257
    • View Profile
Re: [Suggestion] Spawning weapons with ammo loaded
« Reply #5 on: October 02, 2022, 03:45:49 pm »
This would be very useful for my project as well.

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9078
    • View Profile
Re: [DONE][Suggestion] Spawning weapons with loaded ammo
« Reply #6 on: August 11, 2024, 06:06:03 pm »
Done.

Example ruleset:

Code: [Select]
    mapBlocks:
      - name: DESERT04
        extendedItems:
          - type: STR_RIFLE
            pos:
              - [6, 2, 0]
            ammoDef: [[STR_RIFLE_CLIP, 0]]  # list of loaded ammo with quantity (quantity 0 = maximum), example: [[type1, qty1],[type2, qty2],[type3, qty3],[type4, qty4]]
          - type: STR_GRENADE
            pos:
              - [7, 2, 0]
              - [7, 3, 0]
            fuseTimerMin: 0  # default is -1 = not used
            fuseTimerMax: 0  # default is -1 = not used