Asagi’s Gun License

Asagi-sama

This script’s title is nothing but an excuse to post a picture of Asagi. You’re authorized to just call it “Ammo Requirements” because it is exactly what it does: allow your characters to equip ammo and force skills to use said ammo.
Originally, this was supposed to be the Actor Inventory, but after much trial, I thought it was easier to make a completely new script altogether.

Equipment Screen

Brenda is gonna kick some serious ass.

Download!
Modified version by Trihan

Instructions
This is a standalone script, which doesn’t require Ace Equip Engine nor Skill Cost Manager. This shouldn’t prevent you to use them, though because they’re great scripts. But I digress.

Asagi’s Gun License (lol) has three levels of configuration: Class, Weapon and Skill.

The class notetags:

<ammo_slot_id: x>
This determines the slot in the equip screen which will be replaced by the ammo slot. In the Brenda’s example above, the ammo slot replaces the shield, so it is set to 1. Note: if you are using Yanfly’s Ace Equip Engine, and happen to have more than 1 of a specific slot (i.e. 4 accessories), only the first one will be replaced.

<ammo_slot_name: string>
Just the name of the slot. ‘Arrows’, ‘Bullets’, ‘Dwarf’, really, whatever you want.

<ammo_type_id: x>
Ammo are considered as weapons. Therefore they have a weapon type. Replace x with the weapon type of the kind of ammo you want to use.

For the example above, the class tab is like this:

Class Tab

Preparing the ammo:

Ammo are weapons and they actually don’t need any notetag. The only requirement is that their weapon type must be the same as the one indicated in the class tab to be useable. Due to their nature as weapons, they can use whatever traits you want them to have, like, for instance, teaching skills only usable with them.

The skill notetags:

Skills must be told that they need ammo. You have two possibilities:

<linked_ammo_type: x>
Will require and consume ammo of a specific type.

<linked_ammo_id: x>
Will require and consume unique arrows. In this case, x isn’t the weapon type but the weapon ID.

Skill Screen

This skill can only be used with its unique arrows.

And the corresponding skill tab…

Skill Tab

Compatibility notes
Doesn’t require Ace Equip Engine nor Skill Cost Manager. But is compatible with both. Alternatively you can set up the ammo requirements with Skill Cost Manager alone if you are using it.

  1. John Clifford

    Posted a new version that fixed a pretty serious bug I created: unequipping non-weapon items caused the game to crash.

  2. SirCumferance

    Ok, so got it work and I love it. I have just one, teeny weeny question.
    Is there a way that the weapon can play the animation of the ammo, instead of the weapon.
    I have a ‘Sprayer’ weapon that can use different chemicals, Flaming Oil, Poisons, Liquid Nitrogen, etc. but the animation does not reflect that. Did I miss something or am I out of luck.

    • Currently no. I think it’s a good idea so I’ll try to implement it in the next days.

      • SirCumferance

        Awesome, many thanks. Plus, I don’t want you to think I do not appreciate what you are doing, totally do.

      • SirCumferance

        Ok, was thinking. What if it used the attack everything of the Ammo, instead of the weapon. So if you have a Pistol equipped, the attack is different between Standard ammo and Armor Piercing ammo, not just the attack animation. Is that too much to ask?

        • You mean the element properties and the traits? Yeah, why not.

          • SirCumferance

            Well, that and the actual attack formula. If Standard ammo is
            a.atk * 3 – b.def * 2
            but Armor Piercing ammo is
            a.atk * 3
            will the ammo actually use the right skill as well as the animation?
            Thanks again

  3. SirCumferance

    Ok, registered. Now that is out of the way.

  4. Hi! when i used to replace shield, it overrides dual wield slot, and doesn’t do anything if I set it to (yeah, I was bored lol, also was testing what script said about if ammo == 0, then weapon ==1, else weapon == 0). This would actually be fantastic if was a weapon notetag, that way a bow or gun could give its special ammo slot when equipped and dual wielders would be temporarily free of the dual wield glitch (tutorials say that if you want a two handed weapon, make the weapon have the Seal Shield tag, but Dual wield Slot Tag doesn’t recognize this, so you can have a dual wielder with two bows or two claymores or whatever)

    • hmm im sorry, the post thing took out some of my stuff.

      ***when i used (ammo_slot_id: 1) to replace shield***
      ***doesn’t do anything if I set it to (ammo_slot_id: 0)***
      ***fantastic if (ammo_slot_id: x) was a weapon notetag***

      sorry again 😛

  5. Hello, I was wondering how would I change it from requiring the arrow to be a “weapon slot” to a shield slot?

  6. Is it possible to add a tag to add an ammo to the actor’s starting equipment?

    • I don’t understand your question.

      • There’s no way to add ammos to an actor’s starting equipment by default. Like you set the weapon, armor, head etc… So even if you set a gun as a starting gear, you can’t set bullets as well.

        • You’ll need to use a call script event command after the actor joins the party. Try something like this: $game_actors[X].force_change_equip(Y, $data_weapons[Z])
          X is the actor ID in the database.
          Y is the slot ID for the ammo.
          Z is the ammo ID in the database.

  7. Greetings ,

    I am having a issue with this script, I have gotten it to the point where it count the ammo i have used , but if i don’t set the ammo as equipped in the database before play testing i cant equip it.
    I believe i have followed the instructions in the script correctly but i must have gotten something wrong. here is the setting i have used :

    in the Class section:

    in the Skills section:

    in the weapon section :

    (actual weapon)

    and the numbers 61 refers to the first ammo and 62 is the second ammo

    like i said it does remove the ammo as i fire the weapon using the skill i set , but if i dont set the ammo in the database as equiped it wont let me set it in game , nor will it let me change to the second type of ammo i have made.

    Any and all help with this will be greatly appreciated ,as how I have been trying to wrap my skull around this for 2 days and this is as far as i have gotten.
    needless to say i suck at scripting lol, even in SL i suck at it,but normally i am able to muddle along , but this is just making my head hurt , so yeah please help ?

    -Cazziuz

  8. in the Class section:

    ammo_slot_id: 1
    ammo_slot_name: Ammo

    in the Skills section:
    linked_ammo_types: 10
    linked_ammo_ids: 61
    ammo_cost: 2

    in the weapon section :

    (actual weapon)
    ammo_type_id: 61,63

    and the numbers 61 refers to the first ammo and 62 is the second ammo

    Sorry about the double post but i just noticed that i left the signs in and it took it all out when i posted it

    -Cazziuz

  9. You can’t put an <ammo_type_id: x> tag on the actual weapon. Also, <linked_ammo_type: x> (without s) and <linked_ammo_id: x> takes only 1 ID.

    As for the equip problem, either you have a script conflict, or you messed up with the weapon type. Are you sure the type of the ammo is actually enabled for the actor/class?

    • Greetings,
      First let me say thank you for your response. Secondly I have changed that things that you said and it still wont let me equip anything in that renamed slot. To test compatibility I started a fresh Project , it still wouldn’t let me. Strange thing is If i use the Original Script , the one that doesn’t account for ammo used, it works just fine?and yes it is enabled in the class.again thank you for all your help.

      -Cazziuz

  10. Dragovianlord

    Hi, I’m having a problem here. I can now equip ammo but when I attack the ammo doesn’t decrease. I even can still attack with no ammo. I have done everything exactly like what the script says but it doesn’t work for me. Thank you.

  11. Did we ever get the ammo to be the source of damage yet or is that still up in the air?

    • Found it, took a little work but it works. Here be the link if you guys want.
      http://www.rpgmakervxace.net/topic/12715-modifying-asagis-gun-license/?hl=ammo

      • SirCumferance

        Ok, got a teeny problem, using doesnt work with multiple ID’s, only with one. I tried dinking around with the script and all it did was point out how little I know. Pretty sure the problem is here…

        def load_ammo_notetags
        @note.split(/[\r\n]+/).each do |line|
        case line
        when KRX::REGEXP::AMMO_CONSUMPTION_TYPES
        @ammo_type_ids = []
        @ammo_type_ids |= $1.scan(/\d+/).collect {|id| id.to_i} #.collect #|id| id.to_i
        when KRX::REGEXP::AMMO_CONSUMPTION_IDS
        @ammo_absolute_ids = []
        @ammo_absolute_ids |= $1.scan(/\d+/).collect {|id| id.to_i} #.collect
        when KRX::REGEXP::AMMO_COST
        @ammo_cost = $1.to_i
        end
        end
        end
        end

        It seems to not be collecting the ID’s proper and saving them. Any idea’s guys? Gonna post this on the VXA Forums to, just to make sure

  12. Camelslayer

    I think a more helpful method of doing this would be:
    Upon equipping a bow, it changes the Shield slot to Ammo. Upon removing, it changes it back.
    Provided that’s even possible to do.

  13. I’m sorry to bother you, but can you fix this you weapons consume ammo upon attacking.

  14. SwordCoast247

    Uh…I got a message error that reads “Script ‘Ammo Requirements Kread- EX’ line 242: NoMethodError occurred

    undefined method ‘objects=’ for nil:NilClass”

    Can you help me out? Sorry if I am being a burden right now >.<

    • SwordCoast247

      nevermind- I figure out I was using trihan’s version. But, using the original, I can’t equip the ammunition into the slot nor can I reequip it.

  15. Can I make it consume ammunition even when doing simple attacks and not using a skill?

    • Ok.
      So.
      I can get my weapon to equip.
      I can get the ammo to equip, sometimes in various places.
      I even used Yanfly’s Weapon attack Replacement script to use a default attack that lowers ammo by one.

      But I can’t.
      get.
      The dang
      Ammo
      to go
      down.
      I haven’t edited any scripts, I am using Yanfly’s Weapon Attack Replace script, and trihan’s mod. I use 20 as my lucky number to try to get the ammo to go down.
      If I don’t see the number 19 soon I am going to lose it.

  16. Hi, I’m loving this script and after much headbanging, I’ve finally got a lot of things in order, but my skills won’t consume ammo.

    Using Ace Equip (above gun license, below symphony and skill self effect).

    Class configuration:

    weapon config:

    weapon type 11: Arrow

    Arrow constructed in weapons and given to type id 11 (Arrow)

    skill config:

    icon create: user, weapon
    icon: user, weapon, angle, 45
    icon: user, weapon, cur_x 12
    wait: 4
    icon create: user, arrow, hand, 140
    icon throw user: target, arrow, 16, 24, wait
    icon: user, arrow, rotate, 45, 24
    icon delete: user, arrow
    attack animation: target, wait
    skill effect: whole
    icon delete: user, weapon

    I really like the idea of this script as opposed to any that consume ammo during standard attack. This way, even out of ammo, the character can attack, but with ammo, the animation changes to the shooting animation and the ammo itself grants the “shoot” skill.

    • sorry, I copy/pasted from my note tags and it didn’t post them like that.
      class:
      ammo_slot_id: 2
      ammo_slot_name: Ammunition

      skill:
      linked_ammo_type: Arrow
      ammo_cost: 1

      weapon:
      ammo_type_id: 11

      Arrow created as a weapon (number 069 in the list) and Arrow created as a weapon type (id: 11 in the weapon types)

      • Figured out what I was doing wrong. But now if my guy is killed, I can’t equip the ammo when I start a new game.

  17. Pretty much everything works, but I have a question.

    I picked up 5 bullets from a chest and when I equip them into the Ammo slot that does give me 5 equipped bullets, but it leaves the other 4 in my inventory.
    Also, if I pick up new bullets, they get added to the ones I already have equipped.

    Is there a way to just like load the bullets into the slot one by one and a way to just keep the new bullets I find in my inventory?

  18. I have an issue, everythings works perfect until I found out this:

    When I use the skill “shot” that costs one “pistol bullet” and indeed it work until just left one “pistol bullet” in the ammo section, it always remains, no matter if I shot it doesnt remove from ammo section and that means infinity shots and I dont want that.

    Any idea?

    And thank you for the script, it helped me a lot!

  19. This script is very useful but im having 2 issues.

    the most serious issue is that when there is one arrow left, when using the skill that consumes an arrow, the last arrow is not consumed so I have 1 infinite arrow.
    it consumes arrows but just not the last remaining one which is weird.

    Issue 2 is that in the shop processing the character using a bow equiped with arrows shows up as equiped with arrows, I want to fix it so that it shows up as equiped with bows but this issue im not too concerned about, but it would be nice to have it fixed.

Leave a comment