OpenXcom Forum

Modding => Help => Topic started by: Alex_D on October 21, 2020, 06:08:55 pm

Title: questions on fake soldiers, spawning units, and other misc. stuff
Post by: Alex_D on October 21, 2020, 06:08:55 pm
Recently, just for fun with XCF, I created a 2x2 unit that can spawn other small units during battle (link here (https://openxcom.org/forum/index.php/topic,8641.msg133134.html#msg133134)). 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.
Title: Re: questions on fake soldiers, spawning units, and other misc. stuff
Post by: Meridian on October 21, 2020, 06:11:22 pm
why do you need a fake unit?
Title: Re: questions on fake soldiers, spawning units, and other misc. stuff
Post by: Alex_D 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.
Title: Re: questions on fake soldiers, spawning units, and other misc. stuff
Post by: Meridian 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
Title: Re: questions on fake soldiers, spawning units, and other misc. stuff
Post by: Alex_D 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.

Title: Re: questions on fake soldiers, spawning units, and other misc. stuff
Post by: Meridian 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.
Title: Re: questions on fake soldiers, spawning units, and other misc. stuff
Post by: Alex_D on October 21, 2020, 09:35:26 pm
Thanks for the tip.

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