Multiple Same-Faction Sides and the Neutral Side

Started by Ty294, May 21, 2020, 11:52:05 AM

Previous topic - Next topic
Hey all, so in the process of experimenting in the LUA in a (vain) effort to try and have icon-less factions, I discovered something that I'm not entirely sure other people know of or not. I could be wrong, and this could be something that has been common knowledge for years and I just haven't seen it yet (I tried searching and checking through the tutorial guide and didn't see anything on the matter though), so if you guys know this all, just stop reading and tell me to shut up. lol

So, I found myself interested in the information provided by this post by Dark_Phantom, namely the existence of a "neutral" faction. I began doing some experimenting, and discovered a few interesting things that could and should be useful to people (at the least, to myself, if everyone else already knows these things).

Multiple Mainline Teams

As indicated in Phantom's post, the factions listed in the hardcode are the only ones the game recognizes, anything else defaults to the "local" (yellow) faction. In addition, although you have separate listings of "all" and "alliance", "rep" and "republic", "imp" and "empire", these two variants function interchangeably and don't appear to be separate in any way. Therefor, in effect, there are six "factions" as defined by the game:


  • All/Alliance
  • CIS
  • Imp/Empire
  • Rep/Republic
  • Locals
  • Neu/Neutral

Now we all know that you can have multiple local factions, and we further know that you can set teams 3, 4, 5 etc as being one of the off-era mainline factions. But I found it is also entirely possible to use a mainline faction multiple times. For example, let's say you wanted three different clone trooper legions fighting against the seps. You could set your teams 3 and 4 to both pull "Republic" instead of local:

--      2nd Legion Stats
    SetTeamName(3, "republic")
    SetTeamIcon(3, "rep_icon")
    AddUnitClass(3, "rep_inf_clone_trooper",10)
    AddUnitClass(3, "rep_inf_arc_trooper",1)
    AddUnitClass(3, "rep_inf_clone_pilot",2)
    AddUnitClass(3, "rep_inf_clone_sharpshooter",2)
    AddUnitClass(3, "rep_inf_jet_trooper",1)
--    SetHeroClass(3, "rep_inf_macewindu")
    SetUnitCount(3, 16)
    SetTeamAsEnemy(3, ATT)
    SetTeamAsFriend(3, DEF)
     

--      3rd Legion Stats
    SetTeamName(4, "republic")
    SetTeamIcon(4, "rep_icon")
    AddUnitClass(4, "rep_inf_clone_trooper",10)
    AddUnitClass(4, "rep_inf_arc_trooper",1)
    AddUnitClass(4, "rep_inf_clone_pilot",2)
    AddUnitClass(4, "rep_inf_clone_sharpshooter",2)
    AddUnitClass(4, "rep_inf_jet_trooper",1)
--    SetHeroClass(4, "rep_inf_macewindu")
    SetUnitCount(4, 16)
    SetTeamAsEnemy(4, ATT)
    SetTeamAsFriend(4, DEF)


NOTE: This does mean if you give teams 3 and 4 their own CPs, they will wind up "capturing" them for main republic faction (DEF in this case) since their designation as "friend" of DEF makes them subservient. There are ways around that of course, such as untakable CPs, invisible ones, or just attaching them to the same CPs as the main republic faction.

Anyway, back to the main point...

The SetTeamName(4, "republic") line is the key. You could actually take one of the main two factions and simply swap out the name in the quotations to any other faction, regardless of what is before it, and it will load the faction in the quotations. For example:

--      Alliance Stats
    SetTeamName(ALL, "Alliance")
    SetTeamIcon(ALL, "all_icon")
    AddUnitClass(ALL, "all_inf_soldierdesert",10)
    AddUnitClass(ALL, "all_inf_vanguard",1)
    AddUnitClass(ALL, "all_inf_pilot",2)
    AddUnitClass(ALL, "all_inf_marksman",2)
    AddUnitClass(ALL, "all_inf_smuggler",1)
    SetHeroClass(ALL, "all_inf_lukeskywalker")

--      Imperial Stats
    SetTeamName(IMP, "Alliance")
    SetTeamIcon(IMP, "imp_icon")
    AddUnitClass(IMP, "imp_inf_storm_trooper",10)
    AddUnitClass(IMP, "imp_inf_shock_trooper",1)
    AddUnitClass(IMP, "imp_inf_pilottie",2)
    AddUnitClass(IMP, "imp_inf_scout_trooper",2)
    AddUnitClass(IMP, "imp_inf_dark_trooper",1)
    SetHeroClass(IMP, "imp_inf_darthvader")


Despite the fact that the imperial side has "imp," before the word "Alliance", it will load in as a rebel faction, with the rebel logo and rebel localization (and VO). In this particular case, the "imp" is really just the designation that the LUA has been given. You could take that same faction and replace every line of "IMP," with "WOK" and it would function the same, provided you changed the line at the top to reflect it:

    local ALL = 1
    local WOK = 2


You'd also need to replace IMP in the VO's below for them to work right. That's really more if you're into neatness though, you could simply leave everything as IMP, but all you really have to do is replace "Empire" with "Alliance" or "All" in the quotations slot, and it will change the nature of the faction.

Regardless, this is a nice way to supplement one of the main factions with additional soldiers that are localized the same way as that faction. I can see it being used similarly to how Sereja usually has extras like Imperial probe and torture droids, or Rebel R2 units, following alongside the main faction. In his case, they are locals, but this is a way you can define them as being rebel or imperial, so when they are killed they will use those factions' localization instead.

There is one potential shortcoming, a minor one, but still one that is annoying to perfectionists like me. So, say we have our three Republic factions, if one of the non-player ones loses a CP, it will be reported to the player by the announcer as though it was their faction losing the CP. This applies whether those republic factions are friendly, neutral or hostile toward the player's faction; it will simply happen regardless. In effect, the Republic VO will apply to any Republic faction for any Republic Faction's action. I have not attempted to test messing around with the announcer lines in the LUA though, so it is maybe possible to override this somehow, but for the moment I'm going to assume it's bound to the hard-coded faction and not the LUA-defined "side".

The Neutral Side

Now, as I said above, there are 6 factions you can call upon. Neutral, or Neu, as it turns out, is a viable faction that is mostly functional in-game. It does not have an icon (which is where I briefly had high-hopes that it could be used as a non-local alternative to the mainline factions) and behaves similarly to the four mainlines (green for player/allies, red for enemies, white if neutral). It can in fact be loaded in as the player faction as well. It is also partially supported by localization, meaning you can go in and under "common>sides>neu>firstnames/lastnames" you can set names for the soldiers serving for this faction. By default, they are unlocalized, and thus have Imperial Stormtrooper-style designations (two letters and three numbers). Because they are unlocalized though, you to override them with as many or as few designations as you want.

However, the neutral faction has two major weaknesses. The first is, as I implied, the localization is only partial. I cannot get it to accept a faction name, even if I set it up the same way as every other faction. It will always show up in-game as "undefined". The other problem is that, if it is loaded as one of the playable factions, it will run just fine throughout a match, but once the match ends and attempts to go to the stats page, the game will crash. There is no crash risk if it is team 3, 4, 5 etc. But it will crash if it is team 1 or 2.

In essence, the "neutral" or "neu" faction can be used as an "extra" local faction, but primarily as one that does not capture or hold and CPs for itself (unless someone can figure out what is missing on the localization front). It can be used, much like the doubled-up mainline factions as I outlined above, as a supplemental side that spawns via invisible/untakable CPs, or alongside one of the main sides. I can see it as being potentially quite useful in that capacity.




Well, that's what I got. Hopefully I explained it cohesively enough for people to understand. If you guys know all this already, then I'm sorry for wasting your time, and even more for wasting my own! :XD: But if this is something that hasn't really gotten any attention, I hope it can be of use to someone!

Nice research!  I think there had been some research into this topic but it had not been detailed out like this.  I have only a few comments to add:


  • I'm not sure how vehicle initialization will work for team 3/4/5/6/7 if they are one of the 4 main factions
  • There is a max of 8 teams.  Teams 0-7, however team 0 is inaccessible (though you can successfully assign units to it). My uneducated reasoning says that is only there for a truly neutral cp (which is assigned to team 0), and therefore cannot support spawning. This may be related to the neu/neutral crash.
  • If you want one of the local teams to be "truly neutral", you can use SetTeamAsNeutral, just like SetTeamAsFriend and SetTeamAsEnemy.  I use this command successfully in my map Kashyyyk: Recovery to avoid ally spawn limits while also still having them as an "ally", but can also be for true neutral teams.
  • Much of the VO stuff is hard-coded to ATT/DEF_Teamname, so if team 3 or 4 is the same team name, I'm not sure you can work around that.
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.

I've used multiple empire teams allied to each other to increase total apparent AI count.  It is also fun to set them to enemies as well  ;)
Quote from: Abraham Lincoln. on November 04, 1971, 12:34:40 PM
Don't believe everything you read on the internet

Quote from: Dark_Phantom on May 21, 2020, 12:48:56 PM

  • I'm not sure how vehicle initialization will work for team 3/4/5/6/7 if they are one of the 4 main factions

As wsa30h pointed out to me, you would need to create a custom vehicle spawner with just the faction name "empire", "CIS", "all" etc but without the "ATK" or "DEF". I have not tested it yet, but it stands to reason you should be able to likewise add a "neu" or "neutral" designation to spawn vehicles for the neutral team.

I'd have to do some testing to determine if it is possible to separate multiple teams using the same faction.

Quote from: Dark_Phantom on May 21, 2020, 12:48:56 PM

  • Much of the VO stuff is hard-coded to ATT/DEF_Teamname, so if team 3 or 4 is the same team name, I'm not sure you can work around that.

That would seem to confirm what I suspect. I don't think that would be a huge issue for most maps, unless someone was attempting to create a "civil war" type map where two of the same faction were fighting each-other (like what LED mentioned). In which case maybe just removing the VO would be plausible, or replacing it with a custom one that is more generic "a command post has been lost" instead of "we are losing a command post".

Quote from: Dark_Phantom on May 21, 2020, 12:48:56 PM

  • There is a max of 8 teams.  Teams 0-7, however team 0 is inaccessible (though you can successfully assign units to it). My uneducated reasoning says that is only there for a truly neutral cp (which is assigned to team 0), and therefore cannot support spawning. This may be related to the neu/neutral crash.

Possibly. But while team 0 can't spawn, the neu/neutral faction can (as long as it is designated for teams 1-7), so there is some separation between the two in some way.

I tend to suspect that whatever element is missing that prevents it from being localized is also related to the crash. Something that fails to validate it as a full faction, thus not giving it whatever line of code is necessary to give it a name in the localization, and maybe that failure to pull in the name is also why the stats screen cannot handle it.

beware that putting just the name into the vehicle spawner without the atk or def will make the game ignore anything typed under the def and atk fields of those factions.
mods and maps in progress:<br />--Bf1 expanded edition 3.0 version
-- bf1 tcw battles
-- bf1 seasons mod season 1
-- bf2 expanded edition tbh