How to create new ammo type?

Discussion in 'Fallout General Modding' started by kemelman, Apr 29, 2019.

  1. kemelman

    kemelman First time out of the vault

    3
    Mar 16, 2017
    I want to create some new guns for my F2 and there is not problem with it. But I want to use new ammo types and I don't know how to do that. So I need help.
    The first question: should i have the skill for scripts creating? Or I just must find something like "ammo type.lst" and write new types in it&
     
  2. NovaRain

    NovaRain Casual Modder Modder

    Mar 10, 2007
    You need to add your new ammo types in proto.msg, like:
    Code:
    ...
    {316}{}{4.7mm caseless}
    {317}{}{HN needler}
    {318}{}{7.62mm}
    {319}{}{20mm}
    {320}{}{Crossbow bolt}
    
    Then you can select the new ammo types for weapons in F2wedit.
     
  3. CPL

    CPL Still Mildly Glowing
    Modder

    294
    Mar 16, 2013
  4. Cerebro

    Cerebro First time out of the vault

    57
    May 6, 2007
    I'm resurrecting this for a follow-up question: Let's say I have created a new ammo type - how do I integrate it into the selection of some merchants? I guess I'd have to change some scripts for that? I there any "easy" method to do it?
     
  5. Nirran

    Nirran Vault Senior Citizen
    Modder

    Apr 15, 2007
    its simple to add merchant items if u have the source code,for instance rp source for mom in den box : (DIMOMBOX.SSL)

    Code:
             check_restock_item(PID_STIMPAK, 0, 2, 90)
             check_restock_item(PID_CROWBAR, 1, 1, 40)
             check_restock_item(PID_KNIFE, 1, 1, 40)
             set_local_var(LVAR_RESTOCK_TIME, (random(3,5) * ONE_GAME_DAY) + game_time);
    simply add
    Code:
    check_restock_item(YOUR_ITEM_PID, 1, 1, 40)
    edit :
    Code:
    check_restock_item(YOUR_ITEM_PID, minimum of item added, maximum of item added, percent chance of item appearing added)
     
    Last edited: Nov 6, 2019
    • [Rad] [Rad] x 1
  6. Cerebro

    Cerebro First time out of the vault

    57
    May 6, 2007
    Thanks for answering, but everything in regards to scripting is anything but simple to me. :) Well, I already suspected that there is no other way. Guess I'll have to modify some containers to include my new ammo type instead. It's supposed to be rare anyway.
     
  7. Lexx

    Lexx Background Radiant
    Moderator

    Apr 24, 2005
    What do you mean? It's really just what @Nirran wrote. Use @Mr.Stalin 's script editor from here (or if you are using et Tu, just use it from the /tools/ folder), adjust the script paths in the settings, then open the script, edit it and recompile. That's really not rocket science. Now 10 years ago it was still a bit different, but nowadays it's almost plug&play.
     
    Last edited: Nov 8, 2019 at 11:15 PM
  8. Cerebro

    Cerebro First time out of the vault

    57
    May 6, 2007
    Well, it's still intimidating for someone like me who has not the foggiest idea about scripting and neither the time nor patience to trial and error his way through a brick wall of question marks. But ok, I'm willing to give it a try. I modded the Bozar into a powerful single shot big guns anti-materiel rifle and created a new 12.7mm ammo for it. I'd like this ammo to be as rare as the gun, so it should only be sold (occasionally) by Mai Da Chiang (Red 888 Guns) in San Fransisco as well as Eldridge (New Reno Arms) - the latter only for made men, exactly like the gun itself. (Are there any other merchants who sell the Bozar by default? I went on the information in the Wiki for this.)

    Problem no.1: Which scripts do I have to modify here?
    Problem no.2: Where do I get the .ssl files from? (I'm only playing with the Restoration Project, so I cannot rely on vanilla scrips - if the RP did alter any of the scripts I need, I'd have to alter the RP scripts. So I'd need to decompile them first...)

    I'm sorry if this is common knowledge to you and might seem lazy on my part, but I just don't have a clue guys...
     
  9. Lexx

    Lexx Background Radiant
    Moderator

    Apr 24, 2005
    I think the RP comes with the mapper (at least my RP folder has the mapper)? If so, in the mapper folder is a /scripts/ folder, which is what you are looking for.

    The Red 888 Guns store table script is "\Scripts\SANFRAN\FIGUNTBL.SSL"

    Open that script and scroll down until you hit stuff like
    Code:
    check_restock_item(PID_2MM_EC_AMMO, 1, 4, 33)
    Copy that and add your own ammo PID_x item.
    The PID_ are defined in "\Scripts\headers\ITEMPID.h" - add yours to the end of the list (or anyhwere you want), with the correct proto number. If you don't know the proto number, it corresponds with the entry in the pro_item.msg file (number / 100).

    If you are using the new Sfall Script Editor and setup correctly, hoovering with the mouse over "check_restock_item" will show you the macro behind it.

    To explain the numbers a bit, the restock checks like this:
    check_restock_item(ITEM, minimum items to spawn, maximum items to spawn, chance to spawn)
    In the PID_2MM_EC_AMMO example above, there is a 33% chance to spawn 1 to 4 of said item.

    Anyways... edit your stuff, hit compile and if there is no warning, it should start working ingame.

    PS: I found the table script via opening the map in the mapper, then clicking the table container and pressing edit. There you can see the assigned script.
     
    Last edited: Nov 9, 2019 at 11:49 AM
    • [Rad] [Rad] x 1
  10. Cerebro

    Cerebro First time out of the vault

    57
    May 6, 2007
    Thanks a lot, Lexx (and Nirran, of cause). I think I can work with that and will definitely give it a try.
     
  11. Cerebro

    Cerebro First time out of the vault

    57
    May 6, 2007
    Well, sad update on this front: It does not. So my next problem is: Where do I get the decompiled scripts from?
     
  12. Lexx

    Lexx Background Radiant
    Moderator

    Apr 24, 2005
    Did a quick look. Took me less than a minute, sorry. :p

    First post in the thread, or here.
    BUT if you are actually using the RPU patch mod with the RP, you should use the RPU sources, which are here.

    /Edit: Personally I'd suggest using the RPU files, as that stuff isn't ages old like the RP. Also you can effectively use the same mod folder method to get your stuff working without overwriting other mod files. This should be priority no1 for clean files. :>
     
    Last edited: Nov 10, 2019 at 10:15 AM
    • [Rad] [Rad] x 1
  13. Cerebro

    Cerebro First time out of the vault

    57
    May 6, 2007
    Yes, I'm indeed playing with RPU 0.8 and followed your advice. (Got the .ssl files myself by browsing to the RPU github and downloading the sorce code.zip, but thanks for linking this stuff.)

    Setting up the mapper for Fo2 RP was a bit of a pain, because it didn't recognize the updated files from RPU (or my moded proto) and just used old map files from the vanilla master.dat, but in the end I FINALLY managed to get these things straight. I updated the toxic caves map and changed the .233 ammo there with my new 12.7mm and also modified the script file for the shop in SF to (occasionally) include the new ammo as well. Did a quick test with the shop and it works!

    Thanks again - no least for your patience with me! :)
     
  14. Lexx

    Lexx Background Radiant
    Moderator

    Apr 24, 2005
    Good that it is working at least. It's small steps, but as soon as you get into it and start understanding, it's getting easier and easier to do whatever you want.

    The mapper isn't influenced by Sfall, that's why it won't recognize files in /mods/. For myself I've just adapted the paths in the mapper.cfg to point to the correct /mods/ folder.