OpenXcom Forum

Modding => Work In Progress => Topic started by: Nord on January 17, 2017, 11:05:19 am

Title: Mission generation question.
Post by: Nord on January 17, 2017, 11:05:19 am
Please explain me a thing about missions:
When we use missionscript to spawn an alien probe mission, in first month (script gameStart), this kind of missions can be spawned also separately, by globe, regions, and so on? And if yes, how can i define "firstMonth" for all UFO missions?
And if no, so why there is no missionscripts for all other UFO missions?
Title: Re: Mission generation question.
Post by: Meridian on January 17, 2017, 11:37:50 am
Please explain me a thing about missions:
When we use missionscript to spawn an alien probe mission, in first month (script gameStart), this kind of missions can be spawned also separately, by globe, regions, and so on? And if yes, how can i define "firstMonth" for all UFO missions?
And if no, so why there is no missionscripts for all other UFO missions?

Man, this is EXTREMELY hard to read and understand.
I'll try to answer... but I have no idea if I'm even answering the correct questions.

- You can spawn missions "separately" (whatever what means); by mission type, by region, by race, etc.
- I don't have a slightest clue what you mean by "by globe", so I'll skip that
- You can define first month by the "firstMonth" attribute (at the top of the vanilla mission script file, there is a documentation of all available ruleset attributes... read that, if you haven't already)
- There is no (complicated) mission script for other missions, because they are using a different approach (which was there before mission scripting), using alien strategy table, as described here:
 * https://openxcom.org/forum/index.php/topic,3287.msg77582.html#msg77582
 * https://openxcom.org/forum/index.php/topic,3287.msg77736.html#msg77736
 * https://www.ufopaedia.org/index.php/Alien_Missions_in_Enemy_Unknown_(OpenXcom)

Code: [Select]
  - type: recon
    firstMonth: 1
  - type: invasion
    firstMonth: 6

This code covers all 5 standard missions (probe, interdiction, resource raid, infiltration and alien base).
Title: Re: Mission generation question.
Post by: Nord on January 17, 2017, 12:03:51 pm
Man, this is EXTREMELY hard to read and understand.
I'll try to answer... but I have no idea if I'm even answering the correct questions.
Sorry for that. I am ashamed constantly with my por english.
Quote
- There is no (complicated) mission script for other missions, because they are using a different approach
Exactly what i mean when writing "by regions", just wasnt know a " mission table" term. By the way, ufopedia link is empty or broken.

So you mean that this code in missionScripts:
Code: [Select]
  - type: recon
    firstMonth: 1
  - type: invasion
    firstMonth: 6
Will take effect on vanilla missions?
That's what i wanted to hear, thank you once more.
Title: Re: Mission generation question.
Post by: Meridian on January 17, 2017, 12:20:43 pm
By the way, ufopedia link is empty or broken.

The link is fine, it's just the forum ignores the last character for some reason... copy-paste the URL directly to your browser and it should work.

So you mean that this code in missionScripts:
Code: [Select]
  - type: recon
    firstMonth: 1
  - type: invasion
    firstMonth: 6
Will take effect on vanilla missions?

Yes, this code is executing those 5 vanilla missions, which I mentioned before.
Title: Re: Mission generation question.
Post by: Nord on January 17, 2017, 12:54:20 pm
Ok, i understand. Thank you.
But if i want to define firstmonth for each type of vanilla mission separately?(Do i place this word right? :-) )
 
Title: Re: Mission generation question.
Post by: Meridian on January 17, 2017, 01:28:07 pm
But if i want to define firstmonth for each type of vanilla mission separately?(Do i place this word right? :-) )

Then you would need to stop using the "mission table" and define all missions separately using mission script.
Title: Re: Mission generation question.
Post by: Nord on January 17, 2017, 01:52:58 pm
Aaaaand... I got it. Thank you again.
Title: Re: Mission generation question.
Post by: Hobbes on January 17, 2017, 07:50:41 pm
But if i want to define firstmonth for each type of vanilla mission separately?(Do i place this word right? :-) )

If I'm understanding you correctly you want to be able to determine the month of appearance of the 5 missions? So that Probe missions would appear from month 0 onwards, then Resource Raid from month 1, etc.?
Title: Re: Mission generation question.
Post by: Nord on January 18, 2017, 10:35:26 am
Something like this, yes. But "recon" and "invasion" is good enough too.
Title: Re: Mission generation question.
Post by: Hobbes on January 18, 2017, 06:17:50 pm
Something like this, yes. But "recon" and "invasion" is good enough too.

Fair enough. I asked because at a certain point I considered something similar to my Area 51 mod, and although it's feasible I dropped the idea due to other reasons. And if you were interested I'd be willing to have a try, although I'd need more specific info about what your goals for this feature.
Title: Re: Mission generation question.
Post by: Nord on January 18, 2017, 08:56:25 pm
Well... First of all, i work on TFTD mod. And idea was simple - move USOs to the second-third month, because other types of missions must take place before them.
Title: Re: Mission generation question.
Post by: Hobbes on January 18, 2017, 09:54:10 pm
Well... First of all, i work on TFTD mod.

UFO, TFTD, Apoc, Dune, Terminator... names change but how missionScript works stays the same :)

Quote
And idea was simple - move USOs to the second-third month, because other types of missions must take place before them.

Do you literally mean no USOs during the first-second months?
Title: Re: Mission generation question.
Post by: Nord on January 19, 2017, 07:11:18 am
Yes.
Title: Re: Mission generation question.
Post by: Hobbes on January 19, 2017, 05:52:03 pm
Yes.

The issue would be which non-UFO missions would replace the vanilla ones during the first months. And, while not related to the missionScripts, I can't help thinking about the effect this will have on research, since you're creating a bottleneck by restricting the recover of Aquaplastics, Zrbite and other USO components after the initial months.
Title: Re: Mission generation question.
Post by: Nord on January 19, 2017, 09:01:43 pm
The issue would be which non-UFO missions would replace the vanilla ones during the first months. And, while not related to the missionScripts, I can't help thinking about the effect this will have on research, since you're creating a bottleneck by restricting the recover of Aquaplastics, Zrbite and other USO components after the initial months.
New missions are allready implemented(all, except first one... one more sprite needed). And research tree are reworked too. I need to draw some more ufopedia pages and two or three spritesheets for units, and release version will be done. Just have not much free time now.
 
Title: Re: Mission generation question.
Post by: Nord on January 24, 2017, 10:39:03 am
One more question: how to force missions to stop spawn only if it was successful? So if you lose - you can try again next month, but if you reach objective (kill all enemys) this mission will not appear anymore.
Title: Re: Mission generation question.
Post by: Meridian on January 24, 2017, 11:01:22 am
Exactly as described cannot be done atm.

But you can get near-ish by placing a unique object on the map, which will be recovered when mission is successful.
Afterwards player would research this object, which would stop the mission.
Title: Re: Mission generation question.
Post by: Nord on January 24, 2017, 11:03:30 am
Afterwards player would research this object, which would stop the mission.
And this research can not be finished automatically, i guess.
Title: Re: Mission generation question.
Post by: Solarius Scorch on January 24, 2017, 12:46:49 pm
And this research can not be finished automatically, i guess.

Unfortunately, no... I would welcome this feature myself, I had to work around this issue so many times.
Title: Re: Mission generation question.
Post by: Meridian on January 24, 2017, 01:47:10 pm
@both: write a feature request that has at least 10 lines and doesn't contain word 'automagically' and we'll see...
Title: Re: Mission generation question.
Post by: Solarius Scorch on January 24, 2017, 06:19:36 pm
@both: write a feature request that has at least 10 lines and doesn't contain word 'automagically' and we'll see...

Lol, I just wrote a PM to Nord with exactly the same suggestion... :) I'll comment when/if it's ready.
Title: Re: Mission generation question.
Post by: Nord on January 24, 2017, 09:39:32 pm
Though i am not using OXCE, it might be useful for others.
About "automagical" (nice word, should be remembered) research: Dont know exactly how research code works, but presume each hour check of research status. Easiest way as i see is to check inactive, but available researches, searching zero cost. And if zero cost found - mark research as completed. But if it will slow down system, check can be performed once a day or after tactical mission ends.
 And if not use research - i dont know code, we need some global variable, which will change by winning mission. And command in missionscripts to check it. Maybe "objectivesRequired" from alienDeployements will fit.
Sorry, i just dont know exactly what we have in gamecode, and what we do not have.  :-[
Title: Re: Mission generation question.
Post by: ohartenstein23 on January 24, 2017, 10:01:12 pm
Maybe this could be done by having a definition in alienDeployments to grant a specific research at the end of a mission containing that deployment?  In ruleset, this could look like
Code: [Select]
alienDeployments:
  - type: STR_SOME_DEPLOYMENT
    ...
    unlockedResearch: STR_SOME_RESEARCH
    ...
where the research item defined is treated like it was unlocked by another research item completed the next time midnight rolls around?

Another option that I could see is to add a tag (stopMissionRepeat: true?) to alienDeployments that on completing a mission, it would cause the engine to look for the running mission script/mission table entry that spawned that particular mission and had a second tag on that mission script (stopAfterMissionComplete: true?), and remove it from the table/mark that mission script to stop running.
Title: Re: Mission generation question.
Post by: Solarius Scorch on January 24, 2017, 10:16:06 pm
I like the alienDeployment option (the former) best. It's clear and in-line with how things work in OXC.
Title: Re: Mission generation question.
Post by: Meridian on February 16, 2017, 12:20:44 pm
Implemented: https://openxcom.org/forum/index.php/topic,4187.msg79243.html#msg79243

EDIT:

Gives:
 - topic itself (regardless of any prerequisites/dependencies)
 - score
 - all unlocked zero-cost research (and their score)

Doesn't give:
 - get-one-free bonuses

Does NOT trigger:
 - ufopedia
 - cutscenes
 - we can now research popup
 - we can now manufacture popup
 - we can now buy popup
Title: Re: Mission generation question.
Post by: Solarius Scorch on February 19, 2017, 01:26:20 am
One question: if the research has prerequisites (dependencies) which are not met yet, will it also be unlocked? (It should.)
Title: Re: Mission generation question.
Post by: Meridian on February 19, 2017, 01:36:40 am
Yes
Title: Re: Mission generation question.
Post by: Solarius Scorch on February 19, 2017, 01:52:52 am
Thank you!