Results 1 to 4 of 4

Thread: AI characters - different uniform model for every weapon 'variant'

  1. #1

    Default AI characters - different uniform model for every weapon 'variant'

    Hello, I'm in process of modding characters in SP in MoHAA. I found that it's possible to give characters different uniform model and textures by deleting "skelmodel"&"surface" lines from main section of character's .tik file and instead placing them (with proper changes if needed) in "weapon case" sections. I found it especially useful for winter characters - since german forces in WWII didn't have standarised winter clothing and game sadly only has two winter characters, it was very useful to use it to increase variety without needing to edit map or script files to introduce entirely new .tik characters, which could be potentially crash-o-genic. This works fine as long as characters' weapons are covered in file, so for vanilla SP campaign it's all fine. HOWEVER.

    There is one problem with that, which is guard towers. For some reason adding "MG42" case to .tik file works fine for MG's mounted on sandbags or other places, but not for guard towers. Soldiers who man MG42s have only head and hands visible, but not body (because skelmodel for body is "missing"). Is there some different MG42 variant for guard towers? I even added "sdkfzmg42" section just in case it was that, but to no avail. I couldn't even find guard tower model, or different MG42 that would work for this, so I'm at loss. No different MG42 model, nothing in "cases" or weapon lists, scripts etc. skelmodel is added for "none" case too but it seems it's not that.

    So to get straight to question: does anybody know if there exist some alternative MG42 weapon model or weapon class for guard towers? Or script that somehow controls it?



    Alternatively, if there's a way to add basic character model (skelmodel and shaders/surfaces) to main .tik part, but make it somehow replaced by another character skelmodel in weapon 'case' section? That would also cover it and it would also be a way to make those characters work even if new weapons are added to game. But I have no idea how to do it yet.


    I link a screen of how that .tik file looks at the moment. In main section (top) the vanilla lines are disabled with //.
    https://i.imgur.com/lXh6TbX.jpg

  2. #2

    Default

    I suspect what's happening is the AI on sandbags are assigned a behaviour type of machinegunner and their turret assigned in Radiant (so technically, they keep their original weapon of MP40 or whatever). The guard towers tend to use the spotlight system (global/spotlight.scr) so their weapon is set as the actual MG42 entity in there (not actually the keyword of 'MG42'), which is just stupid and probably means it cannot be picked up as a weapon type.

    This is the code in spotlight.scr

    if (self.spotter.target)
    {
    self.spotter type_idle "machinegunner"
    self.spotter type_attack "machinegunner"
    self.spotter type_disguise "machinegunner"
    self.spotter type_grenade "machinegunner"
    self.spotter thread spottergun
    self.spotter gun "MG42"
    self.spotter.turret = self.spotter.target
    println (self.spotter.turret + " and the target " + self.spotter.target)
    self.spotter.gun = self.spotter.target
    }


    Notice how they have self.spotter gun "MG42" AND self.spotter.gun = self.spotter.target. That second gun assignment is overriding the first. They obviously assigned it thinking that would work as a custom variable but it's still just calling the gun function (using ".gun" instead of "gun").

    So maybe the MG42 case isn't being hit inside the tik. So what you think is working on the sandbag gunners is actually just because they have their small arms still assigned to them. Hence why you'll see them using the MG but they'll still be wearing MP40 ammo pouches. We might need to investigate this further to find out if anything in the tik can be done without modifying scripts.

    I've actually modified a lot of my human tiks so that, for instance, the green Wehrmacht models have equipment when using MP40s (annoyingly, the original devs left some out), or officers with MP40s have hats, and so on.

  3. #3

    Default

    so technically, they keep their original weapon of MP40 or whatever
    But then there wouldn't be a problem because I already got a "case" for MP40 ready in those .tik files. The soldiers of this type that spawn with MP40 without being MG gunners have everything working proper. I tried that out by covering every "case" in .tik files for both winter soldiers and it works when they have weapons assigned - as some gunners do - but not those in guard towers.
    Curiously, I found out that in m6l1c (Die Sturmgewehr) there are MG42 gunners of all "types" - on guard towers they seem to have that weird bug where they have no body model and texture (when using my edited .tik ofc), one in bunker in beggining where you spawn has assigned Kar98k properly (his K98 pouches and assigned headgear appears) and gunners in bunker at exit at the ending part of level have the case "none" assigned - they have no weapon and equipment at all and only gain weapons (MP40s) only after they are bothered by player and leave the mounted MG. After I added special hat and equipment to "none" case it appeared there, so I'm certain they have that case assigned and not anything else. Another interesting part is that their equipment doesn't change after they leave MG and get MP40s - since for example wehrmacht_grenadier.tik (green wehrmacht that you mentioned) get equipment change to their weapon after they dismount MG.

    I hope I didn't write it in too complicated way. It just seems like MG gunners have three different types of state - one type has assigned "none" weapon and gets to man MG, and only gain weapon after they leave MG (maybe special script for that?), second type has weapons before they man MG and their equipment changes when they leave MG, and the third type seems to be the spotlight gunners with seemingly no "case" at all (I'll now call them spotlight gunners instead of tower gunners since I observed it's same case with guards on fortress in m1l2 - same thing, they have no weapon case assigned and thus no equipment at all). Damn shame it's such a mess. I guess for this to work I'll have to either find a way to randomise characters' models if such way exists, or find a way to replace characters in .bsp files safely


    I've actually modified a lot of my human tiks so that, for instance, the green Wehrmacht models have equipment when using MP40s (annoyingly, the original devs left some out), or officers with MP40s have hats, and so on.
    Yes exactly that's what got me started on that! So much of stuff got left out. And the winter soldiers - they have "case" for StG44 in .tik files, but they still spawn with no helmets and StG pouches because devs forgot to change "case" name to StG44 as they called it MP44 before. Seems they changed the weapon name in last minute and forgot to do it for those two characters.

  4. #4

    Default

    Quote Originally Posted by sage View Post
    But then there wouldn't be a problem because I already got a "case" for MP40 ready in those .tik files.
    Yes, that was my point . The ones with MP40s will be fine, that's what I said.

    Quote Originally Posted by sage View Post
    The soldiers of this type that spawn with MP40 without being MG gunners have everything working proper. I tried that out by covering every "case" in .tik files for both winter soldiers and it works when they have weapons assigned - as some gunners do - but not those in guard towers.
    Correct, like I said . Though they are mg gunners internally, they just have a gun assigned to them.

    Quote Originally Posted by sage View Post
    one in bunker in beggining where you spawn has assigned Kar98k properly (his K98 pouches and assigned headgear appears)
    Yep, this is because he isn't given a 'gun' of MG42, but given KAR98 instead in Radiant (I just loaded the map up and checked).

    Quote Originally Posted by sage View Post
    and gunners in bunker at exit at the ending part of level have the case "none" assigned
    Yep, correct, I just checked that as well.

    Quote Originally Posted by sage View Post
    they have no weapon and equipment at all and only gain weapons (MP40s) only after they are bothered by player and leave the mounted MG
    This is done in the game engine rather than in a script. You can see here:

    https://github.com/openmoh/openmohaa...gunner.cpp#L96

    That function (End_MachineGunner) is called when the AI stops being a machinegunner (gets off MG). If he has no weapon assigned (e.g. 'none'), it's hardcoded to give him an MP40.

    Quote Originally Posted by sage View Post
    Another interesting part is that their equipment doesn't change after they leave MG and get MP40s
    Correct, that is because the engine doesn't do a call to update their equipment . It's a developer oversight in the End_MachineGunner function.

    They do however update the equipment in other functions, e.g. when giving an AI a gun in the script, which is why they sometimes update their loadout, and sometimes not.

    See https://github.com/openmoh/openmohaa...ctor.cpp#L5937

    Notice if the weapon name is STRING_MG42 they are given an MP40? Also notice the setModel(); line, that is what they use to update the AI's loadout. Unfortunately they didn't use that in End_MachineGunner.


    Quote Originally Posted by sage View Post
    It just seems like MG gunners have three different types of state - one type has assigned "none" weapon and gets to man MG, and only gain weapon after they leave MG (maybe special script for that?), second type has weapons before they man MG and their equipment changes when they leave MG, and the third type seems to be the spotlight gunners with seemingly no "case" at all
    Kind of, but the above code I've provided can explain at least some of the incongruity, and like I said about the spotters, there isn't anything special about them, it's just in the script for spotters they assign the 'gun' of the AI to an actual object in the game (the MG42) rather than the string 'MG42'. The engine doesn't really know how to handle that properly. It's a mistake on the developers' part.

    If you really wanted to, you could update spotlight.scr to use a custom variable and that would sort out most of the spotters I would think.

    Quote Originally Posted by sage View Post
    Yes exactly that's what got me started on that! So much of stuff got left out. And the winter soldiers - they have "case" for StG44 in .tik files, but they still spawn with no helmets and StG pouches because devs forgot to change "case" name to StG44 as they called it MP44 before. Seems they changed the weapon name in last minute and forgot to do it for those two characters.
    Yep, that was one of the first things I changed. Another example are the officers (well, other than the Afrika Korps) having a case of "MP 40" which won't be recognised because of the space, so they don't spawn with equipment when using that gun. At least, I seem to remember that being an issue. I might be misremembering.
    Last edited by 1337Smithy; December 11th, 2021 at 06:48 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
  •