OpenXcom Forum

OpenXcom => Open Feedback => Topic started by: jackstraw2323 on January 28, 2015, 04:36:50 pm

Title: Hard Coded Alien Mission Races
Post by: jackstraw2323 on January 28, 2015, 04:36:50 pm
Is there a way to unset the hard coded alien races? I have deleted the floater race from aliens, and not used it in my alien missions file, but the game is crashing on a terror mission because it's still trying to place them. If I remove the deletion and set to a 0% encounter the game doesn't crash, but the floaters appear even though I haven't defined them. Or do I need to run a delete on all alien missions before defining? I'm assuming there's a workaround because TFTD has different aliens, unless the plan is to reuse the strings for the race names, which I can do but feels wrong.
Title: Re: Hard Coded Alien Mission Races
Post by: Shoes on January 28, 2015, 04:48:22 pm
I don't have much experience with this, but what if instead of deleting, you replaced them? Mod in a "new" race of sectoids and replace the floaters with them.
Title: Re: Hard Coded Alien Mission Races
Post by: Hobbes on January 28, 2015, 05:10:07 pm
Is there a way to unset the hard coded alien races? I have deleted the floater race from aliens, and not used it in my alien missions file, but the game is crashing on a terror mission because it's still trying to place them. If I remove the deletion and set to a 0% encounter the game doesn't crash, but the floaters appear even though I haven't defined them. Or do I need to run a delete on all alien missions before defining? I'm assuming there's a workaround because TFTD has different aliens, unless the plan is to reuse the strings for the race names, which I can do but feels wrong.

I think you need to run a delete, otherwise the settings for the Floaters remain loaded into the game.
Title: Re: Hard Coded Alien Mission Races
Post by: jackstraw2323 on January 28, 2015, 05:18:43 pm
I tried a delete on the terror mission followed by my declaration, but that seemed not to work. Barring a proper mechanism I'll have to reuse the floaters as my container race. Not a deal breaker, but messier than I like. May play around with deletions a bit more first just to 100% confirm. Maybe it chained together from a terror ship? Since I didn't delete those I suppose it's possible that the default array still has floaters listed. I ran into this same issue for the first encounter which seems hard wired for sectoids, so there I ended up reusing the race string.
Title: Re: Hard Coded Alien Mission Races
Post by: Hobbes on January 28, 2015, 05:32:17 pm
I tried a delete on the terror mission followed by my declaration, but that seemed not to work. Barring a proper mechanism I'll have to reuse the floaters as my container race. Not a deal breaker, but messier than I like. May play around with deletions a bit more first just to 100% confirm. Maybe it chained together from a terror ship? Since I didn't delete those I suppose it's possible that the default array still has floaters listed. I ran into this same issue for the first encounter which seems hard wired for sectoids, so there I ended up reusing the race string.

The 1st alien mission is hard coded to be Sectoid Research but I've just checked the code and there's no specific mention of any alien races on the code, other than the ruleset (this is for the latest nightlies though). From what I've seen of the TFTD ruleset it doesn't reuse the existing strings.
Title: Re: Hard Coded Alien Mission Races
Post by: clownagent on January 28, 2015, 09:16:54 pm
I use this code in the alienMissions section and it worked for me in the latest nightly:

Code: [Select]
  - type: STR_ALIEN_TERROR
    points: 10
    raceWeights:
      0:
        STR_OWNRACE: 100
        STR_SECTOID: 0
        STR_FLOATER: 0
      1:
        STR_OWNRACE: 100
        STR_SECTOID: 0
        STR_FLOATER: 0
      3:
        STR_OWNRACE: 100
        STR_SECTOID: 0
        STR_SNAKEMAN: 0
        STR_FLOATER: 0
      5:
        STR_OWNRACE: 100
        STR_SECTOID: 0
        STR_SNAKEMAN: 0
        STR_ETHEREAL: 0
        STR_MUTON: 0
        STR_FLOATER: 0
      7:
        STR_OWNRACE: 100
        STR_SECTOID: 0
        STR_SNAKEMAN: 0
        STR_ETHEREAL: 0
        STR_MUTON: 0
        STR_FLOATER: 0

Of course STR_OWNRACE must be defined in the alienRaces section.
I changed also all other alienMissions like this and encounter only STR_OWNRACE in all UFOs and terror sites.
Title: Re: Hard Coded Alien Mission Races
Post by: jackstraw2323 on January 28, 2015, 09:27:39 pm
I didn't have success with 0 weights before, but I'll revisit, along with my other tests.
Title: Re: Hard Coded Alien Mission Races
Post by: jackstraw2323 on January 29, 2015, 04:01:36 am
Strange. I tried race 0 weights with latest nightly but I still get STR_FLOATER assigned in the deployment. I'm using a saved game to test, maybe some of the values are cached once the game is started? I'm afraid without a more concrete suggestion for how to address I'm going to work with the existing strings to make it bulletproof, at least until I can see if TFTD rules provide additional insight.

Weird, testing with a new game and made it past a ton of terror mission encounters just fine. Made it to the 3rd tier encounters in month 4, so maybe something else was going on. I did find a STR error in my deployments, but that shouldn't have let to the floater error, unless the game was doing some sort of default load because my rule was messed up.

I guess I'll do some more play testing fresh and if it pops up again I'll switch the strings to use the existing races.
Title: Re: Hard Coded Alien Mission Races
Post by: Hobbes on January 29, 2015, 03:28:49 pm
Strange. I tried race 0 weights with latest nightly but I still get STR_FLOATER assigned in the deployment. I'm using a saved game to test, maybe some of the values are cached once the game is started? I'm afraid without a more concrete suggestion for how to address I'm going to work with the existing strings to make it bulletproof, at least until I can see if TFTD rules provide additional insight.

Weird, testing with a new game and made it past a ton of terror mission encounters just fine. Made it to the 3rd tier encounters in month 4, so maybe something else was going on. I did find a STR error in my deployments, but that shouldn't have let to the floater error, unless the game was doing some sort of default load because my rule was messed up.

I guess I'll do some more play testing fresh and if it pops up again I'll switch the strings to use the existing races.

You shouldn't use saved games to test this: alien missions can be prolonged into the next month if you shoot down UFOs.
Title: Re: Hard Coded Alien Mission Races
Post by: Warboy1982 on January 30, 2015, 07:15:39 am
none of the races are hard coded, not even the sectoids in the first month.
you can't retro-actively remove a race from the ruleset for a saved game, either. if there's a mission being run with said race (eg: floater) and you try to remove floaters and continue that game, you're gonna have a bad time. when messing with things like that, make sure to start a fresh game.
Title: Re: Hard Coded Alien Mission Races
Post by: Hobbes on January 30, 2015, 09:10:55 am
none of the races are hard coded, not even the sectoids in the first month.

Hmmm, am I reading wrong the propose of the GeoscapeState::determineAlienMissions function? Ah, I think I got it. It picks the top race for the mission?
Title: Re: Hard Coded Alien Mission Races
Post by: Warboy1982 on January 30, 2015, 09:48:49 am
yes, the first alien listed, not sectoid specifically (in tftd it's aquatoid)
Title: Re: Hard Coded Alien Mission Races
Post by: Hobbes on January 30, 2015, 01:24:00 pm
yes, the first alien listed, not sectoid specifically (in tftd it's aquatoid)

And I've just found out that you can actually define another mission as the first one... including new mission types.
Title: Re: Hard Coded Alien Mission Races
Post by: jackstraw2323 on February 03, 2015, 03:38:41 pm
For anyone else who runs into this can confirm that deleting and re-declaring missions seems to be the way to go, at least in the current build, and does not require using STR_SECTOID for first aliens.
Title: Re: Hard Coded Alien Mission Races
Post by: Hobbes on February 03, 2015, 04:07:15 pm
For anyone else who runs into this can confirm that deleting and re-declaring missions seems to be the way to go, at least in the current build, and does not require using STR_SECTOID for first aliens.

I've actually 'hardcoded' the initial mission on my current mod using this: the first mission on alienMissions is called 'Introduction' and it is only used during the first month, since afterwards it is not assigned to any region. It works without a problem and it uses a special alien crew (no Sectoids) that is listed at the top of alienRaces.

Quote
alienMissions:
  - delete: STR_ALIEN_RESEARCH
  - delete: STR_ALIEN_HARVEST
  - delete: STR_ALIEN_ABDUCTION
  - delete: STR_ALIEN_INFILTRATION
  - delete: STR_ALIEN_BASE
  - delete: STR_ALIEN_TERROR
  - delete: STR_ALIEN_RETALIATION
  - delete: STR_ALIEN_SUPPLY
  - type: STR_ALIEN_INTRODUCTION
    points: 50
    raceWeights:
      0:
          STR_OVERLORD: 100
    waves:
Title: Re: Hard Coded Alien Mission Races
Post by: Arthanor on February 11, 2015, 07:35:47 pm
So is it that the game generates the first mission of the mission list with the first alien race of the race list as its first mission? This would allow a modder to define any combination of mission&race as the first just by moving things around in the lists.

If so, couldn't you just define your intro mission at the top of the alien mission list and keep all the vanilla missions instead of deleting them?
Title: Re: Hard Coded Alien Mission Races
Post by: Hobbes on February 11, 2015, 07:42:03 pm
So is it that the game generates the first mission of the mission list with the first alien race of the race list as its first mission? This would allow a modder to define any combination of mission&race as the first just by moving things around in the lists.

If so, couldn't you just define your intro mission at the top of the alien mission list and keep all the vanilla missions instead of deleting them?

My reasoning is that you need to delete all existing missions (previously loaded by the XCom1ruleset) to ensure that your mission list gets loaded first. Now that I look at it, it seems I don't actually need to delete them, as long as I keep them on the bottom of the list.
Title: Re: Hard Coded Alien Mission Races
Post by: Arthanor on February 11, 2015, 07:54:44 pm
Right, the way missions are loaded is still somewhat of a mystery to me.. missions from mods get added to the existing list, unlike other lists (tech dependencies / items requires / ammunition) which overwrite the previous version?

But from what you just said, you can redefine a vanilla mission and it will be moved down the list?

*Still confused*

Either deleting or redefining the vanilla missions, if another mod (ex.: Mechtoid) adds a mission before yours then it will also screw things up and now you may end up with a mechtoid mission first month or something..

Title: Re: Hard Coded Alien Mission Races
Post by: Hobbes on February 11, 2015, 08:15:38 pm
Right, the way missions are loaded is still somewhat of a mystery to me.. missions from mods get added to the existing list, unlike other lists (tech dependencies / items requires / ammunition) which overwrite the previous version?

But from what you just said, you can redefine a vanilla mission and it will be moved down the list?

*Still confused*

Either deleting or redefining the vanilla missions, if another mod (ex.: Mechtoid) adds a mission before yours then it will also screw things up and now you may end up with a mechtoid mission first month or something..

OK, just tested and it is necessary to delete and readd the vanilla missions, otherwise you get stuck with the Sectoid Research as the first mission.

If people want to use other mods, they're responsible for what happens. Some mods are simply not compatible with others.
Title: Re: Hard Coded Alien Mission Races
Post by: Arthanor on February 11, 2015, 08:54:14 pm
Thanks for looking into it! It supports the "alien missions are added to the list for each mod" hypothesis.

Some mods are indeed incompatible, but it is always good to try to minimalize those incompatibilities. In this case, that means we have to make sure that a mod that modifies the first mission is always before any other mod that has to do with missions in the loading order, which is indeed the player's responsibility. (but a warning would be nice)