warzone2100/data/script/text/genbet.slo

165 lines
3.8 KiB
Plaintext
Raw Normal View History

//Generic script Version 1.0
//GenBet.slo
//For between maps(start of a sub map)
/* ******************** */
/* Declared Variables */
/* ******************** */
/* Next Level stuff */
public LEVEL NextLev;
/* Structure Limits */
public int numStrucStats, strucLimit[6];
public STRUCTURESTAT strucStat[6];
/* Initialisation */
public int centreX, centreY;
public int scrollX1, scrollX2, scrollY1, scrollY2;
public int zoomLevel;
public int numLZ, LZX[8], LZY[8];
public int exitX, exitY;
/* Briefings */
public int numBriefs, briefVal[5];
public INTMESSAGE brief[5];
public INTMESSAGE endMsg;
/* Time Limit */
public int timeLimit;
/* 'Globals' */
public int player;
public SOUND lostSnd; //mission lost
public TEMPLATE transporter;
/* General variables */
private int count, count2; //for while loops
private int countBriefs, temp, temp1, temp2, tempX, tempY;
/* ******************** */
/* Triggers */
/* ******************** */
trigger gameLostTrig (every, 20);
/* ******************** */
/* Events */
/* ******************** */
/* Declared Events */
event briefings;
/* Initialisation */
event start(CALL_GAMEINIT)
{
randomiseSeed();
//centre view
centreViewPos(centreX, centreY);
//set scroll limits
// setScrollParams(scrollX1, scrollY1, scrollX2, scrollY2);
//set radar zoom level
setRadarZoom(zoomLevel);
//set Mission time limit
setMissionTime(timeLimit);
//make sure reinforcements disabled
setReinforcementTime(-1);
//set LZ and no go areas - shouldn't need to do this any more - it is until all NoGoAreas are saved in the save game info
//The LZ can now be set up just before FlyTransporterIn()
initAllNoGoAreas();
count = 0;
while (count < numLZ)
{
setNoGoArea(LZX[count] - 1, LZY[count] - 1, LZX[count] + 1, LZY[count] + 1, count);
count = count + 1;
}
//set structure limits
count = 0;
while (count < numStrucStats)
{
setStructureLimits (strucStat[count], strucLimit[count], player);
enableStructure(strucStat[count], player);
count = count + 1;
}
//place transport
addDroid(transporter, (LZX[0] * 128) + 64, (LZY[0] * 128) + 64, player);
setTransporterExit(player, exitX, exitY);
//play mission brief(s)
if (numBriefs > 0)
{
if (briefVal[0] < 2) //cope with don't play immediately
{
addMessage(brief[0], MISS_MSG, 0, true);
}
else
{
addMessage(brief[0], MISS_MSG, 0, false);
if (countBriefs >= numBriefs) //last briefing?
{
setEventTrigger(briefings, inactive);
}
}
countBriefs = 1;
}
}
event briefings(CALL_VIDEO_QUIT) //need to rework this better!!
{
if (briefVal[countBriefs - 1] == 0) //check to see if needs removing
{
removeMessage(brief[countBriefs - 1], MISS_MSG, 0);
}
if (countBriefs >= numBriefs) //last briefing?
{
setEventTrigger(briefings, inactive);
}
if (countBriefs < numBriefs) //add next brief
{
if (briefVal[countBriefs] < 2) //cope with don't play immediately
{
addMessage(brief[countBriefs], MISS_MSG, 0, true);
}
else
{
addMessage(brief[countBriefs], MISS_MSG, 0, false);
}
countBriefs = countBriefs + 1;
}
}
event nextLevEvnt(CALL_START_NEXT_LEVEL)
{
//setLandingZone(LZ_X1, LZ_Y1, LZ_X2, LZ_Y2);
//use last LZ coords for next map
//shouldn't need to do this any more. The LZ can now be set up just before FlyTransporterIn()
//setLandingZone(LZX[numLZ] - 1, LZY[numLZ] - 1, LZX[numLZ] + 1, LZY[numLZ] + 1);
startMission(OFF_KEEP, NextLev);
setEventTrigger(nextLevEvnt, inactive);
}
event gameLost(inactive)
{
// addMessage(endMsg, MISS_MSG, 0, true);
// pause(10);
// gameOver(false);
gameOverMessage(endMsg, MISS_MSG, 0, false);
setEventTrigger(gameLost, inactive);
}
//out of time?
event timeUp(CALL_MISSION_TIME)
{
playSound(lostSnd,0); //may want different sound, eg "Out of Time"
setEventTrigger(gameLost, gameLostTrig); //waits 2 seconds before ending
setEventTrigger(timeUp, inactive);
}