Skip to content

Commit 4dbff3e

Browse files
committed
mission scripting
here's the bulk of the work, the actual processing of all the data, and generation of results. included mission script provides details and examples of what things mean and replicates xcom1's behaviour nicely. if all went well, players should notice absolutely nothing different between this version and yesterday's modders, on the other hand...
1 parent 15438bb commit 4dbff3e

11 files changed

Lines changed: 1029 additions & 120 deletions

‎Makefile.am‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,8 @@ openxcom_SOURCES = \
516516
src/Ruleset/RuleItem.h \
517517
src/Ruleset/RuleManufacture.cpp \
518518
src/Ruleset/RuleManufacture.h \
519+
src/Ruleset/RuleMissionScript.cpp \
520+
src/Ruleset/RuleMissionScript.h \
519521
src/Ruleset/RuleMusic.cpp \
520522
src/Ruleset/RuleMusic.h \
521523
src/Ruleset/RuleRegion.cpp \
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
# - type: example # the type/name is used for overwriting or deleting purposes.
2+
# firstMonth: 0 # months this command runs on, 0 runs on startup of a new game (default 0)
3+
# lastMonth: 0 # don't run after this month. in this context we mean "run once". -1 denotes no limit (default -1)
4+
# label: 1 # label, used for conditionals (default 0)
5+
# conditionals: [1, -2] # conditional list, just like mapscripts (default none)
6+
# missionWeights: # the type of mission to spawn (omit to pick one from the mission table) (default none)
7+
# 0: # these are split into monthly chunks
8+
# STR_ALIEN_RESEARCH: 100 # and can contain multiple entries, including weighted odds
9+
# executionOdds: 100 # % chances of this command executing (default 100)
10+
# targetBaseOdds: 75 # % chances of this mission targeting a region containing an xcom base instead of random (default 0)
11+
# 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)
12+
# raceWeights: # can override established monthly race weights here if desired (default empty)
13+
# 0:
14+
# STR_SECTOID: 100 # in this case we want a sectoid mission, so they get 100%
15+
# regionWeights: # again, this can override the defined mission region weights (default empty)
16+
# 0: # this won't come into play here unless the mission doesn't target an xcom base, as described above.
17+
# STR_SAMPLE_REGION1: 20 # IF OMITTED:
18+
# STR_SAMPLE_REGION2: 30 # for a terror type mission, all regions that meet the criteria will be weighed equally.
19+
# STR_SAMPLE_REGION3: 50 # for regular missions the normal regional distribution weights will be applied.
20+
# minDifficulty: 0 # this command only applies to difficulty levels of this or above (default 0)
21+
# researchTriggers: # a list of research topics that can influence the execution of this mission (default empty)
22+
# STR_THE_MARTIAN_SOLUTION: true # in this case, the mission would only run if the player has the martian solution
23+
# STR_CYDONIA_OR_BUST: false # and does NOT have Cydonia or bust
24+
# maxRuns: 12 # this mission type can only execute this number of times, -1 for infinite (default -1)
25+
# avoidRepeats: 12 # this means "store an array of the 12 previous coordinates, and don't use them again" (default 0)
26+
# varName: researching # this is an internal variable name, used for tracking maxruns and avoidRepeats (default none)
27+
# useTable: false # check this mission type appears in the mission tables, and remove it if it does? (default true)
28+
29+
missionScripts:
30+
- type: gameStart
31+
missionWeights:
32+
0:
33+
STR_ALIEN_RESEARCH: 100
34+
lastMonth: 0
35+
targetBaseOdds: 100
36+
raceWeights:
37+
0:
38+
STR_SECTOID: 100
39+
startDelay: 120
40+
41+
- type: recurringTerror
42+
missionWeights:
43+
0:
44+
STR_ALIEN_TERROR: 100
45+
useTable: false
46+
startDelay: 150
47+
48+
- type: recon
49+
firstMonth: 1
50+
51+
- type: invasion
52+
firstMonth: 6
53+
54+
- type: researchRetaliation
55+
missionWeights:
56+
0:
57+
STR_ALIEN_RETALIATION: 100
58+
researchTriggers:
59+
STR_THE_MARTIAN_SOLUTION: true
60+
startDelay: 150
61+
targetBaseOdds: 100
62+
useTable: false
63+
label: 1
64+
65+
- type: beginnerRetaliation
66+
missionWeights:
67+
0:
68+
STR_ALIEN_RETALIATION: 100
69+
firstMonth: 14
70+
targetBaseOdds: 100
71+
useTable: false
72+
conditionals: [-1]
73+
label: 2
74+
startDelay: 150
75+
76+
- type: experiencedRetaliation
77+
minDifficulty: 1
78+
missionWeights:
79+
0:
80+
STR_ALIEN_RETALIATION: 100
81+
firstMonth: 13
82+
targetBaseOdds: 100
83+
useTable: false
84+
conditionals: [-1, -2]
85+
label: 3
86+
startDelay: 150
87+
88+
- type: veteranRetaliation
89+
minDifficulty: 2
90+
missionWeights:
91+
0:
92+
STR_ALIEN_RETALIATION: 100
93+
firstMonth: 12
94+
targetBaseOdds: 100
95+
useTable: false
96+
conditionals: [-1, -2, -3]
97+
label: 4
98+
startDelay: 150
99+
100+
- type: geniusRetaliation
101+
minDifficulty: 3
102+
missionWeights:
103+
0:
104+
STR_ALIEN_RETALIATION: 100
105+
firstMonth: 11
106+
targetBaseOdds: 100
107+
useTable: false
108+
conditionals: [-1, -2, -3, -4]
109+
label: 5
110+
startDelay: 150
111+
112+
- type: superhumanRetaliation
113+
minDifficulty: 4
114+
missionWeights:
115+
0:
116+
STR_ALIEN_RETALIATION: 100
117+
firstMonth: 10
118+
targetBaseOdds: 100
119+
useTable: false
120+
conditionals: [-1, -2, -3, -4, -5]
121+
startDelay: 150

‎src/CMakeLists.txt‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,8 @@ set ( ruleset_src
508508
Ruleset/RuleResearch.cpp
509509
Ruleset/RuleManufacture.h
510510
Ruleset/RuleManufacture.cpp
511+
Ruleset/RuleMissionScript.h
512+
Ruleset/RuleMissionScript.cpp
511513
Ruleset/AlienDeployment.h
512514
Ruleset/AlienDeployment.cpp
513515
Ruleset/AlienRace.h

0 commit comments

Comments
 (0)