OpenXcom Forum

Modding => OpenXcom Extended => OXCE Suggestions DONE => Topic started by: thusky on July 24, 2022, 10:17:23 pm

Title: [DONE][Suggestion] Allowed soldier groups per craft
Post by: thusky on July 24, 2022, 10:17:23 pm
Hey there!


I've been messaging Yankes and Meridian by PM and got recommended to make an official request here so everyone can estimate whether or not such feature would be nice for their mods (and thus be implemented, potentially).

I've been making a "Play as the aliens" mod for the past 3 weeks or so, as such I would like to force the player to only be able to have 1 alien race per craft, the feature would work like this:
Go to craft loadouts -> craft crew -> load 1 aquatoid soldier (now craft will only accept aquatoid units (soldiers/terror units)). -> Throw error message when trying to load a different race. -> Unload all  soldiers (empty craft) to accept other races again.

It is, in some way, similar to requiresBaseFunc but for crafts and would only trigger once a unit type is loaded (this could also be applied to armors for other mods).


Having soldier types limited per craft could be useful for mods restricting unit compositions, do tell me if I missed an additionnal benefit of such a feature though!

Do you guys think this would be an interesting enough feature to be added, could this be useful to you as a modder?



Cheers,
Nils
Title: Re: [Suggestion] allowedSoldierType function for craft
Post by: bulletdesigner on July 24, 2022, 10:31:20 pm
I would love also that additon, to have  craft by soldier type, meaning that i have issue making loyaist use heritical crafts(40k mod)
Title: Re: [Suggestion] allowedSoldierType function for craft
Post by: Meridian on July 24, 2022, 10:32:20 pm
Go to craft loadouts -> craft crew -> load 1 aquatoid soldier (now craft will only accept aquatoid units (soldiers/terror units)). -> Throw error message when trying to load a different race. -> Unload all  soldiers (empty craft) to accept other races again.

"allow only 1 soldiertype/race" as described by the example is relatively easy to do

I don't have any particular feelings about the feature myself, feedback welcome

I would love also that additon, to have  craft by soldier type, meaning that i have issue making loyaist use heritical crafts(40k mod)

"allow only 1 particular soldiertype/race" is a bit different, but also doable
Title: Re: [Suggestion] allowedSoldierType function for craft
Post by: thusky on July 24, 2022, 10:42:46 pm


"allow only 1 soldiertype/race" as described by the example is relatively easy to do

I don't have any particular feelings about the feature myself, feedback welcome

"allow only 1 particular soldiertype/race" is a bit different, but also doable
Awesome!

I wanted to give further details on the feature as someone asked a question on the discord servers, the question was:

"Interesting idea. Not one I can see myself using, but nothing wrong with it as an idea. Although, would that not prevent you from carrying an HWP in addition to the soldiers, as they're two different things?"

My answer was:

"One wouldn't go without the other in a sense, once you bring a HWP of type A you can only load soldiers of type A and vice versa.
Much like requiresBaseFunc except the "service" becomes available as soon as a unit type is loaded"

It then returns nothing if the craft is empty, thus allowing for loading a new unit type again
Title: Re: [Suggestion] allowedSoldierType function for craft
Post by: Meridian on July 24, 2022, 10:50:14 pm
One wouldn't go without the other in a sense, once you bring a HWP of type A you can only load soldiers of type A and vice versa.

True vanilla HWPs don't have a soldier type, they are not soldiers.
This would work only if you created soldiers that look like vehicles (btw. many mods already do this).

Which brings up a question: what should happen to the true vanilla non-soldier HWPs? are they all allowed? or are they all disallowed?
Title: Re: [Suggestion] allowedSoldierType function for craft
Post by: thusky on July 24, 2022, 10:57:17 pm
True vanilla HWPs don't have a soldier type, they are not soldiers.
This would work only if you created soldiers that look like vehicles (btw. many mods already do this).

Which brings up a question: what should happen to the true vanilla non-soldier HWPs? are they all allowed? or are they all disallowed?

True they are items, I thought "services" as race categories I guess (since I use base services this way pretty much).

So there isn't a way to link soldiers and items to have both interact with each other in terms of service required?

If so yes, HWPs would be disabled and some soldiers would be used as "fake" HWPs,

In my case I thought HWPs would be terror units, if it's too much of a bother it's far from a deal breaker for sure! The most important part is really to have only 1 soldier type allowed per craft, that is the most important.
Title: Re: [Suggestion] allowedSoldierType function for craft
Post by: Meridian on July 24, 2022, 11:09:56 pm
Which brings me to another question (related to fake HWPs).

You can have only 1 soldier type of a given soldier type :)
I know, sounds weird, don't know how to write it better.

Two different unit types cannot have the same soldier type... maybe that's clearer.

So, what did you mean in your original request?
Use the existing soldier type attribute, this one:
Code: [Select]
soldiers:
  - type: STR_SOLDIER
    costBuy: 40000
    costSalary: 20000
...

...or do I need to introduce something new? So that you can have more than one unit type in your "alien race"...

Same question for bulletdesigner: Is "loyalist" just one soldier type? Or multiple?
Title: Re: [Suggestion] allowedSoldierType function for craft
Post by: thusky on July 24, 2022, 11:20:12 pm
So, what did you mean in your original request?


My apologies, still a noob modder over here (I have a tendency to not use the right words either ahah), I'll try my best to explain through the code snippet you provided:

Code: [Select]
soldiers:
  - type: STR_SOLDIER_AQUATOID
    costBuy: 40000
    costSalary: 20000
    craftRace: Aquatoid
...

So not a new "type" just a "category" or "service" (I don't know how to call it really), that would be set once you crew that soldier into a craft.


...or do I need to introduce something new? So that you can have more than one unit type in your "alien race"...


I guess it could be a boolean for 1 single "type" like STR_SOLDIER for certain mods as well but that would be a different feature yes! Sorry for the missunderstanding.
Title: Re: [Suggestion] allowedSoldierType function for craft
Post by: Meridian on July 24, 2022, 11:32:44 pm
ok, understood
Title: Re: [Suggestion] allowedSoldierType function for craft
Post by: Delian on July 24, 2022, 11:42:07 pm
I think features which are designed to be used only in a single mod aren't useful enough to implement.

So, I think the solution that adds a new property to crafts called allowedSoldierTypes (array of strings), makes the most sense, because it would also be usable by other mods.

If you have 10 different alien races, then thusky would need 10 different crafts, each restricted to a single alien race. So the player(alien) would have to buy/manufacture the craft specific for the race that they'd want to use on that craft.
Title: Re: [Suggestion] allowedSoldierType function for craft
Post by: thusky on July 24, 2022, 11:48:02 pm
I think features which are designed to be used only in a single mod aren't useful enough to implement.

I completely agree with this!


So, I think the solution that adds a new property to crafts called allowedSoldierTypes (array of strings), makes the most sense, because it would also be usable by other mods.


Sure this could be a "related" feature, definitely not what I'm asking but this could be useful for sure!


If you have 10 different alien races, then thusky would need 10 different crafts, each restricted to a single alien race. So the player(alien) would have to buy/manufacture the craft specific for the race that they'd want to use on that craft.

That's the thing, I'm not asking for 1 craft=1 race here but soldiers with "tag A" can only be crewed with "tag A" soldiers, this could still prove useful to other mods, don't you think?
Title: Re: [Suggestion] allowedSoldierType function for craft
Post by: Delian on July 25, 2022, 12:22:12 am
soldiers with "tag A" can only be crewed with "tag A" soldiers

The "allowedSoldierTypes" solution would allow you to do this just fine. Since the property is a list, you simply add all soldiers, that are allowed on the same craft, to that list.
Title: Re: [Suggestion] allowedSoldierType function for craft
Post by: thusky on July 25, 2022, 12:23:27 am
The "allowedSoldierTypes" solution would allow you to do this just fine. Since the property is a list, you simply add all soldiers, that are allowed on the same craft, to that list.

So your example wouldn't force the player to manufacture a specific craft for each soldier type then?

If that's the case, I'm in, for sure!
Title: Re: [Suggestion] allowedSoldierType function for craft
Post by: Delian on July 25, 2022, 12:35:16 am
Not for each soldier type, but for each soldier type group. The crafts would still be restricted to their respective races.

If you'd construct a terror_ship_for_ethereals (this ship would have allowedSoldierTypes of ethereal soldier, ethereal leader, sectopod, etc..), then sectoids wouldn't be allowed on this craft. But if you added a manufacture design that takes terror_ship_for_ethereals as material and produces terror_ship_for_sectoids, then it wouldn't be a problem. Well, besides needing a lot of manufacturing designs for all combinations heh.
Title: Re: [Suggestion] allowedSoldierType function for craft
Post by: thusky on July 25, 2022, 12:41:05 am
Not for each soldier type, but for each soldier type group. The crafts would still be restricted to their respective races.

If you'd construct a terror_ship_for_ethereals (this ship would have allowedSoldierTypes of ethereal soldier, ethereal leader, sectopod, etc..), then sectoids wouldn't be allowed on this craft. But if you added a manufacture design that takes terror_ship_for_ethereals as material and produces terror_ship_for_sectoids, then it wouldn't be a problem. Well, besides needing a lot of manufacturing designs for all combinations heh.

So restricting a group of soldiers for specific crafts would help more modders than having tags directly placed on soldiers themselves then? Fair enough, I could work around this restriction, I aim to make races a meaningful strategic choice anyways, the only reason I wanted this feature to allow for any race on any ship was mainly to be less restrictive at this level of play, but it doesn't hurt going deeper.

If more people prefer craft restriction (all the way as you propose here), I'm perfectly fine transforming that request to fit that criteria for sure!

It's a good call in the end anyways since I have alien ranks (which aren't "ranks" per say but different soldiers [Transformed, just have the rank in their name+stats really]). I could prevent certain soldiers (like terror units) from crewing a small scout ship for instance with your idea, since it's basically a list of allowed soldiers. Nice catch!
Title: Re: [Suggestion] allowedSoldierType function for craft
Post by: Yankes on July 25, 2022, 02:23:34 am
Question if better option would be limit by armor type?
Image XFiles where you have submarine and only armors for underwater are allowed.
Or car where you can't fit power armor.

@Delian

Unique new tag have benefits, it make easier to maintain Cartesian cross of all crafts and solders/armors.
With simple list of types when you add new solder you need visit all crafts to update one where it could use it.
With new tag you only copy paste config from other unit.

I think it could be implemented similarly to base functions where you can create new types on the fly.
Title: Re: [Suggestion] allowedSoldierType function for craft
Post by: thusky on July 25, 2022, 07:40:15 am
Question if better option would be limit by armor type?
Image XFiles where you have submarine and only armors for underwater are allowed.
Or car where you can't fit power armor.

------

I think it could be implemented similarly to base functions where you can create new types on the fly.

That's very good news! Of course I imagine more people would need to vouch for the suggestion before it gets on the waitlist? Would that be correct?

And yes! Armor type could also be the answer as mentionned in the presentation thread, it could really be either soldier/armor or both I think.
Title: Re: [Suggestion] allowedSoldierType function for craft
Post by: Meridian on July 25, 2022, 11:01:40 am
That's very good news! Of course I imagine more people would need to vouch for the suggestion before it gets on the waitlist? Would that be correct?

I have enough good examples already.
Todolisted.
Title: Re: [Suggestion] allowedSoldierType function for craft
Post by: Delian on July 25, 2022, 11:57:08 am
it make easier to maintain Cartesian cross of all crafts and solders/armors

Maintaining it with YAML anchors is just as easy. You don't need to correct all the craft, just correct the anchor.

As for armors vs soldier types... each serve their own purpose, so I'm not sure. Deployments already have startingCondition with allowedArmors and allowedSoldierTypes. So maybe crafts could have both as well.
Title: Re: [Suggestion] allowedSoldierType function for craft
Post by: Yankes on July 25, 2022, 12:59:13 pm
Maintaining it with YAML anchors is just as easy. You don't need to correct all the craft, just correct the anchor.

As for armors vs soldier types... each serve their own purpose, so I'm not sure. Deployments already have startingCondition with allowedArmors and allowedSoldierTypes. So maybe crafts could have both as well.
Between mods and files? Yes anchors are useful in this case but this is more a workaround for problem than solution.
Title: Re: [DONE][Suggestion] Allowed soldier groups per craft
Post by: Meridian on February 10, 2024, 03:11:21 pm
Done.

https://github.com/MeridianOXC/OpenXcom/commit/3743d8e3c7e5b5408a0d5133ca6140a904a24656
Fix: https://github.com/MeridianOXC/OpenXcom/commit/1024a16db5a499f2e60f5a1cf7e9fb08a65005b9

I've been making a "Play as the aliens" mod for the past 3 weeks or so, as such I would like to force the player to only be able to have 1 alien race per craft, the feature would work like this:
Go to craft loadouts -> craft crew -> load 1 aquatoid soldier (now craft will only accept aquatoid units (soldiers/terror units)). -> Throw error message when trying to load a different race. -> Unload all  soldiers (empty craft) to accept other races again.

Sample ruleset:

crafts:
  - type: STR_TRITON
    onlyOneSoldierGroupAllowed: true

soldiers:
  - type: STR_SOLDIER_AQUATOID
    group: 10
  - type: STR_SOLDIER_GILLMAN
    group: 20
  - type: STR_SOLDIER_LOBSTERMAN
    group: 30


I would love also that addition, to have  craft by soldier type, meaning that i have issue making loyalist use heretical crafts(40k mod)

Sample ruleset:

crafts:
  - type: STR_HERETIC_CRAFT
    allowedSoldierGroups: [40, 42]

soldiers:
  - type: STR_SOLDIER_HERETIC_1
    group: 40
  - type: STR_SOLDIER_HERETIC_2
    group: 40
  - type: STR_SOLDIER_HERETIC_3
    group: 42
  - type: STR_SOLDIER_LOYALIST_1
    group: 70
  - type: STR_SOLDIER_LOYALIST_2
    group: 71

Translations:

Code: [Select]
  STR_SOLDIER_GROUP_NOT_ALLOWED: "This soldier type is not allowed onboard."
  STR_SOLDIER_GROUP_NOT_SAME: "This soldier type is not compatible with other soldiers onboard."