OpenXcom Forum

Modding => Work In Progress => Topic started by: robin on July 29, 2015, 09:37:42 am

Title: Mission Scripting
Post by: robin on July 29, 2015, 09:37:42 am
Mission scripting is live. Didn't find this anyware (it's from Warboy) so I'm posting it here:

Code: [Select]
#  - type: example                       # the type/name is used for overwriting or deleting purposes.
#    firstMonth: 0                       # months this command runs on, 0 runs on startup of a new game (default 0)
#    lastMonth: 0                        # don't run after this month. in this context we mean "run once". -1 denotes no limit (default -1)
#    label: 1                            # label, used for conditionals (default 0)
#    conditionals: [1, -2]               # conditional list, just like mapscripts (default none)
#    missionWeights:                     # the type of mission to spawn (omit to pick one from the mission table) (default none)
#      0:                                # these are split into monthly chunks, and can contain multiple entries,
#        STR_ALIEN_RESEARCH: 20          # including weighted odds, but there is a caveat here:
#        STR_ALIEN_ABDUCTION: 30         # you cannot mix and match missions with mission site objectives (ie: terror) with regular missions,
#        STR_ALIEN_CROP_CIRCLES: 30      # they are generated too differently. using executionOdds and conditionals instead can achieve
#        STR_CATTLE_MUTILATION: 20       # exactly the same thing. similarly, terror missions should not appear in regional mission weights (regions.rul)
#    executionOdds: 100                  # % chances of this command executing (default 100)
#    targetBaseOdds: 75                  # % chances of this mission targeting a region containing an xcom base instead of random (default 0)
#    startDelay: 120                     # number of minutes to delay the start of the mission (rounded down to the nearest 30, 0 to use the wave timer from the mission itself) (default 0)
#    raceWeights:                        # can override established monthly race weights here if desired (default empty)
#      0:
#        STR_SECTOID: 100                # in this case we want a sectoid mission, so they get 100%
#    regionWeights:                      # again, this can override the defined mission region weights (default empty)
#      0:                                # this won't come into play here unless the mission doesn't target an xcom base, as described above.
#        STR_SAMPLE_REGION1: 20          # IF OMITTED:
#        STR_SAMPLE_REGION2: 30          # for a terror type mission, all regions that meet the criteria will be weighed equally.
#        STR_SAMPLE_REGION3: 50          # for regular missions the normal regional distribution weights will be applied.
#    minDifficulty: 0                    # this command only applies to difficulty levels of this or above (default 0)
#    researchTriggers:                   # a list of research topics that can influence the execution of this mission (default empty)
#      STR_THE_MARTIAN_SOLUTION: true    # in this case, the mission would only run if the player has the martian solution
#      STR_CYDONIA_OR_BUST: false        # and does NOT have Cydonia or bust
#    maxRuns: 12                         # this mission type can only execute this number of times, -1 for infinite (default -1)
#    avoidRepeats: 12                    # this means "store an array of the 12 previous coordinates, and don't use them again" (default 0)
#    varName: researching                # this is an internal variable name, used for tracking maxruns and avoidRepeats (default none)
#    useTable: false                     # check this mission type appears in the mission tables, and remove it if it does? (default true)
Title: Re: Mission Scripting
Post by: liberation on July 29, 2015, 09:10:27 pm
Epic  8) cheers for the post robin!
Title: Re: Mission Scripting
Post by: Hobbes on July 29, 2015, 09:27:54 pm
Didn't find this anyware (it's from Warboy) so I'm posting it here:

This explanation is included as comments in the missionScript.rul file :)
Title: Re: Mission Scripting
Post by: robin on July 29, 2015, 09:51:21 pm
@liberation: I'm not responsible for Mission Scripting at all, I merely made the thread when I saw the update nightly.

This explanation is included as comments in the missionScript.rul file :)
Yeah, Warboy edited my post pasting that (an updated version of what I posted initially). I still haven't looked into it.
Title: Re: Mission Scripting
Post by: Warboy1982 on August 01, 2015, 05:15:36 am
so... any questions? have people been messing about with it at all? any problems? (apart from the loading/deleting issue that's already solved)
Title: Re: Mission Scripting
Post by: Hobbes on August 01, 2015, 06:31:49 am
so... any questions? have people been messing about with it at all? any problems? (apart from the loading/deleting issue that's already solved)

I've been testing a few things but so far minor stuff, like adding additional missions. I've tried adding the Shipping attacks but that will have to wait until TFTD is fully implemented. The Research triggers are also very interesting but I need first to implement other stuff before I start toying with those.
Title: Re: Mission Scripting
Post by: Zeno on August 01, 2015, 11:14:50 pm
Research trigger is going to be giving a lot of amazing options; you could research an alien weapon, and then the aliens change to adapt
Being able to force a mission of a type/enemy is wonderful, especially being able to force a mission in a region that has an XCOM base in it. You can actually ensure that you get a UFO in the first week.
maxRuns is dangerous as hell if you're setting up a mod that uses plot-based missions; if the player misses a critical one for whatever reason, the players campaign could be gimped if the mod didn't build the missions with research redundancies in mind.
Title: Re: Mission Scripting
Post by: Hobbes on August 02, 2015, 01:27:19 am
Research trigger is going to be giving a lot of amazing options; you could research an alien weapon, and then the aliens change to adapt
[/quote]
You can now actually trigger the appearance of Mutons to plasma weapon research, which is a bit ironic since many players of the original (myself included) wrongly thought that it was the case.

Quote
Being able to force a mission of a type/enemy is wonderful, especially being able to force a mission in a region that has an XCOM base in it. You can actually ensure that you get a UFO in the first week.

You already get this on vanilla. The first mission is always Alien Research crewed by Sectoids and it takes place on the region of your starting base. But your small radar might not be able to detect the initial UFO.
Title: Re: Mission Scripting
Post by: robin on August 02, 2015, 09:42:35 am
  - type: researchRetaliation
    missionWeights:
      0:
        STR_ALIEN_RETALIATION: 100
    researchTriggers:
      STR_THE_MARTIAN_SOLUTION: true
    startDelay: 150
    targetBaseOdds: 100
    useTable: false
    label: 1

  - type: beginnerRetaliation
    missionWeights:
      0:
        STR_ALIEN_RETALIATION: 100
    firstMonth: 14
    targetBaseOdds: 100
    useTable: false
    conditionals: [-1]
    label: 2
    startDelay: 150

Looking at these I understand that "beginnerRetaliation" (conditionals: [-1]) starts if "researchRetaliation" (label: 1) fails.
Is this interpretation correct?
(Also what exactly "fails" means? The player shoots down the UFOs/wipes clean the mission site, or the command itself fails because" executionOdds" missed?)
Title: Re: Mission Scripting
Post by: Warboy1982 on August 02, 2015, 02:09:42 pm
failure in this context literally means "did not run"
causes for a command to fail are:

any of the conditional checks didn't pass
any of the research triggers were not met
the executionOdds check didn't pass
the maxRuns has already been hit
(for terror sites) no suitable location could be found to carry out the attack
the game month is less than the command's firstMonth
the game month is greater than the command's lastMonth
the difficulty is too low

so in this case, researchRetaliation takes priority, as it is listed first.
it processes the list above. if all of the conditions are met, it creates the mission, and post a "success" (1), otherwise it does nothing and posts a "failure" (-1)

then beginnerRetaliation:
process the list above. if all of the conditions are met, create the mission, post a "success" (2), otherwise do nothing and posts a "failure" (-2)

etc.
Title: Re: Mission Scripting
Post by: Hobbes on August 02, 2015, 02:11:34 pm
  - type: researchRetaliation
    missionWeights:
      0:
        STR_ALIEN_RETALIATION: 100
    researchTriggers:
      STR_THE_MARTIAN_SOLUTION: true
    startDelay: 150
    targetBaseOdds: 100
    useTable: false
    label: 1

  - type: beginnerRetaliation
    missionWeights:
      0:
        STR_ALIEN_RETALIATION: 100
    firstMonth: 14
    targetBaseOdds: 100
    useTable: false
    conditionals: [-1]
    label: 2
    startDelay: 150

Looking at these I understand that "beginnerRetaliation" (conditionals: [-1]) starts if "researchRetaliation" (label: 1) fails.
Is this interpretation correct?
(Also what exactly "fails" means? The player shoots down the UFOs/wipes clean the mission site, or the command itself fails because" executionOdds" missed?)

The logic tree of the retaliation sequence is:
1) If Martian Solution is researched then run retaliation mission
2) Otherwise if 1) is false (failed to run) and month >= 14 then run retaliation with 100% of spawning in a region with an XCom base, and don't use the mission table (the list of missions assigned to regions), with a delay of 150
3) Otherwise if 1) and 2) are false and difficulty level = 1 (experienced) and month >= 13, then run retaliation, with the conditions described before
4) Otherwise if 1), 2) and 3) are false and difficulty level = 2 (veteran) and month >= 12, then run retaliation
5) Otherwise if 1), 2), 3) and 4) are false and difficulty level = 3 (genius) and month >= 11, then run retaliation
6) Otherwise if 1), 2), 3), 4) and 5) are false and difficulty level = 4 (superhuman) and month >= 10, then run retaliation
Title: Re: Mission Scripting
Post by: robin on August 02, 2015, 02:27:30 pm
So that whole thing means that, from a certain point in time depending on various factors (research, month, game difficulty), aliens will start retaliating in loop.
This in addition to normal retaliation triggered by soothing down UFOs.
Title: Re: Mission Scripting
Post by: Hobbes on August 02, 2015, 02:44:18 pm
hobbes, check your comparators, you've got = where you should have >=, but otherwise, yes. that.

Correct, thank you and fixed, forgot to add that.

So that whole thing means that, from a certain point in time depending on various factors (research, month, game difficulty), aliens will start retaliating in loop.
This in addition to normal retaliation triggered by soothing down UFOs.

Yup, if by retaliation in loop you mean a monthly retaliation mission.
Title: Re: Mission Scripting
Post by: robin on August 02, 2015, 03:05:53 pm
The check of the conditionals is done after each mission? Monthly?
For example what if want to chain missions:

  - type: doBasicMission1
    firstMonth: 0
    executionOdds: 50
    label: 1
    useTable: false
  - type: ifBasicMission1Fails_DoThisBasicMission2
    firstMonth: 0
    executionOdds: 100
    conditionals: [-1]
    useTable: false
  - type: else_DoBasicMission1FollowUp
    firstMonth: 0
    executionOdds: 100
    conditionals: [1]
    useTable: false

(so each month I'd have 50% BasicMission1+FollowUp or 50% BasicMission2)
?
Title: Re: Mission Scripting
Post by: Warboy1982 on August 02, 2015, 04:00:15 pm
precisely.
although it's worth mentioning that you can omit the exectutionOdds if they're 100, and the firstMonth if that's 0 (those are the default values)

to do "normal" mission generation all you _NEED_ to define in the command is the "type"
Title: Re: Mission Scripting
Post by: Hobbes on August 02, 2015, 04:38:28 pm
to do "normal" mission generation all you _NEED_ to define in the command is the "type"

Further clarification: by "normal" Warboy means a mission from the regular table, which is defined by the missionWeights on the regions section.
Title: Re: Mission Scripting
Post by: XOps on August 02, 2015, 09:17:27 pm
I have a question. I am trying to implement an Artefact style mission in the later months (I've almost got this to work). How does the TFTD ruleset implement the artefact and ship terror missions (or is this not implemented yet and I am wasting my time)? I am assuming the TFTD ruleset is using invisible points on the globe similar to cities as targets to spawn mission sites, but without the city globe marker?
I've gotten close to implementing these myself, but my hangup seems to be the spawnZone command in alienMissions.rul. For mission site missions (objective: 3), the UFOs will always try to land in zone 3 for the UFO with objective: true regardless what spawnZone is set to. This causes a crash when the UFO lands and it cant find the right zone since it's landed in a city for a normal terror mission. I did modify the UFOTrajectories.rul correctly. I know that is working because if the spawnZone is set to 3 (default), then the objective: true UFO will land in the correct zone, but not spawn a mission (instead its just a normal UFO landing). Is this a bug or is it intended behavior and I'm going about this completely wrong?
Title: Re: Mission Scripting
Post by: Solarius Scorch on August 02, 2015, 09:47:18 pm
Here's the code for artifacts mission that Warboy shared:

Code: [Select]
  - type: artifacts
    label: 1
    missionWeights:
      # 0 is just for safety
      0:
        STR_ALIEN_ARTIFACT: 100
    regionWeights:
      0:
        ARTIFACT_SITES: 100
    avoidRepeats: 12
    maxRuns: 12
    varName: artifacts
    useTable: false
    firstMonth: 6
    executionOdds: 50
    startDelay: 0

I hope it's somewhat helpful for you.

(Warboy, I hope this wasn't secret or anything. ;) )
Title: Re: Mission Scripting
Post by: robin on August 02, 2015, 11:16:04 pm
I have a question. I am trying to implement an Artefact style mission in the later months (I've almost got this to work). How does the TFTD ruleset implement the artefact and ship terror missions (or is this not implemented yet and I am wasting my time)? I am assuming the TFTD ruleset is using invisible points on the globe similar to cities as targets to spawn mission sites, but without the city globe marker?
I've gotten close to implementing these myself, but my hangup seems to be the spawnZone command in alienMissions.rul. For mission site missions (objective: 3), the UFOs will always try to land in zone 3 for the UFO with objective: true regardless what spawnZone is set to. This causes a crash when the UFO lands and it cant find the right zone since it's landed in a city for a normal terror mission. I did modify the UFOTrajectories.rul correctly. I know that is working because if the spawnZone is set to 3 (default), then the objective: true UFO will land in the correct zone, but not spawn a mission (instead its just a normal UFO landing). Is this a bug or is it intended behavior and I'm going about this completely wrong?
About Artifact Site, these are examples that Warboy made to me.

Quote
    waves:
      - ufo: dummy #don't spawn a ufo, we only want the site
        count: 1
        trajectory: P10
        timer: 0
        objective: true
    waves:
      - ufo: STR_ARTIFACT_SITE_P1 # spawn this site directly
        count: 1
        trajectory: P10
        timer: 0
        objective: true
first case uses a random choice from the terrain it's spawned on, according to the trajectory
second case spawns an artifact site no matter what

Apparently the P10 trajectory is a special trajectory and it is still not ready. But I may have grossly misinterpreted what he said.
Title: Re: Mission Scripting
Post by: Hobbes on August 03, 2015, 12:05:08 am
I have a question. I am trying to implement an Artefact style mission in the later months (I've almost got this to work). How does the TFTD ruleset implement the artefact and ship terror missions (or is this not implemented yet and I am wasting my time)? I am assuming the TFTD ruleset is using invisible points on the globe similar to cities as targets to spawn mission sites, but without the city globe marker?
I've gotten close to implementing these myself, but my hangup seems to be the spawnZone command in alienMissions.rul. For mission site missions (objective: 3), the UFOs will always try to land in zone 3 for the UFO with objective: true regardless what spawnZone is set to. This causes a crash when the UFO lands and it cant find the right zone since it's landed in a city for a normal terror mission. I did modify the UFOTrajectories.rul correctly. I know that is working because if the spawnZone is set to 3 (default), then the objective: true UFO will land in the correct zone, but not spawn a mission (instead its just a normal UFO landing). Is this a bug or is it intended behavior and I'm going about this completely wrong?

I've already tried adding Shipping Attack routes to UFO and I'm also getting crashes, Warboy's advice was to wait until everything is worked out with TFTD. With Shipping and Artifacts missions, TFTD has 2 special regions defined that consist of a series of MissionZone 0 locations on the oceans.
The P10 UFOTrajectory is the one used for TFTD.
Title: Re: Mission Scripting
Post by: Hobbes on August 06, 2015, 05:54:43 am
I have a question. I am trying to implement an Artefact style mission in the later months (I've almost got this to work). How does the TFTD ruleset implement the artefact and ship terror missions (or is this not implemented yet and I am wasting my time)? I am assuming the TFTD ruleset is using invisible points on the globe similar to cities as targets to spawn mission sites, but without the city globe marker?

I've managed to get both Artifact Sites and Ship Attacks working on Redux, so I might give some tips about it. One key requirement is for a specific region to be defined each of these new missions, under /regions, and also with the corresponding texture entry in /globe. So in TFTD there are the ARTIFACTS and SHIPPING_LANES regions, which consist only of several missionZone 0 entries.

Quote
I've gotten close to implementing these myself, but my hangup seems to be the spawnZone command in alienMissions.rul. For mission site missions (objective: 3), the UFOs will always try to land in zone 3 for the UFO with objective: true regardless what spawnZone is set to. This causes a crash when the UFO lands and it cant find the right zone since it's landed in a city for a normal terror mission. I did modify the UFOTrajectories.rul correctly. I know that is working because if the spawnZone is set to 3 (default), then the objective: true UFO will land in the correct zone, but not spawn a mission (instead its just a normal UFO landing). Is this a bug or is it intended behavior and I'm going about this completely wrong?

The 'UFO' for Artifacts and Ships needs to be spawned on missionZone 0, since there aren't any entries defined on their respective regions for missionZone 3.
Title: Re: Mission Scripting
Post by: Warboy1982 on August 06, 2015, 01:09:46 pm
relevent files:

missionScripts.rul (obviously)
alienMissions.rul
alienDeployments.rul
ufoTrajectories.rul
regions.rul
globe.rul

the deployment defines the mission site details
the globe defines the terrain (id:-3) which references the deployment directly, because this is a terror site terrain.
the region defines a number of city-style "points" (meaning the min/max values are the same for lat/lon) which use that terrain/texture.
the trajectory points to these "points" as the mission site targets
the alienMission provides the link between the trajectory and the region in its waves, which spawn the site directly instead of an actual USO
and finally the missionScript invokes the AlienMission
Title: Re: Mission Scripting
Post by: hellrazor on August 13, 2015, 08:43:04 pm
One Point of notice:

labels have to be unique!

Somehow labels from the appropriate default ruleset (xcom1 or xcom2) get counted against mod labels.
I reserve labels 90-150 for Myself :P

Until someone fixes this somehow.
Title: Re: Mission Scripting
Post by: Hobbes on August 13, 2015, 09:05:56 pm
I reserve labels 90-150 for Myself :P

Too late, I already reserved those for myself. ;)
Title: Re: Mission Scripting
Post by: hellrazor on August 13, 2015, 09:32:43 pm
Too late, I already reserved those for myself. ;)

Woot, those are mine!

In any case it seems to a bug, let's see what i and Warboy will find out.

EDIT: Ignore me shouting about bugs... at least we have now a more verbose Error msgs regarding double labels in the future :)
Title: Re: Mission Scripting
Post by: hellrazor on August 13, 2015, 10:46:09 pm
Code: [Select]
<hellrazor> Warboy, [13-08-2015 21:05:02] [FATAL] Mission generator encountered an error: multiple commands: navigatorConsequenceAlienResearch and researchRetaliation are sharing the same label: 1
<hellrazor> researchRetaliation is defined in the xcom1 ruleset
<hellrazor> so we definitly have a Problem with labelnumbers
<@Warboy> isn't that the problem you had in the first place?
<hellrazor> i did
<hellrazor> but i changed my label numbers
<hellrazor> by +100
<hellrazor> nad now i changed them back beginning with 1
--> Mine4Fish (~Zeph@46.246.124.91) has joined #openxcom
<@Warboy> ok, remember i said start at 6?
<hellrazor> jeah
<@Warboy> start at 6, xcom1 uses 1-5 :P
<hellrazor> i wanted to test this anway
<@Warboy> ah gotcha
<hellrazor> Warboy, no we have confirmation!
<hellrazor> ;>

In this case label numbers 100-150 are mine!
Title: Re: Mission Scripting
Post by: Arthanor on August 13, 2015, 10:48:53 pm
Shouldn't this be an issue only if you load multiple mods with missions in them? I would expect UFORedux and Hardmode to crash (or be completely unplayable) even if you somehow managed to make them load.
Title: Re: Mission Scripting
Post by: hellrazor on August 13, 2015, 10:50:53 pm
Shouldn't this be an issue only if you load multiple mods with missions in them? I would expect UFORedux and Hardmode to crash (or be completely unplayable) even if you somehow managed to make them load.

Well at the current state the labelnumbers are shared with all loaded rulesets. So you have to start at 6, because the first 6 Labelnumbers are taken be the xcom1 ruleset.
In tftd xcom2 ruleset it goes up to 7 or 8.

And those are then shared with Mods. so...
Title: Re: Mission Scripting
Post by: hellrazor on August 13, 2015, 11:36:57 pm
Well i think, i got it working ;)

Alive Alien Interrogations from Engineers and Navigators, do the trigger additional missions.

Code: [Select]
##BEGIN CONSEQUENCES
#BEGIN NAVIGATOR CONSEQUENCE
  - type: navigatorConsequenceAlienResearch
    label: 101
    missionWeights:
      0:
        STR_ALIEN_RESEARCH: 100
    executionOdds: 50
    startDelay: 6000
    researchTriggers:
      STR_ALIEN_RESEARCH: true
    maxRuns: 1
    varName: navigatorConsequenceAlienResearch
  - type: navigatorConsequenceAlienResearchTerror
    label: 102
    conditionals: [-101]
    missionWeights:
      0:
        STR_ALIEN_TERROR: 100
    startDelay: 6000
    researchTriggers:
      STR_ALIEN_RESEARCH: true
    maxRuns: 1
    varName: navigatorConsequenceAlienResearch
  - type: navigatorConsequenceAlienHarvest
    label: 103
    conditionals: [-101, -102]
    missionWeights:
      0:
        STR_ALIEN_HARVEST: 100
      3:
        STR_ALIEN_HARVEST: 60
        STR_ALIEN_BASE: 20
        STR_ALIEN_RETALIATION: 20
      6:
        STR_ALIEN_HARVEST: 40
        STR_ALIEN_INFILTRATION: 40
        STR_ALIEN_RETALIATION: 20
      9:
        STR_ALIEN_HARVEST: 20
        STR_ALIEN_INFILTRATION: 80
    startDelay: 6000
    researchTriggers:
      STR_ALIEN_HARVEST: true
    maxRuns: 1
    varName: navigatorConsequenceAlienHarvest
  - type: navigatorConsequenceAlienAbduction
    label: 104
    conditionals: [-101, -102, -103]
    missionWeights:
      0:
        STR_ALIEN_ABDUCTION: 100
      3:
        STR_ALIEN_ABDUCTION: 60
        STR_ALIEN_BASE: 20
        STR_ALIEN_HARVEST: 20
      6:
        STR_ALIEN_ABDUCTION: 40
        STR_ALIEN_INFILTRATION: 40
        STR_ALIEN_RETALIATION: 20
      9:
        STR_ALIEN_ABDUCTION: 20
        STR_ALIEN_INFILTRATION: 80
    startDelay: 6000
    researchTriggers:
      STR_ALIEN_ABDUCTION: true
    maxRuns: 1
    varName: navigatorConsequenceAlienAbduction
  - type: navigatorConsequenceAlienBase
    label: 105
    conditionals: [-101, -102, -103, -104]
    missionWeights:
      0:
        STR_ALIEN_BASE: 100
      3:
        STR_ALIEN_BASE: 50
        STR_ALIEN_HARVEST: 50
      6:
        STR_ALIEN_BASE: 40
        STR_ALIEN_INFILTRATION: 20
        STR_ALIEN_HARVEST: 40
      9:
        STR_ALIEN_BASE: 20
        STR_ALIEN_INFILTRATION: 80
    startDelay: 6000
    researchTriggers:
      STR_ALIEN_BASE: true
    maxRuns: 1
    varName: navigatorConsequenceAlienBase
  - type: navigatorConsequenceAlienSupply
    label: 106
    conditionals: [-101, -102, -103, -104, -105]
    missionWeights:
      0:
        STR_ALIEN_TERROR: 100
    startDelay: 6000
    researchTriggers:
      STR_ALIEN_SUPPLY: true
    maxRuns: 1
    varName: navigatorConsequenceAlienSupply
  - type: navigatorConsequenceAlienTerror
    label: 107
    conditionals: [-101, -102, -103, -104, -105, -106]
    missionWeights:
      0:
        STR_ALIEN_TERROR: 100
    startDelay: 6000
    researchTriggers:
      STR_ALIEN_TERROR: true
    maxRuns: 1
    varName: navigatorConsequenceAlienTerror
  - type: navigatorConsequenceAlienInfiltration
    label: 108
    conditionals: [-101, -102, -103, -104, -105, -106, -107]
    missionWeights:
      0:
        STR_ALIEN_BASE: 100
      3:
        STR_ALIEN_BASE: 50
        STR_ALIEN_RETALIATION: 50
      6:
        STR_ALIEN_BASE: 60
        STR_ALIEN_INFILTRATION: 40
      9:
        STR_ALIEN_BASE: 20
        STR_ALIEN_INFILTRATION: 80
    startDelay: 9000
    researchTriggers:
      STR_ALIEN_INFILTRATION: true
    maxRuns: 1
    varName: navigatorConsequenceAlienInfiltration
  - type: navigatorConsequenceAlienRetaliation
    label: 109
    conditionals: [-101, -102, -103, -104, -105, -106, -107, -108]
    missionWeights:
      0:
        STR_ALIEN_RETALIATION: 100
    startDelay: 6000
    researchTriggers:
      STR_ALIEN_RETALIATION: true
    maxRuns: 1
    varName: navigatorConsequenceAlienRetaliation
#END NAVIGATOR CONSEQUENCE

#BEGIN ENGINEER CONSEQUENCE
  - type: engineerConsequenceSmallScout
    label: 110
    missionWeights:
      0:
        STR_ALIEN_RESEARCH: 100
    executionOdds: 50
    startDelay: 9000
    researchTriggers:
      STR_SMALL_SCOUT: true
    maxRuns: 1
    varName: engineerConsequenceSmallScout
  - type: engineerConsequenceSmallScoutTerror
    label: 111
    conditionals: [-110]
    missionWeights:
      0:
        STR_ALIEN_TERROR: 100
    startDelay: 9000
    researchTriggers:
      STR_SMALL_SCOUT: true
    maxRuns: 1
    varName: engineerConsequenceSmallScout
  - type: engineerConsequenceMediumScout
    label: 112
    conditionals: [-110, -111]
    missionWeights:
      0:
        STR_ALIEN_RESEARCH: 50
        STR_ALIEN_BASE: 50
    executionOdds: 50
    startDelay: 9000
    researchTriggers:
      STR_MEDIUM_SCOUT: true
    maxRuns: 1
    varName: engineerConsequenceMediumScout
  - type: engineerConsequenceMediumScoutTerror
    label: 113
    conditionals: [-110, -111, -112]
    missionWeights:
      0:
        STR_ALIEN_TERROR: 100
    startDelay: 9000
    researchTriggers:
      STR_MEDIUM_SCOUT: true
    maxRuns: 1
    varName: engineerConsequenceMediumScout
  - type: engineerConsequenceLargeScout
    label: 114
    conditionals: [-110, -111, -112, -113]
    missionWeights:
      0:
        STR_ALIEN_RESEARCH: 33
        STR_ALIEN_BASE: 33
        STR_ALIEN_RETALIATION: 33
    executionOdds: 50
    startDelay: 9000
    researchTriggers:
      STR_LARGE_SCOUT: true
    maxRuns: 1
    varName: engineerConsequenceLargeScout
  - type: engineerConsequenceLargeScoutTerror
    label: 115
    conditionals: [-110, -111, -112, -113, -114]
    missionWeights:
      0:
        STR_ALIEN_TERROR: 100
    startDelay: 9000
    researchTriggers:
      STR_LARGE_SCOUT: true
    maxRuns: 1
    varName: engineerConsequenceLargeScout
  - type: engineerConsequenceFighterShip
    label: 116
    conditionals: [-110, -111, -112, -113, -114, -115]
    missionWeights:
      0:
        STR_ALIEN_BASE: 33
        STR_ALIEN_RETALIATION: 33
        STR_ALIEN_INFILTRATION: 33
    executionOdds: 50
    startDelay: 9000
    researchTriggers:
      STR_FIGHTER_SHIP: true
    maxRuns: 1
    varName: engineerConsequenceFighterShip
  - type: engineerConsequenceFighterShipTerror
    label: 117
    conditionals: [-110, -111, -112, -113, -114, -115, -116]
    missionWeights:
      0:
        STR_ALIEN_TERROR: 100
    startDelay: 9000
    researchTriggers:
      STR_FIGHTER_SHIP: true
    maxRuns: 1
    varName: engineerConsequenceFighterShip
  - type: engineerConsequenceSentryShip
    label: 118
    conditionals: [-110, -111, -112, -113, -114, -115, -116, -117]
    missionWeights:
      0:
        STR_ALIEN_BASE: 33
        STR_ALIEN_RETALIATION: 33
        STR_ALIEN_INFILTRATION: 33
    executionOdds: 50
    startDelay: 9000
    researchTriggers:
      STR_SENTRY_SHIP: true
    maxRuns: 1
    varName: engineerConsequenceSentryShip
  - type: engineerConsequenceSentryShipTerror
    label: 119
    conditionals: [-110, -111, -112, -113, -114, -115, -116, -117, -118]
    missionWeights:
      0:
        STR_ALIEN_TERROR: 100
    startDelay: 9000
    researchTriggers:
      STR_SENTRY_SHIP: true
    maxRuns: 1
    varName: engineerConsequenceSentryShip
  - type: engineerConsequenceExcavator
    label: 120
    conditionals: [-110, -111, -112, -113, -114, -115, -116, -117, -118, -119]
    missionWeights:
      0:
        STR_ALIEN_BASE: 50
        STR_ALIEN_RESEARCH: 50
    startDelay: 9000
    researchTriggers:
      STR_EXCAVATOR: true
    maxRuns: 1
    varName: engineerConsequenceExcavator
  - type: engineerConsequenceAbductor
    label: 121
    conditionals: [-110, -111, -112, -113, -114, -115, -116, -117, -118, -119, -120]
    missionWeights:
      0:
        STR_ALIEN_ABDUCTION: 33
        STR_ALIEN_HARVEST: 33
        STR_ALIEN_RESEARCH: 33
    startDelay: 9000
    researchTriggers:
      STR_ABDUCTOR: true
    maxRuns: 1
    varName: engineerConsequenceAbductor
  - type: engineerConsequenceHarvester
    label: 122
    conditionals: [-110, -111, -112, -113, -114, -115, -116, -117, -118, -119, -120, -121]
    missionWeights:
      0:
        STR_ALIEN_ABDUCTION: 33
        STR_ALIEN_HARVEST: 33
        STR_ALIEN_RESEARCH: 33
    startDelay: 9000
    researchTriggers:
      STR_HARVESTER: true
    maxRuns: 1
    varName: engineerConsequenceHarvester
  - type: engineerConsequenceLabShip
    label: 123
    conditionals: [-110, -111, -112, -113, -114, -115, -116, -117, -118, -119, -120, -121, -122]
    missionWeights:
      0:
        STR_ALIEN_ABDUCTION: 33
        STR_ALIEN_HARVEST: 33
        STR_ALIEN_RESEARCH: 33
    startDelay: 9000
    researchTriggers:
      STR_LAB_SHIP: true
    maxRuns: 1
    varName: engineerConsequenceLabShip
  - type: engineerConsequenceSupplyShip
    label: 124
    conditionals: [-110, -111, -112, -113, -114, -115, -116, -117, -118, -119, -120, -121, -122, -123]
    missionWeights:
      0:
        STR_ALIEN_INFILTRATION: 50
        STR_ALIEN_BASE: 50
    executionOdds: 50
    startDelay: 9000
    researchTriggers:
      STR_SUPPLY_SHIP: true
    maxRuns: 1
    varName: engineerConsequenceSupplyShip
  - type: engineerConsequenceSupplyShipTerror
    label: 125
    conditionals: [-110, -111, -112, -113, -114, -115, -116, -117, -118, -119, -120, -121, -122, -123, -124]
    missionWeights:
      0:
        STR_ALIEN_TERROR: 100
    startDelay: 9000
    researchTriggers:
      STR_SUPPLY_SHIP: true
    maxRuns: 1
    varName: engineerConsequenceSupplyShip
  - type: engineerConsequenceTerrorShip
    label: 126
    conditionals: [-110, -111, -112, -113, -114, -115, -116, -117, -118, -119, -120, -121, -122, -123, -124, -125]
    missionWeights:
      0:
        STR_ALIEN_TERROR: 100
    startDelay: 9000
    researchTriggers:
      STR_TERROR_SHIP: true
    maxRuns: 1
    varName: engineerConsequenceTerrorShip
  - type: engineerConsequenceBattleShip
    label: 127
    conditionals: [-110, -111, -112, -113, -114, -115, -116, -117, -118, -119, -120, -121, -122, -123, -124, -125, -126]
    missionWeights:
      0:
        STR_ALIEN_INFILTRATION: 50
        STR_ALIEN_BASE: 50
    executionOdds: 50
    startDelay: 9000
    researchTriggers:
      STR_BATTLESHIP: true
    maxRuns: 1
    varName: engineerConsequenceBattleShip
  - type: engineerConsequenceBattleShipTerror
    label: 128
    conditionals: [-110, -111, -112, -113, -114, -115, -116, -117, -118, -119, -120, -121, -122, -123, -124, -125, -126, -127]
    missionWeights:
      0:
        STR_ALIEN_TERROR: 100
    startDelay: 9000
    researchTriggers:
      STR_BATTLESHIP: true
    maxRuns: 1
    varName: engineerConsequenceBattleShip
#END ENGINEER CONSEQUENCE
##END CONSEQUENCES

It is just something which will add 1 additional Missions per Month for Navigator and Engineer Interrogations.
The missiontype which gets unlocked is basically semi random, since i linked them towards the researchtopic of the getOnFree option for Engineers and Navigators.

:)
Title: Re: Mission Scripting
Post by: Hobbes on August 14, 2015, 12:34:48 am
Shouldn't this be an issue only if you load multiple mods with missions in them? I would expect UFORedux and Hardmode to crash (or be completely unplayable) even if you somehow managed to make them load.

 ::)

Number 100 shall be mine! Mwahaha
Title: Re: Mission Scripting
Post by: robin on August 15, 2015, 09:35:38 pm
Quote
ERROR: Error with MissionScript: XXX cannot mix terror/non-terror missions in a single command, so sayeth the wise Alaundo.
Alaundo how could you?!

:P
Title: Re: Mission Scripting
Post by: hellrazor on August 18, 2015, 06:24:47 pm
Alaundo how could you?!

:P

Actually the mighty Mapscript is used for doing the Missionscripting. I guess Alaundo's wise words have to do with that ^^
Title: Re: Mission Scripting
Post by: hellrazor on August 21, 2015, 11:48:11 am
Could we have this thread to be sticky?
Since it is wandering down the forums and soon will never to be seen again.
Title: Re: Mission Scripting
Post by: Warboy1982 on August 21, 2015, 01:23:48 pm
Actually the mighty Mapscript is used for doing the Missionscripting.

huh?
Title: Re: Mission Scripting
Post by: hellrazor on August 21, 2015, 03:30:20 pm
huh?

I was assuming this, since when you made Missionscripting throw more verbose messages the actual commit was in the section of the Mapscript.
But maybe you just reused code were appropriate.
Title: Re: Mission Scripting
Post by: Warboy1982 on August 21, 2015, 05:04:28 pm
ah, yeah i reused the error message. mapscripts and missionscripts have some commonalities, but they are fundamentally two very different things
Title: Re: Mission Scripting
Post by: Gemeaux333 on October 26, 2018, 10:57:28 pm
What are the type names for Infiltration and Base building missions ?

I would like to postpone "Base building" missions and "Infiltrations" missions to July in TFTD
Title: Re: Mission Scripting
Post by: Hobbes on October 27, 2018, 03:40:53 am
What are the type names for Infiltration and Base building missions ?

I would like to postpone "Base building" missions and "Infiltrations" missions to July in TFTD

The strings are STR_ALIEN_BASE and STR_ALIEN_INFILTRATION but they're spawned through the mission table, which is defined in regions.rul
Title: Re: Mission Scripting
Post by: Gemeaux333 on October 27, 2018, 06:22:00 pm
So, is there a way to postpone them ?
Title: Re: Mission Scripting
Post by: Meridian on October 27, 2018, 07:17:45 pm
So, is there a way to postpone them ?

Yes, the mission script governs all mission generation... you can customize it any way you like.
It takes a bit of time and experimentation, but it is easy once you understand the basics.

PS: also please avoid necro-posting, opening a new thread is easy
Title: Re: Mission Scripting
Post by: Gemeaux333 on October 27, 2018, 08:05:55 pm
Should I start a new topic to increase my chances of having more detailed answers ?
Title: Re: Mission Scripting
Post by: Meridian on October 27, 2018, 08:38:57 pm
Should I start a new topic to increase my chances of having more detailed answers ?

Depends what kind of answer you're looking for... do you want us to write the mod for you... or give you advice where to look?

If you want me to write it for you, I have to politely decline.

If you want pointers, I'll repeat where the information is stored:
1. mission race weights are stored in alienMissions.rul
2. mission generation information is stored in missionScripts.rul
3. there are two basic modes of mission generation: mission-table-based and scripted... mission tables are located in regions.rul; mission scripts are located directly in missionScripts.rul
4. mission tables approach is inherently random, you can't affect what comes first/next/last
5. if you want more control, you'll need to use mission scripts; or combination of both
6. many mods have changed mission generation, you can find almost any example you can think of by studying vanilla ruleset and other mods

There are several ways how to achieve postponing some missions, the easiest in your case is probably to use scripted missions for a first few months and after that revert to using mission tables. At least, that's how I would do it.

Second quite easy option would be removing these 2 missions from mission tables completely, and only generate them via scripts.
Title: Re: Mission Scripting
Post by: Gemeaux333 on October 27, 2018, 09:02:53 pm
By studying regions.rul, I guess i see the probabilities of each mission to happen... so I could simply change the probabilities of these missions to happen...

Am I right ?

P.S: Don't worry, I don't expect you to do everything at my place, but if anyone willingly propose himself to write it, I am open to it... but I guess I would have more merit doing it myself.
Title: Re: Mission Scripting
Post by: Meridian on October 27, 2018, 09:22:21 pm
By studying regions.rul, I guess i see the probabilities of each mission to happen... so I could simply change the probabilities of these missions to happen...

Am I right ?

Yes, that's a very easy way to do it.

Technically speaking, you are not really postponing those missions, they can still happen in month 1 if you're unlucky... but in majority of the games, it will look like as if they were postponed.
Title: Re: Mission Scripting
Post by: Hobbes on October 27, 2018, 09:58:45 pm
Yes, that's a very easy way to do it.

Technically speaking, you are not really postponing those missions, they can still happen in month 1 if you're unlucky... but in majority of the games, it will look like as if they were postponed.

There's another issue more relevant.

@Gemeaux333
The missions defined in regions.rul make up a deck (composed of all the missions assigned to a region), and everytime missionScripts.rul runs the 'type: recon' or 'type: invasion' lines, the script randomly chooses a mission from that deck (and using the probabilities) and removes that specific mission from the deck. Once the deck is empty of missions, it is repopulated again using the values on regions.rul.

So, on any given game the deck will be composed of X Research, Y Base, W Infiltration, V Abduction and Z Harvest missions (or their TFTD equivalents) that will take place.

If you change the odds on regions.rul so that Base and Infiltration missions have a low chance of happening, you're reducing their odds of being spawned in the first months, but once the game empties the deck of Research, Abductions and Harvest missions, then only Base and Infiltration missions will be spawned. So in the first months those two mission types will hardly appear, but as months go by it will be more likelier that only those two types will be spawned.
Title: Re: Mission Scripting
Post by: Meridian on October 27, 2018, 10:11:56 pm
The "deck" lasts for approximately 2 years, give or take a few months.

With the average vanilla playthrough being 6 to 12 months, it will work approximately as intended.
With a longer playthrough, you might want a different approach.
Title: Re: Mission Scripting
Post by: Solarius Scorch on October 27, 2018, 10:46:32 pm
PS: also please avoid necro-posting, opening a new thread is easy

No, please don't open a thread if an appropriate thread already exists... It would be duplication.
Necroposting can only be relevant to forums covering timed events, like sports.
Title: Re: Mission Scripting
Post by: Gemeaux333 on October 27, 2018, 11:11:49 pm
So, thats my solution : I modify the values in regions.rul to have low chances of having these two missions types in seas/oceans featuring most of the funding countries (north pacific, north atlantic, indian ocean, japan sea, south china sea, mediterraneans sea) ?
Title: Re: Mission Scripting
Post by: Meridian on October 27, 2018, 11:23:17 pm
No, please don't open a thread if an appropriate thread already exists... It would be duplication.
Necroposting can only be relevant to forums covering timed events, like sports.

The question is what is an "appropriate thread", in my opinion almost every question is unique... otherwise he would not have to ask again.
Also, opening a new thread is always a good idea IMO... after you searched the history of course and didn't find what you were looking for.
We want short threads with a clear topic, and clear answer (if the point of the thread was a question).
That way it is easier to search too.
The WORST examples on this forum are threads like "A thread for little questions" from piratez subforum and similar... I guarantee that vast majority of questions and answers from such threads are LOST forever. You cannot find them, because the forum search only shows the last match per thread. So if you're looking for example for "coelacanth" and that word is on the first page of a giant thread and the last page of that same giant thread, the search only ever shows you the last page... even though the question you were looking for might have been in the first page.

And I could continue naming dozens of other reasons why opening a new thread is a better idea... not kidding.
Title: Re: Mission Scripting
Post by: Hobbes on October 28, 2018, 02:00:09 am
So, thats my solution : I modify the values in regions.rul to have low chances of having these two missions types in seas/oceans featuring most of the funding countries (north pacific, north atlantic, indian ocean, japan sea, south china sea, mediterraneans sea) ?

Theoretically, yes.

In practice, RNG can mess up your plans. If you halve the values (25 to 12, etc.) assigned to Base and Infiltration missions, you can still get those missions repeatedly during the first months, if you're unlucky. And the more you reduce the values, the bigger the risk that you'll only get those missions after a certain time in the game, depending on the duration of your campaign.

Now, it feels to me that your issue is more related to the need of being prepared to assault alien colonies with the right tech (ion armor, sonic weapons) because of the the negative score generated by the colonies. If that's the case, there might a better solution, namely reducing the amount of negative score generated by each base (it's -5 points day for each base) and allowing you to postpone colony assaults until you're ready for them.
Title: Re: Mission Scripting
Post by: Solarius Scorch on October 29, 2018, 01:15:38 am
The question is what is an "appropriate thread", in my opinion almost every question is unique... otherwise he would not have to ask again.
Also, opening a new thread is always a good idea IMO... after you searched the history of course and didn't find what you were looking for.
We want short threads with a clear topic, and clear answer (if the point of the thread was a question).
That way it is easier to search too.
The WORST examples on this forum are threads like "A thread for little questions" from piratez subforum and similar... I guarantee that vast majority of questions and answers from such threads are LOST forever. You cannot find them, because the forum search only shows the last match per thread. So if you're looking for example for "coelacanth" and that word is on the first page of a giant thread and the last page of that same giant thread, the search only ever shows you the last page... even though the question you were looking for might have been in the first page.

And I could continue naming dozens of other reasons why opening a new thread is a better idea... not kidding.

Yes, I should have been clearer: my advice/request was to not open another thread which is about exactly the same thing as an existing one. Otherwise we end up with the same question being answered over and over, and general chaos...
And I absolutely agree with what you proposed (search first, open thread later).