DropItemClass crash issue

Started by Ty294, July 16, 2021, 02:56:42 PM

Previous topic - Next topic

Ty294

Heyo people,

So, I was experimenting with the section at the bottom of your average unit class, this being the original form for reference:

DropItemClass = "com_item_powerup_ammo"
DropItemProbability = 0.40
NextDropItem = "-"
DropItemClass = "com_item_powerup_health100"
DropItemProbability = 0.30
NextDropItem = "-"
DropItemClass = "com_item_powerup_dual"
DropItemProbability = 0.10

So, you'd think if you made a modified version of one of those items (from the common folder) and just put it in your side ODF, you should be able to load it in, right? Like if I made a "com_item_powerup_health50", and replaced the ammo one. Well, if you do that, it crashes the game, even if the ODF is correctly connected and even if you don't do anything to change it other than the name.

You can, however, link to certain other common items in the common ODF folder (which is obviously in the common.lvl). For example, com_weap_inf_landmine. If you put this in, when your character dies they will actually drop a landmine upon death (pretty cool), but if you take that landmine and make a name-changed one in your side folder, it doesn't read it and crashes the game.

This looks like, for some reason, the DropItemClass line only reads stuff in the existing common.lvl and won't read anything new in your map's .lvl files. Why is this? I can't get SPTest to work (Steam version, also tried the Gog.com version with the same result), so I can't check the error log, so I'm wondering if someone who does have it could experiment on this and see what they find out?

I think this would be very interesting because it would allow you to not only have soldiers drop unique ammo and health items, but also things like mines or grenades or the like.

Dark_Phantom

SPTest only works for the 1.2 version of the game, of which there is a downgrade here.
I've tried various things but I don't remember what my tests were.

I think the reason you are crashing is because that instance of the mine class never gets loaded in.
You need to learn about one of the most important yet least covered things: req files.
Look at common.req, and you'll see that those classes are loaded in the munge.  The side lvl files work a little bit differently in that I believe if they are a part of a unit class, the armament is loaded ingame as well.  The mine is not loaded if no unit has it, causing a crash.

A req file is just a text file that allows the munger to organize and put the data in the correct places so that when the game loads, it can find what it needs. They are used in every lvl file in the game.
The BOBclan:  A Rich History


Quote from: Unit 33 on November 29, 2014, 03:44:44 AM
'Please, tell me more about the logistics of the design of laser swords being wielded by space wizards' - Some guy on the internet.

AnthonyBF2

Try editing the world REQ file and adding a "class" section then add the name of the ODF that you're trying to make work (make sure those assets exist in world's msh/odf folders).

I did this for BF2 which successfully allowed me to manipulate buildings and props using fake console commands.
Never let a person named AnthonyBF2 touch your BF2.

Ty294

I figured it had something to do with classes, but I wasn't sure.

I tried what you suggested AnthonyBF2, but it still crashes out. World .req:

ucft
{
    REQN
    {
        "config"
    }

    REQN
    {
        "class"
"com_item_powerup_health50"
    }

    REQN
    {
        "texture"
        "GeoCan_map"
    }


    REQN
    {
        "texture"
        "platform=pc"

    }

    REQN
    {
        "path"
        "GeoCan"
    }
    REQN
    {
        "congraph"
        "GeoCan"
    }
    REQN
    {
        "envfx"
        "GeoCan"
    }
    REQN
    {
        "world"
        "GeoCan"
    }
    REQN
    {
        "prop"
        "GeoCan"
    }
    REQN
    {
        "boundary"
        "GeoCan"
    }
    REQN
    {
        "config"
        "flyerspray"
        "walkerstomp"
        "bigwalkerstomp"
        "hailfire_wake"
        "dustwake"
    }

}

I also tried adding it to numerous .reqs in the side's folder, but that didn't work.

So far, the one way to make it work is if I add it to a unit as part of a weapon ODF, like Dark_Phantom suggested. Then it works perfectly fine. Is there something else that needs to be added? Like a line in the LUA or some tweak the munge files or whatnot?

Appreciate your guys help and input on this!

AnthonyBF2

If you're putting the msh/odf assets in your SIDE then the class entries also need to go in the SIDE req, as well as creating a subreq for the class name, then call up those assets alongside the normal SIDE assets in your mission script.

Then apply the class drops to the character ODFs.

I can't say this will work but it seems like it should, I have used similar methods for getting content loaded into BF2.

This is BF1 afterall, one of the jankiest games of all time (Still love it) so it may not work.
Never let a person named AnthonyBF2 touch your BF2.

Ty294

Quote from: AnthonyBF2 on July 17, 2021, 08:12:10 PMIf you're putting the msh/odf assets in your SIDE then the class entries also need to go in the SIDE req, as well as creating a subreq for the class name, then call up those assets alongside the normal SIDE assets in your mission script.

Then apply the class drops to the character ODFs.

I can't say this will work but it seems like it should, I have used similar methods for getting content loaded into BF2.

This is BF1 afterall, one of the jankiest games of all time (Still love it) so it may not work.

I tried this and still crashed, but I might not have your setup 100% correct. I'm gonna share it here and maybe you can spot something I failed to do:

In ODF Folder

com_item_powerup_health50.odf

In REQ Folder

com_item_powerup_health50.req

REQ File:

ucft
{
REQN
{
"class"
"com_item_powerup_health50"
}
}

In Side .REQ

ucft
{
REQN
{
"lvl"
"emp_inf_basic"
"emp_inf_army"
"emp_walk_atat"
"emp_walk_atst"
"emp_walk_atte"
"imp_fly_tiefighter_DOME"
"imp_inf_droids"
"emp_hover_speederbike"
"com_item_powerup_health50"
}
REQN
{
"class"
"com_item_powerup_health50"
}
REQN
{
"model"
"item_powerup_health25"
}
}

In Mission LUA

    ReadDataFile("dc:SIDE\\emp.lvl",
        "emp_inf_basic",
"emp_inf_army",
"emp_walk_atat",
"emp_walk_atst",
"emp_walk_atte",
"imp_fly_tiefighter_DOME",
"emp_hover_speederbike",
"com_item_powerup_health50");

Am I missing any steps here?

AnthonyBF2

all of the msh/tgas used by the ODF must be in the MSH folder
Never let a person named AnthonyBF2 touch your BF2.

Ty294

Quote from: AnthonyBF2 on July 18, 2021, 02:46:12 PMall of the msh/tgas used by the ODF must be in the MSH folder

Did that, still crashes. Also added:

REQN
{
"model"
"item_powerup_health25"
}
REQN
{
"texture"
"item_powerup_health"
}

To both the individual .req in the REQ folder, and to the side REQ. Still crashes. Not sure what else to try. I mean, I guess the easier way to do this is just make a dummy soldier who has it as a weapon, just so it loads, and do it that way. At this point this is not so much on getting it to work in a general sense as much as it is seeing if we can get it work using only .reqs and such without the dummy unit.