Author Topic: questions on fake soldiers, spawning units, and other misc. stuff  (Read 3340 times)

Offline Alex_D

  • Colonel
  • ****
  • Posts: 498
    • View Profile
Recently, just for fun with XCF, I created a 2x2 unit that can spawn other small units during battle (link here). The problem is with the armor of said spawned units. To be playable, I had to insert a fake unit for the armor, a unit that I know cannot be used in-game, or so I thought.
Code: [Select]
armors:
- type: STR_XCOM_CYBERMITE_ARMOR
#snip
    units:
      - STR_FAKE_SOLDIER

soldiers:
  - type: STR_FAKE_SOLDIER  #fake soldier to avoid armours of spawned units to equip to all other soldiers, data copied from AI
    requires:
      - STR_TROLLIUM

The problem arose when I wanted a quick battle thing.  Although the game launched, it crashed when I tried to play. The game was adding these fake soldiers to the roster for the mission. I then needed to add more attributes to the fake soldier to make it "playable":

Code: [Select]
soldiers:
  - type: STR_FAKE_SOLDIER
    #fake soldier to avoid armours of spawned units to equip to all other soldiers, data copied from AI
    requires:
      - STR_TROLLIUM
    minStats:
      tu: 62
      stamina: 92
      health: 20
      bravery: 110
      reactions: 64
      firing: 0
      throwing: 0
      strength: 30
      psiStrength: 100
      psiSkill: 0
      melee: 60
      mana: 100
    maxStats:
      tu: 62
      stamina: 92
      health: 20
      bravery: 110
      reactions: 64
      firing: 0
      throwing: 0
      strength: 30
      psiStrength: 100
      psiSkill: 0
      melee: 60
      mana: 100
    statCaps:
      tu: 62
      stamina: 92
      health: 20
      bravery: 110
      reactions: 64
      firing: 0
      throwing: 0
      strength: 30
      psiStrength: 100
      psiSkill: 0
      melee: 60
      mana: 100
    armor: STR_XCOM_CYBERMITE_ARMOR
    armorForAvatar: STR_XCOM_CYBERMITE_ARMOR
    #soldierNames:
    #  - "Do not use"
    femaleFrequency: 0
    allowPromotion: false
    flagOffset: 888

My first question is if there is a better way to do this.
My second question, where I know the answer may be no, is if there is a way to let said spawned unit appear mid-air, either via some ruleset code or via scripts.

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9098
    • View Profile
Re: questions on fake soldiers, spawning units, and other misc. stuff
« Reply #1 on: October 21, 2020, 06:11:22 pm »
why do you need a fake unit?

Offline Alex_D

  • Colonel
  • ****
  • Posts: 498
    • View Profile
Re: questions on fake soldiers, spawning units, and other misc. stuff
« Reply #2 on: October 21, 2020, 06:53:18 pm »
why do you need a fake unit?

The fake soldier unit, I believe it's to make the armor available to the spawned unit. This is in addition to the NPC unit that is created for playing.

I attach the ruleset in question for convenience.

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9098
    • View Profile
Re: questions on fake soldiers, spawning units, and other misc. stuff
« Reply #3 on: October 21, 2020, 07:10:25 pm »
why not just disable the armor by research?

Code: [Select]
  - type: STR_XCOM_CYBERMITE_ARMOR
    requires: STR_TROLLIUM

Offline Alex_D

  • Colonel
  • ****
  • Posts: 498
    • View Profile
Re: questions on fake soldiers, spawning units, and other misc. stuff
« Reply #4 on: October 21, 2020, 09:15:02 pm »
I believe, that's what I tried to implement. STR_TROLLIUM is/was a way in XCF to not being able to research certain items that require a research topic.

I wanted to show something on the ufopaedia when doing a MMB. I know research and the pedia are kind of separate.

My understanding of the ruleset is if I don't specify the research of the armor then the game will make it available since the beginning and if no soldier is specified, then it will apply to all types of soldiers. So STR_FAKE_SOLDIER is in my mind equivalent to STR_TROLLIUM, except for that during quick battle, the game will attempt to generate roster with them.


Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9098
    • View Profile
Re: questions on fake soldiers, spawning units, and other misc. stuff
« Reply #5 on: October 21, 2020, 09:20:36 pm »
My understanding of the ruleset is if I don't specify the research of the armor then the game will make it available since the beginning and if no soldier is specified, then it will apply to all types of soldiers. So STR_FAKE_SOLDIER is in my mind equivalent to STR_TROLLIUM, except for that during quick battle, the game will attempt to generate roster with them.

Basically yes.

So the same question still stands, why do you want to use a more complicated option that even has an unwanted side effect and no advantages? :)

You were asking if there was a better way to do it... so I suggested blocking by research, which was practically made for this purpose.
« Last Edit: October 21, 2020, 09:22:38 pm by Meridian »

Offline Alex_D

  • Colonel
  • ****
  • Posts: 498
    • View Profile
Re: questions on fake soldiers, spawning units, and other misc. stuff
« Reply #6 on: October 21, 2020, 09:35:26 pm »
Thanks for the tip.

I'll try again this evening once I arrive home.