Jump to content

help tracing out playable chryssalid cocooning?


davidlallen

Recommended Posts

Thanks a lot for the help. Since the player can clearly move the PA_chryssalid, it doesn't seem that team should be confusing.

 

In my PA_Characters.uc, I have set isSoldier=true, isAlien=true. I trigger some behavior in the armory-customize screen for this, since we can't customize alien face/hair/props etc. Could this cause some confusion? I suppose "dropunit chryssalid 0" must have isSoldier=false, isAlien=false, and that works.

 

Is there like a SetTeam, which I can call, to just resolve any possible confusion?

Link to comment
Share on other sites

Okay, I think I see what's happening there. The Chryssalid is indeed on the Xcom team; it's that the X2Effect_SpawnUnit is told to look for the unit's original team by the X2Effect_ParthenogenicPoison, not its current team. The Chryssalid was apparently spawned with no controlling player, so it has no original team at the start of gamestate history. The cocoon is therefore created on eTeam_None.

 

Edit: The "dropunit" command seems to call XComAISpawnManager.CreateUnit(), which calls CreateUnitInternal(), which calls XComGameState_Unit.PostCreateInit() on the created unit, setting the initial controlling player to the player that typed the command, which must be why it works when spawning a unit with the console.

Edited by Lucubration
Link to comment
Share on other sites

That is great work, but how do I fix it? I cannot find any function like SetTeam. I can find XComGameState_Unit.uc function ETeam GetTeam, but it's native, and I can't see any variable for that. How do other recruited units, like black market hires, get the team set properly?

Link to comment
Share on other sites

I think the team is ultimately determined by the XComGameState_Unit.ControllingPlayer. We could set that, but the problem here is that as far as I can tell there is no player until we enter the tactical game, which means we can't set it initially when the unit is created. I'm going to try to override X2Effect_ParthenogenicPoison.GetTeam() to not request the original player, even though that could make things awkward if the Chryssalid gets mind controlled.

Edited by Lucubration
Link to comment
Share on other sites

No, I don't think you are. From what I can, there is no XComGameState_Player for the player until the start of a tactical game, which means that units in your barracks all have no controlling player.

 

When you launch a tactical game, the sequence of events seems to be: Create Player -> Copy Unit from Strategic to Tactical -> Assign Player as Unit.ControllingPlayer.

 

That means that all units created during the strategic game will always have no original controlling player, and so the X2Effect_ParthenogenicPoison.GetTeam() will never return the correct team for a unit that was created before the tactical game was launched.

 

I think the way around this is to use your PA_ParthenoEffect and override the GetTeam() function to not request the original team, only the current team. I just tried doing that before realizing that you no longer use the custom slash ability with the subclassed effect, so updating that class with an override didn't work out.

Edited by Lucubration
Link to comment
Share on other sites

So, "dropunit chryssalid 0" works because it explicitly sets the team right in the command. I guess we can't tell whether or not the team gets set for enemy units, but we can assume it does (somewhere) because enemy chryssalids can cocoon. If the team is really never set for friendly units, is cocooning really the only thing that fails? Nothing else relies on team being set? I wonder how conflicting teams get set in multiplayer.

Link to comment
Share on other sites

So, "dropunit chryssalid 0" works because it explicitly sets the team right in the command. I guess we can't tell whether or not the team gets set for enemy units, but we can assume it does (somewhere) because enemy chryssalids can cocoon. If the team is really never set for friendly units, is cocooning really the only thing that fails? Nothing else relies on team being set? I wonder how conflicting teams get set in multiplayer.

 

The team does get set for friendly units, just not when they're created in the strategic game. The pathenogenic poison effect specifically looks for the original controlling player when it applies; I'm not sure how many other effects do that, but probably not very many if any (maybe the Andromedon's robot phase?).

 

The Chryssalid's abilities were just created with the assumption that the unit would always be created only for the tactical game, so it would always have an original controlling player. I think that it does get set for enemy units at the start of tactical as well in the XComAISpawnManager.

 

That assumption isn't valid in your case since you create Chryssalids outside of the tactical game, so you need an effect that doesn't look for the original controlling player when spawning the cocoon.

Link to comment
Share on other sites

Potential workaround of high effort suggested by /u/fxsjosh here:

https://www.reddit.com/r/xcom2mods/comments/4c7a79/changing_a_units_team_through_effect/

For now, I will probably make a copy of all the several classes involved until I get down to the GetTeam check, and just delete that. For this to be wrong, I think you need a player chryssalid, mind controlled by a sectoid, who kills a human soldier, and then the hatchlings would incorrectly be friendly. That seems unlikely to happen in practice, and I doubt a player would complain the chryssalids should have been hostile. (Retcon: we put being friendly into their new genes!)

Edited by davidlallen
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...