Author Topic: Alien side  (Read 5360 times)

Offline Grober Nitho

  • Sergeant
  • **
  • Posts: 18
    • View Profile
Alien side
« on: March 28, 2023, 05:08:58 am »
There is a little snag with Chryssalids. If I use **zombieUnit:** it creates an enemy zombie, and after the zombie dies it becomes an enemy Chryssalid, but it works fine. The Chrissalid is under the control of the player, like all other aliens. This is the alien side. If I use **spawnUnit:** then everything is fine except that it creates a new zombie after every attack, it also hits the tank 3 times before destroying it once, but it creates 2 zombies from the tank. Sometimes it also creates 2-3 zombies from the unit before it kills it.
**spawnUnitFaction: 0**- this pairs well with **spawnUnit**. Does **zombieUnit** happen to have a similar counterpart?

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9084
    • View Profile
Re: Alien side
« Reply #1 on: March 28, 2023, 09:25:11 am »
There is a little snag with Chryssalids. If I use **zombieUnit:** it creates an enemy zombie, and after the zombie dies it becomes an enemy Chryssalid, but it works fine. The Chrissalid is under the control of the player, like all other aliens. This is the alien side. If I use **spawnUnit:** then everything is fine except that it creates a new zombie after every attack, it also hits the tank 3 times before destroying it once, but it creates 2 zombies from the tank. Sometimes it also creates 2-3 zombies from the unit before it kills it.

Can we get a link to download the mod and a test save to debug the issues?

**spawnUnitFaction: 0**- this pairs well with **spawnUnit**. Does **zombieUnit** happen to have a similar counterpart?

No, there is no classic ruleset attribute for that, zombies always spawn as hostile.

I see there is a Y-script method to be able to change the zombie faction, but I don't think it is usable in this context... maybe Yankes can clarify.

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3349
    • View Profile
Re: Alien side
« Reply #2 on: March 28, 2023, 11:41:00 am »
Yes, script have option to override faction of spawned unit (type and chance too), but for pure ruleset solution there is none, all is hardocded to "hostile".
But I do think that we could add config for this too, as it will play well with scripts and have similar capabilities spawning units on explosions.

Offline Grober Nitho

  • Sergeant
  • **
  • Posts: 18
    • View Profile
Re: Alien side
« Reply #3 on: March 28, 2023, 05:37:54 pm »
Can we get a link to download the mod and a test save to debug the issues?

No, there is no classic ruleset attribute for that, zombies always spawn as hostile.

I see there is a Y-script method to be able to change the zombie faction, but I don't think it is usable in this context... maybe Yankes can clarify.
The game doesn't crash. With the help of Skyhawk, it was managed to make the new Chryssalid created after the zombie's death be friendly in addition to the "spawnUnit:" command. The zombie will be friendly by default. It is true that the Chrysalid created after the zombie's death will lose its ability to control the mind or cause panic, because it will be of the "Unit" category and not of the "Soldier" category, and the ability to use the weapon built into the armor will be taken away. Also thanks to Skyhawk, as soon as the new unit is created, it can be used immediately, and you don't have to wait for the next turn. In any case, I am attaching a zip file, you don't need a saved game, any impromptu battle will do, but according to the basic rules of the mode, it is mandatory that the battle be on land, because the Chrysalid cannot exist underwater, its weaponry does not work. I would have liked not only the weapon to be unusable underwater, but also the unit itself to become completely unusable underwater, but this is one of those things that I couldn't solve. In addition, there are no projectile animations, and there are no stun gun animations either, the sounds have not been put back in yet, I haven't gotten there yet, but the sounds are finally there. This will work roughly the way I want it to. But it would be nice if there was a way to prevent the tank from becoming a zombie, and all other weapons would be destroyed immediately, regardless of the strength of the armor, and only 1 zombie would be created instead. However, there is one exception, armor that is specially developed against Chryssalid attacks, it is immune to it from the start and works well.
« Last Edit: March 28, 2023, 07:56:46 pm by Grober Nitho »

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9084
    • View Profile
Re: Alien side
« Reply #4 on: March 28, 2023, 05:59:23 pm »
I cannot access Discord.

Please upload somewhere else... you can also just attach a zip file here on the forum.

Offline Grober Nitho

  • Sergeant
  • **
  • Posts: 18
    • View Profile
Re: Alien side
« Reply #5 on: March 28, 2023, 08:00:03 pm »
I cannot access Discord.

Please upload somewhere else... you can also just attach a zip file here on the forum.
I hope will work. But this is the spawnUnit version with little fixing. The other way is making hostile zombies and after die the hostil zombie become hostil Chrys.

Offline skyhawk

  • Colonel
  • ****
  • Posts: 115
    • View Profile
Re: Alien side
« Reply #6 on: March 28, 2023, 09:11:36 pm »
I took a stab at this, because I was interested in if I could work-around the limitation via y-script. And I couldn't find a way to do it.

If I may make a suggestion, I don't think it will break anything (At least nothing vanilla) if you make Zombies belong to the faction of the zombifying unit (Chryssalid).

Alternatively, if you allow y-script to change the faction of a new unit during createUnit then y-script can work around this limitation. You're already halfway there, what with BattleUnit.getFaction and BattleUnit.getOriginalFaction. The hooks for altering the zombie spawn behavior are already there. I think we just need a BattleUnit.setFaction

But I'm sure there's more complexity under the hood than I'm aware of.
« Last Edit: March 28, 2023, 09:17:11 pm by skyhawk »

Offline Grober Nitho

  • Sergeant
  • **
  • Posts: 18
    • View Profile
Re: Alien side
« Reply #7 on: March 28, 2023, 09:40:42 pm »
Essentially I want to make minimal changes to the game, but stay as close to the vanilla version as possible. The primary goal is not to make a unit more than one zombie, so the unlucky unit should die the first one hit by the Chryssalid, the tank should die too, but it should not be a zombie. Is the zombieImmun a good solution in case the zombieUnit doesn't work out after all? The secondary goal is to not only make the weapon not work underwater, which I told the game could only be used in land actions, but also to make the units that are banned underwater not be able to move.

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3349
    • View Profile
Re: Alien side
« Reply #8 on: March 28, 2023, 10:54:14 pm »
I took a stab at this, because I was interested in if I could work-around the limitation via y-script. And I couldn't find a way to do it.

If I may make a suggestion, I don't think it will break anything (At least nothing vanilla) if you make Zombies belong to the faction of the zombifying unit (Chryssalid).

Alternatively, if you allow y-script to change the faction of a new unit during createUnit then y-script can work around this limitation. You're already halfway there, what with BattleUnit.getFaction and BattleUnit.getOriginalFaction. The hooks for altering the zombie spawn behavior are already there. I think we just need a BattleUnit.setFaction

But I'm sure there's more complexity under the hood than I'm aware of.
What limitation? I said explicitly that zombie unit is faction IS overridable by scripts, you have exposed all needed function to control all aspect of it used by OXCE.

And for changing faction after unit is created, answer is short: No, there will not be functionality as is would only ask for breaking some fundamental aspect of hanging battle state and unit recovery.

Offline Grober Nitho

  • Sergeant
  • **
  • Posts: 18
    • View Profile
Re: Alien side
« Reply #9 on: March 28, 2023, 11:47:19 pm »
spawnUnit: STR_ZOMBIE
    spawnUnitFaction: 0
This form works fine, it does about what I want it to do, but it does it wrong.
zombieUnit: STR_ZOMBIE
    spawnUnitFaction: 0
This one does perfectly what I would expect from the previous one, but my problem with this form is that the zombie becomes hostile. Well I should make the zombie not be hostile, but unfortunately I'm stupid for scripts.

Offline skyhawk

  • Colonel
  • ****
  • Posts: 115
    • View Profile
Re: Alien side
« Reply #10 on: March 29, 2023, 03:19:30 am »
What limitation? I said explicitly that zombie unit is faction IS overridable by scripts, you have exposed all needed function to control all aspect of it used by OXCE.

The player Chryssalid kills an enemy unit to make a zombie (zombieUnit:). As Meridian stated above, this zombie is *hard-coded* to be hostile. Y-script can make the Chryssalid that spawns when the zombie *dies* be friendly. But it can't make the zombie itself friendly.

  • Player Chryssalid kills an enemy unit, creating a zombie
  • That zombie is enemy-controlled <-- y-script cannot fix this
  • When that zombie dies, it will spawn a new Player Chryssalid
  • That new Player Chryssalid will be enemy-controlled <-- y-script can fix this

Offline Grober Nitho

  • Sergeant
  • **
  • Posts: 18
    • View Profile
Re: Alien side
« Reply #11 on: March 30, 2023, 08:01:48 pm »
I have an alternative solution to the problem. Use the **spawnUnit** command instead of **zombieUnit**, but I need some information about the **zombieImmune** command, what it does exactly, and how to make it so that all armor is knocked over by the Chryss except the armor that is immune to it and the victim dies instantly from the first hit regardless of the armor. This guarantees that a unit will never be more than one zombie.

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3349
    • View Profile
Re: Alien side
« Reply #12 on: March 30, 2023, 08:59:06 pm »
The player Chryssalid kills an enemy unit to make a zombie (zombieUnit:). As Meridian stated above, this zombie is *hard-coded* to be hostile. Y-script can make the Chryssalid that spawns when the zombie *dies* be friendly. But it can't make the zombie itself friendly.

  • Player Chryssalid kills an enemy unit, creating a zombie
  • That zombie is enemy-controlled <-- y-script cannot fix this
  • When that zombie dies, it will spawn a new Player Chryssalid
  • That new Player Chryssalid will be enemy-controlled <-- y-script can fix this
Based on what you say this? Whole point of exposing zombification to y-scripts was to allow for changing faction of spawned zombi.

Offline Grober Nitho

  • Sergeant
  • **
  • Posts: 18
    • View Profile
Re: Alien side
« Reply #13 on: March 30, 2023, 09:43:30 pm »
Based on what you say this? Whole point of exposing zombification to y-scripts was to allow for changing faction of spawned zombi.
Can you help me for that? I'm not programmer, the y-script is not my experience. The spawn unit was simply without y-script, but zombie unit not know how possible making that.

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3349
    • View Profile
Re: Alien side
« Reply #14 on: March 30, 2023, 10:18:13 pm »
Based on what you say this? Whole point of exposing zombification to y-scripts was to allow for changing faction of spawned zombi.
correction on my side, I mix up two cases, when you manually crate zombie and when you use default `zombieUnit:`, because of order of operation you indeed can't intercept default behavior to get zombie on your side.

But, if you make fully manual zombie by scripts (using in y-script `setSpawnUnit`, `setSpawnUnitInstantRespawn` and `setSpawnUnitFaction`) control all behaviors of spawning zombie.

For example https://openxcom.mod.io/hatching-chryssalids-and-tentaculats of functionality I had in mind.