aliens

Author Topic: How do I allow a craft to be consumed in manufacturing project? And other Qs.  (Read 9824 times)

Offline The Reaver of Darkness

  • Commander
  • *****
  • Posts: 1512
    • View Profile
I'm trying to make a manufacturing project in which an existing rental craft can be consumed along with alien alloys to produce a better version of the same craft. Of course it'll have its own separate craft designation and attributes, but will be very similar to the original. How do I get an existing craft to be usable as a part? Is there some way to maybe "repackage" the craft and have it become an inventory item rather than using hangar space and having unique attributes? If I could do that, it would also help me make my aircraft storage facility that I want to put in my mod.

Another question: how do I get the names of things to show up correctly? For example, instead of STR_GUARDIAN_TANK_CANNON I want it to say Guardian Tank w/ Cannon.

Third question: Can I assign the damage to the tank instead of the ammo? It would save a lot of list space if each different cannon tank could use the same cannon rounds.

edit 22 Mar 2020: Aircraft can now be consumed in manufacturing projects as well as being sold for money, and items in stores can have a rental fee, all in Open X-Com Extended (OXCE).
« Last Edit: March 22, 2020, 01:33:02 pm by The Reaver of Darkness »

Offline ivandogovich

  • Commander
  • *****
  • Posts: 2381
  • X-Com Afficionado
    • View Profile
    • Ivan Dogovich Youtube
How do I get an existing craft to be usable as a part?

Not sure.  Items can be consumed, but not sure about craft.
Maybe something like this?
Code: [Select]
  - name: STR_SKYTROOPER
    category: STR_CRAFT
    requires:
      - STR_SKYTROOPER
    space: 40
    time: 8000
    cost: 600000
    requiredItems:
      STR_ALIEN_ALLOYS: 110
      STR_SKYRANGER
    listOrder: 3201


Another question: how do I get the names of things to show up correctly? For example, instead of STR_GUARDIAN_TANK_CANNON I want it to say Guardian Tank w/ Cannon.

Extra Strings:
Code: [Select]
- type: en-GB
    strings:
      STR_GUARDIAN_TANK_CANNON: Guardian Tank w/ Cannon

Third question: Can I assign the damage to the tank instead of the ammo? It would save a lot of list space if each different cannon tank could use the same cannon rounds.

Check out the Laser Tank in the base ruleset. It doesn't use ammo.

Offline Falko

  • Commander
  • *****
  • Posts: 802
    • View Profile
using crafts a manufacture material is not possible

Offline The Reaver of Darkness

  • Commander
  • *****
  • Posts: 1512
    • View Profile
Not sure.  Items can be consumed, but not sure about craft.
Maybe something like this?
Code: [Select]
  - name: STR_SKYTROOPER
    category: STR_CRAFT
    requires:
      - STR_SKYTROOPER
    space: 40
    time: 8000
    cost: 600000
    requiredItems:
      STR_ALIEN_ALLOYS: 110
      STR_SKYRANGER
    listOrder: 3201
I tried that first, but it didn't work as I expected. Interceptor-1 isn't quite the same thing as "an interceptor". I thought of trying removing their number tags but it might break something else and I assume it probably won't work.



using crafts a manufacture material is not possible
I guarantee you it is possible, though not necessarily with YAML rulesets.

Offline Falko

  • Commander
  • *****
  • Posts: 802
    • View Profile
I guarantee you it is possible, though not necessarily with YAML rulesets.
you talk a lot without giving any substantial backup to your claims
yes you someone could add it in the code but currently its not in there so its not possible

Offline The Reaver of Darkness

  • Commander
  • *****
  • Posts: 1512
    • View Profile
I just don't like a defeatist attitude. I wouldn't mind you saying it probably won't happen, but you shouldn't say it is impossible when you don't know that for certain.

Offline Falko

  • Commander
  • *****
  • Posts: 802
    • View Profile
i said one can implement it
but for now it is impossible!
and i know because
https://github.com/SupSuper/OpenXcom/blob/2ee614e6258a7001753dcefb8575cdac5568affe/src/Savegame/Production.cpp#L207
Code: [Select]
for(std::map<std::string,int>::const_iterator iter = _rules->getRequiredItems ().begin (); iter != _rules->getRequiredItems ().end (); ++iter)
{
b->getItems ()->removeItem(iter->first, iter->second);
}
thats the code for the ITEM consumption during manufacture there is no CRAFT stuff in there

if you say you meant "I guarantee you it is possible" in a way somebody can implement it perhaps some day
then using "possible" in that sense (without context ) would  be quite useless then i could say a gazillion things are "possible" in openxcom (voice control, 3d space shooter while flying to mars, if you press this button 100 bucks appear in your RL-account ( hey i only need to find a billionaire to support me - the button i  programm myself .. but its possible!...) ,..)

Offline The Reaver of Darkness

  • Commander
  • *****
  • Posts: 1512
    • View Profile
Third question: Can I assign the damage to the tank instead of the ammo? It would save a lot of list space if each different cannon tank could use the same cannon rounds.
Check out the Laser Tank in the base ruleset. It doesn't use ammo.
Thanks, I guess it was pretty obvious after all. I just took the power attribute off the ammo and put it on the tank instead, and it worked of course. :P

Offline The Reaver of Darkness

  • Commander
  • *****
  • Posts: 1512
    • View Profile
if you say you meant "I guarantee you it is possible" in a way somebody can implement it perhaps some day
then using "possible" in that sense (without context ) would  be quite useless then i could say a gazillion things are "possible" in openxcom (voice control, 3d space shooter while flying to mars, if you press this button 100 bucks appear in your RL-account ( hey i only need to find a billionaire to support me - the button i  programm myself .. but its possible!...) ,..)
There may be a way around it. Just because a specific path doesn't work, it doesn't mean the end goal is not achievable.

Right now I am toying with the idea that the craft can be swapped with an item version of it. I have successfully made an item version of the craft, but that was the easy part. Now I need to find a way to allow one to be swapped for the other in-game.

Offline Arthanor

  • Commander
  • *****
  • Posts: 2488
  • XCom Armoury Quartermaster
    • View Profile
I think what Falko is trying to say is that there is no "modding" way of doing what you want with crafts.

As it is currently hard coded in the OpenXCom C++ codes, manufacturing can only consume items. Since a craft is not an item, manufacturing cannot consume a craft, no matter how you approach the problem within the current possibilities offered by the ruleset.

Of course, if you want to make your one version of the C++ code that allows crafts to be consumed in manufacturing, then it is possible. But that would be creating your own version/branch of OpenXCom, and would essentially not be OpenXCom anymore since it would use different C++ code.

There is a realm of the possible that encompasses pretty much everything we could dream of, a subset of that is the realm of everything possible to modders as currently supported by OpenXCom. Unfortunately, what you want to do with crafts is within the former but not the latter. Either make it happen using C++, going beyond what is possible for modders into what is possible to coders, or it is indeed impossible.

TL;DR: "I want to use the ruleset and make manufacture take a craft as a component" is impossible. "I want to go and change the OpenXCom C++ code to make manufacture take a craft as a component" is possible, but much more work and not really considered modding since it tampers with the executable instead of its ruleset.

I think your best alternative as a modder would be to increase the price by 600k, and the time by 72 hours (the ordering price and delivery time of an interceptor), to represent ordering a brand new interceptor and modifying it as soon as it arrives.

Offline The Reaver of Darkness

  • Commander
  • *****
  • Posts: 1512
    • View Profile
Re: How do I allow a craft to be consumed in manufacturing project? And other Qs.
« Reply #10 on: September 17, 2014, 07:26:52 am »
What if I just make a way to change your craft into an item version of itself? I already made a Punisher item and gave it a purchase price. Then I sold my Punisher craft and bought a Punisher item. Now I just want some way to allow the Punisher craft to be swapped with the Punisher item without having to resort to purchasing and selling, and ultimately waiting for it to arrive while taking a net loss in funds before you even start the manufacturing process.

Offline The Reaver of Darkness

  • Commander
  • *****
  • Posts: 1512
    • View Profile
Re: How do I allow a craft to be consumed in manufacturing project? And other Qs.
« Reply #11 on: September 17, 2014, 09:14:22 am »
Thanks, I guess it was pretty obvious after all. I just took the power attribute off the ammo and put it on the tank instead, and it worked of course. :P

Actually it didn't work. I forgot to remove the power attribute from the ammunition, and it was using that. Once I removed the power from the ammunition, the weapon took on a power of 0 and didn't do any damage, although it would fire and use up ammo. Apparently the power rating on the tank only works if the tank doesn't use any type of ammo? That's my best guess anyway.

Offline ivandogovich

  • Commander
  • *****
  • Posts: 2381
  • X-Com Afficionado
    • View Profile
    • Ivan Dogovich Youtube
Re: How do I allow a craft to be consumed in manufacturing project? And other Qs.
« Reply #12 on: September 17, 2014, 04:58:09 pm »
This is how I have my scout drone set up. Fixed weapon may be the key.

Code: [Select]
  - type: STR_SCOUT_DRONE
    size: 6
    costBuy: 80000
    costSell: 40000
    transferTime: 72
    weight: 10
    bigSprite: 109
    bulletSprite: 8
    fireSound: 88
    hitSound: 13
    hitAnimation: 26
    power: 40
    damageType: 9
    blastRadius: 3
    maxRange: 3
    accuracySnap: 100
    tuSnap: 20
    battleType: 1
    arcingShot: true
    fixedWeapon: true
    clipSize: -1
    invWidth: 2
    invHeight: 3
    listOrder: 1098

Offline The Reaver of Darkness

  • Commander
  • *****
  • Posts: 1512
    • View Profile
Re: How do I allow a craft to be consumed in manufacturing project? And other Qs.
« Reply #13 on: September 18, 2014, 12:27:42 am »
Yeah, it's not using any ammo.

I just went ahead and made them take different kinds of ammo. It takes up a lot of space on the purchase list but at least I can set different prices for different types of ammo.

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11721
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: How do I allow a craft to be consumed in manufacturing project? And other Qs.
« Reply #14 on: September 21, 2014, 10:59:53 am »
I'd like a space shooter on my way to Mars, or better yet, something like FTL. :P