Shared HOD files

I am trying to use LoadSharedModel() since I want to replace some models w others but don’t want to have to make scripting changes everywhere that unit is used and don’t want to just copy the hod into the directory (I hate wasting computer resources like that and would much rather it goes to something more productive like better AI or smoother game play).

for example, if I replace the tai_lightcorevtte w the tur_standardcorvette. I copy any associated .ship, .event, .madstate and .mad files then change buildfamily to “Corvette_Tai” and LoadModel() to LoadSharedModel(1,)

I get an Access Violation error when I just say “tur_standardcorvette” but can’t seem to get “tur_standardcorvette”, “…\HW1Ships\ship\tur_standardcorvette” or variations of that to work either (one is in the default HomeWorld.big and the other is in the HW1Ships.big and I forget which is which right now).

what am I doing wrong?

my goal was to make the following replacements (they’re completely arbitrary and an attempt to change up game play a bit or because I don’t care for the ship model that’s currently there – it’s the original design I didn’t like and have no fault w the remastered ones other than I didn’t like the originals)

original unit replaced by -> alternate

tai_lightcorvette -> tur_standardcorvette
tai_multiguncorvette -> tur_missilecorvette
tai_minelayercorvette-> vgr_minelayercorvette
tai_researchship -> tai_reasearchstation
tai_gravwell (removed)
der_scaffold as (added) tai_shipyard
tai_interceptor -> tur_fighter
vgr_probe -> tai_probe
kus_probe -> hgn_probe
kus_scout (removed)
kus_cloakfighter -> kad_swarmer
kus_carrier -> der_carriernew
kus_interceptor -> kad_advancedswarmer
kus_ioncannonfrigate -> kad_multibeamfrigate
kus_supportfrigate -> kad_fuelpod
kus_heavycorvette -> kpr_mover
vgr_bomber -> tai_bomber
vgr_interceptor -> vgr_scout (appropriate ^ to stats and cost)
vgr_scout -> vgr_ecmprobe (ECM defenses + scout EMP are it’s only weapons).

hgn_mothership -> vgr_commstation

  • can't move or add subsystems, but already has research ability plus fighter, "shipyard", utility and probe builds
  • the shipyard can be "built" or called in when there's enough RU's (only then can the player build modules like advanced research, corvette production and other modules be built)
  • hgn_shipyard -> a bare hgn_mothership w just a hyperspace module and the ability to produce BC's when the advanced research module and capship module are built, plus, BC research is completed...

    to mix things up a bit more, I have made all platforms but the hyperspace platform moveable and a little slower (it would be nice if we could break the hyperspace link, move the platform. and then pay to re-establish the link). I consider Gravwells and CloakGenerators to essentially be platforms and if they can be moved, why can’t the HW2 ones be moved as well?

    I know my changes make things completely UN-balanced atm… some of them I won’t be able to fully implement until/unless we have text files for hardpoints but I wanted to see what changes might be useful and/or make it strategically interesting so that each of the races has a completely different set of strategies (the new hgn “mothership” is essentially a civilian unit so a more defensive posture is necessary).

    some changes under consideration would be:

    the tai replace quality for quantity (this would mean proportionately higher unit caps, faster build times).

    the vgr would have automatic radiation immunity and EMP scouts.

    the kus would have automatic cloakfighters and start w corvette chassis research.

    the hgn would start w the ability to research (see mothership changes) and a few more resourcers.

    the vgr increase damage per hit, but decrease accuracy while the hgn do the opposite (no net change in combat ability, just a different flavor)

    Two possibilities: First, I don’t think you need to copy the .mad file, doing so may be causing trouble. Second, the .ship may be refering to weapon hardpoint names that don’t exist in the hod you are trying to load.

    thank you but that isn’t the issue here.

    I took the tur_standardcorvette.ship and renamed it and the directory it was in to both be tai_lightcorvette just to avoid that kind of mistake.

    I changed the build family, etc in what had been the tur_standardcorvette.ship file.

    I could just copy in and rename tur_standardcorvette.hod then just use LoadModel() but, like I said above, I hate the thought of that wasted extra space…

    And did you try deleting the copied .mad file?

    Now that I’ve had my coffee… are you actually calling “…\HW1Ships\tur_standardcorvette” somewhere in your edited scripts? I think I’m a little unclear on what you are doing exactly. If I interpert correctly, your goal is to replace the taiidani light corvette model with the turanic one without duplicating the model. If I were doing that, I would…

    • Copy the stock ships/tur_standardcorvette/tur_standardcorvette.ship to the mod’s ships/tai_lightcorvette/
    • Rename the copied.ship file to tai_lightcorvette.ship
    • Change the LoadModel(NewShipType,1) to LoadSharedModel(NewShipType,“tur_standardcorvette”)

    And then everything should work, at least once the families are adjusted. Is there any step in your process that is different? I’m still confused by the “…\HW1Ships\tur_standardcorvette” in your original post, I can never remember seeing the name of a .big file coming up anywhere except the initial loading messages.

    I have not tried deleting the .mad file yet. I’ve done everything else.

    you did interpret me correctly. since I want it to be the de factor replacement for the LightCorvette, I figured I could just change the icon and the information in the tai_lightcorvette directory.

    I was going to do the other substitutions I talked about but was wondering if there were any ship loading differences if some of the ships to be replaced are in HW1Ships.big, others in HW2Ships.big and the rest in the Homeworld2.big file.

    Grumble. I was doing something similar myself recently, and now it seems to be crashing when I do it again today. It’d really be nice to have more descriptive error messages for some of these.


    @BitVenom, I have tried every variation I can think of to get LoadSharedModel() to work by copying the tur_standardcorvette.ship file in to the tai_lightcorvette directory, renaming the file and then changing params in the ship file.

    I might be using LoadSharedModel() wrong (I’ve used it a lot for classic HW2 over the years) or it might be broken. could you help?

    There’s a pretty solid chance much of this changes in the next few patches - so I can’t even debug your stuff… I am 99% sure LoadSharedModel works just fine - there are examples of it being used in the retail game, right? What are you trying to do that’s different?

    I look forward to those changes… in fact if anything were to change for LiadSharedModel(), I would hope to be able to use it for subsystems too (I’m tired of seeing mods w dozens of iterations of what is essentially the same thing, especially non-buildable weapon turrets b/c the modder has no idea that you can re-use the same weapon-as-subsystem).

    The thing is I have used LoadSharedModel() in HomeWorld2 a lot over the years and never had a problem w it. I can’t think of what I might be doing that is different. it feels like there might be a file permissions issue (I haven’t looked at that yet), but that just seems so non-relevant here.

    minor update: I’m able to use use LoadSharedModel() for ships that are within the same originating .big file (Homeworld2.big, HW1Ships.big or HW2Ships.big). I can replace the Kushan HeavyCruiser with the Taiidan HeavyCruiser, but where I can’t make changes is to replace the Taiidan LightCorvette hod with the Turanic StandardCorvette.