Author Topic: How does OpenXcom know where to place Elerium-115 on the battlefield?  (Read 3842 times)

Offline grzegorj

  • Captain
  • ***
  • Posts: 87
  • grzegorj and Sherlock are my nicknames...
    • View Profile
    • X-COM
Long ago someone did new UFO variants for the vanilla game + XComUtil. I would like to bring them back to OpenXcom as well. There are two problems about it, however.

1. Various extra UFO maps can use different tilesets, see my other post.
2. UFO Power Source in those new UFOs is, as a rule, in a different place than it is in the basic, well-known UFO variants.

Elerium-115 is an object which should be generated on the battlefield somehow... It's location is not written in any map file, either the terrain or the alien ship, so the game must place it correctly with the help of a built-in procedure. All is right as long as we deal with either original UFOs or their slight modifications (e.g. with moved inner walls). And what if the new UFO has its power source in a different place than the basic variant? Will the game recognize it and place Elerium in the right place?

UFO:EU + XComUtils does not do it correctly, and as a result, Elerium lies on the ground in a different place than the power source is. Or, exactly speaking, it is generated in the place where the power source should be (if the UFO map was default).

I am asking about it because there is an Alien Base map with two power sources, and it is necessary to point the right place for Elerium openly, in the Ruleset. So, what is the algorithm in case of other terrains, those with an alien ship generated on the battlefield?

And another, related question. Let's say I want to make a new UFO variant with 8 power sources but with only 4 Eleriums generated on the battlefield. Is it possible?

The question seems to be important for the future of OpenXcom because in TFTD the number of Zrbite does not always correspond to the number of Ion-Beam Accelerators in the alien ship...


Offline Warboy1982

  • Administrator
  • Commander
  • *****
  • Posts: 2333
  • Developer
    • View Profile
Re: How does OpenXcom know where to place Elerium-115 on the battlefield?
« Reply #2 on: September 07, 2014, 09:23:04 am »
there's this too:
https://github.com/SupSuper/OpenXcom/blob/master/src/Battlescape/BattlescapeGenerator.cpp#L1750
which overrides any algorithmic behaviour, allowing one to define in the ruleset where items are placed.
« Last Edit: September 07, 2014, 10:32:31 am by Warboy1982 »

Offline RSSwizard

  • Commander
  • *****
  • Posts: 766
    • View Profile
Re: How does OpenXcom know where to place Elerium-115 on the battlefield?
« Reply #3 on: September 08, 2014, 02:29:31 am »
cool, so it looks for a ufo power source, and then puts a fuel object under it.

When it blows up it does 180-250 points of damage (blast radius 10 it seems).

I always give E-115 ground object alot of armor so it can survive the explosion, good to know how much it causes.

Offline grzegorj

  • Captain
  • ***
  • Posts: 87
  • grzegorj and Sherlock are my nicknames...
    • View Profile
    • X-COM
Re: How does OpenXcom know where to place Elerium-115 on the battlefield?
« Reply #4 on: September 08, 2014, 06:28:27 pm »
Clear now, thanks :)