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

    89
    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

    89
    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 Modder

    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
  8. Cerebro

    Cerebro First time out of the vault

    89
    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 Modder

    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
    • [Rad] [Rad] x 1
  10. Cerebro

    Cerebro First time out of the vault

    89
    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

    89
    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 Modder

    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
    • [Rad] [Rad] x 1
  13. Cerebro

    Cerebro First time out of the vault

    89
    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 Modder

    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.
     
  15. Cerebro

    Cerebro First time out of the vault

    89
    May 6, 2007
    Well, time to dig up some bones...

    As there is a chance to get the Bozar from the Gun Runners in Et Tu now, I tried to modify the GUNCACHE.ssl to include my 12.7mm ammo type, so that the gun gets some ammo to shoot. But when I try to compile the script, I get an error regarding a line of code of I never touched. It's line 30 and the message is: Undefined symbol fo1in2_merch_enabled in factor.

    What do I have to do to make this work?
     
  16. Lexx

    Lexx Background Radiant
    Moderator Modder

    Apr 24, 2005
    That means the script editor can't find the required header file with the defined value. Something in your settings is wrong.

    I assume you didn't set "search include from this path" in the settings? Though that should mean you will have problems with compiling any other script as well.

    PS: It also should be "fo1in2_merch_restock_enabled" and not "fo1in2_merch_enabled".
     
  17. Cerebro

    Cerebro First time out of the vault

    89
    May 6, 2007
    Well, I used the script folders in the mapper path:

    Headers file: ...\Fallout1in2\Mapper\source\scripts\headers
    Script.H file: ...\Fallout1in2\Mapper\source\scripts\headers\scripts.h

    And "search include from this path" is checked.

    Edit: Alright, I noticed what I did wrong. Got it to work now.
     
    Last edited: May 15, 2020
  18. Zorchar

    Zorchar Still Mildly Glowing

    240
    Jun 18, 2018
    Can u tell me how to add new weapon animation types? (j-rifle, p-custom sniper rifle)

    EDIT: or at least how to edit them. I realize making new ones can mean thousands of new FRM's. (I basically just want to add the new custom animation types to the mapper, so it would be easier to get a critter to wield a hunting rifle, without scripting it.)
     
    Last edited: May 17, 2020
  19. Lexx

    Lexx Background Radiant
    Moderator Modder

    Apr 24, 2005
    There is no way to do that.

    If you want certain critters to be able to wield weapon types they don't have animations for, then the most easiest (and laziest) way would be to just copy and rename an existing animation. Of course this will look like shit, though, so my suggestion would be not to give weapon types to critters who can't use them.
     
  20. Zorchar

    Zorchar Still Mildly Glowing

    240
    Jun 18, 2018
    Thanks for the answer.

    The thing is, I want to use critters that DO HAVE the neccecery FRMs for the animation type, IN-GAME. The mapper doesn't recognize the animation type though, so it acts as if it doesn't have the FRMs, which it does actually.

    I can change the animation type of the weapon back to "j" for instance, to the hunting rifle. Then change it back with a proto editor once the map is done, along with the critters who carry the gun. Only thing is, I'm not sure they will use the new custom animation in-game, because I think (and correct me if I'm wrong) that the gun instance on the critter that the map saved is of the 'j' animation type, even though I later edited the proto file, since an instance of a proto, once "on the map" acts like the proto it was used from originally (again, "j" animation) EDIT: so lets say if I rebuild protos using the mapper, it will make the critters disappear again in mapper.(though it would still work in-game, which would actually be a solution.)
     
    Last edited: May 19, 2020