Modding Multiple/Simultaneous Building

So, I’ve picked up editing ship files and such, and I have some questions. Let’s say I click on the interceptor button to build a squad, how would I go about…

  1. building several (let’s say 3 or 4) interceptors squads
  2. building interceptor and bomber squads
  3. building interceptors, corvettes, and frigates

…instead (or with) the initial fighter squad.

Along with this, I’d like to learn how to create a new ‘unit’ such as “fighter assault” that will spawn numbers 1 and 2. I’m stuck and keep getting game crashes every time i attempt to add this ‘unit’.

The goal is to select in the build menu a fighter force ( an undecided name for now) in place of or in addition to the current unit options to produce an actual force, with x number of units z and y, or a, b, and c.

I would guess that this stuff is all hardcoded.

I guess you could create a script that spawns several ships when you press a button. But I don’t know how you would animate the build menu to reflect build times and so forth.

Creating a script… that’s the question at hand. I don’t have enough experience with homeworld scripting to even know where to begin with that, hence the point of the thread. Animating the build menu isn’t really a concern right now, I could just recycle the current build icon, such that one ‘push’ of that build menu button will spawn multiples simultaneously, mix and match of different fleets, etc.

Thanks though.

I think the UI you need to edit is data\ui\newui\buildqueuemenu.lua

You’re going to need to get rid of all the stuff the game handles outside the script, and replace them with new stuff you have direct control over.

Then you’re going to need to insert your custom ship spawning code into some “onmouseclicked” button parameters.

Unfortunately, you don’t have access to ship manipulation functions from there. So none of this may in fact be possible.

nope ^^
This one is for the small buid menu accessed with the handy-button on the left of the screen. The one he is looking for is finalbuild.lua.

But as you said, it’s not possible to integrate such a thing in the current build menu, as the buttons in it are hardcoded and linked to the .ship files, and I’m pretty sure it’s not possible to have a single .ship files calling different models of ships.

It could be possible with a custom UI screen, though.

Is it not possible to use link other .ship files to an initial one? This seems rather limited… and disappointing.

I don’t think so. A .ship file represents a ship or a squadron of the same ship (an unique 3d model file to use is defined in this file)

It’s not limited in any way. What you want is totally out of the scope of the original game, so the original ui was never meant to be used for something like this.
But as I said, it’s possible by creating a custom ui screen with specific buttons which would spawn several different ships with one click.

Hmm, I misunderstood the ‘role’ of the .ship file then. It makes sense that is would load a specific ship, hod, and event file. I had thought that it acted more or a receptionist ready to direct you to a desired location, rather than the destination itself.

Would it be possible to mimic/copy the build screen as a new one? If so, could I then ‘create’ this new build screen, disable the old, and set custom ship spawns?

Not really, the buttons for each ship/squadron in the build screen are created from a common template element which is automatically cloned with the needed informations (ship associated, text, price, etc…) populated in an hardcoded way.
So re-using the already existing buildmenu is not an option.

You would have to create a totally different ui screen, with it’s own buttons and scripted logic.

Mm. That sounds very interesting. Any suggestions on how to go about that?

On a side note, how does the sobsubstitutionlist.lua work? I can’t seem to get substituted names to be recognized in game… I just get crashes.

It’s clearly not an easy task if you’ve never worked on the UI :confused:
I want to make a tutorial for UI stuff, but I’m currently reworking my rainbow mod, so I’ve no idea when that will be.

No idea, never used it. Time to summon the great guru @BitVenom ^^

You could probably create a system where you build a ‘dummy’ ship and then a game rule detects its existence, destroys it, and creates a predefined set of ships. Unfortunately such a system wouldn’t be very flexible. HWR lets you build any number of dissimilar ships in parallel if you want to though, just not large numbers of the same kind of ship, nor mixed batches of ships as a single ‘unit’.

I have possible counters to those issues. Maybe?

For similar ships in large groups, could I have that ‘dummy’ spawn, die, and bring out a sqaud of ‘dummy 2’, which then are destroyed, thus spawning, lets say, ‘dummies’ 2a, 2b, and 2c. Dummies 2a could be a fighter squad, 2b could be a frigate, 2 c could continue the dummy chain, or be another ship/squad, etc. Thoughts?

I’d just like to add that that’s a good idea @CryCoh.

As far as the dummy concept, I have no idea where to start.

However, I have experimented with the salvage on death, but cannot seem to bring a ship into being instead of salvage.

Can anyone direct me here?