warzone2100/data/script/text/cam3-1x.slo

215 lines
4.9 KiB
Plaintext
Raw Normal View History

/*
* cam3-1x.slo
*
* Extra scripting for level 3-1
*
*/
// general use variables
private INT count;
private BOOL flag;
// the player side
public INT player;
// the computer sides
public INT enemy[2];
// the specific mission target buildings
public INT numTargets;
public STRUCTURE tarStructs[5];
public INTMESSAGE targets;
private BOOL tarGone[5];
private BOOL msgAdded;
// the target area
public INT tarX1,tarY1,tarX2,tarY2;
// the briefing from the first part of the mission
public INTMESSAGE cam3_1ABrief;
// the briefing message once the silos are dead
public INTMESSAGE briefing, briefing2;
//the proximity message for the hide location
public INTMESSAGE hideLocBlip;
// the time for the next mission
public INT secondMissionTime;
// the wav to play for the second bit of the mission
public SOUND missileAbort;
private DROID droid;
private STRUCTURE struct;
//valley areas
public int numSafe, safeX1[2], safeY1[2], safeX2[2], safeY2[2];
public int numDead, deadX1[2], deadY1[2], deadX2[2], deadY2[2];
private int temp;
private GROUP deadGroup;
// pause before playing the 1B breifing
trigger briefPause(wait, 30);
trigger vidTrig(CALL_VIDEO_QUIT);
trigger nukeTrig((missionTimeRemaining() <= 50), 5);
trigger checkValleyTrig(every, 55);
event checkValley;
event nuke;
event start(CALL_GAMEINIT)
{
setScrollParams(0, 32, 64, 64);
// add the blip over the uplink sensor
addMessage(targets, PROX_MSG, player, false);
tarGone[0] = FALSE;
msgAdded = FALSE;
//we don't want the coded countdown
setPlayCountDown(FALSE);
}
/*
// add individual blips for each silo once they have been seen
event silosSeen(seenStructInArea(player, enemy[0], FALSE, tarX1,tarY1,tarX2,tarY2), 20)
{
count = 1;
while (count < numTargets)
{
addMessage(targets[count], PROX_MSG, player, false);
tarGone[count] = FALSE;
count = count + 1;
}
msgAdded = TRUE;
setEventTrigger(silosSeen, inactive);
}
*/
event playBrief2(inactive)
{
removeMessage(cam3_1ABrief, MISS_MSG, player); //remove cam3-1A message
removeMessage(briefing, MISS_MSG, player); //remove earlier bit
addMessage(briefing2, MISS_MSG, player, TRUE); //summary to keep
pause(20);
setMissionTime(secondMissionTime);
setEventTrigger(playBrief2, inactive);
}
// play the mission breifing for 1B
event playBriefing(inactive)
{
setEventTrigger(playBrief2, vidTrig);
addMessage(briefing, MISS_MSG, player, TRUE);
//set the reinforcement time to -1 so that the timer widget disappears
setReinforcementTime(-1);
//set up the proximity message for the hideaway location
addMessage(hideLocBlip, PROX_MSG, player, false);
setScrollParams(0, 0, 64, 64);
//allow valley checks
setEventTrigger(checkValley, checkValleyTrig);
setEventTrigger(nuke, nukeTrig);
}
// check to see if all the missile silos are dead
event silosDead(every, 21)
{
count = 0;
flag = TRUE;
while (count < numTargets)
{
if (tarStructs[count] != NULLOBJECT)
{
flag = FALSE;
}
/*
else if ( (not tarGone[count]) and
((count == 0) or (msgAdded)) )
{
removeMessage(targets[count], PROX_MSG, player);
tarGone[count] = TRUE;
}
*/
count = count + 1;
}
if (flag)
{
removeMessage(targets, PROX_MSG, player);
//extraVictoryFlag = TRUE;
playSound(missileAbort, player);
setMissionTime(-1);
setEventTrigger(silosDead, inactive);
setEventTrigger(playBriefing, briefPause);
}
}
event checkValley(inactive)
{
//check to see if all players forces in valley for winning
temp = 0;
count = 0;
while (count < numSafe)
{
temp = temp + numDroidsInArea(player, safeX1[count], safeY1[count], safeX2[count],safeY2[count]);
count = count + 1;
}
if ((temp == getDroidCount(player)) and (getDroidCount(player) > 0)) //all units safe
{
//flag won
extraVictoryFlag = TRUE;
setEventTrigger(checkValley, inactive);
}
}
event nuke(inactive)
{
//kill off all player units outside of the valley when time almost up
//check to see if any in valley first and set "extraVictoryFlag = TRUE" first
//then wait short time before killing them all off
count = 0;
temp = 0;
while (count < numSafe)
{
temp = temp + numDroidsInArea(player, safeX1[count], safeY1[count], safeX2[count],safeY2[count]);
count = count + 1;
}
if (temp > 0) //some units safe
{
//flag won
extraVictoryFlag = TRUE;
pause(35);
/* old system
//kill everything outside area
count = 0;
while (count < numDead)
{
groupAddArea(deadGroup, player, deadX1[count], deadY1[count], deadX2[count], deadY2[count]);
count = count + 1;
}
initIterateGroup(deadGroup);
count = 0;
while (count < deadGroup.members)
{
droid = iterateGroup(deadGroup);
vanishUnit(droid);
count = count + 1;
}
*/
//new system
count = 0;
while (count < numDead)
{
killDroidsInArea(deadX1[count], deadY1[count], deadX2[count], deadY2[count], player);
//killDroidsInArea(deadX1[count], deadY1[count], deadX2[count], deadY2[count], enemy);
count = count + 1;
}
setEventTrigger(nuke, inactive); //oneshot
}
}