Author Topic: Creating custom kit which randomizes main handweapon?  (Read 167 times)

Offline VolkssturmGewehr

  • Jr. Member
  • **
  • Posts: 73
    • View Profile
Hi all. I'm wanting to create custom kits which sort of randomizes the handweapon you actually end up spawning with. For instance a kit which, if chosen, may spawn you with either an MG34 or an MG42 depending what ObjectTemplate's are included in that particular [custom kit].inc. The other parameters would remain the same (IE: knife, pistol, bandage).


Basically I want to add a bit of variety to the custom co-op maps I am currently working on, being that it's limited to six kits. With the SMG/Rifle NCO kit, the bots only choose whichever kit is on the left side in the selection menu (Which is generally the SMG in default FH2 kits). Thus attempting to do it via the NCO kit way with creating two separate kits then coding "addTemplate" and "replaceItem" won't work. The bots will always chose the left side kit.


I saw it mentioned elsewhere in a thread here on the FH2 forums that this is indeed possible to do, however the specific way of doing it (what code is necessary) was not mentioned in that thread and despite searching both here + google for a few hours I have came up empty handed. Thus I'm wondering if anyone here knows what specific code to use to randomize a handweapon in a custom kit?


Thanks all for the help. About a month ago my laptop died. Bad motherboard. It was a crappy Celeron anyway, but at least I could generate navmeshes & such. I'm currently using a desktop with an ancient AMD Athlon II & 4gb RAM. Barely runs FH2 at 1024x768. If I try to navmesh it crashes after 4 hours. Thus this put a massive damper on my project(s) of bringing singleplayer/co-op functionality to several of the CMP Pacific maps as well as the Eastern Front maps. I have some of them navmeshed already, but they're outdated & need re-navmeshed again. However I nearly have enough money saved up to get a decent pre-owned laptop, only need to save another $100 or so. Something in the $200 range with at least an Intel I7 & 8gb RAM. Once I get that then I'll finally be able to get some real work done on my project.

Offline Ts4EVER

  • Banner of THeTA0123
  • Developer
  • ******
  • Posts: 7.748
    • View Profile
Re: Creating custom kit which randomizes main handweapon?
« Reply #1 on: 26-04-2019, 06:04:28 »
When we had that in the beta, we had two kits added to mapdata.py (where the kitlimits are set). But there might be more to it than that.

Offline VolkssturmGewehr

  • Jr. Member
  • **
  • Posts: 73
    • View Profile
Re: Creating custom kit which randomizes main handweapon?
« Reply #2 on: 29-04-2019, 19:04:54 »
Thanks for the response. That does work, having two kits separated by comma in the mapdata.py, (no python errors either) however for some reason the bots don't seem too keen on selecting it now. The kitlimit is set to 6.0 for that line. My custom kit(s) were placed in Ramelle for Germany. One being the stock MP40/Eihandgranate SMG kit, the other replaced the MP40 with STG44. I played a co-op round with 24 German bots + 13 U.S. and only saw my custom kit in use twice. Whereas before it was regularly seen among the bots. It does randomize however. Not entirely sure what would cause that, possibly something with the kitlimits maybe & having two kits on that line. I did add the new kit to the tmp file.