363 lines
7.5 KiB
Plaintext
363 lines
7.5 KiB
Plaintext
//
|
|
// Multi-player script for upto 8 players.
|
|
//
|
|
|
|
public STRUCTURESTAT command;
|
|
public STRUCTURESTAT factory;
|
|
public STRUCTURESTAT wall;
|
|
public STRUCTURESTAT cornerWall;
|
|
public STRUCTURESTAT oilDerrick;
|
|
public STRUCTURESTAT powerGen;
|
|
public STRUCTURESTAT research;
|
|
public STRUCTURESTAT commandrelay;
|
|
public STRUCTURESTAT cybfac;
|
|
public STRUCTURESTAT vtolfac;
|
|
|
|
// starting technologies.
|
|
public int numtecP0, numtecP1, numtecP2, numtecP3,numtecP4, numtecP5, numtecP6, numtecP7;
|
|
public RESEARCHSTAT tecP0[5], tecP1[5], tecP2[5], tecP3[5], tecP4[5], tecP5[5], tecP6[5], tecP7[5];
|
|
|
|
public int numCleanTech, numBaseTech, numDefTech;
|
|
public RESEARCHSTAT cleanTech[32], baseTech[32], defTech[64];
|
|
|
|
// research topics
|
|
public int numResP0, numResP1, numResP2, numResP3, numResP4, numResP5, numResP6, numResP7;
|
|
public RESEARCHSTAT resP0[5], resP1[5], resP2[5], resP3[5], resP4[5], resP5[5], resP6[5], resP7[5];
|
|
|
|
public int numCleanRes, numBaseRes, numDefRes;
|
|
public RESEARCHSTAT cleanRes[10], baseRes[10], defRes[10];
|
|
|
|
// Other Stuff
|
|
private INT count;
|
|
private INT playnum;
|
|
private BOOL gamenotwon;
|
|
|
|
// Base Under Attack Stuff
|
|
private STRUCTURE hitStruc;
|
|
private BASEOBJ attackerObj;
|
|
private int t;
|
|
public SOUND attackSnd1;
|
|
|
|
public INTMESSAGE endMsg, winMsg;
|
|
|
|
// /////////////////////////////////////////////////////////////////
|
|
|
|
trigger endConditions(every, 100);
|
|
|
|
// /////////////////////////////////////////////////////////////////
|
|
//this event is called once the game has initialised itself
|
|
|
|
event initialisedEvent(CALL_GAMEINIT)
|
|
{
|
|
playnum=0;
|
|
while (playnum < 8)
|
|
{
|
|
if(multiPlayerBaseType == CAMP_CLEAN)
|
|
{
|
|
setPowerLevel(750,playnum);
|
|
count = 0;
|
|
while (count < numCleanTech)
|
|
{
|
|
completeResearch(cleanTech[count], playnum);
|
|
count = count +1;
|
|
}
|
|
|
|
count = 0;
|
|
while (count < numCleanRes)
|
|
{
|
|
enableResearch(cleanRes[count], playnum);
|
|
count = count +1;
|
|
}
|
|
}
|
|
else if(multiPlayerBaseType == CAMP_BASE)
|
|
{
|
|
setPowerLevel(1000,playnum);
|
|
count = 0;
|
|
while (count < numBaseTech)
|
|
{
|
|
completeResearch(baseTech[count], playnum);
|
|
count = count +1;
|
|
}
|
|
count = 0;
|
|
while (count < numBaseRes)
|
|
{
|
|
enableResearch(baseRes[count], playnum);
|
|
count = count +1;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
setPowerLevel(2000,playnum);
|
|
count = 0;
|
|
while (count < numDefTech)
|
|
{
|
|
completeResearch(defTech[count], playnum);
|
|
count = count +1;
|
|
}
|
|
count = 0;
|
|
while (count < numDefRes)
|
|
{
|
|
enableResearch(defRes[count], playnum);
|
|
count = count +1;
|
|
}
|
|
}
|
|
|
|
playnum = playnum + 1;
|
|
}
|
|
|
|
}
|
|
|
|
|
|
event initialisedEvent2(CALL_GAMEINIT)
|
|
{
|
|
|
|
//set up the reticule buttons
|
|
addReticuleButton(OPTIONS);
|
|
addReticuleButton(CANCEL);
|
|
addReticuleButton(BUILD);
|
|
addReticuleButton(MANUFACTURE);
|
|
addReticuleButton(RESEARCH);
|
|
addReticuleButton(INTELMAP);
|
|
addReticuleButton(DESIGN);
|
|
|
|
playnum=0;
|
|
while (playnum < 8)
|
|
{
|
|
enableStructure(command , playnum); //make structures available to build
|
|
enableStructure(factory, playnum);
|
|
//enableStructure(wall, playnum);
|
|
//enableStructure(cornerWall, playnum);
|
|
enableStructure(oilDerrick, playnum);
|
|
enableStructure(powerGen, playnum);
|
|
enableStructure(research, playnum);
|
|
|
|
setStructureLimits(factory, 5, playnum); // set structure limits
|
|
setStructureLimits(powerGen, 5, playnum);
|
|
setStructureLimits(research, 5, playnum);
|
|
setStructureLimits(command, 1, playnum);
|
|
setStructureLimits(commandrelay,1, playnum);
|
|
setStructureLimits(cybfac, 5, playnum);
|
|
setStructureLimits(vtolfac, 5, playnum);
|
|
|
|
playnum = playnum+1;
|
|
}
|
|
applyLimitSet(); // set limit options
|
|
|
|
// player specific technology startups
|
|
count = 0;
|
|
while (count < numtecP0)
|
|
{
|
|
completeResearch(tecP0[count], 0);
|
|
count = count +1;
|
|
}
|
|
count = 0;
|
|
while (count < numtecP1)
|
|
{
|
|
completeResearch(tecP1[count], 1);
|
|
count = count +1;
|
|
}
|
|
count = 0;
|
|
while (count < numtecP2)
|
|
{
|
|
completeResearch(tecP2[count], 2);
|
|
count = count +1;
|
|
}
|
|
count = 0;
|
|
while (count < numtecP3)
|
|
{
|
|
completeResearch(tecP3[count], 3);
|
|
count = count +1;
|
|
}
|
|
count = 0;
|
|
while (count < numtecP4)
|
|
{
|
|
completeResearch(tecP4[count], 4);
|
|
count = count +1;
|
|
}
|
|
count = 0;
|
|
while (count < numtecP5)
|
|
{
|
|
completeResearch(tecP5[count], 5);
|
|
count = count +1;
|
|
}
|
|
count = 0;
|
|
while (count < numtecP6)
|
|
{
|
|
completeResearch(tecP6[count], 6);
|
|
count = count +1;
|
|
}
|
|
count = 0;
|
|
while (count < numtecP7)
|
|
{
|
|
completeResearch(tecP7[count], 7);
|
|
count = count +1;
|
|
}
|
|
|
|
|
|
// player specific research startups
|
|
count = 0;
|
|
while (count < numResP0)
|
|
{
|
|
enableResearch(resP0[count], 0);
|
|
count = count +1;
|
|
}
|
|
count = 0;
|
|
while (count < numResP1)
|
|
{
|
|
enableResearch(resP1[count], 1);
|
|
count = count +1;
|
|
}
|
|
count = 0;
|
|
while (count < numResP2)
|
|
{
|
|
enableResearch(resP2[count], 2);
|
|
count = count +1;
|
|
}
|
|
count = 0;
|
|
while (count < numResP3)
|
|
{
|
|
enableResearch(resP3[count], 3);
|
|
count = count +1;
|
|
}
|
|
count = 0;
|
|
while (count < numResP4)
|
|
{
|
|
enableResearch(resP4[count], 4);
|
|
count = count +1;
|
|
}
|
|
count = 0;
|
|
while (count < numResP5)
|
|
{
|
|
enableResearch(resP5[count], 5);
|
|
count = count +1;
|
|
}
|
|
count = 0;
|
|
while (count < numResP6)
|
|
{
|
|
enableResearch(resP6[count], 6);
|
|
count = count +1;
|
|
}
|
|
count = 0;
|
|
while (count < numResP7)
|
|
{
|
|
enableResearch(resP7[count], 7);
|
|
count = count +1;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// /////////////////////////////////////////////////////////////////
|
|
event checkEndConditions (endConditions)
|
|
{
|
|
// Losing Conditions
|
|
// if( ( not (multiPlayerGameType == DMATCH))
|
|
if( ( not anyDroidsLeft(selectedPlayer))
|
|
and ( not anyFactoriesLeft(selectedPlayer))
|
|
// and ( not playerInAlliance(selectedPlayer))
|
|
)
|
|
{
|
|
// addMessage(endMsg, MISS_MSG, 0, true);
|
|
// pause(10);
|
|
// gameOver(FALSE);
|
|
gameOverMessage(endMsg, MISS_MSG, 0, FALSE);
|
|
setEventTrigger(checkEndConditions, inactive);
|
|
}
|
|
|
|
|
|
// Winning Conditions
|
|
playnum=0;
|
|
gamenotwon = FALSE;
|
|
|
|
////////////////
|
|
// Campaign Game
|
|
if(multiPlayerGameType == CAMPAIGN)
|
|
{
|
|
// check humans are still about
|
|
while (playnum < multiPlayerMaxPlayers)
|
|
{
|
|
if (playnum != selectedPlayer)
|
|
{
|
|
if(anyDroidsLeft(playnum) or anyFactoriesLeft(playnum) )
|
|
{
|
|
gamenotwon = TRUE;
|
|
}
|
|
}
|
|
playnum = playnum + 1;
|
|
}
|
|
|
|
//check computer/babas are wiped out completely
|
|
while(playnum<8)
|
|
{
|
|
if(anyDroidsLeft(playnum) or anyStructButWallsLeft(playnum))
|
|
{
|
|
gamenotwon = TRUE;
|
|
}
|
|
playnum = playnum + 1;
|
|
}
|
|
}
|
|
|
|
////////////////
|
|
// TeamPlay Game.. (same as campaign, but no alliance watching)
|
|
if(multiPlayerGameType == TEAMPLAY)
|
|
{
|
|
|
|
gamenotwon = TRUE;
|
|
if(dominatingAlliance())
|
|
{
|
|
gamenotwon = FALSE;
|
|
}
|
|
}
|
|
|
|
////////////////
|
|
// Deathmatch Game (never ends)
|
|
// if(multiPlayerGameType == DMATCH)
|
|
//{
|
|
// gamenotwon = TRUE;
|
|
//}
|
|
|
|
|
|
if(gamenotwon == FALSE)
|
|
{
|
|
// addMessage(winMsg, MISS_MSG, 0, true);
|
|
// pause(10);
|
|
// gameOver(TRUE);
|
|
gameOverMessage(winMsg, MISS_MSG, 0, TRUE);
|
|
setEventTrigger(checkEndConditions, inactive);
|
|
}
|
|
}
|
|
|
|
// /////////////////////////////////////////////////////////////////
|
|
/* Base Under Attack */
|
|
event baseHit(CALL_STRUCT_ATTACKED, selectedPlayer, ref hitStruc, ref attackerObj)
|
|
{
|
|
if (t >= 10)
|
|
{
|
|
t=0;
|
|
if (hitStruc != NULLOBJECT)
|
|
{
|
|
playSoundPos(attackSnd1, selectedPlayer, hitStruc.x, hitStruc.y, hitStruc.z); //show position if still alive
|
|
}
|
|
else
|
|
{
|
|
playSound(attackSnd1, selectedPlayer);
|
|
}
|
|
}
|
|
}
|
|
|
|
event everySec(every, 10)
|
|
{
|
|
t=t+1;
|
|
}
|
|
|
|
//go to where the structure being attacked is on CTRL B
|
|
event seeBaseHit(CALL_MISSION_END)
|
|
{
|
|
if (hitStruc!=NULLOBJECT)
|
|
{
|
|
centreView(hitStruc);
|
|
t=0; //flag known about!
|
|
}
|
|
}
|
|
|