2
// Multi-player script for upto 8 players.
5
public STRUCTURESTAT command;
6
public STRUCTURESTAT factory;
7
public STRUCTURESTAT wall;
8
public STRUCTURESTAT cornerWall;
9
public STRUCTURESTAT oilDerrick;
10
public STRUCTURESTAT powerGen;
11
public STRUCTURESTAT research;
12
public STRUCTURESTAT commandrelay;
13
public STRUCTURESTAT cybfac;
14
public STRUCTURESTAT vtolfac;
16
// starting technologies.
17
public int numtecP0, numtecP1, numtecP2, numtecP3,numtecP4, numtecP5, numtecP6, numtecP7;
18
public RESEARCHSTAT tecP0[5], tecP1[5], tecP2[5], tecP3[5], tecP4[5], tecP5[5], tecP6[5], tecP7[5];
20
public int numCleanTech, numBaseTech, numDefTech;
21
public RESEARCHSTAT cleanTech[32], baseTech[32], defTech[64];
24
public int numResP0, numResP1, numResP2, numResP3, numResP4, numResP5, numResP6, numResP7;
25
public RESEARCHSTAT resP0[5], resP1[5], resP2[5], resP3[5], resP4[5], resP5[5], resP6[5], resP7[5];
27
public int numCleanRes, numBaseRes, numDefRes;
28
public RESEARCHSTAT cleanRes[10], baseRes[10], defRes[10];
33
private BOOL gamenotwon;
35
// Base Under Attack Stuff
36
private STRUCTURE hitStruc;
37
private BASEOBJ attackerObj;
39
public SOUND attackSnd1;
41
public INTMESSAGE endMsg, winMsg;
43
// /////////////////////////////////////////////////////////////////
45
trigger endConditions(every, 100);
47
// /////////////////////////////////////////////////////////////////
48
//this event is called once the game has initialised itself
50
event initialisedEvent(CALL_GAMEINIT)
55
if(multiPlayerBaseType == CAMP_CLEAN)
57
setPowerLevel(750,playnum);
59
while (count < numCleanTech)
61
completeResearch(cleanTech[count], playnum);
66
while (count < numCleanRes)
68
enableResearch(cleanRes[count], playnum);
72
else if(multiPlayerBaseType == CAMP_BASE)
74
setPowerLevel(1000,playnum);
76
while (count < numBaseTech)
78
completeResearch(baseTech[count], playnum);
82
while (count < numBaseRes)
84
enableResearch(baseRes[count], playnum);
90
setPowerLevel(2000,playnum);
92
while (count < numDefTech)
94
completeResearch(defTech[count], playnum);
98
while (count < numDefRes)
100
enableResearch(defRes[count], playnum);
105
playnum = playnum + 1;
111
event initialisedEvent2(CALL_GAMEINIT)
114
//set up the reticule buttons
115
addReticuleButton(OPTIONS);
116
addReticuleButton(CANCEL);
117
addReticuleButton(BUILD);
118
addReticuleButton(MANUFACTURE);
119
addReticuleButton(RESEARCH);
120
addReticuleButton(INTELMAP);
121
addReticuleButton(DESIGN);
126
enableStructure(command , playnum); //make structures available to build
127
enableStructure(factory, playnum);
128
//enableStructure(wall, playnum);
129
//enableStructure(cornerWall, playnum);
130
enableStructure(oilDerrick, playnum);
131
enableStructure(powerGen, playnum);
132
enableStructure(research, playnum);
134
setStructureLimits(factory, 5, playnum); // set structure limits
135
setStructureLimits(powerGen, 5, playnum);
136
setStructureLimits(research, 5, playnum);
137
setStructureLimits(command, 1, playnum);
138
setStructureLimits(commandrelay,1, playnum);
139
setStructureLimits(cybfac, 5, playnum);
140
setStructureLimits(vtolfac, 5, playnum);
144
applyLimitSet(); // set limit options
146
// player specific technology startups
148
while (count < numtecP0)
150
completeResearch(tecP0[count], 0);
154
while (count < numtecP1)
156
completeResearch(tecP1[count], 1);
160
while (count < numtecP2)
162
completeResearch(tecP2[count], 2);
166
while (count < numtecP3)
168
completeResearch(tecP3[count], 3);
172
while (count < numtecP4)
174
completeResearch(tecP4[count], 4);
178
while (count < numtecP5)
180
completeResearch(tecP5[count], 5);
184
while (count < numtecP6)
186
completeResearch(tecP6[count], 6);
190
while (count < numtecP7)
192
completeResearch(tecP7[count], 7);
197
// player specific research startups
199
while (count < numResP0)
201
enableResearch(resP0[count], 0);
205
while (count < numResP1)
207
enableResearch(resP1[count], 1);
211
while (count < numResP2)
213
enableResearch(resP2[count], 2);
217
while (count < numResP3)
219
enableResearch(resP3[count], 3);
223
while (count < numResP4)
225
enableResearch(resP4[count], 4);
229
while (count < numResP5)
231
enableResearch(resP5[count], 5);
235
while (count < numResP6)
237
enableResearch(resP6[count], 6);
241
while (count < numResP7)
243
enableResearch(resP7[count], 7);
250
// /////////////////////////////////////////////////////////////////
251
event checkEndConditions (endConditions)
254
// if( ( not (multiPlayerGameType == DMATCH))
255
if( ( not anyDroidsLeft(selectedPlayer))
256
and ( not anyFactoriesLeft(selectedPlayer))
257
// and ( not playerInAlliance(selectedPlayer))
260
// addMessage(endMsg, MISS_MSG, 0, true);
263
gameOverMessage(endMsg, MISS_MSG, 0, FALSE);
264
setEventTrigger(checkEndConditions, inactive);
269
// Winning Conditions
275
if(multiPlayerGameType == CAMPAIGN)
277
// check humans are still about
278
while (playnum < multiPlayerMaxPlayers)
280
if (playnum != selectedPlayer)
282
if(anyDroidsLeft(playnum) or anyFactoriesLeft(playnum) )
287
playnum = playnum + 1;
290
//check computer/babas are wiped out completely
293
if(not isHumanPlayer(playnum))
295
if(anyDroidsLeft(playnum) or anyStructButWallsLeft(playnum))
300
playnum = playnum + 1;
304
if(gamenotwon == FALSE)
306
// addMessage(winMsg, MISS_MSG, 0, true);
309
gameOverMessage(winMsg, MISS_MSG, 0, TRUE);
310
setEventTrigger(checkEndConditions, inactive);
314
// /////////////////////////////////////////////////////////////////
315
/* Base Under Attack */
316
event baseHit(CALL_STRUCT_ATTACKED, selectedPlayer, ref hitStruc, ref attackerObj)
321
if (hitStruc != NULLOBJECT)
323
playSoundPos(attackSnd1, selectedPlayer, hitStruc.x, hitStruc.y, hitStruc.z); //show position if still alive
327
playSound(attackSnd1, selectedPlayer);
332
event everySec(every, 10)
337
//go to where the structure being attacked is on CTRL B
338
event seeBaseHit(CALL_MISSION_END)
340
if (hitStruc!=NULLOBJECT)
342
centreView(hitStruc);
343
t=0; //flag known about!