Results 1 to 4 of 4

Thread: NPCS default weapons management

  1. #1

    Default NPCS default weapons management

    Dear all, i'm new in this forum, if a question like mine has already been asked or is in the wrong section please let me know.

    I started an editing project on MOHAA, specifically on Breakthrough. Does anyone in the forum know where and how to manage the default weapons for NCPs in single player maps? I tried to search in the .scr files and .bsp files but I could not find anything that could help me, thanks.

  2. #2

    Default

    I don't know scripting or mapping, but I think one way is to edit the map and replace the original NPCs with the NPCs that are using your guns and settings.
    To edit the maps (.bsp files) you need MoHRadiant tool.

    Another way I saw in youtube is by manualy spawning NPC's through the console and set their settings there: https://www.youtube.com/watch?v=TAokNBps7TA
    https://www.youtube.com/watch?v=kL3LRDzvnwo

    You could possibly use the same commands to spawn NPCs with your settings on the map's .scr file. by writting something like '$player stufftext spawn model/human/adolf_hatler.tik weapon "jonson launcher" health 999 accuracy 1000 coords x y z' or allong those lines.

    I hope this provides you some usefull information and good luck.
    Last edited by Soares93; September 4th, 2021 at 07:14 PM.

  3. #3

    Default

    Quote Originally Posted by ohifra1987 View Post
    Dear all, i'm new in this forum, if a question like mine has already been asked or is in the wrong section please let me know.

    I started an editing project on MOHAA, specifically on Breakthrough. Does anyone in the forum know where and how to manage the default weapons for NCPs in single player maps? I tried to search in the .scr files and .bsp files but I could not find anything that could help me, thanks.
    On the Pak1 on the global folder theres one script called weapon where you have all the weapons on the game but im not sure if his used on SP or not to set a weapon on the AI.

    If you are in a project to edit alot of things on the game i suggest you to download this file because have alot of commands of the game where you can use on the SP:
    Attached Files Attached Files

  4. #4

    Default

    Quote Originally Posted by ohifra1987 View Post
    Does anyone in the forum know where and how to manage the default weapons for NCPs in single player maps? I tried to search in the .scr files and .bsp files but I could not find anything that could help me, thanks.
    I suppose it depends what you mean by default weapons. MOHAA actually does have a concept of default weapons for AI, but it depends on how they are spawned in script or placed in Radiant. When placing them in Radiant, you have an option of selecting 'default', and the game reads the AI .tik files to determine what the weapon should be. For example, NCO models tend to have MP40s as their default weapon.

    For example, in maintt/pak1.pk3/models/human/german_afrika_NCO.tik


    server
    {
    classname Actor
    setsize "-16 -16 0" "16 16 92"
    german
    health 100
    weapon "MP40" //<----- default weapon

    // Make him mumble but not breathe steam
    exec global/breathe.scr 0 1

    // Set up the helmet for popping off
    // <model to spawn> <speed to throw it at> <damage multiplier for helmet shots> <surface to turn off>
    sethelmet "models/gear/german_dakcap.tik" 200 4 "hat"
    }


    That file is in maintt, but because BT is an expansion, only some of the AI tiks are in there. You'd need to edit the rest of them in main if you wanted the Wehrmacht NCO for example.

    So you could change the weapon property to be another weapon, but this will only change weapons of the AI that were placed via Radiant with 'default' selected or spawned in the map without a weapon specified in the script. It won't change the guns for the individual AI given a specific weapon, such as the snipers in Sniper Town as an example.

    So you could try modifying the above tik files and see if that is good enough. I can't be certain that you won't run into any issues doing this, but it's one of the safest ways to do it, as you won't override special AI that are meant to have a specific weapon for a level to function.

    There are other ways to force AI to have weapons (other than messing with map scripts), such as executing a script when an actor spawns. You could do this by modifying every human tik like above, or you could find the file models/human/new_generic_human.tik and add an init block (underneath setup) like so:


    setup
    {
    ischaracter
    }

    init
    {
    server
    {
    exec somefolder/somescript.scr
    }
    }


    And in that file have a script like so:


    main:
    switch (self.model)
    {
    case "models/human/german_afrika_NCO.tik":
    case "models/human/german_wehrmact_NCO.tik":
    self weapon "stg44"
    break
    case "models/human/german_wehrmact_soldier.tik":
    self weapon "mp40"
    break
    }
    end


    And just add the models you wish to change. This works because every AI tik includes new_generic_human.tik. Just means you can handle it in a single file rather than messing with them all. This example will also override those given a specific weapon in Radiant, and also those spawned in the scripts with a weapon command supplied as part of the spawn command. It won't stop changes made later on however.

    Also bear in mind that AI have different equipment loadouts for each gun, and stupidly the developers left out the loadouts for MP40s on german_wehrmact_soldier.tik so they run around without a helmet or any equipment like idiots. I guess one developer/animator/modeller thought normal soldiers shouldn't have MP40s, but then the scripters put them in the maps anyway. You can add those in yourself if needs be.

    I wouldn't recommend changing global/weapon.scr as the engine calls this script every time a gun is given to an AI, so it'll just call it again when changing their weapon and you can run into all sorts of issues.
    Last edited by 1337Smithy; September 5th, 2021 at 04:18 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •